]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
* doc/invoke.texi: Fix build.
[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 -Wbool-compare -Wbool-operation @gol
287 -Wno-builtin-declaration-mismatch @gol
288 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
289 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
290 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
291 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
292 -Wclobbered -Wcomment -Wconditionally-supported @gol
293 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
294 -Wdelete-incomplete @gol
295 -Wno-attribute-warning @gol
296 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
297 -Wdisabled-optimization @gol
298 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
299 -Wno-div-by-zero -Wdouble-promotion @gol
300 -Wduplicated-branches -Wduplicated-cond @gol
301 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
302 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
303 -Wfloat-equal -Wformat -Wformat=2 @gol
304 -Wno-format-contains-nul -Wno-format-extra-args @gol
305 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
306 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
307 -Wformat-y2k -Wframe-address @gol
308 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
309 -Wjump-misses-init @gol
310 -Wif-not-aligned @gol
311 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
312 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
313 -Wimplicit-function-declaration -Wimplicit-int @gol
314 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
315 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
316 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
317 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
318 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
319 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
320 -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-profile @gol
321 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
322 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
323 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
324 -Woverride-init-side-effects -Woverlength-strings @gol
325 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
326 -Wparentheses -Wno-pedantic-ms-format @gol
327 -Wplacement-new -Wplacement-new=@var{n} @gol
328 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
329 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
330 -Wrestrict -Wno-return-local-addr @gol
331 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
332 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
333 -Wshift-overflow -Wshift-overflow=@var{n} @gol
334 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
335 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
336 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
337 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
338 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
339 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
340 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
341 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
342 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
343 -Wmissing-format-attribute -Wsubobject-linkage @gol
344 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
345 -Wswitch-unreachable -Wsync-nand @gol
346 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
347 -Wtype-limits -Wundef @gol
348 -Wuninitialized -Wunknown-pragmas @gol
349 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
350 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
351 -Wunused-parameter -Wno-unused-result @gol
352 -Wunused-value -Wunused-variable @gol
353 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
354 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
355 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
356 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
357 -Wwrite-strings @gol
358 -Wzero-as-null-pointer-constant -Whsa}
359
360 @item C and Objective-C-only Warning Options
361 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
362 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
363 -Wold-style-declaration -Wold-style-definition @gol
364 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
365 -Wdeclaration-after-statement -Wpointer-sign}
366
367 @item Debugging Options
368 @xref{Debugging Options,,Options for Debugging Your Program}.
369 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
370 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
371 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
372 -gas-loc-support -gno-as-loc-support @gol
373 -gas-locview-support -gno-as-locview-support @gol
374 -gcolumn-info -gno-column-info @gol
375 -gstatement-frontiers -gno-statement-frontiers @gol
376 -gvariable-location-views -gno-variable-location-views @gol
377 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
378 -ginline-points -gno-inline-points @gol
379 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
380 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
381 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
382 -fno-eliminate-unused-debug-types @gol
383 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
384 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
385 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
386 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
387 -fvar-tracking -fvar-tracking-assignments}
388
389 @item Optimization Options
390 @xref{Optimize Options,,Options that Control Optimization}.
391 @gccoptlist{-faggressive-loop-optimizations @gol
392 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
393 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
394 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
395 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
396 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
397 -fauto-inc-dec -fbranch-probabilities @gol
398 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
399 -fbtr-bb-exclusive -fcaller-saves @gol
400 -fcombine-stack-adjustments -fconserve-stack @gol
401 -fcompare-elim -fcprop-registers -fcrossjumping @gol
402 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
403 -fcx-limited-range @gol
404 -fdata-sections -fdce -fdelayed-branch @gol
405 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
406 -fdevirtualize-at-ltrans -fdse @gol
407 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
408 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
409 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
410 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
411 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
412 -fif-conversion2 -findirect-inlining @gol
413 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
414 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
415 -fipa-bit-cp -fipa-vrp @gol
416 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
417 -fira-algorithm=@var{algorithm} @gol
418 -fira-region=@var{region} -fira-hoist-pressure @gol
419 -fira-loop-pressure -fno-ira-share-save-slots @gol
420 -fno-ira-share-spill-slots @gol
421 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
422 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
423 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
424 -floop-block -floop-interchange -floop-strip-mine @gol
425 -floop-unroll-and-jam -floop-nest-optimize @gol
426 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
427 -flto-partition=@var{alg} -fmerge-all-constants @gol
428 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
429 -fmove-loop-invariants -fno-branch-count-reg @gol
430 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
431 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
432 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
433 -fno-sched-spec -fno-signed-zeros @gol
434 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
435 -fomit-frame-pointer -foptimize-sibling-calls @gol
436 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
437 -fprefetch-loop-arrays @gol
438 -fprofile-correction @gol
439 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
440 -fprofile-reorder-functions @gol
441 -freciprocal-math -free -frename-registers -freorder-blocks @gol
442 -freorder-blocks-algorithm=@var{algorithm} @gol
443 -freorder-blocks-and-partition -freorder-functions @gol
444 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
445 -frounding-math -fsave-optimization-record @gol
446 -fsched2-use-superblocks -fsched-pressure @gol
447 -fsched-spec-load -fsched-spec-load-dangerous @gol
448 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
449 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
450 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
451 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
452 -fschedule-fusion @gol
453 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
454 -fselective-scheduling -fselective-scheduling2 @gol
455 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
456 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
457 -fsignaling-nans @gol
458 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
459 -fsplit-paths @gol
460 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
461 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
462 -fthread-jumps -ftracer -ftree-bit-ccp @gol
463 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
464 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
465 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
466 -ftree-loop-if-convert -ftree-loop-im @gol
467 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
468 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
469 -ftree-loop-vectorize @gol
470 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
471 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
472 -ftree-switch-conversion -ftree-tail-merge @gol
473 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
474 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
475 -funsafe-math-optimizations -funswitch-loops @gol
476 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
477 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
478 --param @var{name}=@var{value}
479 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
480
481 @item Program Instrumentation Options
482 @xref{Instrumentation Options,,Program Instrumentation Options}.
483 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
484 -fprofile-abs-path @gol
485 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
486 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
487 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
488 -fsanitize-undefined-trap-on-error -fbounds-check @gol
489 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
490 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
491 -fstack-protector-explicit -fstack-check @gol
492 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
493 -fno-stack-limit -fsplit-stack @gol
494 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
495 -fvtv-counts -fvtv-debug @gol
496 -finstrument-functions @gol
497 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
498 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
499
500 @item Preprocessor Options
501 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
502 @gccoptlist{-A@var{question}=@var{answer} @gol
503 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
504 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
505 -dD -dI -dM -dN -dU @gol
506 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
507 -fexec-charset=@var{charset} -fextended-identifiers @gol
508 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
509 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
510 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
511 -fwide-exec-charset=@var{charset} -fworking-directory @gol
512 -H -imacros @var{file} -include @var{file} @gol
513 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
514 -no-integrated-cpp -P -pthread -remap @gol
515 -traditional -traditional-cpp -trigraphs @gol
516 -U@var{macro} -undef @gol
517 -Wp,@var{option} -Xpreprocessor @var{option}}
518
519 @item Assembler Options
520 @xref{Assembler Options,,Passing Options to the Assembler}.
521 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
522
523 @item Linker Options
524 @xref{Link Options,,Options for Linking}.
525 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
526 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
527 -e @var{entry} --entry=@var{entry} @gol
528 -pie -pthread -r -rdynamic @gol
529 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
530 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
531 -shared -shared-libgcc -symbolic @gol
532 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
533 -u @var{symbol} -z @var{keyword}}
534
535 @item Directory Options
536 @xref{Directory Options,,Options for Directory Search}.
537 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
538 -idirafter @var{dir} @gol
539 -imacros @var{file} -imultilib @var{dir} @gol
540 -iplugindir=@var{dir} -iprefix @var{file} @gol
541 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
542 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
543 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
544 -nostdinc -nostdinc++ --sysroot=@var{dir}}
545
546 @item Code Generation Options
547 @xref{Code Gen Options,,Options for Code Generation Conventions}.
548 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
549 -ffixed-@var{reg} -fexceptions @gol
550 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
551 -fasynchronous-unwind-tables @gol
552 -fno-gnu-unique @gol
553 -finhibit-size-directive -fno-common -fno-ident @gol
554 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
555 -fno-jump-tables @gol
556 -frecord-gcc-switches @gol
557 -freg-struct-return -fshort-enums -fshort-wchar @gol
558 -fverbose-asm -fpack-struct[=@var{n}] @gol
559 -fleading-underscore -ftls-model=@var{model} @gol
560 -fstack-reuse=@var{reuse_level} @gol
561 -ftrampolines -ftrapv -fwrapv @gol
562 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
563 -fstrict-volatile-bitfields -fsync-libcalls}
564
565 @item Developer Options
566 @xref{Developer Options,,GCC Developer Options}.
567 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
568 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
569 -fdbg-cnt=@var{counter-value-list} @gol
570 -fdisable-ipa-@var{pass_name} @gol
571 -fdisable-rtl-@var{pass_name} @gol
572 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
573 -fdisable-tree-@var{pass_name} @gol
574 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
575 -fdump-debug -fdump-earlydebug @gol
576 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
577 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
578 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
579 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
580 -fdump-lang-all @gol
581 -fdump-lang-@var{switch} @gol
582 -fdump-lang-@var{switch}-@var{options} @gol
583 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
584 -fdump-passes @gol
585 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
586 -fdump-statistics @gol
587 -fdump-tree-all @gol
588 -fdump-tree-@var{switch} @gol
589 -fdump-tree-@var{switch}-@var{options} @gol
590 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
591 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
592 -fenable-@var{kind}-@var{pass} @gol
593 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
594 -fira-verbose=@var{n} @gol
595 -flto-report -flto-report-wpa -fmem-report-wpa @gol
596 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
597 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
598 -fprofile-report @gol
599 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
600 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
601 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
602 -fvar-tracking-assignments-toggle -gtoggle @gol
603 -print-file-name=@var{library} -print-libgcc-file-name @gol
604 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
605 -print-prog-name=@var{program} -print-search-dirs -Q @gol
606 -print-sysroot -print-sysroot-headers-suffix @gol
607 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
608
609 @item Machine-Dependent Options
610 @xref{Submodel Options,,Machine-Dependent Options}.
611 @c This list is ordered alphanumerically by subsection name.
612 @c Try and put the significant identifier (CPU or system) first,
613 @c so users have a clue at guessing where the ones they want will be.
614
615 @emph{AArch64 Options}
616 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
617 -mgeneral-regs-only @gol
618 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
619 -mstrict-align -mno-strict-align @gol
620 -momit-leaf-frame-pointer @gol
621 -mtls-dialect=desc -mtls-dialect=traditional @gol
622 -mtls-size=@var{size} @gol
623 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
624 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
625 -mpc-relative-literal-loads @gol
626 -msign-return-address=@var{scope} @gol
627 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
628 -moverride=@var{string} -mverbose-cost-dump -mtrack-speculation}
629
630 @emph{Adapteva Epiphany Options}
631 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
632 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
633 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
634 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
635 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
636 -msplit-vecmove-early -m1reg-@var{reg}}
637
638 @emph{ARC Options}
639 @gccoptlist{-mbarrel-shifter -mjli-always @gol
640 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
641 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
642 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
643 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
644 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
645 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
646 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
647 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
648 -mvolatile-cache -mtp-regno=@var{regno} @gol
649 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
650 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
651 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
652 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
653 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
654 -mtune=@var{cpu} -mmultcost=@var{num} @gol
655 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
656 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
657
658 @emph{ARM Options}
659 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
660 -mabi=@var{name} @gol
661 -mapcs-stack-check -mno-apcs-stack-check @gol
662 -mapcs-reentrant -mno-apcs-reentrant @gol
663 -msched-prolog -mno-sched-prolog @gol
664 -mlittle-endian -mbig-endian @gol
665 -mbe8 -mbe32 @gol
666 -mfloat-abi=@var{name} @gol
667 -mfp16-format=@var{name}
668 -mthumb-interwork -mno-thumb-interwork @gol
669 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
670 -mtune=@var{name} -mprint-tune-info @gol
671 -mstructure-size-boundary=@var{n} @gol
672 -mabort-on-noreturn @gol
673 -mlong-calls -mno-long-calls @gol
674 -msingle-pic-base -mno-single-pic-base @gol
675 -mpic-register=@var{reg} @gol
676 -mnop-fun-dllimport @gol
677 -mpoke-function-name @gol
678 -mthumb -marm -mflip-thumb @gol
679 -mtpcs-frame -mtpcs-leaf-frame @gol
680 -mcaller-super-interworking -mcallee-super-interworking @gol
681 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
682 -mword-relocations @gol
683 -mfix-cortex-m3-ldrd @gol
684 -munaligned-access @gol
685 -mneon-for-64bits @gol
686 -mslow-flash-data @gol
687 -masm-syntax-unified @gol
688 -mrestrict-it @gol
689 -mverbose-cost-dump @gol
690 -mpure-code @gol
691 -mcmse}
692
693 @emph{AVR Options}
694 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
695 -mbranch-cost=@var{cost} @gol
696 -mcall-prologues -mgas-isr-prologues -mint8 @gol
697 -mn_flash=@var{size} -mno-interrupts @gol
698 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
699 -mfract-convert-truncate @gol
700 -mshort-calls -nodevicelib @gol
701 -Waddr-space-convert -Wmisspelled-isr}
702
703 @emph{Blackfin Options}
704 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
705 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
706 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
707 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
708 -mno-id-shared-library -mshared-library-id=@var{n} @gol
709 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
710 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
711 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
712 -micplb}
713
714 @emph{C6X Options}
715 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
716 -msim -msdata=@var{sdata-type}}
717
718 @emph{CRIS Options}
719 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
720 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
721 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
722 -mstack-align -mdata-align -mconst-align @gol
723 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
724 -melf -maout -melinux -mlinux -sim -sim2 @gol
725 -mmul-bug-workaround -mno-mul-bug-workaround}
726
727 @emph{CR16 Options}
728 @gccoptlist{-mmac @gol
729 -mcr16cplus -mcr16c @gol
730 -msim -mint32 -mbit-ops
731 -mdata-model=@var{model}}
732
733 @emph{C-SKY Options}
734 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
735 -mbig-endian -EB -mlittle-endian -EL @gol
736 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
737 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
738 -mdsp -medsp -mvdsp @gol
739 -mdiv -msmart -mhigh-registers -manchor @gol
740 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
741 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
742
743 @emph{Darwin Options}
744 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
745 -arch_only -bind_at_load -bundle -bundle_loader @gol
746 -client_name -compatibility_version -current_version @gol
747 -dead_strip @gol
748 -dependency-file -dylib_file -dylinker_install_name @gol
749 -dynamic -dynamiclib -exported_symbols_list @gol
750 -filelist -flat_namespace -force_cpusubtype_ALL @gol
751 -force_flat_namespace -headerpad_max_install_names @gol
752 -iframework @gol
753 -image_base -init -install_name -keep_private_externs @gol
754 -multi_module -multiply_defined -multiply_defined_unused @gol
755 -noall_load -no_dead_strip_inits_and_terms @gol
756 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
757 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
758 -private_bundle -read_only_relocs -sectalign @gol
759 -sectobjectsymbols -whyload -seg1addr @gol
760 -sectcreate -sectobjectsymbols -sectorder @gol
761 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
762 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
763 -segprot -segs_read_only_addr -segs_read_write_addr @gol
764 -single_module -static -sub_library -sub_umbrella @gol
765 -twolevel_namespace -umbrella -undefined @gol
766 -unexported_symbols_list -weak_reference_mismatches @gol
767 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
768 -mkernel -mone-byte-bool}
769
770 @emph{DEC Alpha Options}
771 @gccoptlist{-mno-fp-regs -msoft-float @gol
772 -mieee -mieee-with-inexact -mieee-conformant @gol
773 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
774 -mtrap-precision=@var{mode} -mbuild-constants @gol
775 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
776 -mbwx -mmax -mfix -mcix @gol
777 -mfloat-vax -mfloat-ieee @gol
778 -mexplicit-relocs -msmall-data -mlarge-data @gol
779 -msmall-text -mlarge-text @gol
780 -mmemory-latency=@var{time}}
781
782 @emph{FR30 Options}
783 @gccoptlist{-msmall-model -mno-lsim}
784
785 @emph{FT32 Options}
786 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
787
788 @emph{FRV Options}
789 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
790 -mhard-float -msoft-float @gol
791 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
792 -mdouble -mno-double @gol
793 -mmedia -mno-media -mmuladd -mno-muladd @gol
794 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
795 -mlinked-fp -mlong-calls -malign-labels @gol
796 -mlibrary-pic -macc-4 -macc-8 @gol
797 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
798 -moptimize-membar -mno-optimize-membar @gol
799 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
800 -mvliw-branch -mno-vliw-branch @gol
801 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
802 -mno-nested-cond-exec -mtomcat-stats @gol
803 -mTLS -mtls @gol
804 -mcpu=@var{cpu}}
805
806 @emph{GNU/Linux Options}
807 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
808 -tno-android-cc -tno-android-ld}
809
810 @emph{H8/300 Options}
811 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
812
813 @emph{HPPA Options}
814 @gccoptlist{-march=@var{architecture-type} @gol
815 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
816 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
817 -mfixed-range=@var{register-range} @gol
818 -mjump-in-delay -mlinker-opt -mlong-calls @gol
819 -mlong-load-store -mno-disable-fpregs @gol
820 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
821 -mno-jump-in-delay -mno-long-load-store @gol
822 -mno-portable-runtime -mno-soft-float @gol
823 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
824 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
825 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
826 -munix=@var{unix-std} -nolibdld -static -threads}
827
828 @emph{IA-64 Options}
829 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
830 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
831 -mconstant-gp -mauto-pic -mfused-madd @gol
832 -minline-float-divide-min-latency @gol
833 -minline-float-divide-max-throughput @gol
834 -mno-inline-float-divide @gol
835 -minline-int-divide-min-latency @gol
836 -minline-int-divide-max-throughput @gol
837 -mno-inline-int-divide @gol
838 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
839 -mno-inline-sqrt @gol
840 -mdwarf2-asm -mearly-stop-bits @gol
841 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
842 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
843 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
844 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
845 -msched-spec-ldc -msched-spec-control-ldc @gol
846 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
847 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
848 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
849 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
850
851 @emph{LM32 Options}
852 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
853 -msign-extend-enabled -muser-enabled}
854
855 @emph{M32R/D Options}
856 @gccoptlist{-m32r2 -m32rx -m32r @gol
857 -mdebug @gol
858 -malign-loops -mno-align-loops @gol
859 -missue-rate=@var{number} @gol
860 -mbranch-cost=@var{number} @gol
861 -mmodel=@var{code-size-model-type} @gol
862 -msdata=@var{sdata-type} @gol
863 -mno-flush-func -mflush-func=@var{name} @gol
864 -mno-flush-trap -mflush-trap=@var{number} @gol
865 -G @var{num}}
866
867 @emph{M32C Options}
868 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
869
870 @emph{M680x0 Options}
871 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
872 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
873 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
874 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
875 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
876 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
877 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
878 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
879 -mxgot -mno-xgot -mlong-jump-table-offsets}
880
881 @emph{MCore Options}
882 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
883 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
884 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
885 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
886 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
887
888 @emph{MeP Options}
889 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
890 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
891 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
892 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
893 -mtiny=@var{n}}
894
895 @emph{MicroBlaze Options}
896 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
897 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
898 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
899 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
900 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
901 -mpic-data-is-text-relative}
902
903 @emph{MIPS Options}
904 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
905 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
906 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
907 -mips16 -mno-mips16 -mflip-mips16 @gol
908 -minterlink-compressed -mno-interlink-compressed @gol
909 -minterlink-mips16 -mno-interlink-mips16 @gol
910 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
911 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
912 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
913 -mno-float -msingle-float -mdouble-float @gol
914 -modd-spreg -mno-odd-spreg @gol
915 -mabs=@var{mode} -mnan=@var{encoding} @gol
916 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
917 -mmcu -mmno-mcu @gol
918 -meva -mno-eva @gol
919 -mvirt -mno-virt @gol
920 -mxpa -mno-xpa @gol
921 -mcrc -mno-crc @gol
922 -mginv -mno-ginv @gol
923 -mmicromips -mno-micromips @gol
924 -mmsa -mno-msa @gol
925 -mloongson-mmi -mno-loongson-mmi @gol
926 -mloongson-ext -mno-loongson-ext @gol
927 -mloongson-ext2 -mno-loongson-ext2 @gol
928 -mfpu=@var{fpu-type} @gol
929 -msmartmips -mno-smartmips @gol
930 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
931 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
932 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
933 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
934 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
935 -membedded-data -mno-embedded-data @gol
936 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
937 -mcode-readable=@var{setting} @gol
938 -msplit-addresses -mno-split-addresses @gol
939 -mexplicit-relocs -mno-explicit-relocs @gol
940 -mcheck-zero-division -mno-check-zero-division @gol
941 -mdivide-traps -mdivide-breaks @gol
942 -mload-store-pairs -mno-load-store-pairs @gol
943 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
944 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
945 -mfix-24k -mno-fix-24k @gol
946 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
947 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
948 -mfix-vr4120 -mno-fix-vr4120 @gol
949 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
950 -mflush-func=@var{func} -mno-flush-func @gol
951 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
952 -mcompact-branches=@var{policy} @gol
953 -mfp-exceptions -mno-fp-exceptions @gol
954 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
955 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
956 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
957 -mframe-header-opt -mno-frame-header-opt}
958
959 @emph{MMIX Options}
960 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
961 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
962 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
963 -mno-base-addresses -msingle-exit -mno-single-exit}
964
965 @emph{MN10300 Options}
966 @gccoptlist{-mmult-bug -mno-mult-bug @gol
967 -mno-am33 -mam33 -mam33-2 -mam34 @gol
968 -mtune=@var{cpu-type} @gol
969 -mreturn-pointer-on-d0 @gol
970 -mno-crt0 -mrelax -mliw -msetlb}
971
972 @emph{Moxie Options}
973 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
974
975 @emph{MSP430 Options}
976 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
977 -mwarn-mcu @gol
978 -mcode-region= -mdata-region= @gol
979 -msilicon-errata= -msilicon-errata-warn= @gol
980 -mhwmult= -minrt}
981
982 @emph{NDS32 Options}
983 @gccoptlist{-mbig-endian -mlittle-endian @gol
984 -mreduced-regs -mfull-regs @gol
985 -mcmov -mno-cmov @gol
986 -mext-perf -mno-ext-perf @gol
987 -mext-perf2 -mno-ext-perf2 @gol
988 -mext-string -mno-ext-string @gol
989 -mv3push -mno-v3push @gol
990 -m16bit -mno-16bit @gol
991 -misr-vector-size=@var{num} @gol
992 -mcache-block-size=@var{num} @gol
993 -march=@var{arch} @gol
994 -mcmodel=@var{code-model} @gol
995 -mctor-dtor -mrelax}
996
997 @emph{Nios II Options}
998 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
999 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1000 -mel -meb @gol
1001 -mno-bypass-cache -mbypass-cache @gol
1002 -mno-cache-volatile -mcache-volatile @gol
1003 -mno-fast-sw-div -mfast-sw-div @gol
1004 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1005 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1006 -mcustom-fpu-cfg=@var{name} @gol
1007 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1008 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1009
1010 @emph{Nvidia PTX Options}
1011 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1012
1013 @emph{PDP-11 Options}
1014 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1015 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1016 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1017
1018 @emph{picoChip Options}
1019 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1020 -msymbol-as-address -mno-inefficient-warnings}
1021
1022 @emph{PowerPC Options}
1023 See RS/6000 and PowerPC Options.
1024
1025 @emph{PowerPC SPE Options}
1026 @gccoptlist{-mcpu=@var{cpu-type} @gol
1027 -mtune=@var{cpu-type} @gol
1028 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
1029 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1030 -m32 -mxl-compat -mno-xl-compat @gol
1031 -malign-power -malign-natural @gol
1032 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1033 -msingle-float -mdouble-float @gol
1034 -mupdate -mno-update @gol
1035 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1036 -mstrict-align -mno-strict-align -mrelocatable @gol
1037 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1038 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1039 -msingle-pic-base @gol
1040 -mprioritize-restricted-insns=@var{priority} @gol
1041 -msched-costly-dep=@var{dependence_type} @gol
1042 -minsert-sched-nops=@var{scheme} @gol
1043 -mcall-sysv -mcall-netbsd @gol
1044 -maix-struct-return -msvr4-struct-return @gol
1045 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1046 -mblock-move-inline-limit=@var{num} @gol
1047 -misel -mno-isel @gol
1048 -misel=yes -misel=no @gol
1049 -mspe -mno-spe @gol
1050 -mspe=yes -mspe=no @gol
1051 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1052 -mprototype -mno-prototype @gol
1053 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1054 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1055 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1056 -mno-recip-precision @gol
1057 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1058 -msave-toc-indirect -mno-save-toc-indirect @gol
1059 -mcompat-align-parm -mno-compat-align-parm @gol
1060 -mfloat128 -mno-float128 @gol
1061 -mgnu-attribute -mno-gnu-attribute @gol
1062 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1063 -mstack-protector-guard-offset=@var{offset}}
1064
1065 @emph{RISC-V Options}
1066 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1067 -mplt -mno-plt @gol
1068 -mabi=@var{ABI-string} @gol
1069 -mfdiv -mno-fdiv @gol
1070 -mdiv -mno-div @gol
1071 -march=@var{ISA-string} @gol
1072 -mtune=@var{processor-string} @gol
1073 -mpreferred-stack-boundary=@var{num} @gol
1074 -msmall-data-limit=@var{N-bytes} @gol
1075 -msave-restore -mno-save-restore @gol
1076 -mstrict-align -mno-strict-align @gol
1077 -mcmodel=medlow -mcmodel=medany @gol
1078 -mexplicit-relocs -mno-explicit-relocs @gol
1079 -mrelax -mno-relax @gol}
1080
1081 @emph{RL78 Options}
1082 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1083 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1084 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1085
1086 @emph{RS/6000 and PowerPC Options}
1087 @gccoptlist{-mcpu=@var{cpu-type} @gol
1088 -mtune=@var{cpu-type} @gol
1089 -mcmodel=@var{code-model} @gol
1090 -mpowerpc64 @gol
1091 -maltivec -mno-altivec @gol
1092 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1093 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1094 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1095 -mfprnd -mno-fprnd @gol
1096 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1097 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1098 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1099 -malign-power -malign-natural @gol
1100 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1101 -mupdate -mno-update @gol
1102 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1103 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1104 -mstrict-align -mno-strict-align -mrelocatable @gol
1105 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1106 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1107 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1108 -mprioritize-restricted-insns=@var{priority} @gol
1109 -msched-costly-dep=@var{dependence_type} @gol
1110 -minsert-sched-nops=@var{scheme} @gol
1111 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1112 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1113 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1114 -mtraceback=@var{traceback_type} @gol
1115 -maix-struct-return -msvr4-struct-return @gol
1116 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1117 -mblock-move-inline-limit=@var{num} @gol
1118 -mblock-compare-inline-limit=@var{num} @gol
1119 -mblock-compare-inline-loop-limit=@var{num} @gol
1120 -mstring-compare-inline-limit=@var{num} @gol
1121 -misel -mno-isel @gol
1122 -mvrsave -mno-vrsave @gol
1123 -mmulhw -mno-mulhw @gol
1124 -mdlmzb -mno-dlmzb @gol
1125 -mprototype -mno-prototype @gol
1126 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1127 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1128 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1129 -mno-recip-precision @gol
1130 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1131 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1132 -msave-toc-indirect -mno-save-toc-indirect @gol
1133 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1134 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1135 -mquad-memory -mno-quad-memory @gol
1136 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1137 -mcompat-align-parm -mno-compat-align-parm @gol
1138 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1139 -mgnu-attribute -mno-gnu-attribute @gol
1140 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1141 -mstack-protector-guard-offset=@var{offset}}
1142
1143 @emph{RX Options}
1144 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1145 -mcpu=@gol
1146 -mbig-endian-data -mlittle-endian-data @gol
1147 -msmall-data @gol
1148 -msim -mno-sim@gol
1149 -mas100-syntax -mno-as100-syntax@gol
1150 -mrelax@gol
1151 -mmax-constant-size=@gol
1152 -mint-register=@gol
1153 -mpid@gol
1154 -mallow-string-insns -mno-allow-string-insns@gol
1155 -mjsr@gol
1156 -mno-warn-multiple-fast-interrupts@gol
1157 -msave-acc-in-interrupts}
1158
1159 @emph{S/390 and zSeries Options}
1160 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1161 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1162 -mlong-double-64 -mlong-double-128 @gol
1163 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1164 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1165 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1166 -mhtm -mvx -mzvector @gol
1167 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1168 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1169 -mhotpatch=@var{halfwords},@var{halfwords}}
1170
1171 @emph{Score Options}
1172 @gccoptlist{-meb -mel @gol
1173 -mnhwloop @gol
1174 -muls @gol
1175 -mmac @gol
1176 -mscore5 -mscore5u -mscore7 -mscore7d}
1177
1178 @emph{SH Options}
1179 @gccoptlist{-m1 -m2 -m2e @gol
1180 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1181 -m3 -m3e @gol
1182 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1183 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1184 -mb -ml -mdalign -mrelax @gol
1185 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1186 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1187 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1188 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1189 -maccumulate-outgoing-args @gol
1190 -matomic-model=@var{atomic-model} @gol
1191 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1192 -mcbranch-force-delay-slot @gol
1193 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1194 -mpretend-cmove -mtas}
1195
1196 @emph{Solaris 2 Options}
1197 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1198 -pthreads}
1199
1200 @emph{SPARC Options}
1201 @gccoptlist{-mcpu=@var{cpu-type} @gol
1202 -mtune=@var{cpu-type} @gol
1203 -mcmodel=@var{code-model} @gol
1204 -mmemory-model=@var{mem-model} @gol
1205 -m32 -m64 -mapp-regs -mno-app-regs @gol
1206 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1207 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1208 -mhard-quad-float -msoft-quad-float @gol
1209 -mstack-bias -mno-stack-bias @gol
1210 -mstd-struct-return -mno-std-struct-return @gol
1211 -munaligned-doubles -mno-unaligned-doubles @gol
1212 -muser-mode -mno-user-mode @gol
1213 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1214 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1215 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1216 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1217 -mpopc -mno-popc -msubxc -mno-subxc @gol
1218 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1219 -mlra -mno-lra}
1220
1221 @emph{SPU Options}
1222 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1223 -msafe-dma -munsafe-dma @gol
1224 -mbranch-hints @gol
1225 -msmall-mem -mlarge-mem -mstdmain @gol
1226 -mfixed-range=@var{register-range} @gol
1227 -mea32 -mea64 @gol
1228 -maddress-space-conversion -mno-address-space-conversion @gol
1229 -mcache-size=@var{cache-size} @gol
1230 -matomic-updates -mno-atomic-updates}
1231
1232 @emph{System V Options}
1233 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1234
1235 @emph{TILE-Gx Options}
1236 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1237 -mcmodel=@var{code-model}}
1238
1239 @emph{TILEPro Options}
1240 @gccoptlist{-mcpu=@var{cpu} -m32}
1241
1242 @emph{V850 Options}
1243 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1244 -mprolog-function -mno-prolog-function -mspace @gol
1245 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1246 -mapp-regs -mno-app-regs @gol
1247 -mdisable-callt -mno-disable-callt @gol
1248 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1249 -mv850e -mv850 -mv850e3v5 @gol
1250 -mloop @gol
1251 -mrelax @gol
1252 -mlong-jumps @gol
1253 -msoft-float @gol
1254 -mhard-float @gol
1255 -mgcc-abi @gol
1256 -mrh850-abi @gol
1257 -mbig-switch}
1258
1259 @emph{VAX Options}
1260 @gccoptlist{-mg -mgnu -munix}
1261
1262 @emph{Visium Options}
1263 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1264 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1265
1266 @emph{VMS Options}
1267 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1268 -mpointer-size=@var{size}}
1269
1270 @emph{VxWorks Options}
1271 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1272 -Xbind-lazy -Xbind-now}
1273
1274 @emph{x86 Options}
1275 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1276 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1277 -mfpmath=@var{unit} @gol
1278 -masm=@var{dialect} -mno-fancy-math-387 @gol
1279 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1280 -mno-wide-multiply -mrtd -malign-double @gol
1281 -mpreferred-stack-boundary=@var{num} @gol
1282 -mincoming-stack-boundary=@var{num} @gol
1283 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1284 -mrecip -mrecip=@var{opt} @gol
1285 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1286 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1287 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1288 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1289 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1290 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1291 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1292 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1293 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1294 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1295 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1296 -mcldemote @gol
1297 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1298 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1299 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1300 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1301 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1302 -mregparm=@var{num} -msseregparm @gol
1303 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1304 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1305 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1306 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1307 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1308 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1309 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1310 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1311 -mstack-protector-guard-reg=@var{reg} @gol
1312 -mstack-protector-guard-offset=@var{offset} @gol
1313 -mstack-protector-guard-symbol=@var{symbol} @gol
1314 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1315 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1316 -mindirect-branch-register}
1317
1318 @emph{x86 Windows Options}
1319 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1320 -mnop-fun-dllimport -mthread @gol
1321 -municode -mwin32 -mwindows -fno-set-stack-executable}
1322
1323 @emph{Xstormy16 Options}
1324 @gccoptlist{-msim}
1325
1326 @emph{Xtensa Options}
1327 @gccoptlist{-mconst16 -mno-const16 @gol
1328 -mfused-madd -mno-fused-madd @gol
1329 -mforce-no-pic @gol
1330 -mserialize-volatile -mno-serialize-volatile @gol
1331 -mtext-section-literals -mno-text-section-literals @gol
1332 -mauto-litpools -mno-auto-litpools @gol
1333 -mtarget-align -mno-target-align @gol
1334 -mlongcalls -mno-longcalls}
1335
1336 @emph{zSeries Options}
1337 See S/390 and zSeries Options.
1338 @end table
1339
1340
1341 @node Overall Options
1342 @section Options Controlling the Kind of Output
1343
1344 Compilation can involve up to four stages: preprocessing, compilation
1345 proper, assembly and linking, always in that order. GCC is capable of
1346 preprocessing and compiling several files either into several
1347 assembler input files, or into one assembler input file; then each
1348 assembler input file produces an object file, and linking combines all
1349 the object files (those newly compiled, and those specified as input)
1350 into an executable file.
1351
1352 @cindex file name suffix
1353 For any given input file, the file name suffix determines what kind of
1354 compilation is done:
1355
1356 @table @gcctabopt
1357 @item @var{file}.c
1358 C source code that must be preprocessed.
1359
1360 @item @var{file}.i
1361 C source code that should not be preprocessed.
1362
1363 @item @var{file}.ii
1364 C++ source code that should not be preprocessed.
1365
1366 @item @var{file}.m
1367 Objective-C source code. Note that you must link with the @file{libobjc}
1368 library to make an Objective-C program work.
1369
1370 @item @var{file}.mi
1371 Objective-C source code that should not be preprocessed.
1372
1373 @item @var{file}.mm
1374 @itemx @var{file}.M
1375 Objective-C++ source code. Note that you must link with the @file{libobjc}
1376 library to make an Objective-C++ program work. Note that @samp{.M} refers
1377 to a literal capital M@.
1378
1379 @item @var{file}.mii
1380 Objective-C++ source code that should not be preprocessed.
1381
1382 @item @var{file}.h
1383 C, C++, Objective-C or Objective-C++ header file to be turned into a
1384 precompiled header (default), or C, C++ header file to be turned into an
1385 Ada spec (via the @option{-fdump-ada-spec} switch).
1386
1387 @item @var{file}.cc
1388 @itemx @var{file}.cp
1389 @itemx @var{file}.cxx
1390 @itemx @var{file}.cpp
1391 @itemx @var{file}.CPP
1392 @itemx @var{file}.c++
1393 @itemx @var{file}.C
1394 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1395 the last two letters must both be literally @samp{x}. Likewise,
1396 @samp{.C} refers to a literal capital C@.
1397
1398 @item @var{file}.mm
1399 @itemx @var{file}.M
1400 Objective-C++ source code that must be preprocessed.
1401
1402 @item @var{file}.mii
1403 Objective-C++ source code that should not be preprocessed.
1404
1405 @item @var{file}.hh
1406 @itemx @var{file}.H
1407 @itemx @var{file}.hp
1408 @itemx @var{file}.hxx
1409 @itemx @var{file}.hpp
1410 @itemx @var{file}.HPP
1411 @itemx @var{file}.h++
1412 @itemx @var{file}.tcc
1413 C++ header file to be turned into a precompiled header or Ada spec.
1414
1415 @item @var{file}.f
1416 @itemx @var{file}.for
1417 @itemx @var{file}.ftn
1418 Fixed form Fortran source code that should not be preprocessed.
1419
1420 @item @var{file}.F
1421 @itemx @var{file}.FOR
1422 @itemx @var{file}.fpp
1423 @itemx @var{file}.FPP
1424 @itemx @var{file}.FTN
1425 Fixed form Fortran source code that must be preprocessed (with the traditional
1426 preprocessor).
1427
1428 @item @var{file}.f90
1429 @itemx @var{file}.f95
1430 @itemx @var{file}.f03
1431 @itemx @var{file}.f08
1432 Free form Fortran source code that should not be preprocessed.
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 must be preprocessed (with the
1439 traditional preprocessor).
1440
1441 @item @var{file}.go
1442 Go source code.
1443
1444 @item @var{file}.brig
1445 BRIG files (binary representation of HSAIL).
1446
1447 @item @var{file}.d
1448 D source code.
1449
1450 @item @var{file}.di
1451 D interface file.
1452
1453 @item @var{file}.dd
1454 D documentation code (Ddoc).
1455
1456 @item @var{file}.ads
1457 Ada source code file that contains a library unit declaration (a
1458 declaration of a package, subprogram, or generic, or a generic
1459 instantiation), or a library unit renaming declaration (a package,
1460 generic, or subprogram renaming declaration). Such files are also
1461 called @dfn{specs}.
1462
1463 @item @var{file}.adb
1464 Ada source code file containing a library unit body (a subprogram or
1465 package body). Such files are also called @dfn{bodies}.
1466
1467 @c GCC also knows about some suffixes for languages not yet included:
1468 @c Ratfor:
1469 @c @var{file}.r
1470
1471 @item @var{file}.s
1472 Assembler code.
1473
1474 @item @var{file}.S
1475 @itemx @var{file}.sx
1476 Assembler code that must be preprocessed.
1477
1478 @item @var{other}
1479 An object file to be fed straight into linking.
1480 Any file name with no recognized suffix is treated this way.
1481 @end table
1482
1483 @opindex x
1484 You can specify the input language explicitly with the @option{-x} option:
1485
1486 @table @gcctabopt
1487 @item -x @var{language}
1488 Specify explicitly the @var{language} for the following input files
1489 (rather than letting the compiler choose a default based on the file
1490 name suffix). This option applies to all following input files until
1491 the next @option{-x} option. Possible values for @var{language} are:
1492 @smallexample
1493 c c-header cpp-output
1494 c++ c++-header c++-cpp-output
1495 objective-c objective-c-header objective-c-cpp-output
1496 objective-c++ objective-c++-header objective-c++-cpp-output
1497 assembler assembler-with-cpp
1498 ada
1499 d
1500 f77 f77-cpp-input f95 f95-cpp-input
1501 go
1502 brig
1503 @end smallexample
1504
1505 @item -x none
1506 Turn off any specification of a language, so that subsequent files are
1507 handled according to their file name suffixes (as they are if @option{-x}
1508 has not been used at all).
1509 @end table
1510
1511 If you only want some of the stages of compilation, you can use
1512 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1513 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1514 @command{gcc} is to stop. Note that some combinations (for example,
1515 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1516
1517 @table @gcctabopt
1518 @item -c
1519 @opindex c
1520 Compile or assemble the source files, but do not link. The linking
1521 stage simply is not done. The ultimate output is in the form of an
1522 object file for each source file.
1523
1524 By default, the object file name for a source file is made by replacing
1525 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1526
1527 Unrecognized input files, not requiring compilation or assembly, are
1528 ignored.
1529
1530 @item -S
1531 @opindex S
1532 Stop after the stage of compilation proper; do not assemble. The output
1533 is in the form of an assembler code file for each non-assembler input
1534 file specified.
1535
1536 By default, the assembler file name for a source file is made by
1537 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1538
1539 Input files that don't require compilation are ignored.
1540
1541 @item -E
1542 @opindex E
1543 Stop after the preprocessing stage; do not run the compiler proper. The
1544 output is in the form of preprocessed source code, which is sent to the
1545 standard output.
1546
1547 Input files that don't require preprocessing are ignored.
1548
1549 @cindex output file option
1550 @item -o @var{file}
1551 @opindex o
1552 Place output in file @var{file}. This applies to whatever
1553 sort of output is being produced, whether it be an executable file,
1554 an object file, an assembler file or preprocessed C code.
1555
1556 If @option{-o} is not specified, the default is to put an executable
1557 file in @file{a.out}, the object file for
1558 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1559 assembler file in @file{@var{source}.s}, a precompiled header file in
1560 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1561 standard output.
1562
1563 @item -v
1564 @opindex v
1565 Print (on standard error output) the commands executed to run the stages
1566 of compilation. Also print the version number of the compiler driver
1567 program and of the preprocessor and the compiler proper.
1568
1569 @item -###
1570 @opindex ###
1571 Like @option{-v} except the commands are not executed and arguments
1572 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1573 This is useful for shell scripts to capture the driver-generated command lines.
1574
1575 @item --help
1576 @opindex help
1577 Print (on the standard output) a description of the command-line options
1578 understood by @command{gcc}. If the @option{-v} option is also specified
1579 then @option{--help} is also passed on to the various processes
1580 invoked by @command{gcc}, so that they can display the command-line options
1581 they accept. If the @option{-Wextra} option has also been specified
1582 (prior to the @option{--help} option), then command-line options that
1583 have no documentation associated with them are also displayed.
1584
1585 @item --target-help
1586 @opindex target-help
1587 Print (on the standard output) a description of target-specific command-line
1588 options for each tool. For some targets extra target-specific
1589 information may also be printed.
1590
1591 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1592 Print (on the standard output) a description of the command-line
1593 options understood by the compiler that fit into all specified classes
1594 and qualifiers. These are the supported classes:
1595
1596 @table @asis
1597 @item @samp{optimizers}
1598 Display all of the optimization options supported by the
1599 compiler.
1600
1601 @item @samp{warnings}
1602 Display all of the options controlling warning messages
1603 produced by the compiler.
1604
1605 @item @samp{target}
1606 Display target-specific options. Unlike the
1607 @option{--target-help} option however, target-specific options of the
1608 linker and assembler are not displayed. This is because those
1609 tools do not currently support the extended @option{--help=} syntax.
1610
1611 @item @samp{params}
1612 Display the values recognized by the @option{--param}
1613 option.
1614
1615 @item @var{language}
1616 Display the options supported for @var{language}, where
1617 @var{language} is the name of one of the languages supported in this
1618 version of GCC@.
1619
1620 @item @samp{common}
1621 Display the options that are common to all languages.
1622 @end table
1623
1624 These are the supported qualifiers:
1625
1626 @table @asis
1627 @item @samp{undocumented}
1628 Display only those options that are undocumented.
1629
1630 @item @samp{joined}
1631 Display options taking an argument that appears after an equal
1632 sign in the same continuous piece of text, such as:
1633 @samp{--help=target}.
1634
1635 @item @samp{separate}
1636 Display options taking an argument that appears as a separate word
1637 following the original option, such as: @samp{-o output-file}.
1638 @end table
1639
1640 Thus for example to display all the undocumented target-specific
1641 switches supported by the compiler, use:
1642
1643 @smallexample
1644 --help=target,undocumented
1645 @end smallexample
1646
1647 The sense of a qualifier can be inverted by prefixing it with the
1648 @samp{^} character, so for example to display all binary warning
1649 options (i.e., ones that are either on or off and that do not take an
1650 argument) that have a description, use:
1651
1652 @smallexample
1653 --help=warnings,^joined,^undocumented
1654 @end smallexample
1655
1656 The argument to @option{--help=} should not consist solely of inverted
1657 qualifiers.
1658
1659 Combining several classes is possible, although this usually
1660 restricts the output so much that there is nothing to display. One
1661 case where it does work, however, is when one of the classes is
1662 @var{target}. For example, to display all the target-specific
1663 optimization options, use:
1664
1665 @smallexample
1666 --help=target,optimizers
1667 @end smallexample
1668
1669 The @option{--help=} option can be repeated on the command line. Each
1670 successive use displays its requested class of options, skipping
1671 those that have already been displayed.
1672
1673 If the @option{-Q} option appears on the command line before the
1674 @option{--help=} option, then the descriptive text displayed by
1675 @option{--help=} is changed. Instead of describing the displayed
1676 options, an indication is given as to whether the option is enabled,
1677 disabled or set to a specific value (assuming that the compiler
1678 knows this at the point where the @option{--help=} option is used).
1679
1680 Here is a truncated example from the ARM port of @command{gcc}:
1681
1682 @smallexample
1683 % gcc -Q -mabi=2 --help=target -c
1684 The following options are target specific:
1685 -mabi= 2
1686 -mabort-on-noreturn [disabled]
1687 -mapcs [disabled]
1688 @end smallexample
1689
1690 The output is sensitive to the effects of previous command-line
1691 options, so for example it is possible to find out which optimizations
1692 are enabled at @option{-O2} by using:
1693
1694 @smallexample
1695 -Q -O2 --help=optimizers
1696 @end smallexample
1697
1698 Alternatively you can discover which binary optimizations are enabled
1699 by @option{-O3} by using:
1700
1701 @smallexample
1702 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1703 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1704 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1705 @end smallexample
1706
1707 @item --version
1708 @opindex version
1709 Display the version number and copyrights of the invoked GCC@.
1710
1711 @item -pass-exit-codes
1712 @opindex pass-exit-codes
1713 Normally the @command{gcc} program exits with the code of 1 if any
1714 phase of the compiler returns a non-success return code. If you specify
1715 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1716 the numerically highest error produced by any phase returning an error
1717 indication. The C, C++, and Fortran front ends return 4 if an internal
1718 compiler error is encountered.
1719
1720 @item -pipe
1721 @opindex pipe
1722 Use pipes rather than temporary files for communication between the
1723 various stages of compilation. This fails to work on some systems where
1724 the assembler is unable to read from a pipe; but the GNU assembler has
1725 no trouble.
1726
1727 @item -specs=@var{file}
1728 @opindex specs
1729 Process @var{file} after the compiler reads in the standard @file{specs}
1730 file, in order to override the defaults which the @command{gcc} driver
1731 program uses when determining what switches to pass to @command{cc1},
1732 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1733 @option{-specs=@var{file}} can be specified on the command line, and they
1734 are processed in order, from left to right. @xref{Spec Files}, for
1735 information about the format of the @var{file}.
1736
1737 @item -wrapper
1738 @opindex wrapper
1739 Invoke all subcommands under a wrapper program. The name of the
1740 wrapper program and its parameters are passed as a comma separated
1741 list.
1742
1743 @smallexample
1744 gcc -c t.c -wrapper gdb,--args
1745 @end smallexample
1746
1747 @noindent
1748 This invokes all subprograms of @command{gcc} under
1749 @samp{gdb --args}, thus the invocation of @command{cc1} is
1750 @samp{gdb --args cc1 @dots{}}.
1751
1752 @item -ffile-prefix-map=@var{old}=@var{new}
1753 @opindex ffile-prefix-map
1754 When compiling files residing in directory @file{@var{old}}, record
1755 any references to them in the result of the compilation as if the
1756 files resided in directory @file{@var{new}} instead. Specifying this
1757 option is equivalent to specifying all the individual
1758 @option{-f*-prefix-map} options. This can be used to make reproducible
1759 builds that are location independent. See also
1760 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1761
1762 @item -fplugin=@var{name}.so
1763 @opindex fplugin
1764 Load the plugin code in file @var{name}.so, assumed to be a
1765 shared object to be dlopen'd by the compiler. The base name of
1766 the shared object file is used to identify the plugin for the
1767 purposes of argument parsing (See
1768 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1769 Each plugin should define the callback functions specified in the
1770 Plugins API.
1771
1772 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1773 @opindex fplugin-arg
1774 Define an argument called @var{key} with a value of @var{value}
1775 for the plugin called @var{name}.
1776
1777 @item -fdump-ada-spec@r{[}-slim@r{]}
1778 @opindex fdump-ada-spec
1779 For C and C++ source and include files, generate corresponding Ada specs.
1780 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1781 GNAT User's Guide}, which provides detailed documentation on this feature.
1782
1783 @item -fada-spec-parent=@var{unit}
1784 @opindex fada-spec-parent
1785 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1786 Ada specs as child units of parent @var{unit}.
1787
1788 @item -fdump-go-spec=@var{file}
1789 @opindex fdump-go-spec
1790 For input files in any language, generate corresponding Go
1791 declarations in @var{file}. This generates Go @code{const},
1792 @code{type}, @code{var}, and @code{func} declarations which may be a
1793 useful way to start writing a Go interface to code written in some
1794 other language.
1795
1796 @include @value{srcdir}/../libiberty/at-file.texi
1797 @end table
1798
1799 @node Invoking G++
1800 @section Compiling C++ Programs
1801
1802 @cindex suffixes for C++ source
1803 @cindex C++ source file suffixes
1804 C++ source files conventionally use one of the suffixes @samp{.C},
1805 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1806 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1807 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1808 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1809 files with these names and compiles them as C++ programs even if you
1810 call the compiler the same way as for compiling C programs (usually
1811 with the name @command{gcc}).
1812
1813 @findex g++
1814 @findex c++
1815 However, the use of @command{gcc} does not add the C++ library.
1816 @command{g++} is a program that calls GCC and automatically specifies linking
1817 against the C++ library. It treats @samp{.c},
1818 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1819 files unless @option{-x} is used. This program is also useful when
1820 precompiling a C header file with a @samp{.h} extension for use in C++
1821 compilations. On many systems, @command{g++} is also installed with
1822 the name @command{c++}.
1823
1824 @cindex invoking @command{g++}
1825 When you compile C++ programs, you may specify many of the same
1826 command-line options that you use for compiling programs in any
1827 language; or command-line options meaningful for C and related
1828 languages; or options that are meaningful only for C++ programs.
1829 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1830 explanations of options for languages related to C@.
1831 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1832 explanations of options that are meaningful only for C++ programs.
1833
1834 @node C Dialect Options
1835 @section Options Controlling C Dialect
1836 @cindex dialect options
1837 @cindex language dialect options
1838 @cindex options, dialect
1839
1840 The following options control the dialect of C (or languages derived
1841 from C, such as C++, Objective-C and Objective-C++) that the compiler
1842 accepts:
1843
1844 @table @gcctabopt
1845 @cindex ANSI support
1846 @cindex ISO support
1847 @item -ansi
1848 @opindex ansi
1849 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1850 equivalent to @option{-std=c++98}.
1851
1852 This turns off certain features of GCC that are incompatible with ISO
1853 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1854 such as the @code{asm} and @code{typeof} keywords, and
1855 predefined macros such as @code{unix} and @code{vax} that identify the
1856 type of system you are using. It also enables the undesirable and
1857 rarely used ISO trigraph feature. For the C compiler,
1858 it disables recognition of C++ style @samp{//} comments as well as
1859 the @code{inline} keyword.
1860
1861 The alternate keywords @code{__asm__}, @code{__extension__},
1862 @code{__inline__} and @code{__typeof__} continue to work despite
1863 @option{-ansi}. You would not want to use them in an ISO C program, of
1864 course, but it is useful to put them in header files that might be included
1865 in compilations done with @option{-ansi}. Alternate predefined macros
1866 such as @code{__unix__} and @code{__vax__} are also available, with or
1867 without @option{-ansi}.
1868
1869 The @option{-ansi} option does not cause non-ISO programs to be
1870 rejected gratuitously. For that, @option{-Wpedantic} is required in
1871 addition to @option{-ansi}. @xref{Warning Options}.
1872
1873 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1874 option is used. Some header files may notice this macro and refrain
1875 from declaring certain functions or defining certain macros that the
1876 ISO standard doesn't call for; this is to avoid interfering with any
1877 programs that might use these names for other things.
1878
1879 Functions that are normally built in but do not have semantics
1880 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1881 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1882 built-in functions provided by GCC}, for details of the functions
1883 affected.
1884
1885 @item -std=
1886 @opindex std
1887 Determine the language standard. @xref{Standards,,Language Standards
1888 Supported by GCC}, for details of these standard versions. This option
1889 is currently only supported when compiling C or C++.
1890
1891 The compiler can accept several base standards, such as @samp{c90} or
1892 @samp{c++98}, and GNU dialects of those standards, such as
1893 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1894 compiler accepts all programs following that standard plus those
1895 using GNU extensions that do not contradict it. For example,
1896 @option{-std=c90} turns off certain features of GCC that are
1897 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1898 keywords, but not other GNU extensions that do not have a meaning in
1899 ISO C90, such as omitting the middle term of a @code{?:}
1900 expression. On the other hand, when a GNU dialect of a standard is
1901 specified, all features supported by the compiler are enabled, even when
1902 those features change the meaning of the base standard. As a result, some
1903 strict-conforming programs may be rejected. The particular standard
1904 is used by @option{-Wpedantic} to identify which features are GNU
1905 extensions given that version of the standard. For example
1906 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1907 comments, while @option{-std=gnu99 -Wpedantic} does not.
1908
1909 A value for this option must be provided; possible values are
1910
1911 @table @samp
1912 @item c90
1913 @itemx c89
1914 @itemx iso9899:1990
1915 Support all ISO C90 programs (certain GNU extensions that conflict
1916 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1917
1918 @item iso9899:199409
1919 ISO C90 as modified in amendment 1.
1920
1921 @item c99
1922 @itemx c9x
1923 @itemx iso9899:1999
1924 @itemx iso9899:199x
1925 ISO C99. This standard is substantially completely supported, modulo
1926 bugs and floating-point issues
1927 (mainly but not entirely relating to optional C99 features from
1928 Annexes F and G). See
1929 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1930 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1931
1932 @item c11
1933 @itemx c1x
1934 @itemx iso9899:2011
1935 ISO C11, the 2011 revision of the ISO C standard. This standard is
1936 substantially completely supported, modulo bugs, floating-point issues
1937 (mainly but not entirely relating to optional C11 features from
1938 Annexes F and G) and the optional Annexes K (Bounds-checking
1939 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1940
1941 @item c17
1942 @itemx c18
1943 @itemx iso9899:2017
1944 @itemx iso9899:2018
1945 ISO C17, the 2017 revision of the ISO C standard
1946 (published in 2018). This standard is
1947 same as C11 except for corrections of defects (all of which are also
1948 applied with @option{-std=c11}) and a new value of
1949 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1950
1951 @item c2x
1952 The next version of the ISO C standard, still under development. The
1953 support for this version is experimental and incomplete.
1954
1955 @item gnu90
1956 @itemx gnu89
1957 GNU dialect of ISO C90 (including some C99 features).
1958
1959 @item gnu99
1960 @itemx gnu9x
1961 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1962
1963 @item gnu11
1964 @itemx gnu1x
1965 GNU dialect of ISO C11.
1966 The name @samp{gnu1x} is deprecated.
1967
1968 @item gnu17
1969 @itemx gnu18
1970 GNU dialect of ISO C17. This is the default for C code.
1971
1972 @item gnu2x
1973 The next version of the ISO C standard, still under development, plus
1974 GNU extensions. The support for this version is experimental and
1975 incomplete.
1976
1977 @item c++98
1978 @itemx c++03
1979 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1980 additional defect reports. Same as @option{-ansi} for C++ code.
1981
1982 @item gnu++98
1983 @itemx gnu++03
1984 GNU dialect of @option{-std=c++98}.
1985
1986 @item c++11
1987 @itemx c++0x
1988 The 2011 ISO C++ standard plus amendments.
1989 The name @samp{c++0x} is deprecated.
1990
1991 @item gnu++11
1992 @itemx gnu++0x
1993 GNU dialect of @option{-std=c++11}.
1994 The name @samp{gnu++0x} is deprecated.
1995
1996 @item c++14
1997 @itemx c++1y
1998 The 2014 ISO C++ standard plus amendments.
1999 The name @samp{c++1y} is deprecated.
2000
2001 @item gnu++14
2002 @itemx gnu++1y
2003 GNU dialect of @option{-std=c++14}.
2004 This is the default for C++ code.
2005 The name @samp{gnu++1y} is deprecated.
2006
2007 @item c++17
2008 @itemx c++1z
2009 The 2017 ISO C++ standard plus amendments.
2010 The name @samp{c++1z} is deprecated.
2011
2012 @item gnu++17
2013 @itemx gnu++1z
2014 GNU dialect of @option{-std=c++17}.
2015 The name @samp{gnu++1z} is deprecated.
2016
2017 @item c++2a
2018 The next revision of the ISO C++ standard, tentatively planned for
2019 2020. Support is highly experimental, and will almost certainly
2020 change in incompatible ways in future releases.
2021
2022 @item gnu++2a
2023 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2024 and will almost certainly change in incompatible ways in future
2025 releases.
2026 @end table
2027
2028 @item -fgnu89-inline
2029 @opindex fgnu89-inline
2030 The option @option{-fgnu89-inline} tells GCC to use the traditional
2031 GNU semantics for @code{inline} functions when in C99 mode.
2032 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2033 Using this option is roughly equivalent to adding the
2034 @code{gnu_inline} function attribute to all inline functions
2035 (@pxref{Function Attributes}).
2036
2037 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2038 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2039 specifies the default behavior).
2040 This option is not supported in @option{-std=c90} or
2041 @option{-std=gnu90} mode.
2042
2043 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2044 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2045 in effect for @code{inline} functions. @xref{Common Predefined
2046 Macros,,,cpp,The C Preprocessor}.
2047
2048 @item -fpermitted-flt-eval-methods=@var{style}
2049 @opindex fpermitted-flt-eval-methods
2050 @opindex fpermitted-flt-eval-methods=c11
2051 @opindex fpermitted-flt-eval-methods=ts-18661-3
2052 ISO/IEC TS 18661-3 defines new permissible values for
2053 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2054 a semantic type that is an interchange or extended format should be
2055 evaluated to the precision and range of that type. These new values are
2056 a superset of those permitted under C99/C11, which does not specify the
2057 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2058 conforming to C11 may not have been written expecting the possibility of
2059 the new values.
2060
2061 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2062 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2063 or the extended set of values specified in ISO/IEC TS 18661-3.
2064
2065 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2066
2067 The default when in a standards compliant mode (@option{-std=c11} or similar)
2068 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2069 dialect (@option{-std=gnu11} or similar) is
2070 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2071
2072 @item -aux-info @var{filename}
2073 @opindex aux-info
2074 Output to the given filename prototyped declarations for all functions
2075 declared and/or defined in a translation unit, including those in header
2076 files. This option is silently ignored in any language other than C@.
2077
2078 Besides declarations, the file indicates, in comments, the origin of
2079 each declaration (source file and line), whether the declaration was
2080 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2081 @samp{O} for old, respectively, in the first character after the line
2082 number and the colon), and whether it came from a declaration or a
2083 definition (@samp{C} or @samp{F}, respectively, in the following
2084 character). In the case of function definitions, a K&R-style list of
2085 arguments followed by their declarations is also provided, inside
2086 comments, after the declaration.
2087
2088 @item -fallow-parameterless-variadic-functions
2089 @opindex fallow-parameterless-variadic-functions
2090 Accept variadic functions without named parameters.
2091
2092 Although it is possible to define such a function, this is not very
2093 useful as it is not possible to read the arguments. This is only
2094 supported for C as this construct is allowed by C++.
2095
2096 @item -fno-asm
2097 @opindex fno-asm
2098 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2099 keyword, so that code can use these words as identifiers. You can use
2100 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2101 instead. @option{-ansi} implies @option{-fno-asm}.
2102
2103 In C++, this switch only affects the @code{typeof} keyword, since
2104 @code{asm} and @code{inline} are standard keywords. You may want to
2105 use the @option{-fno-gnu-keywords} flag instead, which has the same
2106 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2107 switch only affects the @code{asm} and @code{typeof} keywords, since
2108 @code{inline} is a standard keyword in ISO C99.
2109
2110 @item -fno-builtin
2111 @itemx -fno-builtin-@var{function}
2112 @opindex fno-builtin
2113 @cindex built-in functions
2114 Don't recognize built-in functions that do not begin with
2115 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2116 functions provided by GCC}, for details of the functions affected,
2117 including those which are not built-in functions when @option{-ansi} or
2118 @option{-std} options for strict ISO C conformance are used because they
2119 do not have an ISO standard meaning.
2120
2121 GCC normally generates special code to handle certain built-in functions
2122 more efficiently; for instance, calls to @code{alloca} may become single
2123 instructions which adjust the stack directly, and calls to @code{memcpy}
2124 may become inline copy loops. The resulting code is often both smaller
2125 and faster, but since the function calls no longer appear as such, you
2126 cannot set a breakpoint on those calls, nor can you change the behavior
2127 of the functions by linking with a different library. In addition,
2128 when a function is recognized as a built-in function, GCC may use
2129 information about that function to warn about problems with calls to
2130 that function, or to generate more efficient code, even if the
2131 resulting code still contains calls to that function. For example,
2132 warnings are given with @option{-Wformat} for bad calls to
2133 @code{printf} when @code{printf} is built in and @code{strlen} is
2134 known not to modify global memory.
2135
2136 With the @option{-fno-builtin-@var{function}} option
2137 only the built-in function @var{function} is
2138 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2139 function is named that is not built-in in this version of GCC, this
2140 option is ignored. There is no corresponding
2141 @option{-fbuiltin-@var{function}} option; if you wish to enable
2142 built-in functions selectively when using @option{-fno-builtin} or
2143 @option{-ffreestanding}, you may define macros such as:
2144
2145 @smallexample
2146 #define abs(n) __builtin_abs ((n))
2147 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2148 @end smallexample
2149
2150 @item -fgimple
2151 @opindex fgimple
2152
2153 Enable parsing of function definitions marked with @code{__GIMPLE}.
2154 This is an experimental feature that allows unit testing of GIMPLE
2155 passes.
2156
2157 @item -fhosted
2158 @opindex fhosted
2159 @cindex hosted environment
2160
2161 Assert that compilation targets a hosted environment. This implies
2162 @option{-fbuiltin}. A hosted environment is one in which the
2163 entire standard library is available, and in which @code{main} has a return
2164 type of @code{int}. Examples are nearly everything except a kernel.
2165 This is equivalent to @option{-fno-freestanding}.
2166
2167 @item -ffreestanding
2168 @opindex ffreestanding
2169 @cindex hosted environment
2170
2171 Assert that compilation targets a freestanding environment. This
2172 implies @option{-fno-builtin}. A freestanding environment
2173 is one in which the standard library may not exist, and program startup may
2174 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2175 This is equivalent to @option{-fno-hosted}.
2176
2177 @xref{Standards,,Language Standards Supported by GCC}, for details of
2178 freestanding and hosted environments.
2179
2180 @item -fopenacc
2181 @opindex fopenacc
2182 @cindex OpenACC accelerator programming
2183 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2184 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2185 compiler generates accelerated code according to the OpenACC Application
2186 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2187 implies @option{-pthread}, and thus is only supported on targets that
2188 have support for @option{-pthread}.
2189
2190 @item -fopenacc-dim=@var{geom}
2191 @opindex fopenacc-dim
2192 @cindex OpenACC accelerator programming
2193 Specify default compute dimensions for parallel offload regions that do
2194 not explicitly specify. The @var{geom} value is a triple of
2195 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2196 can be omitted, to use a target-specific default value.
2197
2198 @item -fopenmp
2199 @opindex fopenmp
2200 @cindex OpenMP parallel
2201 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2202 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2203 compiler generates parallel code according to the OpenMP Application
2204 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2205 implies @option{-pthread}, and thus is only supported on targets that
2206 have support for @option{-pthread}. @option{-fopenmp} implies
2207 @option{-fopenmp-simd}.
2208
2209 @item -fopenmp-simd
2210 @opindex fopenmp-simd
2211 @cindex OpenMP SIMD
2212 @cindex SIMD
2213 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2214 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2215 are ignored.
2216
2217 @item -fgnu-tm
2218 @opindex fgnu-tm
2219 When the option @option{-fgnu-tm} is specified, the compiler
2220 generates code for the Linux variant of Intel's current Transactional
2221 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2222 an experimental feature whose interface may change in future versions
2223 of GCC, as the official specification changes. Please note that not
2224 all architectures are supported for this feature.
2225
2226 For more information on GCC's support for transactional memory,
2227 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2228 Transactional Memory Library}.
2229
2230 Note that the transactional memory feature is not supported with
2231 non-call exceptions (@option{-fnon-call-exceptions}).
2232
2233 @item -fms-extensions
2234 @opindex fms-extensions
2235 Accept some non-standard constructs used in Microsoft header files.
2236
2237 In C++ code, this allows member names in structures to be similar
2238 to previous types declarations.
2239
2240 @smallexample
2241 typedef int UOW;
2242 struct ABC @{
2243 UOW UOW;
2244 @};
2245 @end smallexample
2246
2247 Some cases of unnamed fields in structures and unions are only
2248 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2249 fields within structs/unions}, for details.
2250
2251 Note that this option is off for all targets but x86
2252 targets using ms-abi.
2253
2254 @item -fplan9-extensions
2255 @opindex fplan9-extensions
2256 Accept some non-standard constructs used in Plan 9 code.
2257
2258 This enables @option{-fms-extensions}, permits passing pointers to
2259 structures with anonymous fields to functions that expect pointers to
2260 elements of the type of the field, and permits referring to anonymous
2261 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2262 struct/union fields within structs/unions}, for details. This is only
2263 supported for C, not C++.
2264
2265 @item -fcond-mismatch
2266 @opindex fcond-mismatch
2267 Allow conditional expressions with mismatched types in the second and
2268 third arguments. The value of such an expression is void. This option
2269 is not supported for C++.
2270
2271 @item -flax-vector-conversions
2272 @opindex flax-vector-conversions
2273 Allow implicit conversions between vectors with differing numbers of
2274 elements and/or incompatible element types. This option should not be
2275 used for new code.
2276
2277 @item -funsigned-char
2278 @opindex funsigned-char
2279 Let the type @code{char} be unsigned, like @code{unsigned char}.
2280
2281 Each kind of machine has a default for what @code{char} should
2282 be. It is either like @code{unsigned char} by default or like
2283 @code{signed char} by default.
2284
2285 Ideally, a portable program should always use @code{signed char} or
2286 @code{unsigned char} when it depends on the signedness of an object.
2287 But many programs have been written to use plain @code{char} and
2288 expect it to be signed, or expect it to be unsigned, depending on the
2289 machines they were written for. This option, and its inverse, let you
2290 make such a program work with the opposite default.
2291
2292 The type @code{char} is always a distinct type from each of
2293 @code{signed char} or @code{unsigned char}, even though its behavior
2294 is always just like one of those two.
2295
2296 @item -fsigned-char
2297 @opindex fsigned-char
2298 Let the type @code{char} be signed, like @code{signed char}.
2299
2300 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2301 the negative form of @option{-funsigned-char}. Likewise, the option
2302 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2303
2304 @item -fsigned-bitfields
2305 @itemx -funsigned-bitfields
2306 @itemx -fno-signed-bitfields
2307 @itemx -fno-unsigned-bitfields
2308 @opindex fsigned-bitfields
2309 @opindex funsigned-bitfields
2310 @opindex fno-signed-bitfields
2311 @opindex fno-unsigned-bitfields
2312 These options control whether a bit-field is signed or unsigned, when the
2313 declaration does not use either @code{signed} or @code{unsigned}. By
2314 default, such a bit-field is signed, because this is consistent: the
2315 basic integer types such as @code{int} are signed types.
2316
2317 @item -fsso-struct=@var{endianness}
2318 @opindex fsso-struct
2319 Set the default scalar storage order of structures and unions to the
2320 specified endianness. The accepted values are @samp{big-endian},
2321 @samp{little-endian} and @samp{native} for the native endianness of
2322 the target (the default). This option is not supported for C++.
2323
2324 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2325 code that is not binary compatible with code generated without it if the
2326 specified endianness is not the native endianness of the target.
2327 @end table
2328
2329 @node C++ Dialect Options
2330 @section Options Controlling C++ Dialect
2331
2332 @cindex compiler options, C++
2333 @cindex C++ options, command-line
2334 @cindex options, C++
2335 This section describes the command-line options that are only meaningful
2336 for C++ programs. You can also use most of the GNU compiler options
2337 regardless of what language your program is in. For example, you
2338 might compile a file @file{firstClass.C} like this:
2339
2340 @smallexample
2341 g++ -g -fstrict-enums -O -c firstClass.C
2342 @end smallexample
2343
2344 @noindent
2345 In this example, only @option{-fstrict-enums} is an option meant
2346 only for C++ programs; you can use the other options with any
2347 language supported by GCC@.
2348
2349 Some options for compiling C programs, such as @option{-std}, are also
2350 relevant for C++ programs.
2351 @xref{C Dialect Options,,Options Controlling C Dialect}.
2352
2353 Here is a list of options that are @emph{only} for compiling C++ programs:
2354
2355 @table @gcctabopt
2356
2357 @item -fabi-version=@var{n}
2358 @opindex fabi-version
2359 Use version @var{n} of the C++ ABI@. The default is version 0.
2360
2361 Version 0 refers to the version conforming most closely to
2362 the C++ ABI specification. Therefore, the ABI obtained using version 0
2363 will change in different versions of G++ as ABI bugs are fixed.
2364
2365 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2366
2367 Version 2 is the version of the C++ ABI that first appeared in G++
2368 3.4, and was the default through G++ 4.9.
2369
2370 Version 3 corrects an error in mangling a constant address as a
2371 template argument.
2372
2373 Version 4, which first appeared in G++ 4.5, implements a standard
2374 mangling for vector types.
2375
2376 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2377 attribute const/volatile on function pointer types, decltype of a
2378 plain decl, and use of a function parameter in the declaration of
2379 another parameter.
2380
2381 Version 6, which first appeared in G++ 4.7, corrects the promotion
2382 behavior of C++11 scoped enums and the mangling of template argument
2383 packs, const/static_cast, prefix ++ and --, and a class scope function
2384 used as a template argument.
2385
2386 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2387 builtin type and corrects the mangling of lambdas in default argument
2388 scope.
2389
2390 Version 8, which first appeared in G++ 4.9, corrects the substitution
2391 behavior of function types with function-cv-qualifiers.
2392
2393 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2394 @code{nullptr_t}.
2395
2396 Version 10, which first appeared in G++ 6.1, adds mangling of
2397 attributes that affect type identity, such as ia32 calling convention
2398 attributes (e.g.@: @samp{stdcall}).
2399
2400 Version 11, which first appeared in G++ 7, corrects the mangling of
2401 sizeof... expressions and operator names. For multiple entities with
2402 the same name within a function, that are declared in different scopes,
2403 the mangling now changes starting with the twelfth occurrence. It also
2404 implies @option{-fnew-inheriting-ctors}.
2405
2406 Version 12, which first appeared in G++ 8, corrects the calling
2407 conventions for empty classes on the x86_64 target and for classes
2408 with only deleted copy/move constructors. It accidentally changes the
2409 calling convention for classes with a deleted copy constructor and a
2410 trivial move constructor.
2411
2412 Version 13, which first appeared in G++ 8.2, fixes the accidental
2413 change in version 12.
2414
2415 See also @option{-Wabi}.
2416
2417 @item -fabi-compat-version=@var{n}
2418 @opindex fabi-compat-version
2419 On targets that support strong aliases, G++
2420 works around mangling changes by creating an alias with the correct
2421 mangled name when defining a symbol with an incorrect mangled name.
2422 This switch specifies which ABI version to use for the alias.
2423
2424 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2425 compatibility). If another ABI version is explicitly selected, this
2426 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2427 use @option{-fabi-compat-version=2}.
2428
2429 If this option is not provided but @option{-Wabi=@var{n}} is, that
2430 version is used for compatibility aliases. If this option is provided
2431 along with @option{-Wabi} (without the version), the version from this
2432 option is used for the warning.
2433
2434 @item -fno-access-control
2435 @opindex fno-access-control
2436 Turn off all access checking. This switch is mainly useful for working
2437 around bugs in the access control code.
2438
2439 @item -faligned-new
2440 @opindex faligned-new
2441 Enable support for C++17 @code{new} of types that require more
2442 alignment than @code{void* ::operator new(std::size_t)} provides. A
2443 numeric argument such as @code{-faligned-new=32} can be used to
2444 specify how much alignment (in bytes) is provided by that function,
2445 but few users will need to override the default of
2446 @code{alignof(std::max_align_t)}.
2447
2448 This flag is enabled by default for @option{-std=c++17}.
2449
2450 @item -fcheck-new
2451 @opindex fcheck-new
2452 Check that the pointer returned by @code{operator new} is non-null
2453 before attempting to modify the storage allocated. This check is
2454 normally unnecessary because the C++ standard specifies that
2455 @code{operator new} only returns @code{0} if it is declared
2456 @code{throw()}, in which case the compiler always checks the
2457 return value even without this option. In all other cases, when
2458 @code{operator new} has a non-empty exception specification, memory
2459 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2460 @samp{new (nothrow)}.
2461
2462 @item -fconcepts
2463 @opindex fconcepts
2464 Enable support for the C++ Extensions for Concepts Technical
2465 Specification, ISO 19217 (2015), which allows code like
2466
2467 @smallexample
2468 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2469 template <Addable T> T add (T a, T b) @{ return a + b; @}
2470 @end smallexample
2471
2472 @item -fconstexpr-depth=@var{n}
2473 @opindex fconstexpr-depth
2474 Set the maximum nested evaluation depth for C++11 constexpr functions
2475 to @var{n}. A limit is needed to detect endless recursion during
2476 constant expression evaluation. The minimum specified by the standard
2477 is 512.
2478
2479 @item -fconstexpr-loop-limit=@var{n}
2480 @opindex fconstexpr-loop-limit
2481 Set the maximum number of iterations for a loop in C++14 constexpr functions
2482 to @var{n}. A limit is needed to detect infinite loops during
2483 constant expression evaluation. The default is 262144 (1<<18).
2484
2485 @item -fdeduce-init-list
2486 @opindex fdeduce-init-list
2487 Enable deduction of a template type parameter as
2488 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2489
2490 @smallexample
2491 template <class T> auto forward(T t) -> decltype (realfn (t))
2492 @{
2493 return realfn (t);
2494 @}
2495
2496 void f()
2497 @{
2498 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2499 @}
2500 @end smallexample
2501
2502 This deduction was implemented as a possible extension to the
2503 originally proposed semantics for the C++11 standard, but was not part
2504 of the final standard, so it is disabled by default. This option is
2505 deprecated, and may be removed in a future version of G++.
2506
2507 @item -fno-elide-constructors
2508 @opindex fno-elide-constructors
2509 The C++ standard allows an implementation to omit creating a temporary
2510 that is only used to initialize another object of the same type.
2511 Specifying this option disables that optimization, and forces G++ to
2512 call the copy constructor in all cases. This option also causes G++
2513 to call trivial member functions which otherwise would be expanded inline.
2514
2515 In C++17, the compiler is required to omit these temporaries, but this
2516 option still affects trivial member functions.
2517
2518 @item -fno-enforce-eh-specs
2519 @opindex fno-enforce-eh-specs
2520 Don't generate code to check for violation of exception specifications
2521 at run time. This option violates the C++ standard, but may be useful
2522 for reducing code size in production builds, much like defining
2523 @code{NDEBUG}. This does not give user code permission to throw
2524 exceptions in violation of the exception specifications; the compiler
2525 still optimizes based on the specifications, so throwing an
2526 unexpected exception results in undefined behavior at run time.
2527
2528 @item -fextern-tls-init
2529 @itemx -fno-extern-tls-init
2530 @opindex fextern-tls-init
2531 @opindex fno-extern-tls-init
2532 The C++11 and OpenMP standards allow @code{thread_local} and
2533 @code{threadprivate} variables to have dynamic (runtime)
2534 initialization. To support this, any use of such a variable goes
2535 through a wrapper function that performs any necessary initialization.
2536 When the use and definition of the variable are in the same
2537 translation unit, this overhead can be optimized away, but when the
2538 use is in a different translation unit there is significant overhead
2539 even if the variable doesn't actually need dynamic initialization. If
2540 the programmer can be sure that no use of the variable in a
2541 non-defining TU needs to trigger dynamic initialization (either
2542 because the variable is statically initialized, or a use of the
2543 variable in the defining TU will be executed before any uses in
2544 another TU), they can avoid this overhead with the
2545 @option{-fno-extern-tls-init} option.
2546
2547 On targets that support symbol aliases, the default is
2548 @option{-fextern-tls-init}. On targets that do not support symbol
2549 aliases, the default is @option{-fno-extern-tls-init}.
2550
2551 @item -fno-gnu-keywords
2552 @opindex fno-gnu-keywords
2553 Do not recognize @code{typeof} as a keyword, so that code can use this
2554 word as an identifier. You can use the keyword @code{__typeof__} instead.
2555 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2556 @option{-std=c++98}, @option{-std=c++11}, etc.
2557
2558 @item -fno-implicit-templates
2559 @opindex fno-implicit-templates
2560 Never emit code for non-inline templates that are instantiated
2561 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2562 @xref{Template Instantiation}, for more information.
2563
2564 @item -fno-implicit-inline-templates
2565 @opindex fno-implicit-inline-templates
2566 Don't emit code for implicit instantiations of inline templates, either.
2567 The default is to handle inlines differently so that compiles with and
2568 without optimization need the same set of explicit instantiations.
2569
2570 @item -fno-implement-inlines
2571 @opindex fno-implement-inlines
2572 To save space, do not emit out-of-line copies of inline functions
2573 controlled by @code{#pragma implementation}. This causes linker
2574 errors if these functions are not inlined everywhere they are called.
2575
2576 @item -fms-extensions
2577 @opindex fms-extensions
2578 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2579 int and getting a pointer to member function via non-standard syntax.
2580
2581 @item -fnew-inheriting-ctors
2582 @opindex fnew-inheriting-ctors
2583 Enable the P0136 adjustment to the semantics of C++11 constructor
2584 inheritance. This is part of C++17 but also considered to be a Defect
2585 Report against C++11 and C++14. This flag is enabled by default
2586 unless @option{-fabi-version=10} or lower is specified.
2587
2588 @item -fnew-ttp-matching
2589 @opindex fnew-ttp-matching
2590 Enable the P0522 resolution to Core issue 150, template template
2591 parameters and default arguments: this allows a template with default
2592 template arguments as an argument for a template template parameter
2593 with fewer template parameters. This flag is enabled by default for
2594 @option{-std=c++17}.
2595
2596 @item -fno-nonansi-builtins
2597 @opindex fno-nonansi-builtins
2598 Disable built-in declarations of functions that are not mandated by
2599 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2600 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2601
2602 @item -fnothrow-opt
2603 @opindex fnothrow-opt
2604 Treat a @code{throw()} exception specification as if it were a
2605 @code{noexcept} specification to reduce or eliminate the text size
2606 overhead relative to a function with no exception specification. If
2607 the function has local variables of types with non-trivial
2608 destructors, the exception specification actually makes the
2609 function smaller because the EH cleanups for those variables can be
2610 optimized away. The semantic effect is that an exception thrown out of
2611 a function with such an exception specification results in a call
2612 to @code{terminate} rather than @code{unexpected}.
2613
2614 @item -fno-operator-names
2615 @opindex fno-operator-names
2616 Do not treat the operator name keywords @code{and}, @code{bitand},
2617 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2618 synonyms as keywords.
2619
2620 @item -fno-optional-diags
2621 @opindex fno-optional-diags
2622 Disable diagnostics that the standard says a compiler does not need to
2623 issue. Currently, the only such diagnostic issued by G++ is the one for
2624 a name having multiple meanings within a class.
2625
2626 @item -fpermissive
2627 @opindex fpermissive
2628 Downgrade some diagnostics about nonconformant code from errors to
2629 warnings. Thus, using @option{-fpermissive} allows some
2630 nonconforming code to compile.
2631
2632 @item -fno-pretty-templates
2633 @opindex fno-pretty-templates
2634 When an error message refers to a specialization of a function
2635 template, the compiler normally prints the signature of the
2636 template followed by the template arguments and any typedefs or
2637 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2638 rather than @code{void f(int)}) so that it's clear which template is
2639 involved. When an error message refers to a specialization of a class
2640 template, the compiler omits any template arguments that match
2641 the default template arguments for that template. If either of these
2642 behaviors make it harder to understand the error message rather than
2643 easier, you can use @option{-fno-pretty-templates} to disable them.
2644
2645 @item -frepo
2646 @opindex frepo
2647 Enable automatic template instantiation at link time. This option also
2648 implies @option{-fno-implicit-templates}. @xref{Template
2649 Instantiation}, for more information.
2650
2651 @item -fno-rtti
2652 @opindex fno-rtti
2653 Disable generation of information about every class with virtual
2654 functions for use by the C++ run-time type identification features
2655 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2656 of the language, you can save some space by using this flag. Note that
2657 exception handling uses the same information, but G++ generates it as
2658 needed. The @code{dynamic_cast} operator can still be used for casts that
2659 do not require run-time type information, i.e.@: casts to @code{void *} or to
2660 unambiguous base classes.
2661
2662 @item -fsized-deallocation
2663 @opindex fsized-deallocation
2664 Enable the built-in global declarations
2665 @smallexample
2666 void operator delete (void *, std::size_t) noexcept;
2667 void operator delete[] (void *, std::size_t) noexcept;
2668 @end smallexample
2669 as introduced in C++14. This is useful for user-defined replacement
2670 deallocation functions that, for example, use the size of the object
2671 to make deallocation faster. Enabled by default under
2672 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2673 warns about places that might want to add a definition.
2674
2675 @item -fstrict-enums
2676 @opindex fstrict-enums
2677 Allow the compiler to optimize using the assumption that a value of
2678 enumerated type can only be one of the values of the enumeration (as
2679 defined in the C++ standard; basically, a value that can be
2680 represented in the minimum number of bits needed to represent all the
2681 enumerators). This assumption may not be valid if the program uses a
2682 cast to convert an arbitrary integer value to the enumerated type.
2683
2684 @item -fstrong-eval-order
2685 @opindex fstrong-eval-order
2686 Evaluate member access, array subscripting, and shift expressions in
2687 left-to-right order, and evaluate assignment in right-to-left order,
2688 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2689 @option{-fstrong-eval-order=some} enables just the ordering of member
2690 access and shift expressions, and is the default without
2691 @option{-std=c++17}.
2692
2693 @item -ftemplate-backtrace-limit=@var{n}
2694 @opindex ftemplate-backtrace-limit
2695 Set the maximum number of template instantiation notes for a single
2696 warning or error to @var{n}. The default value is 10.
2697
2698 @item -ftemplate-depth=@var{n}
2699 @opindex ftemplate-depth
2700 Set the maximum instantiation depth for template classes to @var{n}.
2701 A limit on the template instantiation depth is needed to detect
2702 endless recursions during template class instantiation. ANSI/ISO C++
2703 conforming programs must not rely on a maximum depth greater than 17
2704 (changed to 1024 in C++11). The default value is 900, as the compiler
2705 can run out of stack space before hitting 1024 in some situations.
2706
2707 @item -fno-threadsafe-statics
2708 @opindex fno-threadsafe-statics
2709 Do not emit the extra code to use the routines specified in the C++
2710 ABI for thread-safe initialization of local statics. You can use this
2711 option to reduce code size slightly in code that doesn't need to be
2712 thread-safe.
2713
2714 @item -fuse-cxa-atexit
2715 @opindex fuse-cxa-atexit
2716 Register destructors for objects with static storage duration with the
2717 @code{__cxa_atexit} function rather than the @code{atexit} function.
2718 This option is required for fully standards-compliant handling of static
2719 destructors, but only works if your C library supports
2720 @code{__cxa_atexit}.
2721
2722 @item -fno-use-cxa-get-exception-ptr
2723 @opindex fno-use-cxa-get-exception-ptr
2724 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2725 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2726 if the runtime routine is not available.
2727
2728 @item -fvisibility-inlines-hidden
2729 @opindex fvisibility-inlines-hidden
2730 This switch declares that the user does not attempt to compare
2731 pointers to inline functions or methods where the addresses of the two functions
2732 are taken in different shared objects.
2733
2734 The effect of this is that GCC may, effectively, mark inline methods with
2735 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2736 appear in the export table of a DSO and do not require a PLT indirection
2737 when used within the DSO@. Enabling this option can have a dramatic effect
2738 on load and link times of a DSO as it massively reduces the size of the
2739 dynamic export table when the library makes heavy use of templates.
2740
2741 The behavior of this switch is not quite the same as marking the
2742 methods as hidden directly, because it does not affect static variables
2743 local to the function or cause the compiler to deduce that
2744 the function is defined in only one shared object.
2745
2746 You may mark a method as having a visibility explicitly to negate the
2747 effect of the switch for that method. For example, if you do want to
2748 compare pointers to a particular inline method, you might mark it as
2749 having default visibility. Marking the enclosing class with explicit
2750 visibility has no effect.
2751
2752 Explicitly instantiated inline methods are unaffected by this option
2753 as their linkage might otherwise cross a shared library boundary.
2754 @xref{Template Instantiation}.
2755
2756 @item -fvisibility-ms-compat
2757 @opindex fvisibility-ms-compat
2758 This flag attempts to use visibility settings to make GCC's C++
2759 linkage model compatible with that of Microsoft Visual Studio.
2760
2761 The flag makes these changes to GCC's linkage model:
2762
2763 @enumerate
2764 @item
2765 It sets the default visibility to @code{hidden}, like
2766 @option{-fvisibility=hidden}.
2767
2768 @item
2769 Types, but not their members, are not hidden by default.
2770
2771 @item
2772 The One Definition Rule is relaxed for types without explicit
2773 visibility specifications that are defined in more than one
2774 shared object: those declarations are permitted if they are
2775 permitted when this option is not used.
2776 @end enumerate
2777
2778 In new code it is better to use @option{-fvisibility=hidden} and
2779 export those classes that are intended to be externally visible.
2780 Unfortunately it is possible for code to rely, perhaps accidentally,
2781 on the Visual Studio behavior.
2782
2783 Among the consequences of these changes are that static data members
2784 of the same type with the same name but defined in different shared
2785 objects are different, so changing one does not change the other;
2786 and that pointers to function members defined in different shared
2787 objects may not compare equal. When this flag is given, it is a
2788 violation of the ODR to define types with the same name differently.
2789
2790 @item -fno-weak
2791 @opindex fno-weak
2792 Do not use weak symbol support, even if it is provided by the linker.
2793 By default, G++ uses weak symbols if they are available. This
2794 option exists only for testing, and should not be used by end-users;
2795 it results in inferior code and has no benefits. This option may
2796 be removed in a future release of G++.
2797
2798 @item -nostdinc++
2799 @opindex nostdinc++
2800 Do not search for header files in the standard directories specific to
2801 C++, but do still search the other standard directories. (This option
2802 is used when building the C++ library.)
2803 @end table
2804
2805 In addition, these optimization, warning, and code generation options
2806 have meanings only for C++ programs:
2807
2808 @table @gcctabopt
2809 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2810 @opindex Wabi
2811 @opindex Wno-abi
2812 Warn when G++ it generates code that is probably not compatible with
2813 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2814 ABI with each major release, normally @option{-Wabi} will warn only if
2815 there is a check added later in a release series for an ABI issue
2816 discovered since the initial release. @option{-Wabi} will warn about
2817 more things if an older ABI version is selected (with
2818 @option{-fabi-version=@var{n}}).
2819
2820 @option{-Wabi} can also be used with an explicit version number to
2821 warn about compatibility with a particular @option{-fabi-version}
2822 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2823 @option{-fabi-version=2}.
2824
2825 If an explicit version number is provided and
2826 @option{-fabi-compat-version} is not specified, the version number
2827 from this option is used for compatibility aliases. If no explicit
2828 version number is provided with this option, but
2829 @option{-fabi-compat-version} is specified, that version number is
2830 used for ABI warnings.
2831
2832 Although an effort has been made to warn about
2833 all such cases, there are probably some cases that are not warned about,
2834 even though G++ is generating incompatible code. There may also be
2835 cases where warnings are emitted even though the code that is generated
2836 is compatible.
2837
2838 You should rewrite your code to avoid these warnings if you are
2839 concerned about the fact that code generated by G++ may not be binary
2840 compatible with code generated by other compilers.
2841
2842 Known incompatibilities in @option{-fabi-version=2} (which was the
2843 default from GCC 3.4 to 4.9) include:
2844
2845 @itemize @bullet
2846
2847 @item
2848 A template with a non-type template parameter of reference type was
2849 mangled incorrectly:
2850 @smallexample
2851 extern int N;
2852 template <int &> struct S @{@};
2853 void n (S<N>) @{2@}
2854 @end smallexample
2855
2856 This was fixed in @option{-fabi-version=3}.
2857
2858 @item
2859 SIMD vector types declared using @code{__attribute ((vector_size))} were
2860 mangled in a non-standard way that does not allow for overloading of
2861 functions taking vectors of different sizes.
2862
2863 The mangling was changed in @option{-fabi-version=4}.
2864
2865 @item
2866 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2867 qualifiers, and @code{decltype} of a plain declaration was folded away.
2868
2869 These mangling issues were fixed in @option{-fabi-version=5}.
2870
2871 @item
2872 Scoped enumerators passed as arguments to a variadic function are
2873 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2874 On most targets this does not actually affect the parameter passing
2875 ABI, as there is no way to pass an argument smaller than @code{int}.
2876
2877 Also, the ABI changed the mangling of template argument packs,
2878 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2879 a class scope function used as a template argument.
2880
2881 These issues were corrected in @option{-fabi-version=6}.
2882
2883 @item
2884 Lambdas in default argument scope were mangled incorrectly, and the
2885 ABI changed the mangling of @code{nullptr_t}.
2886
2887 These issues were corrected in @option{-fabi-version=7}.
2888
2889 @item
2890 When mangling a function type with function-cv-qualifiers, the
2891 un-qualified function type was incorrectly treated as a substitution
2892 candidate.
2893
2894 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2895
2896 @item
2897 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2898 unaligned accesses. Note that this did not affect the ABI of a
2899 function with a @code{nullptr_t} parameter, as parameters have a
2900 minimum alignment.
2901
2902 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2903
2904 @item
2905 Target-specific attributes that affect the identity of a type, such as
2906 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2907 did not affect the mangled name, leading to name collisions when
2908 function pointers were used as template arguments.
2909
2910 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2911
2912 @end itemize
2913
2914 It also warns about psABI-related changes. The known psABI changes at this
2915 point include:
2916
2917 @itemize @bullet
2918
2919 @item
2920 For SysV/x86-64, unions with @code{long double} members are
2921 passed in memory as specified in psABI. For example:
2922
2923 @smallexample
2924 union U @{
2925 long double ld;
2926 int i;
2927 @};
2928 @end smallexample
2929
2930 @noindent
2931 @code{union U} is always passed in memory.
2932
2933 @end itemize
2934
2935 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2936 @opindex Wabi-tag
2937 @opindex Wabi-tag
2938 Warn when a type with an ABI tag is used in a context that does not
2939 have that ABI tag. See @ref{C++ Attributes} for more information
2940 about ABI tags.
2941
2942 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2943 @opindex Wctor-dtor-privacy
2944 @opindex Wno-ctor-dtor-privacy
2945 Warn when a class seems unusable because all the constructors or
2946 destructors in that class are private, and it has neither friends nor
2947 public static member functions. Also warn if there are no non-private
2948 methods, and there's at least one private member function that isn't
2949 a constructor or destructor.
2950
2951 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2952 @opindex Wdelete-non-virtual-dtor
2953 @opindex Wno-delete-non-virtual-dtor
2954 Warn when @code{delete} is used to destroy an instance of a class that
2955 has virtual functions and non-virtual destructor. It is unsafe to delete
2956 an instance of a derived class through a pointer to a base class if the
2957 base class does not have a virtual destructor. This warning is enabled
2958 by @option{-Wall}.
2959
2960 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2961 @opindex Wdeprecated-copy
2962 @opindex Wno-deprecated-copy
2963 Warn that the implicit declaration of a copy constructor or copy
2964 assignment operator is deprecated if the class has a user-provided
2965 copy constructor, copy assignment operator, or destructor, in C++11
2966 and up. This warning is enabled by @option{-Wall}.
2967
2968 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
2969 @opindex Winit-list-lifetime
2970 @opindex Wno-init-list-lifetime
2971 Do not warn about uses of @code{std::initializer_list} that are likely
2972 to result in dangling pointers. Since the underlying array for an
2973 @code{initializer_list} is handled like a normal C++ temporary object,
2974 it is easy to inadvertently keep a pointer to the array past the end
2975 of the array's lifetime. For example:
2976
2977 @itemize @bullet
2978 @item
2979 If a function returns a temporary @code{initializer_list}, or a local
2980 @code{initializer_list} variable, the array's lifetime ends at the end
2981 of the return statement, so the value returned has a dangling pointer.
2982
2983 @item
2984 If a new-expression creates an @code{initializer_list}, the array only
2985 lives until the end of the enclosing full-expression, so the
2986 @code{initializer_list} in the heap has a dangling pointer.
2987
2988 @item
2989 When an @code{initializer_list} variable is assigned from a
2990 brace-enclosed initializer list, the temporary array created for the
2991 right side of the assignment only lives until the end of the
2992 full-expression, so at the next statement the @code{initializer_list}
2993 variable has a dangling pointer.
2994
2995 @smallexample
2996 // li's initial underlying array lives as long as li
2997 std::initializer_list<int> li = @{ 1,2,3 @};
2998 // assignment changes li to point to a temporary array
2999 li = @{ 4, 5 @};
3000 // now the temporary is gone and li has a dangling pointer
3001 int i = li.begin()[0] // undefined behavior
3002 @end smallexample
3003
3004 @item
3005 When a list constructor stores the @code{begin} pointer from the
3006 @code{initializer_list} argument, this doesn't extend the lifetime of
3007 the array, so if a class variable is constructed from a temporary
3008 @code{initializer_list}, the pointer is left dangling by the end of
3009 the variable declaration statement.
3010
3011 @end itemize
3012
3013 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3014 @opindex Wliteral-suffix
3015 @opindex Wno-literal-suffix
3016 Warn when a string or character literal is followed by a ud-suffix which does
3017 not begin with an underscore. As a conforming extension, GCC treats such
3018 suffixes as separate preprocessing tokens in order to maintain backwards
3019 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3020 For example:
3021
3022 @smallexample
3023 #define __STDC_FORMAT_MACROS
3024 #include <inttypes.h>
3025 #include <stdio.h>
3026
3027 int main() @{
3028 int64_t i64 = 123;
3029 printf("My int64: %" PRId64"\n", i64);
3030 @}
3031 @end smallexample
3032
3033 In this case, @code{PRId64} is treated as a separate preprocessing token.
3034
3035 Additionally, warn when a user-defined literal operator is declared with
3036 a literal suffix identifier that doesn't begin with an underscore. Literal
3037 suffix identifiers that don't begin with an underscore are reserved for
3038 future standardization.
3039
3040 This warning is enabled by default.
3041
3042 @item -Wlto-type-mismatch
3043 @opindex Wlto-type-mismatch
3044 @opindex Wno-lto-type-mismatch
3045
3046 During the link-time optimization warn about type mismatches in
3047 global declarations from different compilation units.
3048 Requires @option{-flto} to be enabled. Enabled by default.
3049
3050 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3051 @opindex Wnarrowing
3052 @opindex Wno-narrowing
3053 For C++11 and later standards, narrowing conversions are diagnosed by default,
3054 as required by the standard. A narrowing conversion from a constant produces
3055 an error, and a narrowing conversion from a non-constant produces a warning,
3056 but @option{-Wno-narrowing} suppresses the diagnostic.
3057 Note that this does not affect the meaning of well-formed code;
3058 narrowing conversions are still considered ill-formed in SFINAE contexts.
3059
3060 With @option{-Wnarrowing} in C++98, warn when a narrowing
3061 conversion prohibited by C++11 occurs within
3062 @samp{@{ @}}, e.g.
3063
3064 @smallexample
3065 int i = @{ 2.2 @}; // error: narrowing from double to int
3066 @end smallexample
3067
3068 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3069
3070 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3071 @opindex Wnoexcept
3072 @opindex Wno-noexcept
3073 Warn when a noexcept-expression evaluates to false because of a call
3074 to a function that does not have a non-throwing exception
3075 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3076 the compiler to never throw an exception.
3077
3078 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3079 @opindex Wnoexcept-type
3080 @opindex Wno-noexcept-type
3081 Warn if the C++17 feature making @code{noexcept} part of a function
3082 type changes the mangled name of a symbol relative to C++14. Enabled
3083 by @option{-Wabi} and @option{-Wc++17-compat}.
3084
3085 As an example:
3086
3087 @smallexample
3088 template <class T> void f(T t) @{ t(); @};
3089 void g() noexcept;
3090 void h() @{ f(g); @}
3091 @end smallexample
3092
3093 @noindent
3094 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3095 C++17 it calls @code{f<void(*)()noexcept>}.
3096
3097 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3098 @opindex Wclass-memaccess
3099 @opindex Wno-class-memaccess
3100 Warn when the destination of a call to a raw memory function such as
3101 @code{memset} or @code{memcpy} is an object of class type, and when writing
3102 into such an object might bypass the class non-trivial or deleted constructor
3103 or copy assignment, violate const-correctness or encapsulation, or corrupt
3104 virtual table pointers. Modifying the representation of such objects may
3105 violate invariants maintained by member functions of the class. For example,
3106 the call to @code{memset} below is undefined because it modifies a non-trivial
3107 class object and is, therefore, diagnosed. The safe way to either initialize
3108 or clear the storage of objects of such types is by using the appropriate
3109 constructor or assignment operator, if one is available.
3110 @smallexample
3111 std::string str = "abc";
3112 memset (&str, 0, sizeof str);
3113 @end smallexample
3114 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3115 Explicitly casting the pointer to the class object to @code{void *} or
3116 to a type that can be safely accessed by the raw memory function suppresses
3117 the warning.
3118
3119 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3120 @opindex Wnon-virtual-dtor
3121 @opindex Wno-non-virtual-dtor
3122 Warn when a class has virtual functions and an accessible non-virtual
3123 destructor itself or in an accessible polymorphic base class, in which
3124 case it is possible but unsafe to delete an instance of a derived
3125 class through a pointer to the class itself or base class. This
3126 warning is automatically enabled if @option{-Weffc++} is specified.
3127
3128 @item -Wregister @r{(C++ and Objective-C++ only)}
3129 @opindex Wregister
3130 @opindex Wno-register
3131 Warn on uses of the @code{register} storage class specifier, except
3132 when it is part of the GNU @ref{Explicit Register Variables} extension.
3133 The use of the @code{register} keyword as storage class specifier has
3134 been deprecated in C++11 and removed in C++17.
3135 Enabled by default with @option{-std=c++17}.
3136
3137 @item -Wreorder @r{(C++ and Objective-C++ only)}
3138 @opindex Wreorder
3139 @opindex Wno-reorder
3140 @cindex reordering, warning
3141 @cindex warning for reordering of member initializers
3142 Warn when the order of member initializers given in the code does not
3143 match the order in which they must be executed. For instance:
3144
3145 @smallexample
3146 struct A @{
3147 int i;
3148 int j;
3149 A(): j (0), i (1) @{ @}
3150 @};
3151 @end smallexample
3152
3153 @noindent
3154 The compiler rearranges the member initializers for @code{i}
3155 and @code{j} to match the declaration order of the members, emitting
3156 a warning to that effect. This warning is enabled by @option{-Wall}.
3157
3158 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3159 @opindex Wpessimizing-move
3160 @opindex Wno-pessimizing-move
3161 This warning warns when a call to @code{std::move} prevents copy
3162 elision. A typical scenario when copy elision can occur is when returning in
3163 a function with a class return type, when the expression being returned is the
3164 name of a non-volatile automatic object, and is not a function parameter, and
3165 has the same type as the function return type.
3166
3167 @smallexample
3168 struct T @{
3169 @dots{}
3170 @};
3171 T fn()
3172 @{
3173 T t;
3174 @dots{}
3175 return std::move (t);
3176 @}
3177 @end smallexample
3178
3179 But in this example, the @code{std::move} call prevents copy elision.
3180
3181 This warning is enabled by @option{-Wall}.
3182
3183 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3184 @opindex Wredundant-move
3185 @opindex Wno-redundant-move
3186 This warning warns about redundant calls to @code{std::move}; that is, when
3187 a move operation would have been performed even without the @code{std::move}
3188 call. This happens because the compiler is forced to treat the object as if
3189 it were an rvalue in certain situations such as returning a local variable,
3190 where copy elision isn't applicable. Consider:
3191
3192 @smallexample
3193 struct T @{
3194 @dots{}
3195 @};
3196 T fn(T t)
3197 @{
3198 @dots{}
3199 return std::move (t);
3200 @}
3201 @end smallexample
3202
3203 Here, the @code{std::move} call is redundant. Because G++ implements Core
3204 Issue 1579, another example is:
3205
3206 @smallexample
3207 struct T @{ // convertible to U
3208 @dots{}
3209 @};
3210 struct U @{
3211 @dots{}
3212 @};
3213 U fn()
3214 @{
3215 T t;
3216 @dots{}
3217 return std::move (t);
3218 @}
3219 @end smallexample
3220 In this example, copy elision isn't applicable because the type of the
3221 expression being returned and the function return type differ, yet G++
3222 treats the return value as if it were designated by an rvalue.
3223
3224 This warning is enabled by @option{-Wextra}.
3225
3226 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3227 @opindex fext-numeric-literals
3228 @opindex fno-ext-numeric-literals
3229 Accept imaginary, fixed-point, or machine-defined
3230 literal number suffixes as GNU extensions.
3231 When this option is turned off these suffixes are treated
3232 as C++11 user-defined literal numeric suffixes.
3233 This is on by default for all pre-C++11 dialects and all GNU dialects:
3234 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3235 @option{-std=gnu++14}.
3236 This option is off by default
3237 for ISO C++11 onwards (@option{-std=c++11}, ...).
3238 @end table
3239
3240 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3241
3242 @table @gcctabopt
3243 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3244 @opindex Weffc++
3245 @opindex Wno-effc++
3246 Warn about violations of the following style guidelines from Scott Meyers'
3247 @cite{Effective C++} series of books:
3248
3249 @itemize @bullet
3250 @item
3251 Define a copy constructor and an assignment operator for classes
3252 with dynamically-allocated memory.
3253
3254 @item
3255 Prefer initialization to assignment in constructors.
3256
3257 @item
3258 Have @code{operator=} return a reference to @code{*this}.
3259
3260 @item
3261 Don't try to return a reference when you must return an object.
3262
3263 @item
3264 Distinguish between prefix and postfix forms of increment and
3265 decrement operators.
3266
3267 @item
3268 Never overload @code{&&}, @code{||}, or @code{,}.
3269
3270 @end itemize
3271
3272 This option also enables @option{-Wnon-virtual-dtor}, which is also
3273 one of the effective C++ recommendations. However, the check is
3274 extended to warn about the lack of virtual destructor in accessible
3275 non-polymorphic bases classes too.
3276
3277 When selecting this option, be aware that the standard library
3278 headers do not obey all of these guidelines; use @samp{grep -v}
3279 to filter out those warnings.
3280
3281 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3282 @opindex Wstrict-null-sentinel
3283 @opindex Wno-strict-null-sentinel
3284 Warn about the use of an uncasted @code{NULL} as sentinel. When
3285 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3286 to @code{__null}. Although it is a null pointer constant rather than a
3287 null pointer, it is guaranteed to be of the same size as a pointer.
3288 But this use is not portable across different compilers.
3289
3290 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3291 @opindex Wno-non-template-friend
3292 @opindex Wnon-template-friend
3293 Disable warnings when non-template friend functions are declared
3294 within a template. In very old versions of GCC that predate implementation
3295 of the ISO standard, declarations such as
3296 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3297 could be interpreted as a particular specialization of a template
3298 function; the warning exists to diagnose compatibility problems,
3299 and is enabled by default.
3300
3301 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3302 @opindex Wold-style-cast
3303 @opindex Wno-old-style-cast
3304 Warn if an old-style (C-style) cast to a non-void type is used within
3305 a C++ program. The new-style casts (@code{dynamic_cast},
3306 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3307 less vulnerable to unintended effects and much easier to search for.
3308
3309 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3310 @opindex Woverloaded-virtual
3311 @opindex Wno-overloaded-virtual
3312 @cindex overloaded virtual function, warning
3313 @cindex warning for overloaded virtual function
3314 Warn when a function declaration hides virtual functions from a
3315 base class. For example, in:
3316
3317 @smallexample
3318 struct A @{
3319 virtual void f();
3320 @};
3321
3322 struct B: public A @{
3323 void f(int);
3324 @};
3325 @end smallexample
3326
3327 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3328 like:
3329
3330 @smallexample
3331 B* b;
3332 b->f();
3333 @end smallexample
3334
3335 @noindent
3336 fails to compile.
3337
3338 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3339 @opindex Wno-pmf-conversions
3340 @opindex Wpmf-conversions
3341 Disable the diagnostic for converting a bound pointer to member function
3342 to a plain pointer.
3343
3344 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3345 @opindex Wsign-promo
3346 @opindex Wno-sign-promo
3347 Warn when overload resolution chooses a promotion from unsigned or
3348 enumerated type to a signed type, over a conversion to an unsigned type of
3349 the same size. Previous versions of G++ tried to preserve
3350 unsignedness, but the standard mandates the current behavior.
3351
3352 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3353 @opindex Wtemplates
3354 @opindex Wno-templates
3355 Warn when a primary template declaration is encountered. Some coding
3356 rules disallow templates, and this may be used to enforce that rule.
3357 The warning is inactive inside a system header file, such as the STL, so
3358 one can still use the STL. One may also instantiate or specialize
3359 templates.
3360
3361 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3362 @opindex Wmultiple-inheritance
3363 @opindex Wno-multiple-inheritance
3364 Warn when a class is defined with multiple direct base classes. Some
3365 coding rules disallow multiple inheritance, and this may be used to
3366 enforce that rule. The warning is inactive inside a system header file,
3367 such as the STL, so one can still use the STL. One may also define
3368 classes that indirectly use multiple inheritance.
3369
3370 @item -Wvirtual-inheritance
3371 @opindex Wvirtual-inheritance
3372 @opindex Wno-virtual-inheritance
3373 Warn when a class is defined with a virtual direct base class. Some
3374 coding rules disallow multiple inheritance, and this may be used to
3375 enforce that rule. The warning is inactive inside a system header file,
3376 such as the STL, so one can still use the STL. One may also define
3377 classes that indirectly use virtual inheritance.
3378
3379 @item -Wnamespaces
3380 @opindex Wnamespaces
3381 @opindex Wno-namespaces
3382 Warn when a namespace definition is opened. Some coding rules disallow
3383 namespaces, and this may be used to enforce that rule. The warning is
3384 inactive inside a system header file, such as the STL, so one can still
3385 use the STL. One may also use using directives and qualified names.
3386
3387 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3388 @opindex Wterminate
3389 @opindex Wno-terminate
3390 Disable the warning about a throw-expression that will immediately
3391 result in a call to @code{terminate}.
3392
3393 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3394 @opindex Wno-class-conversion
3395 @opindex Wclass-conversion
3396 Disable the warning about the case when a conversion function converts an
3397 object to the same type, to a base class of that type, or to void; such
3398 a conversion function will never be called.
3399 @end table
3400
3401 @node Objective-C and Objective-C++ Dialect Options
3402 @section Options Controlling Objective-C and Objective-C++ Dialects
3403
3404 @cindex compiler options, Objective-C and Objective-C++
3405 @cindex Objective-C and Objective-C++ options, command-line
3406 @cindex options, Objective-C and Objective-C++
3407 (NOTE: This manual does not describe the Objective-C and Objective-C++
3408 languages themselves. @xref{Standards,,Language Standards
3409 Supported by GCC}, for references.)
3410
3411 This section describes the command-line options that are only meaningful
3412 for Objective-C and Objective-C++ programs. You can also use most of
3413 the language-independent GNU compiler options.
3414 For example, you might compile a file @file{some_class.m} like this:
3415
3416 @smallexample
3417 gcc -g -fgnu-runtime -O -c some_class.m
3418 @end smallexample
3419
3420 @noindent
3421 In this example, @option{-fgnu-runtime} is an option meant only for
3422 Objective-C and Objective-C++ programs; you can use the other options with
3423 any language supported by GCC@.
3424
3425 Note that since Objective-C is an extension of the C language, Objective-C
3426 compilations may also use options specific to the C front-end (e.g.,
3427 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3428 C++-specific options (e.g., @option{-Wabi}).
3429
3430 Here is a list of options that are @emph{only} for compiling Objective-C
3431 and Objective-C++ programs:
3432
3433 @table @gcctabopt
3434 @item -fconstant-string-class=@var{class-name}
3435 @opindex fconstant-string-class
3436 Use @var{class-name} as the name of the class to instantiate for each
3437 literal string specified with the syntax @code{@@"@dots{}"}. The default
3438 class name is @code{NXConstantString} if the GNU runtime is being used, and
3439 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3440 @option{-fconstant-cfstrings} option, if also present, overrides the
3441 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3442 to be laid out as constant CoreFoundation strings.
3443
3444 @item -fgnu-runtime
3445 @opindex fgnu-runtime
3446 Generate object code compatible with the standard GNU Objective-C
3447 runtime. This is the default for most types of systems.
3448
3449 @item -fnext-runtime
3450 @opindex fnext-runtime
3451 Generate output compatible with the NeXT runtime. This is the default
3452 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3453 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3454 used.
3455
3456 @item -fno-nil-receivers
3457 @opindex fno-nil-receivers
3458 Assume that all Objective-C message dispatches (@code{[receiver
3459 message:arg]}) in this translation unit ensure that the receiver is
3460 not @code{nil}. This allows for more efficient entry points in the
3461 runtime to be used. This option is only available in conjunction with
3462 the NeXT runtime and ABI version 0 or 1.
3463
3464 @item -fobjc-abi-version=@var{n}
3465 @opindex fobjc-abi-version
3466 Use version @var{n} of the Objective-C ABI for the selected runtime.
3467 This option is currently supported only for the NeXT runtime. In that
3468 case, Version 0 is the traditional (32-bit) ABI without support for
3469 properties and other Objective-C 2.0 additions. Version 1 is the
3470 traditional (32-bit) ABI with support for properties and other
3471 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3472 nothing is specified, the default is Version 0 on 32-bit target
3473 machines, and Version 2 on 64-bit target machines.
3474
3475 @item -fobjc-call-cxx-cdtors
3476 @opindex fobjc-call-cxx-cdtors
3477 For each Objective-C class, check if any of its instance variables is a
3478 C++ object with a non-trivial default constructor. If so, synthesize a
3479 special @code{- (id) .cxx_construct} instance method which runs
3480 non-trivial default constructors on any such instance variables, in order,
3481 and then return @code{self}. Similarly, check if any instance variable
3482 is a C++ object with a non-trivial destructor, and if so, synthesize a
3483 special @code{- (void) .cxx_destruct} method which runs
3484 all such default destructors, in reverse order.
3485
3486 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3487 methods thusly generated only operate on instance variables
3488 declared in the current Objective-C class, and not those inherited
3489 from superclasses. It is the responsibility of the Objective-C
3490 runtime to invoke all such methods in an object's inheritance
3491 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3492 by the runtime immediately after a new object instance is allocated;
3493 the @code{- (void) .cxx_destruct} methods are invoked immediately
3494 before the runtime deallocates an object instance.
3495
3496 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3497 support for invoking the @code{- (id) .cxx_construct} and
3498 @code{- (void) .cxx_destruct} methods.
3499
3500 @item -fobjc-direct-dispatch
3501 @opindex fobjc-direct-dispatch
3502 Allow fast jumps to the message dispatcher. On Darwin this is
3503 accomplished via the comm page.
3504
3505 @item -fobjc-exceptions
3506 @opindex fobjc-exceptions
3507 Enable syntactic support for structured exception handling in
3508 Objective-C, similar to what is offered by C++. This option
3509 is required to use the Objective-C keywords @code{@@try},
3510 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3511 @code{@@synchronized}. This option is available with both the GNU
3512 runtime and the NeXT runtime (but not available in conjunction with
3513 the NeXT runtime on Mac OS X 10.2 and earlier).
3514
3515 @item -fobjc-gc
3516 @opindex fobjc-gc
3517 Enable garbage collection (GC) in Objective-C and Objective-C++
3518 programs. This option is only available with the NeXT runtime; the
3519 GNU runtime has a different garbage collection implementation that
3520 does not require special compiler flags.
3521
3522 @item -fobjc-nilcheck
3523 @opindex fobjc-nilcheck
3524 For the NeXT runtime with version 2 of the ABI, check for a nil
3525 receiver in method invocations before doing the actual method call.
3526 This is the default and can be disabled using
3527 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3528 checked for nil in this way no matter what this flag is set to.
3529 Currently this flag does nothing when the GNU runtime, or an older
3530 version of the NeXT runtime ABI, is used.
3531
3532 @item -fobjc-std=objc1
3533 @opindex fobjc-std
3534 Conform to the language syntax of Objective-C 1.0, the language
3535 recognized by GCC 4.0. This only affects the Objective-C additions to
3536 the C/C++ language; it does not affect conformance to C/C++ standards,
3537 which is controlled by the separate C/C++ dialect option flags. When
3538 this option is used with the Objective-C or Objective-C++ compiler,
3539 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3540 This is useful if you need to make sure that your Objective-C code can
3541 be compiled with older versions of GCC@.
3542
3543 @item -freplace-objc-classes
3544 @opindex freplace-objc-classes
3545 Emit a special marker instructing @command{ld(1)} not to statically link in
3546 the resulting object file, and allow @command{dyld(1)} to load it in at
3547 run time instead. This is used in conjunction with the Fix-and-Continue
3548 debugging mode, where the object file in question may be recompiled and
3549 dynamically reloaded in the course of program execution, without the need
3550 to restart the program itself. Currently, Fix-and-Continue functionality
3551 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3552 and later.
3553
3554 @item -fzero-link
3555 @opindex fzero-link
3556 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3557 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3558 compile time) with static class references that get initialized at load time,
3559 which improves run-time performance. Specifying the @option{-fzero-link} flag
3560 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3561 to be retained. This is useful in Zero-Link debugging mode, since it allows
3562 for individual class implementations to be modified during program execution.
3563 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3564 regardless of command-line options.
3565
3566 @item -fno-local-ivars
3567 @opindex fno-local-ivars
3568 @opindex flocal-ivars
3569 By default instance variables in Objective-C can be accessed as if
3570 they were local variables from within the methods of the class they're
3571 declared in. This can lead to shadowing between instance variables
3572 and other variables declared either locally inside a class method or
3573 globally with the same name. Specifying the @option{-fno-local-ivars}
3574 flag disables this behavior thus avoiding variable shadowing issues.
3575
3576 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3577 @opindex fivar-visibility
3578 Set the default instance variable visibility to the specified option
3579 so that instance variables declared outside the scope of any access
3580 modifier directives default to the specified visibility.
3581
3582 @item -gen-decls
3583 @opindex gen-decls
3584 Dump interface declarations for all classes seen in the source file to a
3585 file named @file{@var{sourcename}.decl}.
3586
3587 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3588 @opindex Wassign-intercept
3589 @opindex Wno-assign-intercept
3590 Warn whenever an Objective-C assignment is being intercepted by the
3591 garbage collector.
3592
3593 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3594 @opindex Wno-protocol
3595 @opindex Wprotocol
3596 If a class is declared to implement a protocol, a warning is issued for
3597 every method in the protocol that is not implemented by the class. The
3598 default behavior is to issue a warning for every method not explicitly
3599 implemented in the class, even if a method implementation is inherited
3600 from the superclass. If you use the @option{-Wno-protocol} option, then
3601 methods inherited from the superclass are considered to be implemented,
3602 and no warning is issued for them.
3603
3604 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3605 @opindex Wselector
3606 @opindex Wno-selector
3607 Warn if multiple methods of different types for the same selector are
3608 found during compilation. The check is performed on the list of methods
3609 in the final stage of compilation. Additionally, a check is performed
3610 for each selector appearing in a @code{@@selector(@dots{})}
3611 expression, and a corresponding method for that selector has been found
3612 during compilation. Because these checks scan the method table only at
3613 the end of compilation, these warnings are not produced if the final
3614 stage of compilation is not reached, for example because an error is
3615 found during compilation, or because the @option{-fsyntax-only} option is
3616 being used.
3617
3618 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3619 @opindex Wstrict-selector-match
3620 @opindex Wno-strict-selector-match
3621 Warn if multiple methods with differing argument and/or return types are
3622 found for a given selector when attempting to send a message using this
3623 selector to a receiver of type @code{id} or @code{Class}. When this flag
3624 is off (which is the default behavior), the compiler omits such warnings
3625 if any differences found are confined to types that share the same size
3626 and alignment.
3627
3628 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3629 @opindex Wundeclared-selector
3630 @opindex Wno-undeclared-selector
3631 Warn if a @code{@@selector(@dots{})} expression referring to an
3632 undeclared selector is found. A selector is considered undeclared if no
3633 method with that name has been declared before the
3634 @code{@@selector(@dots{})} expression, either explicitly in an
3635 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3636 an @code{@@implementation} section. This option always performs its
3637 checks as soon as a @code{@@selector(@dots{})} expression is found,
3638 while @option{-Wselector} only performs its checks in the final stage of
3639 compilation. This also enforces the coding style convention
3640 that methods and selectors must be declared before being used.
3641
3642 @item -print-objc-runtime-info
3643 @opindex print-objc-runtime-info
3644 Generate C header describing the largest structure that is passed by
3645 value, if any.
3646
3647 @end table
3648
3649 @node Diagnostic Message Formatting Options
3650 @section Options to Control Diagnostic Messages Formatting
3651 @cindex options to control diagnostics formatting
3652 @cindex diagnostic messages
3653 @cindex message formatting
3654
3655 Traditionally, diagnostic messages have been formatted irrespective of
3656 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3657 options described below
3658 to control the formatting algorithm for diagnostic messages,
3659 e.g.@: how many characters per line, how often source location
3660 information should be reported. Note that some language front ends may not
3661 honor these options.
3662
3663 @table @gcctabopt
3664 @item -fmessage-length=@var{n}
3665 @opindex fmessage-length
3666 Try to format error messages so that they fit on lines of about
3667 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3668 done; each error message appears on a single line. This is the
3669 default for all front ends.
3670
3671 Note - this option also affects the display of the @samp{#error} and
3672 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3673 function/type/variable attribute. It does not however affect the
3674 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3675
3676 @item -fdiagnostics-show-location=once
3677 @opindex fdiagnostics-show-location
3678 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3679 reporter to emit source location information @emph{once}; that is, in
3680 case the message is too long to fit on a single physical line and has to
3681 be wrapped, the source location won't be emitted (as prefix) again,
3682 over and over, in subsequent continuation lines. This is the default
3683 behavior.
3684
3685 @item -fdiagnostics-show-location=every-line
3686 Only meaningful in line-wrapping mode. Instructs the diagnostic
3687 messages reporter to emit the same source location information (as
3688 prefix) for physical lines that result from the process of breaking
3689 a message which is too long to fit on a single line.
3690
3691 @item -fdiagnostics-color[=@var{WHEN}]
3692 @itemx -fno-diagnostics-color
3693 @opindex fdiagnostics-color
3694 @cindex highlight, color
3695 @vindex GCC_COLORS @r{environment variable}
3696 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3697 or @samp{auto}. The default depends on how the compiler has been configured,
3698 it can be any of the above @var{WHEN} options or also @samp{never}
3699 if @env{GCC_COLORS} environment variable isn't present in the environment,
3700 and @samp{auto} otherwise.
3701 @samp{auto} means to use color only when the standard error is a terminal.
3702 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3703 aliases for @option{-fdiagnostics-color=always} and
3704 @option{-fdiagnostics-color=never}, respectively.
3705
3706 The colors are defined by the environment variable @env{GCC_COLORS}.
3707 Its value is a colon-separated list of capabilities and Select Graphic
3708 Rendition (SGR) substrings. SGR commands are interpreted by the
3709 terminal or terminal emulator. (See the section in the documentation
3710 of your text terminal for permitted values and their meanings as
3711 character attributes.) These substring values are integers in decimal
3712 representation and can be concatenated with semicolons.
3713 Common values to concatenate include
3714 @samp{1} for bold,
3715 @samp{4} for underline,
3716 @samp{5} for blink,
3717 @samp{7} for inverse,
3718 @samp{39} for default foreground color,
3719 @samp{30} to @samp{37} for foreground colors,
3720 @samp{90} to @samp{97} for 16-color mode foreground colors,
3721 @samp{38;5;0} to @samp{38;5;255}
3722 for 88-color and 256-color modes foreground colors,
3723 @samp{49} for default background color,
3724 @samp{40} to @samp{47} for background colors,
3725 @samp{100} to @samp{107} for 16-color mode background colors,
3726 and @samp{48;5;0} to @samp{48;5;255}
3727 for 88-color and 256-color modes background colors.
3728
3729 The default @env{GCC_COLORS} is
3730 @smallexample
3731 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3732 quote=01:fixit-insert=32:fixit-delete=31:\
3733 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3734 type-diff=01;32
3735 @end smallexample
3736 @noindent
3737 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3738 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3739 @samp{01} is bold, and @samp{31} is red.
3740 Setting @env{GCC_COLORS} to the empty string disables colors.
3741 Supported capabilities are as follows.
3742
3743 @table @code
3744 @item error=
3745 @vindex error GCC_COLORS @r{capability}
3746 SGR substring for error: markers.
3747
3748 @item warning=
3749 @vindex warning GCC_COLORS @r{capability}
3750 SGR substring for warning: markers.
3751
3752 @item note=
3753 @vindex note GCC_COLORS @r{capability}
3754 SGR substring for note: markers.
3755
3756 @item range1=
3757 @vindex range1 GCC_COLORS @r{capability}
3758 SGR substring for first additional range.
3759
3760 @item range2=
3761 @vindex range2 GCC_COLORS @r{capability}
3762 SGR substring for second additional range.
3763
3764 @item locus=
3765 @vindex locus GCC_COLORS @r{capability}
3766 SGR substring for location information, @samp{file:line} or
3767 @samp{file:line:column} etc.
3768
3769 @item quote=
3770 @vindex quote GCC_COLORS @r{capability}
3771 SGR substring for information printed within quotes.
3772
3773 @item fixit-insert=
3774 @vindex fixit-insert GCC_COLORS @r{capability}
3775 SGR substring for fix-it hints suggesting text to
3776 be inserted or replaced.
3777
3778 @item fixit-delete=
3779 @vindex fixit-delete GCC_COLORS @r{capability}
3780 SGR substring for fix-it hints suggesting text to
3781 be deleted.
3782
3783 @item diff-filename=
3784 @vindex diff-filename GCC_COLORS @r{capability}
3785 SGR substring for filename headers within generated patches.
3786
3787 @item diff-hunk=
3788 @vindex diff-hunk GCC_COLORS @r{capability}
3789 SGR substring for the starts of hunks within generated patches.
3790
3791 @item diff-delete=
3792 @vindex diff-delete GCC_COLORS @r{capability}
3793 SGR substring for deleted lines within generated patches.
3794
3795 @item diff-insert=
3796 @vindex diff-insert GCC_COLORS @r{capability}
3797 SGR substring for inserted lines within generated patches.
3798
3799 @item type-diff=
3800 @vindex type-diff GCC_COLORS @r{capability}
3801 SGR substring for highlighting mismatching types within template
3802 arguments in the C++ frontend.
3803 @end table
3804
3805 @item -fno-diagnostics-show-option
3806 @opindex fno-diagnostics-show-option
3807 @opindex fdiagnostics-show-option
3808 By default, each diagnostic emitted includes text indicating the
3809 command-line option that directly controls the diagnostic (if such an
3810 option is known to the diagnostic machinery). Specifying the
3811 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3812
3813 @item -fno-diagnostics-show-caret
3814 @opindex fno-diagnostics-show-caret
3815 @opindex fdiagnostics-show-caret
3816 By default, each diagnostic emitted includes the original source line
3817 and a caret @samp{^} indicating the column. This option suppresses this
3818 information. The source line is truncated to @var{n} characters, if
3819 the @option{-fmessage-length=n} option is given. When the output is done
3820 to the terminal, the width is limited to the width given by the
3821 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3822
3823 @item -fno-diagnostics-show-labels
3824 @opindex fno-diagnostics-show-labels
3825 @opindex fdiagnostics-show-labels
3826 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3827 diagnostics can label ranges of source code with pertinent information, such
3828 as the types of expressions:
3829
3830 @smallexample
3831 printf ("foo %s bar", long_i + long_j);
3832 ~^ ~~~~~~~~~~~~~~~
3833 | |
3834 char * long int
3835 @end smallexample
3836
3837 This option suppresses the printing of these labels (in the example above,
3838 the vertical bars and the ``char *'' and ``long int'' text).
3839
3840 @item -fno-diagnostics-show-line-numbers
3841 @opindex fno-diagnostics-show-line-numbers
3842 @opindex fdiagnostics-show-line-numbers
3843 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3844 a left margin is printed, showing line numbers. This option suppresses this
3845 left margin.
3846
3847 @item -fdiagnostics-minimum-margin-width=@var{width}
3848 @opindex fdiagnostics-minimum-margin-width
3849 This option controls the minimum width of the left margin printed by
3850 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3851
3852 @item -fdiagnostics-parseable-fixits
3853 @opindex fdiagnostics-parseable-fixits
3854 Emit fix-it hints in a machine-parseable format, suitable for consumption
3855 by IDEs. For each fix-it, a line will be printed after the relevant
3856 diagnostic, starting with the string ``fix-it:''. For example:
3857
3858 @smallexample
3859 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3860 @end smallexample
3861
3862 The location is expressed as a half-open range, expressed as a count of
3863 bytes, starting at byte 1 for the initial column. In the above example,
3864 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3865 given string:
3866
3867 @smallexample
3868 00000000011111111112222222222
3869 12345678901234567890123456789
3870 gtk_widget_showall (dlg);
3871 ^^^^^^^^^^^^^^^^^^
3872 gtk_widget_show_all
3873 @end smallexample
3874
3875 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3876 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3877 (e.g. vertical tab as ``\013'').
3878
3879 An empty replacement string indicates that the given range is to be removed.
3880 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3881 be inserted at the given position.
3882
3883 @item -fdiagnostics-generate-patch
3884 @opindex fdiagnostics-generate-patch
3885 Print fix-it hints to stderr in unified diff format, after any diagnostics
3886 are printed. For example:
3887
3888 @smallexample
3889 --- test.c
3890 +++ test.c
3891 @@ -42,5 +42,5 @@
3892
3893 void show_cb(GtkDialog *dlg)
3894 @{
3895 - gtk_widget_showall(dlg);
3896 + gtk_widget_show_all(dlg);
3897 @}
3898
3899 @end smallexample
3900
3901 The diff may or may not be colorized, following the same rules
3902 as for diagnostics (see @option{-fdiagnostics-color}).
3903
3904 @item -fdiagnostics-show-template-tree
3905 @opindex fdiagnostics-show-template-tree
3906
3907 In the C++ frontend, when printing diagnostics showing mismatching
3908 template types, such as:
3909
3910 @smallexample
3911 could not convert 'std::map<int, std::vector<double> >()'
3912 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3913 @end smallexample
3914
3915 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3916 tree-like structure showing the common and differing parts of the types,
3917 such as:
3918
3919 @smallexample
3920 map<
3921 [...],
3922 vector<
3923 [double != float]>>
3924 @end smallexample
3925
3926 The parts that differ are highlighted with color (``double'' and
3927 ``float'' in this case).
3928
3929 @item -fno-elide-type
3930 @opindex fno-elide-type
3931 @opindex felide-type
3932 By default when the C++ frontend prints diagnostics showing mismatching
3933 template types, common parts of the types are printed as ``[...]'' to
3934 simplify the error message. For example:
3935
3936 @smallexample
3937 could not convert 'std::map<int, std::vector<double> >()'
3938 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3939 @end smallexample
3940
3941 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3942 This flag also affects the output of the
3943 @option{-fdiagnostics-show-template-tree} flag.
3944
3945 @item -fno-show-column
3946 @opindex fno-show-column
3947 Do not print column numbers in diagnostics. This may be necessary if
3948 diagnostics are being scanned by a program that does not understand the
3949 column numbers, such as @command{dejagnu}.
3950
3951 @end table
3952
3953 @node Warning Options
3954 @section Options to Request or Suppress Warnings
3955 @cindex options to control warnings
3956 @cindex warning messages
3957 @cindex messages, warning
3958 @cindex suppressing warnings
3959
3960 Warnings are diagnostic messages that report constructions that
3961 are not inherently erroneous but that are risky or suggest there
3962 may have been an error.
3963
3964 The following language-independent options do not enable specific
3965 warnings but control the kinds of diagnostics produced by GCC@.
3966
3967 @table @gcctabopt
3968 @cindex syntax checking
3969 @item -fsyntax-only
3970 @opindex fsyntax-only
3971 Check the code for syntax errors, but don't do anything beyond that.
3972
3973 @item -fmax-errors=@var{n}
3974 @opindex fmax-errors
3975 Limits the maximum number of error messages to @var{n}, at which point
3976 GCC bails out rather than attempting to continue processing the source
3977 code. If @var{n} is 0 (the default), there is no limit on the number
3978 of error messages produced. If @option{-Wfatal-errors} is also
3979 specified, then @option{-Wfatal-errors} takes precedence over this
3980 option.
3981
3982 @item -w
3983 @opindex w
3984 Inhibit all warning messages.
3985
3986 @item -Werror
3987 @opindex Werror
3988 @opindex Wno-error
3989 Make all warnings into errors.
3990
3991 @item -Werror=
3992 @opindex Werror=
3993 @opindex Wno-error=
3994 Make the specified warning into an error. The specifier for a warning
3995 is appended; for example @option{-Werror=switch} turns the warnings
3996 controlled by @option{-Wswitch} into errors. This switch takes a
3997 negative form, to be used to negate @option{-Werror} for specific
3998 warnings; for example @option{-Wno-error=switch} makes
3999 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4000 is in effect.
4001
4002 The warning message for each controllable warning includes the
4003 option that controls the warning. That option can then be used with
4004 @option{-Werror=} and @option{-Wno-error=} as described above.
4005 (Printing of the option in the warning message can be disabled using the
4006 @option{-fno-diagnostics-show-option} flag.)
4007
4008 Note that specifying @option{-Werror=}@var{foo} automatically implies
4009 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4010 imply anything.
4011
4012 @item -Wfatal-errors
4013 @opindex Wfatal-errors
4014 @opindex Wno-fatal-errors
4015 This option causes the compiler to abort compilation on the first error
4016 occurred rather than trying to keep going and printing further error
4017 messages.
4018
4019 @end table
4020
4021 You can request many specific warnings with options beginning with
4022 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4023 implicit declarations. Each of these specific warning options also
4024 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4025 example, @option{-Wno-implicit}. This manual lists only one of the
4026 two forms, whichever is not the default. For further
4027 language-specific options also refer to @ref{C++ Dialect Options} and
4028 @ref{Objective-C and Objective-C++ Dialect Options}.
4029
4030 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4031 options, such as @option{-Wunused}, which may turn on further options,
4032 such as @option{-Wunused-value}. The combined effect of positive and
4033 negative forms is that more specific options have priority over less
4034 specific ones, independently of their position in the command-line. For
4035 options of the same specificity, the last one takes effect. Options
4036 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4037 as if they appeared at the end of the command-line.
4038
4039 When an unrecognized warning option is requested (e.g.,
4040 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4041 that the option is not recognized. However, if the @option{-Wno-} form
4042 is used, the behavior is slightly different: no diagnostic is
4043 produced for @option{-Wno-unknown-warning} unless other diagnostics
4044 are being produced. This allows the use of new @option{-Wno-} options
4045 with old compilers, but if something goes wrong, the compiler
4046 warns that an unrecognized option is present.
4047
4048 @table @gcctabopt
4049 @item -Wpedantic
4050 @itemx -pedantic
4051 @opindex pedantic
4052 @opindex Wpedantic
4053 @opindex Wno-pedantic
4054 Issue all the warnings demanded by strict ISO C and ISO C++;
4055 reject all programs that use forbidden extensions, and some other
4056 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4057 version of the ISO C standard specified by any @option{-std} option used.
4058
4059 Valid ISO C and ISO C++ programs should compile properly with or without
4060 this option (though a rare few require @option{-ansi} or a
4061 @option{-std} option specifying the required version of ISO C)@. However,
4062 without this option, certain GNU extensions and traditional C and C++
4063 features are supported as well. With this option, they are rejected.
4064
4065 @option{-Wpedantic} does not cause warning messages for use of the
4066 alternate keywords whose names begin and end with @samp{__}. Pedantic
4067 warnings are also disabled in the expression that follows
4068 @code{__extension__}. However, only system header files should use
4069 these escape routes; application programs should avoid them.
4070 @xref{Alternate Keywords}.
4071
4072 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4073 C conformance. They soon find that it does not do quite what they want:
4074 it finds some non-ISO practices, but not all---only those for which
4075 ISO C @emph{requires} a diagnostic, and some others for which
4076 diagnostics have been added.
4077
4078 A feature to report any failure to conform to ISO C might be useful in
4079 some instances, but would require considerable additional work and would
4080 be quite different from @option{-Wpedantic}. We don't have plans to
4081 support such a feature in the near future.
4082
4083 Where the standard specified with @option{-std} represents a GNU
4084 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4085 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4086 extended dialect is based. Warnings from @option{-Wpedantic} are given
4087 where they are required by the base standard. (It does not make sense
4088 for such warnings to be given only for features not in the specified GNU
4089 C dialect, since by definition the GNU dialects of C include all
4090 features the compiler supports with the given option, and there would be
4091 nothing to warn about.)
4092
4093 @item -pedantic-errors
4094 @opindex pedantic-errors
4095 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4096 requires a diagnostic, in some cases where there is undefined behavior
4097 at compile-time and in some other cases that do not prevent compilation
4098 of programs that are valid according to the standard. This is not
4099 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4100 by this option and not enabled by the latter and vice versa.
4101
4102 @item -Wall
4103 @opindex Wall
4104 @opindex Wno-all
4105 This enables all the warnings about constructions that some users
4106 consider questionable, and that are easy to avoid (or modify to
4107 prevent the warning), even in conjunction with macros. This also
4108 enables some language-specific warnings described in @ref{C++ Dialect
4109 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4110
4111 @option{-Wall} turns on the following warning flags:
4112
4113 @gccoptlist{-Waddress @gol
4114 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4115 -Wbool-compare @gol
4116 -Wbool-operation @gol
4117 -Wc++11-compat -Wc++14-compat @gol
4118 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4119 -Wchar-subscripts @gol
4120 -Wcomment @gol
4121 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4122 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4123 -Wformat @gol
4124 -Wint-in-bool-context @gol
4125 -Wimplicit @r{(C and Objective-C only)} @gol
4126 -Wimplicit-int @r{(C and Objective-C only)} @gol
4127 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4128 -Winit-self @r{(only for C++)} @gol
4129 -Wlogical-not-parentheses @gol
4130 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4131 -Wmaybe-uninitialized @gol
4132 -Wmemset-elt-size @gol
4133 -Wmemset-transposed-args @gol
4134 -Wmisleading-indentation @r{(only for C/C++)} @gol
4135 -Wmissing-attributes @gol
4136 -Wmissing-braces @r{(only for C/ObjC)} @gol
4137 -Wmultistatement-macros @gol
4138 -Wnarrowing @r{(only for C++)} @gol
4139 -Wnonnull @gol
4140 -Wnonnull-compare @gol
4141 -Wopenmp-simd @gol
4142 -Wparentheses @gol
4143 -Wpessimizing-move @r{(only for C++)} @gol
4144 -Wpointer-sign @gol
4145 -Wreorder @gol
4146 -Wrestrict @gol
4147 -Wreturn-type @gol
4148 -Wsequence-point @gol
4149 -Wsign-compare @r{(only in C++)} @gol
4150 -Wsizeof-pointer-div @gol
4151 -Wsizeof-pointer-memaccess @gol
4152 -Wstrict-aliasing @gol
4153 -Wstrict-overflow=1 @gol
4154 -Wswitch @gol
4155 -Wtautological-compare @gol
4156 -Wtrigraphs @gol
4157 -Wuninitialized @gol
4158 -Wunknown-pragmas @gol
4159 -Wunused-function @gol
4160 -Wunused-label @gol
4161 -Wunused-value @gol
4162 -Wunused-variable @gol
4163 -Wvolatile-register-var @gol
4164 }
4165
4166 Note that some warning flags are not implied by @option{-Wall}. Some of
4167 them warn about constructions that users generally do not consider
4168 questionable, but which occasionally you might wish to check for;
4169 others warn about constructions that are necessary or hard to avoid in
4170 some cases, and there is no simple way to modify the code to suppress
4171 the warning. Some of them are enabled by @option{-Wextra} but many of
4172 them must be enabled individually.
4173
4174 @item -Wextra
4175 @opindex W
4176 @opindex Wextra
4177 @opindex Wno-extra
4178 This enables some extra warning flags that are not enabled by
4179 @option{-Wall}. (This option used to be called @option{-W}. The older
4180 name is still supported, but the newer name is more descriptive.)
4181
4182 @gccoptlist{-Wclobbered @gol
4183 -Wcast-function-type @gol
4184 -Wempty-body @gol
4185 -Wignored-qualifiers @gol
4186 -Wimplicit-fallthrough=3 @gol
4187 -Wmissing-field-initializers @gol
4188 -Wmissing-parameter-type @r{(C only)} @gol
4189 -Wold-style-declaration @r{(C only)} @gol
4190 -Woverride-init @gol
4191 -Wsign-compare @r{(C only)} @gol
4192 -Wredundant-move @r{(only for C++)} @gol
4193 -Wtype-limits @gol
4194 -Wuninitialized @gol
4195 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4196 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4197 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4198 }
4199
4200 The option @option{-Wextra} also prints warning messages for the
4201 following cases:
4202
4203 @itemize @bullet
4204
4205 @item
4206 A pointer is compared against integer zero with @code{<}, @code{<=},
4207 @code{>}, or @code{>=}.
4208
4209 @item
4210 (C++ only) An enumerator and a non-enumerator both appear in a
4211 conditional expression.
4212
4213 @item
4214 (C++ only) Ambiguous virtual bases.
4215
4216 @item
4217 (C++ only) Subscripting an array that has been declared @code{register}.
4218
4219 @item
4220 (C++ only) Taking the address of a variable that has been declared
4221 @code{register}.
4222
4223 @item
4224 (C++ only) A base class is not initialized in the copy constructor
4225 of a derived class.
4226
4227 @end itemize
4228
4229 @item -Wchar-subscripts
4230 @opindex Wchar-subscripts
4231 @opindex Wno-char-subscripts
4232 Warn if an array subscript has type @code{char}. This is a common cause
4233 of error, as programmers often forget that this type is signed on some
4234 machines.
4235 This warning is enabled by @option{-Wall}.
4236
4237 @item -Wchkp
4238 @opindex Wchkp
4239 @opindex Wno-chkp
4240 Warn about an invalid memory access that is found by Pointer Bounds Checker
4241 (@option{-fcheck-pointer-bounds}).
4242
4243 @item -Wno-coverage-mismatch
4244 @opindex Wno-coverage-mismatch
4245 @opindex Wcoverage-mismatch
4246 Warn if feedback profiles do not match when using the
4247 @option{-fprofile-use} option.
4248 If a source file is changed between compiling with @option{-fprofile-generate}
4249 and with @option{-fprofile-use}, the files with the profile feedback can fail
4250 to match the source file and GCC cannot use the profile feedback
4251 information. By default, this warning is enabled and is treated as an
4252 error. @option{-Wno-coverage-mismatch} can be used to disable the
4253 warning or @option{-Wno-error=coverage-mismatch} can be used to
4254 disable the error. Disabling the error for this warning can result in
4255 poorly optimized code and is useful only in the
4256 case of very minor changes such as bug fixes to an existing code-base.
4257 Completely disabling the warning is not recommended.
4258
4259 @item -Wno-cpp
4260 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4261
4262 Suppress warning messages emitted by @code{#warning} directives.
4263
4264 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4265 @opindex Wdouble-promotion
4266 @opindex Wno-double-promotion
4267 Give a warning when a value of type @code{float} is implicitly
4268 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4269 floating-point unit implement @code{float} in hardware, but emulate
4270 @code{double} in software. On such a machine, doing computations
4271 using @code{double} values is much more expensive because of the
4272 overhead required for software emulation.
4273
4274 It is easy to accidentally do computations with @code{double} because
4275 floating-point literals are implicitly of type @code{double}. For
4276 example, in:
4277 @smallexample
4278 @group
4279 float area(float radius)
4280 @{
4281 return 3.14159 * radius * radius;
4282 @}
4283 @end group
4284 @end smallexample
4285 the compiler performs the entire computation with @code{double}
4286 because the floating-point literal is a @code{double}.
4287
4288 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4289 @opindex Wduplicate-decl-specifier
4290 @opindex Wno-duplicate-decl-specifier
4291 Warn if a declaration has duplicate @code{const}, @code{volatile},
4292 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4293 @option{-Wall}.
4294
4295 @item -Wformat
4296 @itemx -Wformat=@var{n}
4297 @opindex Wformat
4298 @opindex Wno-format
4299 @opindex ffreestanding
4300 @opindex fno-builtin
4301 @opindex Wformat=
4302 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4303 the arguments supplied have types appropriate to the format string
4304 specified, and that the conversions specified in the format string make
4305 sense. This includes standard functions, and others specified by format
4306 attributes (@pxref{Function Attributes}), in the @code{printf},
4307 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4308 not in the C standard) families (or other target-specific families).
4309 Which functions are checked without format attributes having been
4310 specified depends on the standard version selected, and such checks of
4311 functions without the attribute specified are disabled by
4312 @option{-ffreestanding} or @option{-fno-builtin}.
4313
4314 The formats are checked against the format features supported by GNU
4315 libc version 2.2. These include all ISO C90 and C99 features, as well
4316 as features from the Single Unix Specification and some BSD and GNU
4317 extensions. Other library implementations may not support all these
4318 features; GCC does not support warning about features that go beyond a
4319 particular library's limitations. However, if @option{-Wpedantic} is used
4320 with @option{-Wformat}, warnings are given about format features not
4321 in the selected standard version (but not for @code{strfmon} formats,
4322 since those are not in any version of the C standard). @xref{C Dialect
4323 Options,,Options Controlling C Dialect}.
4324
4325 @table @gcctabopt
4326 @item -Wformat=1
4327 @itemx -Wformat
4328 @opindex Wformat
4329 @opindex Wformat=1
4330 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4331 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4332 @option{-Wformat} also checks for null format arguments for several
4333 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4334 aspects of this level of format checking can be disabled by the
4335 options: @option{-Wno-format-contains-nul},
4336 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4337 @option{-Wformat} is enabled by @option{-Wall}.
4338
4339 @item -Wno-format-contains-nul
4340 @opindex Wno-format-contains-nul
4341 @opindex Wformat-contains-nul
4342 If @option{-Wformat} is specified, do not warn about format strings that
4343 contain NUL bytes.
4344
4345 @item -Wno-format-extra-args
4346 @opindex Wno-format-extra-args
4347 @opindex Wformat-extra-args
4348 If @option{-Wformat} is specified, do not warn about excess arguments to a
4349 @code{printf} or @code{scanf} format function. The C standard specifies
4350 that such arguments are ignored.
4351
4352 Where the unused arguments lie between used arguments that are
4353 specified with @samp{$} operand number specifications, normally
4354 warnings are still given, since the implementation could not know what
4355 type to pass to @code{va_arg} to skip the unused arguments. However,
4356 in the case of @code{scanf} formats, this option suppresses the
4357 warning if the unused arguments are all pointers, since the Single
4358 Unix Specification says that such unused arguments are allowed.
4359
4360 @item -Wformat-overflow
4361 @itemx -Wformat-overflow=@var{level}
4362 @opindex Wformat-overflow
4363 @opindex Wno-format-overflow
4364 Warn about calls to formatted input/output functions such as @code{sprintf}
4365 and @code{vsprintf} that might overflow the destination buffer. When the
4366 exact number of bytes written by a format directive cannot be determined
4367 at compile-time it is estimated based on heuristics that depend on the
4368 @var{level} argument and on optimization. While enabling optimization
4369 will in most cases improve the accuracy of the warning, it may also
4370 result in false positives.
4371
4372 @table @gcctabopt
4373 @item -Wformat-overflow
4374 @itemx -Wformat-overflow=1
4375 @opindex Wformat-overflow
4376 @opindex Wno-format-overflow
4377 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4378 employs a conservative approach that warns only about calls that most
4379 likely overflow the buffer. At this level, numeric arguments to format
4380 directives with unknown values are assumed to have the value of one, and
4381 strings of unknown length to be empty. Numeric arguments that are known
4382 to be bounded to a subrange of their type, or string arguments whose output
4383 is bounded either by their directive's precision or by a finite set of
4384 string literals, are assumed to take on the value within the range that
4385 results in the most bytes on output. For example, the call to @code{sprintf}
4386 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4387 the terminating NUL character (@code{'\0'}) appended by the function
4388 to the destination buffer will be written past its end. Increasing
4389 the size of the buffer by a single byte is sufficient to avoid the
4390 warning, though it may not be sufficient to avoid the overflow.
4391
4392 @smallexample
4393 void f (int a, int b)
4394 @{
4395 char buf [13];
4396 sprintf (buf, "a = %i, b = %i\n", a, b);
4397 @}
4398 @end smallexample
4399
4400 @item -Wformat-overflow=2
4401 Level @var{2} warns also about calls that might overflow the destination
4402 buffer given an argument of sufficient length or magnitude. At level
4403 @var{2}, unknown numeric arguments are assumed to have the minimum
4404 representable value for signed types with a precision greater than 1, and
4405 the maximum representable value otherwise. Unknown string arguments whose
4406 length cannot be assumed to be bounded either by the directive's precision,
4407 or by a finite set of string literals they may evaluate to, or the character
4408 array they may point to, are assumed to be 1 character long.
4409
4410 At level @var{2}, the call in the example above is again diagnosed, but
4411 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4412 @code{%i} directive will write some of its digits beyond the end of
4413 the destination buffer. To make the call safe regardless of the values
4414 of the two variables, the size of the destination buffer must be increased
4415 to at least 34 bytes. GCC includes the minimum size of the buffer in
4416 an informational note following the warning.
4417
4418 An alternative to increasing the size of the destination buffer is to
4419 constrain the range of formatted values. The maximum length of string
4420 arguments can be bounded by specifying the precision in the format
4421 directive. When numeric arguments of format directives can be assumed
4422 to be bounded by less than the precision of their type, choosing
4423 an appropriate length modifier to the format specifier will reduce
4424 the required buffer size. For example, if @var{a} and @var{b} in the
4425 example above can be assumed to be within the precision of
4426 the @code{short int} type then using either the @code{%hi} format
4427 directive or casting the argument to @code{short} reduces the maximum
4428 required size of the buffer to 24 bytes.
4429
4430 @smallexample
4431 void f (int a, int b)
4432 @{
4433 char buf [23];
4434 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4435 @}
4436 @end smallexample
4437 @end table
4438
4439 @item -Wno-format-zero-length
4440 @opindex Wno-format-zero-length
4441 @opindex Wformat-zero-length
4442 If @option{-Wformat} is specified, do not warn about zero-length formats.
4443 The C standard specifies that zero-length formats are allowed.
4444
4445
4446 @item -Wformat=2
4447 @opindex Wformat=2
4448 Enable @option{-Wformat} plus additional format checks. Currently
4449 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4450 -Wformat-y2k}.
4451
4452 @item -Wformat-nonliteral
4453 @opindex Wformat-nonliteral
4454 @opindex Wno-format-nonliteral
4455 If @option{-Wformat} is specified, also warn if the format string is not a
4456 string literal and so cannot be checked, unless the format function
4457 takes its format arguments as a @code{va_list}.
4458
4459 @item -Wformat-security
4460 @opindex Wformat-security
4461 @opindex Wno-format-security
4462 If @option{-Wformat} is specified, also warn about uses of format
4463 functions that represent possible security problems. At present, this
4464 warns about calls to @code{printf} and @code{scanf} functions where the
4465 format string is not a string literal and there are no format arguments,
4466 as in @code{printf (foo);}. This may be a security hole if the format
4467 string came from untrusted input and contains @samp{%n}. (This is
4468 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4469 in future warnings may be added to @option{-Wformat-security} that are not
4470 included in @option{-Wformat-nonliteral}.)
4471
4472 @item -Wformat-signedness
4473 @opindex Wformat-signedness
4474 @opindex Wno-format-signedness
4475 If @option{-Wformat} is specified, also warn if the format string
4476 requires an unsigned argument and the argument is signed and vice versa.
4477
4478 @item -Wformat-truncation
4479 @itemx -Wformat-truncation=@var{level}
4480 @opindex Wformat-truncation
4481 @opindex Wno-format-truncation
4482 Warn about calls to formatted input/output functions such as @code{snprintf}
4483 and @code{vsnprintf} that might result in output truncation. When the exact
4484 number of bytes written by a format directive cannot be determined at
4485 compile-time it is estimated based on heuristics that depend on
4486 the @var{level} argument and on optimization. While enabling optimization
4487 will in most cases improve the accuracy of the warning, it may also result
4488 in false positives. Except as noted otherwise, the option uses the same
4489 logic @option{-Wformat-overflow}.
4490
4491 @table @gcctabopt
4492 @item -Wformat-truncation
4493 @itemx -Wformat-truncation=1
4494 @opindex Wformat-truncation
4495 @opindex Wno-format-truncation
4496 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4497 employs a conservative approach that warns only about calls to bounded
4498 functions whose return value is unused and that will most likely result
4499 in output truncation.
4500
4501 @item -Wformat-truncation=2
4502 Level @var{2} warns also about calls to bounded functions whose return
4503 value is used and that might result in truncation given an argument of
4504 sufficient length or magnitude.
4505 @end table
4506
4507 @item -Wformat-y2k
4508 @opindex Wformat-y2k
4509 @opindex Wno-format-y2k
4510 If @option{-Wformat} is specified, also warn about @code{strftime}
4511 formats that may yield only a two-digit year.
4512 @end table
4513
4514 @item -Wnonnull
4515 @opindex Wnonnull
4516 @opindex Wno-nonnull
4517 Warn about passing a null pointer for arguments marked as
4518 requiring a non-null value by the @code{nonnull} function attribute.
4519
4520 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4521 can be disabled with the @option{-Wno-nonnull} option.
4522
4523 @item -Wnonnull-compare
4524 @opindex Wnonnull-compare
4525 @opindex Wno-nonnull-compare
4526 Warn when comparing an argument marked with the @code{nonnull}
4527 function attribute against null inside the function.
4528
4529 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4530 can be disabled with the @option{-Wno-nonnull-compare} option.
4531
4532 @item -Wnull-dereference
4533 @opindex Wnull-dereference
4534 @opindex Wno-null-dereference
4535 Warn if the compiler detects paths that trigger erroneous or
4536 undefined behavior due to dereferencing a null pointer. This option
4537 is only active when @option{-fdelete-null-pointer-checks} is active,
4538 which is enabled by optimizations in most targets. The precision of
4539 the warnings depends on the optimization options used.
4540
4541 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4542 @opindex Winit-self
4543 @opindex Wno-init-self
4544 Warn about uninitialized variables that are initialized with themselves.
4545 Note this option can only be used with the @option{-Wuninitialized} option.
4546
4547 For example, GCC warns about @code{i} being uninitialized in the
4548 following snippet only when @option{-Winit-self} has been specified:
4549 @smallexample
4550 @group
4551 int f()
4552 @{
4553 int i = i;
4554 return i;
4555 @}
4556 @end group
4557 @end smallexample
4558
4559 This warning is enabled by @option{-Wall} in C++.
4560
4561 @item -Wimplicit-int @r{(C and Objective-C only)}
4562 @opindex Wimplicit-int
4563 @opindex Wno-implicit-int
4564 Warn when a declaration does not specify a type.
4565 This warning is enabled by @option{-Wall}.
4566
4567 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4568 @opindex Wimplicit-function-declaration
4569 @opindex Wno-implicit-function-declaration
4570 Give a warning whenever a function is used before being declared. In
4571 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4572 enabled by default and it is made into an error by
4573 @option{-pedantic-errors}. This warning is also enabled by
4574 @option{-Wall}.
4575
4576 @item -Wimplicit @r{(C and Objective-C only)}
4577 @opindex Wimplicit
4578 @opindex Wno-implicit
4579 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4580 This warning is enabled by @option{-Wall}.
4581
4582 @item -Wimplicit-fallthrough
4583 @opindex Wimplicit-fallthrough
4584 @opindex Wno-implicit-fallthrough
4585 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4586 and @option{-Wno-implicit-fallthrough} is the same as
4587 @option{-Wimplicit-fallthrough=0}.
4588
4589 @item -Wimplicit-fallthrough=@var{n}
4590 @opindex Wimplicit-fallthrough=
4591 Warn when a switch case falls through. For example:
4592
4593 @smallexample
4594 @group
4595 switch (cond)
4596 @{
4597 case 1:
4598 a = 1;
4599 break;
4600 case 2:
4601 a = 2;
4602 case 3:
4603 a = 3;
4604 break;
4605 @}
4606 @end group
4607 @end smallexample
4608
4609 This warning does not warn when the last statement of a case cannot
4610 fall through, e.g. when there is a return statement or a call to function
4611 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4612 also takes into account control flow statements, such as ifs, and only
4613 warns when appropriate. E.g.@:
4614
4615 @smallexample
4616 @group
4617 switch (cond)
4618 @{
4619 case 1:
4620 if (i > 3) @{
4621 bar (5);
4622 break;
4623 @} else if (i < 1) @{
4624 bar (0);
4625 @} else
4626 return;
4627 default:
4628 @dots{}
4629 @}
4630 @end group
4631 @end smallexample
4632
4633 Since there are occasions where a switch case fall through is desirable,
4634 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4635 to be used along with a null statement to suppress this warning that
4636 would normally occur:
4637
4638 @smallexample
4639 @group
4640 switch (cond)
4641 @{
4642 case 1:
4643 bar (0);
4644 __attribute__ ((fallthrough));
4645 default:
4646 @dots{}
4647 @}
4648 @end group
4649 @end smallexample
4650
4651 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4652 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4653 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4654 Instead of these attributes, it is also possible to add a fallthrough comment
4655 to silence the warning. The whole body of the C or C++ style comment should
4656 match the given regular expressions listed below. The option argument @var{n}
4657 specifies what kind of comments are accepted:
4658
4659 @itemize @bullet
4660
4661 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4662
4663 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4664 expression, any comment is used as fallthrough comment.
4665
4666 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4667 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4668
4669 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4670 following regular expressions:
4671
4672 @itemize @bullet
4673
4674 @item @code{-fallthrough}
4675
4676 @item @code{@@fallthrough@@}
4677
4678 @item @code{lint -fallthrough[ \t]*}
4679
4680 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4681
4682 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4683
4684 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4685
4686 @end itemize
4687
4688 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4689 following regular expressions:
4690
4691 @itemize @bullet
4692
4693 @item @code{-fallthrough}
4694
4695 @item @code{@@fallthrough@@}
4696
4697 @item @code{lint -fallthrough[ \t]*}
4698
4699 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4700
4701 @end itemize
4702
4703 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4704 fallthrough comments, only attributes disable the warning.
4705
4706 @end itemize
4707
4708 The comment needs to be followed after optional whitespace and other comments
4709 by @code{case} or @code{default} keywords or by a user label that precedes some
4710 @code{case} or @code{default} label.
4711
4712 @smallexample
4713 @group
4714 switch (cond)
4715 @{
4716 case 1:
4717 bar (0);
4718 /* FALLTHRU */
4719 default:
4720 @dots{}
4721 @}
4722 @end group
4723 @end smallexample
4724
4725 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4726
4727 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4728 @opindex Wif-not-aligned
4729 @opindex Wno-if-not-aligned
4730 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4731 should be issued. This is enabled by default.
4732 Use @option{-Wno-if-not-aligned} to disable it.
4733
4734 @item -Wignored-qualifiers @r{(C and C++ only)}
4735 @opindex Wignored-qualifiers
4736 @opindex Wno-ignored-qualifiers
4737 Warn if the return type of a function has a type qualifier
4738 such as @code{const}. For ISO C such a type qualifier has no effect,
4739 since the value returned by a function is not an lvalue.
4740 For C++, the warning is only emitted for scalar types or @code{void}.
4741 ISO C prohibits qualified @code{void} return types on function
4742 definitions, so such return types always receive a warning
4743 even without this option.
4744
4745 This warning is also enabled by @option{-Wextra}.
4746
4747 @item -Wignored-attributes @r{(C and C++ only)}
4748 @opindex Wignored-attributes
4749 @opindex Wno-ignored-attributes
4750 Warn when an attribute is ignored. This is different from the
4751 @option{-Wattributes} option in that it warns whenever the compiler decides
4752 to drop an attribute, not that the attribute is either unknown, used in a
4753 wrong place, etc. This warning is enabled by default.
4754
4755 @item -Wmain
4756 @opindex Wmain
4757 @opindex Wno-main
4758 Warn if the type of @code{main} is suspicious. @code{main} should be
4759 a function with external linkage, returning int, taking either zero
4760 arguments, two, or three arguments of appropriate types. This warning
4761 is enabled by default in C++ and is enabled by either @option{-Wall}
4762 or @option{-Wpedantic}.
4763
4764 @item -Wmisleading-indentation @r{(C and C++ only)}
4765 @opindex Wmisleading-indentation
4766 @opindex Wno-misleading-indentation
4767 Warn when the indentation of the code does not reflect the block structure.
4768 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4769 @code{for} clauses with a guarded statement that does not use braces,
4770 followed by an unguarded statement with the same indentation.
4771
4772 In the following example, the call to ``bar'' is misleadingly indented as
4773 if it were guarded by the ``if'' conditional.
4774
4775 @smallexample
4776 if (some_condition ())
4777 foo ();
4778 bar (); /* Gotcha: this is not guarded by the "if". */
4779 @end smallexample
4780
4781 In the case of mixed tabs and spaces, the warning uses the
4782 @option{-ftabstop=} option to determine if the statements line up
4783 (defaulting to 8).
4784
4785 The warning is not issued for code involving multiline preprocessor logic
4786 such as the following example.
4787
4788 @smallexample
4789 if (flagA)
4790 foo (0);
4791 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4792 if (flagB)
4793 #endif
4794 foo (1);
4795 @end smallexample
4796
4797 The warning is not issued after a @code{#line} directive, since this
4798 typically indicates autogenerated code, and no assumptions can be made
4799 about the layout of the file that the directive references.
4800
4801 This warning is enabled by @option{-Wall} in C and C++.
4802
4803 @item -Wmissing-attributes
4804 @opindex Wmissing-attributes
4805 @opindex Wno-missing-attributes
4806 Warn when a declaration of a function is missing one or more attributes
4807 that a related function is declared with and whose absence may adversely
4808 affect the correctness or efficiency of generated code. For example, in
4809 C++, the warning is issued when an explicit specialization of a primary
4810 template declared with attribute @code{alloc_align}, @code{alloc_size},
4811 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
4812 or @code{nonnull} is declared without it. Attributes @code{deprecated},
4813 @code{error}, and @code{warning} suppress the warning.
4814 (@pxref{Function Attributes}).
4815
4816 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
4817
4818 For example, since the declaration of the primary function template
4819 below makes use of both attribute @code{malloc} and @code{alloc_size}
4820 the declaration of the explicit specialization of the template is
4821 diagnosed because it is missing one of the attributes.
4822
4823 @smallexample
4824 template <class T>
4825 T* __attribute__ ((malloc, alloc_size (1)))
4826 allocate (size_t);
4827
4828 template <>
4829 void* __attribute__ ((malloc)) // missing alloc_size
4830 allocate<void> (size_t);
4831 @end smallexample
4832
4833 @item -Wmissing-braces
4834 @opindex Wmissing-braces
4835 @opindex Wno-missing-braces
4836 Warn if an aggregate or union initializer is not fully bracketed. In
4837 the following example, the initializer for @code{a} is not fully
4838 bracketed, but that for @code{b} is fully bracketed. This warning is
4839 enabled by @option{-Wall} in C.
4840
4841 @smallexample
4842 int a[2][2] = @{ 0, 1, 2, 3 @};
4843 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4844 @end smallexample
4845
4846 This warning is enabled by @option{-Wall}.
4847
4848 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4849 @opindex Wmissing-include-dirs
4850 @opindex Wno-missing-include-dirs
4851 Warn if a user-supplied include directory does not exist.
4852
4853 @item -Wmissing-profile
4854 @opindex Wmissing-profile
4855 @opindex Wno-missing-profile
4856 Warn if feedback profiles are missing when using the
4857 @option{-fprofile-use} option.
4858 This option diagnoses those cases where a new function or a new file is added
4859 to the user code between compiling with @option{-fprofile-generate} and with
4860 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
4861 profile feedback data files do not contain any profile feedback information for
4862 the newly added function or file respectively. Also, in the case when profile
4863 count data (.gcda) files are removed, GCC cannot use any profile feedback
4864 information. In all these cases, warnings are issued to inform the user that a
4865 profile generation step is due. @option{-Wno-missing-profile} can be used to
4866 disable the warning. Ignoring the warning can result in poorly optimized code.
4867 Completely disabling the warning is not recommended and should be done only
4868 when non-existent profile data is justified.
4869
4870 @item -Wmultistatement-macros
4871 @opindex Wmultistatement-macros
4872 @opindex Wno-multistatement-macros
4873 Warn about unsafe multiple statement macros that appear to be guarded
4874 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4875 @code{while}, in which only the first statement is actually guarded after
4876 the macro is expanded.
4877
4878 For example:
4879
4880 @smallexample
4881 #define DOIT x++; y++
4882 if (c)
4883 DOIT;
4884 @end smallexample
4885
4886 will increment @code{y} unconditionally, not just when @code{c} holds.
4887 The can usually be fixed by wrapping the macro in a do-while loop:
4888 @smallexample
4889 #define DOIT do @{ x++; y++; @} while (0)
4890 if (c)
4891 DOIT;
4892 @end smallexample
4893
4894 This warning is enabled by @option{-Wall} in C and C++.
4895
4896 @item -Wparentheses
4897 @opindex Wparentheses
4898 @opindex Wno-parentheses
4899 Warn if parentheses are omitted in certain contexts, such
4900 as when there is an assignment in a context where a truth value
4901 is expected, or when operators are nested whose precedence people
4902 often get confused about.
4903
4904 Also warn if a comparison like @code{x<=y<=z} appears; this is
4905 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4906 interpretation from that of ordinary mathematical notation.
4907
4908 Also warn for dangerous uses of the GNU extension to
4909 @code{?:} with omitted middle operand. When the condition
4910 in the @code{?}: operator is a boolean expression, the omitted value is
4911 always 1. Often programmers expect it to be a value computed
4912 inside the conditional expression instead.
4913
4914 For C++ this also warns for some cases of unnecessary parentheses in
4915 declarations, which can indicate an attempt at a function call instead
4916 of a declaration:
4917 @smallexample
4918 @{
4919 // Declares a local variable called mymutex.
4920 std::unique_lock<std::mutex> (mymutex);
4921 // User meant std::unique_lock<std::mutex> lock (mymutex);
4922 @}
4923 @end smallexample
4924
4925 This warning is enabled by @option{-Wall}.
4926
4927 @item -Wsequence-point
4928 @opindex Wsequence-point
4929 @opindex Wno-sequence-point
4930 Warn about code that may have undefined semantics because of violations
4931 of sequence point rules in the C and C++ standards.
4932
4933 The C and C++ standards define the order in which expressions in a C/C++
4934 program are evaluated in terms of @dfn{sequence points}, which represent
4935 a partial ordering between the execution of parts of the program: those
4936 executed before the sequence point, and those executed after it. These
4937 occur after the evaluation of a full expression (one which is not part
4938 of a larger expression), after the evaluation of the first operand of a
4939 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4940 function is called (but after the evaluation of its arguments and the
4941 expression denoting the called function), and in certain other places.
4942 Other than as expressed by the sequence point rules, the order of
4943 evaluation of subexpressions of an expression is not specified. All
4944 these rules describe only a partial order rather than a total order,
4945 since, for example, if two functions are called within one expression
4946 with no sequence point between them, the order in which the functions
4947 are called is not specified. However, the standards committee have
4948 ruled that function calls do not overlap.
4949
4950 It is not specified when between sequence points modifications to the
4951 values of objects take effect. Programs whose behavior depends on this
4952 have undefined behavior; the C and C++ standards specify that ``Between
4953 the previous and next sequence point an object shall have its stored
4954 value modified at most once by the evaluation of an expression.
4955 Furthermore, the prior value shall be read only to determine the value
4956 to be stored.''. If a program breaks these rules, the results on any
4957 particular implementation are entirely unpredictable.
4958
4959 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4960 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4961 diagnosed by this option, and it may give an occasional false positive
4962 result, but in general it has been found fairly effective at detecting
4963 this sort of problem in programs.
4964
4965 The C++17 standard will define the order of evaluation of operands in
4966 more cases: in particular it requires that the right-hand side of an
4967 assignment be evaluated before the left-hand side, so the above
4968 examples are no longer undefined. But this warning will still warn
4969 about them, to help people avoid writing code that is undefined in C
4970 and earlier revisions of C++.
4971
4972 The standard is worded confusingly, therefore there is some debate
4973 over the precise meaning of the sequence point rules in subtle cases.
4974 Links to discussions of the problem, including proposed formal
4975 definitions, may be found on the GCC readings page, at
4976 @uref{http://gcc.gnu.org/@/readings.html}.
4977
4978 This warning is enabled by @option{-Wall} for C and C++.
4979
4980 @item -Wno-return-local-addr
4981 @opindex Wno-return-local-addr
4982 @opindex Wreturn-local-addr
4983 Do not warn about returning a pointer (or in C++, a reference) to a
4984 variable that goes out of scope after the function returns.
4985
4986 @item -Wreturn-type
4987 @opindex Wreturn-type
4988 @opindex Wno-return-type
4989 Warn whenever a function is defined with a return type that defaults
4990 to @code{int}. Also warn about any @code{return} statement with no
4991 return value in a function whose return type is not @code{void}
4992 (falling off the end of the function body is considered returning
4993 without a value).
4994
4995 For C only, warn about a @code{return} statement with an expression in a
4996 function whose return type is @code{void}, unless the expression type is
4997 also @code{void}. As a GNU extension, the latter case is accepted
4998 without a warning unless @option{-Wpedantic} is used.
4999
5000 For C++, a function without return type always produces a diagnostic
5001 message, even when @option{-Wno-return-type} is specified. The only
5002 exceptions are @code{main} and functions defined in system headers.
5003
5004 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
5005
5006 @item -Wshift-count-negative
5007 @opindex Wshift-count-negative
5008 @opindex Wno-shift-count-negative
5009 Warn if shift count is negative. This warning is enabled by default.
5010
5011 @item -Wshift-count-overflow
5012 @opindex Wshift-count-overflow
5013 @opindex Wno-shift-count-overflow
5014 Warn if shift count >= width of type. This warning is enabled by default.
5015
5016 @item -Wshift-negative-value
5017 @opindex Wshift-negative-value
5018 @opindex Wno-shift-negative-value
5019 Warn if left shifting a negative value. This warning is enabled by
5020 @option{-Wextra} in C99 and C++11 modes (and newer).
5021
5022 @item -Wshift-overflow
5023 @itemx -Wshift-overflow=@var{n}
5024 @opindex Wshift-overflow
5025 @opindex Wno-shift-overflow
5026 Warn about left shift overflows. This warning is enabled by
5027 default in C99 and C++11 modes (and newer).
5028
5029 @table @gcctabopt
5030 @item -Wshift-overflow=1
5031 This is the warning level of @option{-Wshift-overflow} and is enabled
5032 by default in C99 and C++11 modes (and newer). This warning level does
5033 not warn about left-shifting 1 into the sign bit. (However, in C, such
5034 an overflow is still rejected in contexts where an integer constant expression
5035 is required.)
5036
5037 @item -Wshift-overflow=2
5038 This warning level also warns about left-shifting 1 into the sign bit,
5039 unless C++14 mode is active.
5040 @end table
5041
5042 @item -Wswitch
5043 @opindex Wswitch
5044 @opindex Wno-switch
5045 Warn whenever a @code{switch} statement has an index of enumerated type
5046 and lacks a @code{case} for one or more of the named codes of that
5047 enumeration. (The presence of a @code{default} label prevents this
5048 warning.) @code{case} labels outside the enumeration range also
5049 provoke warnings when this option is used (even if there is a
5050 @code{default} label).
5051 This warning is enabled by @option{-Wall}.
5052
5053 @item -Wswitch-default
5054 @opindex Wswitch-default
5055 @opindex Wno-switch-default
5056 Warn whenever a @code{switch} statement does not have a @code{default}
5057 case.
5058
5059 @item -Wswitch-enum
5060 @opindex Wswitch-enum
5061 @opindex Wno-switch-enum
5062 Warn whenever a @code{switch} statement has an index of enumerated type
5063 and lacks a @code{case} for one or more of the named codes of that
5064 enumeration. @code{case} labels outside the enumeration range also
5065 provoke warnings when this option is used. The only difference
5066 between @option{-Wswitch} and this option is that this option gives a
5067 warning about an omitted enumeration code even if there is a
5068 @code{default} label.
5069
5070 @item -Wswitch-bool
5071 @opindex Wswitch-bool
5072 @opindex Wno-switch-bool
5073 Warn whenever a @code{switch} statement has an index of boolean type
5074 and the case values are outside the range of a boolean type.
5075 It is possible to suppress this warning by casting the controlling
5076 expression to a type other than @code{bool}. For example:
5077 @smallexample
5078 @group
5079 switch ((int) (a == 4))
5080 @{
5081 @dots{}
5082 @}
5083 @end group
5084 @end smallexample
5085 This warning is enabled by default for C and C++ programs.
5086
5087 @item -Wswitch-unreachable
5088 @opindex Wswitch-unreachable
5089 @opindex Wno-switch-unreachable
5090 Warn whenever a @code{switch} statement contains statements between the
5091 controlling expression and the first case label, which will never be
5092 executed. For example:
5093 @smallexample
5094 @group
5095 switch (cond)
5096 @{
5097 i = 15;
5098 @dots{}
5099 case 5:
5100 @dots{}
5101 @}
5102 @end group
5103 @end smallexample
5104 @option{-Wswitch-unreachable} does not warn if the statement between the
5105 controlling expression and the first case label is just a declaration:
5106 @smallexample
5107 @group
5108 switch (cond)
5109 @{
5110 int i;
5111 @dots{}
5112 case 5:
5113 i = 5;
5114 @dots{}
5115 @}
5116 @end group
5117 @end smallexample
5118 This warning is enabled by default for C and C++ programs.
5119
5120 @item -Wsync-nand @r{(C and C++ only)}
5121 @opindex Wsync-nand
5122 @opindex Wno-sync-nand
5123 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5124 built-in functions are used. These functions changed semantics in GCC 4.4.
5125
5126 @item -Wunused-but-set-parameter
5127 @opindex Wunused-but-set-parameter
5128 @opindex Wno-unused-but-set-parameter
5129 Warn whenever a function parameter is assigned to, but otherwise unused
5130 (aside from its declaration).
5131
5132 To suppress this warning use the @code{unused} attribute
5133 (@pxref{Variable Attributes}).
5134
5135 This warning is also enabled by @option{-Wunused} together with
5136 @option{-Wextra}.
5137
5138 @item -Wunused-but-set-variable
5139 @opindex Wunused-but-set-variable
5140 @opindex Wno-unused-but-set-variable
5141 Warn whenever a local variable is assigned to, but otherwise unused
5142 (aside from its declaration).
5143 This warning is enabled by @option{-Wall}.
5144
5145 To suppress this warning use the @code{unused} attribute
5146 (@pxref{Variable Attributes}).
5147
5148 This warning is also enabled by @option{-Wunused}, which is enabled
5149 by @option{-Wall}.
5150
5151 @item -Wunused-function
5152 @opindex Wunused-function
5153 @opindex Wno-unused-function
5154 Warn whenever a static function is declared but not defined or a
5155 non-inline static function is unused.
5156 This warning is enabled by @option{-Wall}.
5157
5158 @item -Wunused-label
5159 @opindex Wunused-label
5160 @opindex Wno-unused-label
5161 Warn whenever a label is declared but not used.
5162 This warning is enabled by @option{-Wall}.
5163
5164 To suppress this warning use the @code{unused} attribute
5165 (@pxref{Variable Attributes}).
5166
5167 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5168 @opindex Wunused-local-typedefs
5169 @opindex Wno-unused-local-typedefs
5170 Warn when a typedef locally defined in a function is not used.
5171 This warning is enabled by @option{-Wall}.
5172
5173 @item -Wunused-parameter
5174 @opindex Wunused-parameter
5175 @opindex Wno-unused-parameter
5176 Warn whenever a function parameter is unused aside from its declaration.
5177
5178 To suppress this warning use the @code{unused} attribute
5179 (@pxref{Variable Attributes}).
5180
5181 @item -Wno-unused-result
5182 @opindex Wunused-result
5183 @opindex Wno-unused-result
5184 Do not warn if a caller of a function marked with attribute
5185 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5186 its return value. The default is @option{-Wunused-result}.
5187
5188 @item -Wunused-variable
5189 @opindex Wunused-variable
5190 @opindex Wno-unused-variable
5191 Warn whenever a local or static variable is unused aside from its
5192 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5193 but not for C++. This warning is enabled by @option{-Wall}.
5194
5195 To suppress this warning use the @code{unused} attribute
5196 (@pxref{Variable Attributes}).
5197
5198 @item -Wunused-const-variable
5199 @itemx -Wunused-const-variable=@var{n}
5200 @opindex Wunused-const-variable
5201 @opindex Wno-unused-const-variable
5202 Warn whenever a constant static variable is unused aside from its declaration.
5203 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5204 for C, but not for C++. In C this declares variable storage, but in C++ this
5205 is not an error since const variables take the place of @code{#define}s.
5206
5207 To suppress this warning use the @code{unused} attribute
5208 (@pxref{Variable Attributes}).
5209
5210 @table @gcctabopt
5211 @item -Wunused-const-variable=1
5212 This is the warning level that is enabled by @option{-Wunused-variable} for
5213 C. It warns only about unused static const variables defined in the main
5214 compilation unit, but not about static const variables declared in any
5215 header included.
5216
5217 @item -Wunused-const-variable=2
5218 This warning level also warns for unused constant static variables in
5219 headers (excluding system headers). This is the warning level of
5220 @option{-Wunused-const-variable} and must be explicitly requested since
5221 in C++ this isn't an error and in C it might be harder to clean up all
5222 headers included.
5223 @end table
5224
5225 @item -Wunused-value
5226 @opindex Wunused-value
5227 @opindex Wno-unused-value
5228 Warn whenever a statement computes a result that is explicitly not
5229 used. To suppress this warning cast the unused expression to
5230 @code{void}. This includes an expression-statement or the left-hand
5231 side of a comma expression that contains no side effects. For example,
5232 an expression such as @code{x[i,j]} causes a warning, while
5233 @code{x[(void)i,j]} does not.
5234
5235 This warning is enabled by @option{-Wall}.
5236
5237 @item -Wunused
5238 @opindex Wunused
5239 @opindex Wno-unused
5240 All the above @option{-Wunused} options combined.
5241
5242 In order to get a warning about an unused function parameter, you must
5243 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5244 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5245
5246 @item -Wuninitialized
5247 @opindex Wuninitialized
5248 @opindex Wno-uninitialized
5249 Warn if an automatic variable is used without first being initialized
5250 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5251 warn if a non-static reference or non-static @code{const} member
5252 appears in a class without constructors.
5253
5254 If you want to warn about code that uses the uninitialized value of the
5255 variable in its own initializer, use the @option{-Winit-self} option.
5256
5257 These warnings occur for individual uninitialized or clobbered
5258 elements of structure, union or array variables as well as for
5259 variables that are uninitialized or clobbered as a whole. They do
5260 not occur for variables or elements declared @code{volatile}. Because
5261 these warnings depend on optimization, the exact variables or elements
5262 for which there are warnings depends on the precise optimization
5263 options and version of GCC used.
5264
5265 Note that there may be no warning about a variable that is used only
5266 to compute a value that itself is never used, because such
5267 computations may be deleted by data flow analysis before the warnings
5268 are printed.
5269
5270 @item -Winvalid-memory-model
5271 @opindex Winvalid-memory-model
5272 @opindex Wno-invalid-memory-model
5273 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5274 and the C11 atomic generic functions with a memory consistency argument
5275 that is either invalid for the operation or outside the range of values
5276 of the @code{memory_order} enumeration. For example, since the
5277 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5278 defined for the relaxed, release, and sequentially consistent memory
5279 orders the following code is diagnosed:
5280
5281 @smallexample
5282 void store (int *i)
5283 @{
5284 __atomic_store_n (i, 0, memory_order_consume);
5285 @}
5286 @end smallexample
5287
5288 @option{-Winvalid-memory-model} is enabled by default.
5289
5290 @item -Wmaybe-uninitialized
5291 @opindex Wmaybe-uninitialized
5292 @opindex Wno-maybe-uninitialized
5293 For an automatic (i.e.@: local) variable, if there exists a path from the
5294 function entry to a use of the variable that is initialized, but there exist
5295 some other paths for which the variable is not initialized, the compiler
5296 emits a warning if it cannot prove the uninitialized paths are not
5297 executed at run time.
5298
5299 These warnings are only possible in optimizing compilation, because otherwise
5300 GCC does not keep track of the state of variables.
5301
5302 These warnings are made optional because GCC may not be able to determine when
5303 the code is correct in spite of appearing to have an error. Here is one
5304 example of how this can happen:
5305
5306 @smallexample
5307 @group
5308 @{
5309 int x;
5310 switch (y)
5311 @{
5312 case 1: x = 1;
5313 break;
5314 case 2: x = 4;
5315 break;
5316 case 3: x = 5;
5317 @}
5318 foo (x);
5319 @}
5320 @end group
5321 @end smallexample
5322
5323 @noindent
5324 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5325 always initialized, but GCC doesn't know this. To suppress the
5326 warning, you need to provide a default case with assert(0) or
5327 similar code.
5328
5329 @cindex @code{longjmp} warnings
5330 This option also warns when a non-volatile automatic variable might be
5331 changed by a call to @code{longjmp}.
5332 The compiler sees only the calls to @code{setjmp}. It cannot know
5333 where @code{longjmp} will be called; in fact, a signal handler could
5334 call it at any point in the code. As a result, you may get a warning
5335 even when there is in fact no problem because @code{longjmp} cannot
5336 in fact be called at the place that would cause a problem.
5337
5338 Some spurious warnings can be avoided if you declare all the functions
5339 you use that never return as @code{noreturn}. @xref{Function
5340 Attributes}.
5341
5342 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5343
5344 @item -Wunknown-pragmas
5345 @opindex Wunknown-pragmas
5346 @opindex Wno-unknown-pragmas
5347 @cindex warning for unknown pragmas
5348 @cindex unknown pragmas, warning
5349 @cindex pragmas, warning of unknown
5350 Warn when a @code{#pragma} directive is encountered that is not understood by
5351 GCC@. If this command-line option is used, warnings are even issued
5352 for unknown pragmas in system header files. This is not the case if
5353 the warnings are only enabled by the @option{-Wall} command-line option.
5354
5355 @item -Wno-pragmas
5356 @opindex Wno-pragmas
5357 @opindex Wpragmas
5358 Do not warn about misuses of pragmas, such as incorrect parameters,
5359 invalid syntax, or conflicts between pragmas. See also
5360 @option{-Wunknown-pragmas}.
5361
5362 @item -Wno-prio-ctor-dtor
5363 @opindex Wno-prio-ctor-dtor
5364 @opindex Wprio-ctor-dtor
5365 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5366 The use of constructor and destructor attributes allow you to assign a
5367 priority to the constructor/destructor to control its order of execution
5368 before @code{main} is called or after it returns. The priority values must be
5369 greater than 100 as the compiler reserves priority values between 0--100 for
5370 the implementation.
5371
5372 @item -Wstrict-aliasing
5373 @opindex Wstrict-aliasing
5374 @opindex Wno-strict-aliasing
5375 This option is only active when @option{-fstrict-aliasing} is active.
5376 It warns about code that might break the strict aliasing rules that the
5377 compiler is using for optimization. The warning does not catch all
5378 cases, but does attempt to catch the more common pitfalls. It is
5379 included in @option{-Wall}.
5380 It is equivalent to @option{-Wstrict-aliasing=3}
5381
5382 @item -Wstrict-aliasing=n
5383 @opindex Wstrict-aliasing=n
5384 This option is only active when @option{-fstrict-aliasing} is active.
5385 It warns about code that might break the strict aliasing rules that the
5386 compiler is using for optimization.
5387 Higher levels correspond to higher accuracy (fewer false positives).
5388 Higher levels also correspond to more effort, similar to the way @option{-O}
5389 works.
5390 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5391
5392 Level 1: Most aggressive, quick, least accurate.
5393 Possibly useful when higher levels
5394 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5395 false negatives. However, it has many false positives.
5396 Warns for all pointer conversions between possibly incompatible types,
5397 even if never dereferenced. Runs in the front end only.
5398
5399 Level 2: Aggressive, quick, not too precise.
5400 May still have many false positives (not as many as level 1 though),
5401 and few false negatives (but possibly more than level 1).
5402 Unlike level 1, it only warns when an address is taken. Warns about
5403 incomplete types. Runs in the front end only.
5404
5405 Level 3 (default for @option{-Wstrict-aliasing}):
5406 Should have very few false positives and few false
5407 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5408 Takes care of the common pun+dereference pattern in the front end:
5409 @code{*(int*)&some_float}.
5410 If optimization is enabled, it also runs in the back end, where it deals
5411 with multiple statement cases using flow-sensitive points-to information.
5412 Only warns when the converted pointer is dereferenced.
5413 Does not warn about incomplete types.
5414
5415 @item -Wstrict-overflow
5416 @itemx -Wstrict-overflow=@var{n}
5417 @opindex Wstrict-overflow
5418 @opindex Wno-strict-overflow
5419 This option is only active when signed overflow is undefined.
5420 It warns about cases where the compiler optimizes based on the
5421 assumption that signed overflow does not occur. Note that it does not
5422 warn about all cases where the code might overflow: it only warns
5423 about cases where the compiler implements some optimization. Thus
5424 this warning depends on the optimization level.
5425
5426 An optimization that assumes that signed overflow does not occur is
5427 perfectly safe if the values of the variables involved are such that
5428 overflow never does, in fact, occur. Therefore this warning can
5429 easily give a false positive: a warning about code that is not
5430 actually a problem. To help focus on important issues, several
5431 warning levels are defined. No warnings are issued for the use of
5432 undefined signed overflow when estimating how many iterations a loop
5433 requires, in particular when determining whether a loop will be
5434 executed at all.
5435
5436 @table @gcctabopt
5437 @item -Wstrict-overflow=1
5438 Warn about cases that are both questionable and easy to avoid. For
5439 example the compiler simplifies
5440 @code{x + 1 > x} to @code{1}. This level of
5441 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5442 are not, and must be explicitly requested.
5443
5444 @item -Wstrict-overflow=2
5445 Also warn about other cases where a comparison is simplified to a
5446 constant. For example: @code{abs (x) >= 0}. This can only be
5447 simplified when signed integer overflow is undefined, because
5448 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5449 zero. @option{-Wstrict-overflow} (with no level) is the same as
5450 @option{-Wstrict-overflow=2}.
5451
5452 @item -Wstrict-overflow=3
5453 Also warn about other cases where a comparison is simplified. For
5454 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5455
5456 @item -Wstrict-overflow=4
5457 Also warn about other simplifications not covered by the above cases.
5458 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5459
5460 @item -Wstrict-overflow=5
5461 Also warn about cases where the compiler reduces the magnitude of a
5462 constant involved in a comparison. For example: @code{x + 2 > y} is
5463 simplified to @code{x + 1 >= y}. This is reported only at the
5464 highest warning level because this simplification applies to many
5465 comparisons, so this warning level gives a very large number of
5466 false positives.
5467 @end table
5468
5469 @item -Wstringop-overflow
5470 @itemx -Wstringop-overflow=@var{type}
5471 @opindex Wstringop-overflow
5472 @opindex Wno-stringop-overflow
5473 Warn for calls to string manipulation functions such as @code{memcpy} and
5474 @code{strcpy} that are determined to overflow the destination buffer. The
5475 optional argument is one greater than the type of Object Size Checking to
5476 perform to determine the size of the destination. @xref{Object Size Checking}.
5477 The argument is meaningful only for functions that operate on character arrays
5478 but not for raw memory functions like @code{memcpy} which always make use
5479 of Object Size type-0. The option also warns for calls that specify a size
5480 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5481 The option produces the best results with optimization enabled but can detect
5482 a small subset of simple buffer overflows even without optimization in
5483 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5484 correspond to the standard functions. In any case, the option warns about
5485 just a subset of buffer overflows detected by the corresponding overflow
5486 checking built-ins. For example, the option will issue a warning for
5487 the @code{strcpy} call below because it copies at least 5 characters
5488 (the string @code{"blue"} including the terminating NUL) into the buffer
5489 of size 4.
5490
5491 @smallexample
5492 enum Color @{ blue, purple, yellow @};
5493 const char* f (enum Color clr)
5494 @{
5495 static char buf [4];
5496 const char *str;
5497 switch (clr)
5498 @{
5499 case blue: str = "blue"; break;
5500 case purple: str = "purple"; break;
5501 case yellow: str = "yellow"; break;
5502 @}
5503
5504 return strcpy (buf, str); // warning here
5505 @}
5506 @end smallexample
5507
5508 Option @option{-Wstringop-overflow=2} is enabled by default.
5509
5510 @table @gcctabopt
5511 @item -Wstringop-overflow
5512 @itemx -Wstringop-overflow=1
5513 @opindex Wstringop-overflow
5514 @opindex Wno-stringop-overflow
5515 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5516 to determine the sizes of destination objects. This is the default setting
5517 of the option. At this setting the option will not warn for writes past
5518 the end of subobjects of larger objects accessed by pointers unless the
5519 size of the largest surrounding object is known. When the destination may
5520 be one of several objects it is assumed to be the largest one of them. On
5521 Linux systems, when optimization is enabled at this setting the option warns
5522 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5523 a non-zero value.
5524
5525 @item -Wstringop-overflow=2
5526 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5527 to determine the sizes of destination objects. At this setting the option
5528 will warn about overflows when writing to members of the largest complete
5529 objects whose exact size is known. It will, however, not warn for excessive
5530 writes to the same members of unknown objects referenced by pointers since
5531 they may point to arrays containing unknown numbers of elements.
5532
5533 @item -Wstringop-overflow=3
5534 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5535 to determine the sizes of destination objects. At this setting the option
5536 warns about overflowing the smallest object or data member. This is the
5537 most restrictive setting of the option that may result in warnings for safe
5538 code.
5539
5540 @item -Wstringop-overflow=4
5541 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5542 to determine the sizes of destination objects. At this setting the option
5543 will warn about overflowing any data members, and when the destination is
5544 one of several objects it uses the size of the largest of them to decide
5545 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5546 setting of the option may result in warnings for benign code.
5547 @end table
5548
5549 @item -Wstringop-truncation
5550 @opindex Wstringop-truncation
5551 @opindex Wno-stringop-truncation
5552 Warn for calls to bounded string manipulation functions such as @code{strncat},
5553 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5554 or leave the destination unchanged.
5555
5556 In the following example, the call to @code{strncat} specifies a bound that
5557 is less than the length of the source string. As a result, the copy of
5558 the source will be truncated and so the call is diagnosed. To avoid the
5559 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5560
5561 @smallexample
5562 void append (char *buf, size_t bufsize)
5563 @{
5564 strncat (buf, ".txt", 3);
5565 @}
5566 @end smallexample
5567
5568 As another example, the following call to @code{strncpy} results in copying
5569 to @code{d} just the characters preceding the terminating NUL, without
5570 appending the NUL to the end. Assuming the result of @code{strncpy} is
5571 necessarily a NUL-terminated string is a common mistake, and so the call
5572 is diagnosed. To avoid the warning when the result is not expected to be
5573 NUL-terminated, call @code{memcpy} instead.
5574
5575 @smallexample
5576 void copy (char *d, const char *s)
5577 @{
5578 strncpy (d, s, strlen (s));
5579 @}
5580 @end smallexample
5581
5582 In the following example, the call to @code{strncpy} specifies the size
5583 of the destination buffer as the bound. If the length of the source
5584 string is equal to or greater than this size the result of the copy will
5585 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5586 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5587 element of the buffer to @code{NUL}.
5588
5589 @smallexample
5590 void copy (const char *s)
5591 @{
5592 char buf[80];
5593 strncpy (buf, s, sizeof buf);
5594 @dots{}
5595 @}
5596 @end smallexample
5597
5598 In situations where a character array is intended to store a sequence
5599 of bytes with no terminating @code{NUL} such an array may be annotated
5600 with attribute @code{nonstring} to avoid this warning. Such arrays,
5601 however, are not suitable arguments to functions that expect
5602 @code{NUL}-terminated strings. To help detect accidental misuses of
5603 such arrays GCC issues warnings unless it can prove that the use is
5604 safe. @xref{Common Variable Attributes}.
5605
5606 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5607 @opindex Wsuggest-attribute=
5608 @opindex Wno-suggest-attribute=
5609 Warn for cases where adding an attribute may be beneficial. The
5610 attributes currently supported are listed below.
5611
5612 @table @gcctabopt
5613 @item -Wsuggest-attribute=pure
5614 @itemx -Wsuggest-attribute=const
5615 @itemx -Wsuggest-attribute=noreturn
5616 @itemx -Wsuggest-attribute=malloc
5617 @opindex Wsuggest-attribute=pure
5618 @opindex Wno-suggest-attribute=pure
5619 @opindex Wsuggest-attribute=const
5620 @opindex Wno-suggest-attribute=const
5621 @opindex Wsuggest-attribute=noreturn
5622 @opindex Wno-suggest-attribute=noreturn
5623 @opindex Wsuggest-attribute=malloc
5624 @opindex Wno-suggest-attribute=malloc
5625
5626 Warn about functions that might be candidates for attributes
5627 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5628 only warns for functions visible in other compilation units or (in the case of
5629 @code{pure} and @code{const}) if it cannot prove that the function returns
5630 normally. A function returns normally if it doesn't contain an infinite loop or
5631 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5632 requires option @option{-fipa-pure-const}, which is enabled by default at
5633 @option{-O} and higher. Higher optimization levels improve the accuracy
5634 of the analysis.
5635
5636 @item -Wsuggest-attribute=format
5637 @itemx -Wmissing-format-attribute
5638 @opindex Wsuggest-attribute=format
5639 @opindex Wmissing-format-attribute
5640 @opindex Wno-suggest-attribute=format
5641 @opindex Wno-missing-format-attribute
5642 @opindex Wformat
5643 @opindex Wno-format
5644
5645 Warn about function pointers that might be candidates for @code{format}
5646 attributes. Note these are only possible candidates, not absolute ones.
5647 GCC guesses that function pointers with @code{format} attributes that
5648 are used in assignment, initialization, parameter passing or return
5649 statements should have a corresponding @code{format} attribute in the
5650 resulting type. I.e.@: the left-hand side of the assignment or
5651 initialization, the type of the parameter variable, or the return type
5652 of the containing function respectively should also have a @code{format}
5653 attribute to avoid the warning.
5654
5655 GCC also warns about function definitions that might be
5656 candidates for @code{format} attributes. Again, these are only
5657 possible candidates. GCC guesses that @code{format} attributes
5658 might be appropriate for any function that calls a function like
5659 @code{vprintf} or @code{vscanf}, but this might not always be the
5660 case, and some functions for which @code{format} attributes are
5661 appropriate may not be detected.
5662
5663 @item -Wsuggest-attribute=cold
5664 @opindex Wsuggest-attribute=cold
5665 @opindex Wno-suggest-attribute=cold
5666
5667 Warn about functions that might be candidates for @code{cold} attribute. This
5668 is based on static detection and generally will only warn about functions which
5669 always leads to a call to another @code{cold} function such as wrappers of
5670 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5671 @end table
5672
5673 @item -Wsuggest-final-types
5674 @opindex Wno-suggest-final-types
5675 @opindex Wsuggest-final-types
5676 Warn about types with virtual methods where code quality would be improved
5677 if the type were declared with the C++11 @code{final} specifier,
5678 or, if possible,
5679 declared in an anonymous namespace. This allows GCC to more aggressively
5680 devirtualize the polymorphic calls. This warning is more effective with link
5681 time optimization, where the information about the class hierarchy graph is
5682 more complete.
5683
5684 @item -Wsuggest-final-methods
5685 @opindex Wno-suggest-final-methods
5686 @opindex Wsuggest-final-methods
5687 Warn about virtual methods where code quality would be improved if the method
5688 were declared with the C++11 @code{final} specifier,
5689 or, if possible, its type were
5690 declared in an anonymous namespace or with the @code{final} specifier.
5691 This warning is
5692 more effective with link-time optimization, where the information about the
5693 class hierarchy graph is more complete. It is recommended to first consider
5694 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5695 annotations.
5696
5697 @item -Wsuggest-override
5698 Warn about overriding virtual functions that are not marked with the override
5699 keyword.
5700
5701 @item -Walloc-zero
5702 @opindex Wno-alloc-zero
5703 @opindex Walloc-zero
5704 Warn about calls to allocation functions decorated with attribute
5705 @code{alloc_size} that specify zero bytes, including those to the built-in
5706 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5707 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5708 when called with a zero size differs among implementations (and in the case
5709 of @code{realloc} has been deprecated) relying on it may result in subtle
5710 portability bugs and should be avoided.
5711
5712 @item -Walloc-size-larger-than=@var{byte-size}
5713 @opindex Walloc-size-larger-than=
5714 @opindex Wno-alloc-size-larger-than
5715 Warn about calls to functions decorated with attribute @code{alloc_size}
5716 that attempt to allocate objects larger than the specified number of bytes,
5717 or where the result of the size computation in an integer type with infinite
5718 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5719 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5720 Warnings controlled by the option can be disabled either by specifying
5721 @var{byte-size} of @samp{SIZE_MAX} or more or by
5722 @option{-Wno-alloc-size-larger-than}.
5723 @xref{Function Attributes}.
5724
5725 @item -Wno-alloc-size-larger-than
5726 @opindex Wno-alloc-size-larger-than
5727 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5728 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5729 larger.
5730
5731 @item -Walloca
5732 @opindex Wno-alloca
5733 @opindex Walloca
5734 This option warns on all uses of @code{alloca} in the source.
5735
5736 @item -Walloca-larger-than=@var{byte-size}
5737 @opindex Walloca-larger-than=
5738 @opindex Wno-alloca-larger-than
5739 This option warns on calls to @code{alloca} with an integer argument whose
5740 value is either zero, or that is not bounded by a controlling predicate
5741 that limits its value to at most @var{byte-size}. It also warns for calls
5742 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5743 types are considered unbounded even if they appear to be constrained to
5744 the expected range.
5745
5746 For example, a bounded case of @code{alloca} could be:
5747
5748 @smallexample
5749 void func (size_t n)
5750 @{
5751 void *p;
5752 if (n <= 1000)
5753 p = alloca (n);
5754 else
5755 p = malloc (n);
5756 f (p);
5757 @}
5758 @end smallexample
5759
5760 In the above example, passing @code{-Walloca-larger-than=1000} would not
5761 issue a warning because the call to @code{alloca} is known to be at most
5762 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5763 the compiler would emit a warning.
5764
5765 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5766 controlling predicate constraining its integer argument. For example:
5767
5768 @smallexample
5769 void func ()
5770 @{
5771 void *p = alloca (n);
5772 f (p);
5773 @}
5774 @end smallexample
5775
5776 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5777 a warning, but this time because of the lack of bounds checking.
5778
5779 Note, that even seemingly correct code involving signed integers could
5780 cause a warning:
5781
5782 @smallexample
5783 void func (signed int n)
5784 @{
5785 if (n < 500)
5786 @{
5787 p = alloca (n);
5788 f (p);
5789 @}
5790 @}
5791 @end smallexample
5792
5793 In the above example, @var{n} could be negative, causing a larger than
5794 expected argument to be implicitly cast into the @code{alloca} call.
5795
5796 This option also warns when @code{alloca} is used in a loop.
5797
5798 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
5799 but is usually only effective when @option{-ftree-vrp} is active (default
5800 for @option{-O2} and above).
5801
5802 See also @option{-Wvla-larger-than=}@samp{byte-size}.
5803
5804 @item -Wno-alloca-larger-than
5805 @opindex Wno-alloca-larger-than
5806 Disable @option{-Walloca-larger-than=} warnings. The option is
5807 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
5808
5809 @item -Warray-bounds
5810 @itemx -Warray-bounds=@var{n}
5811 @opindex Wno-array-bounds
5812 @opindex Warray-bounds
5813 This option is only active when @option{-ftree-vrp} is active
5814 (default for @option{-O2} and above). It warns about subscripts to arrays
5815 that are always out of bounds. This warning is enabled by @option{-Wall}.
5816
5817 @table @gcctabopt
5818 @item -Warray-bounds=1
5819 This is the warning level of @option{-Warray-bounds} and is enabled
5820 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5821
5822 @item -Warray-bounds=2
5823 This warning level also warns about out of bounds access for
5824 arrays at the end of a struct and for arrays accessed through
5825 pointers. This warning level may give a larger number of
5826 false positives and is deactivated by default.
5827 @end table
5828
5829 @item -Wattribute-alias
5830 Warn about declarations using the @code{alias} and similar attributes whose
5831 target is incompatible with the type of the alias. @xref{Function Attributes,
5832 ,Declaring Attributes of Functions}.
5833
5834 @item -Wbool-compare
5835 @opindex Wno-bool-compare
5836 @opindex Wbool-compare
5837 Warn about boolean expression compared with an integer value different from
5838 @code{true}/@code{false}. For instance, the following comparison is
5839 always false:
5840 @smallexample
5841 int n = 5;
5842 @dots{}
5843 if ((n > 1) == 2) @{ @dots{} @}
5844 @end smallexample
5845 This warning is enabled by @option{-Wall}.
5846
5847 @item -Wbool-operation
5848 @opindex Wno-bool-operation
5849 @opindex Wbool-operation
5850 Warn about suspicious operations on expressions of a boolean type. For
5851 instance, bitwise negation of a boolean is very likely a bug in the program.
5852 For C, this warning also warns about incrementing or decrementing a boolean,
5853 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5854 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5855
5856 This warning is enabled by @option{-Wall}.
5857
5858 @item -Wduplicated-branches
5859 @opindex Wno-duplicated-branches
5860 @opindex Wduplicated-branches
5861 Warn when an if-else has identical branches. This warning detects cases like
5862 @smallexample
5863 if (p != NULL)
5864 return 0;
5865 else
5866 return 0;
5867 @end smallexample
5868 It doesn't warn when both branches contain just a null statement. This warning
5869 also warn for conditional operators:
5870 @smallexample
5871 int i = x ? *p : *p;
5872 @end smallexample
5873
5874 @item -Wduplicated-cond
5875 @opindex Wno-duplicated-cond
5876 @opindex Wduplicated-cond
5877 Warn about duplicated conditions in an if-else-if chain. For instance,
5878 warn for the following code:
5879 @smallexample
5880 if (p->q != NULL) @{ @dots{} @}
5881 else if (p->q != NULL) @{ @dots{} @}
5882 @end smallexample
5883
5884 @item -Wframe-address
5885 @opindex Wno-frame-address
5886 @opindex Wframe-address
5887 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5888 is called with an argument greater than 0. Such calls may return indeterminate
5889 values or crash the program. The warning is included in @option{-Wall}.
5890
5891 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5892 @opindex Wno-discarded-qualifiers
5893 @opindex Wdiscarded-qualifiers
5894 Do not warn if type qualifiers on pointers are being discarded.
5895 Typically, the compiler warns if a @code{const char *} variable is
5896 passed to a function that takes a @code{char *} parameter. This option
5897 can be used to suppress such a warning.
5898
5899 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5900 @opindex Wno-discarded-array-qualifiers
5901 @opindex Wdiscarded-array-qualifiers
5902 Do not warn if type qualifiers on arrays which are pointer targets
5903 are being discarded. Typically, the compiler warns if a
5904 @code{const int (*)[]} variable is passed to a function that
5905 takes a @code{int (*)[]} parameter. This option can be used to
5906 suppress such a warning.
5907
5908 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5909 @opindex Wno-incompatible-pointer-types
5910 @opindex Wincompatible-pointer-types
5911 Do not warn when there is a conversion between pointers that have incompatible
5912 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5913 which warns for pointer argument passing or assignment with different
5914 signedness.
5915
5916 @item -Wno-int-conversion @r{(C and Objective-C only)}
5917 @opindex Wno-int-conversion
5918 @opindex Wint-conversion
5919 Do not warn about incompatible integer to pointer and pointer to integer
5920 conversions. This warning is about implicit conversions; for explicit
5921 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5922 @option{-Wno-pointer-to-int-cast} may be used.
5923
5924 @item -Wno-div-by-zero
5925 @opindex Wno-div-by-zero
5926 @opindex Wdiv-by-zero
5927 Do not warn about compile-time integer division by zero. Floating-point
5928 division by zero is not warned about, as it can be a legitimate way of
5929 obtaining infinities and NaNs.
5930
5931 @item -Wsystem-headers
5932 @opindex Wsystem-headers
5933 @opindex Wno-system-headers
5934 @cindex warnings from system headers
5935 @cindex system headers, warnings from
5936 Print warning messages for constructs found in system header files.
5937 Warnings from system headers are normally suppressed, on the assumption
5938 that they usually do not indicate real problems and would only make the
5939 compiler output harder to read. Using this command-line option tells
5940 GCC to emit warnings from system headers as if they occurred in user
5941 code. However, note that using @option{-Wall} in conjunction with this
5942 option does @emph{not} warn about unknown pragmas in system
5943 headers---for that, @option{-Wunknown-pragmas} must also be used.
5944
5945 @item -Wtautological-compare
5946 @opindex Wtautological-compare
5947 @opindex Wno-tautological-compare
5948 Warn if a self-comparison always evaluates to true or false. This
5949 warning detects various mistakes such as:
5950 @smallexample
5951 int i = 1;
5952 @dots{}
5953 if (i > i) @{ @dots{} @}
5954 @end smallexample
5955
5956 This warning also warns about bitwise comparisons that always evaluate
5957 to true or false, for instance:
5958 @smallexample
5959 if ((a & 16) == 10) @{ @dots{} @}
5960 @end smallexample
5961 will always be false.
5962
5963 This warning is enabled by @option{-Wall}.
5964
5965 @item -Wtrampolines
5966 @opindex Wtrampolines
5967 @opindex Wno-trampolines
5968 Warn about trampolines generated for pointers to nested functions.
5969 A trampoline is a small piece of data or code that is created at run
5970 time on the stack when the address of a nested function is taken, and is
5971 used to call the nested function indirectly. For some targets, it is
5972 made up of data only and thus requires no special treatment. But, for
5973 most targets, it is made up of code and thus requires the stack to be
5974 made executable in order for the program to work properly.
5975
5976 @item -Wfloat-equal
5977 @opindex Wfloat-equal
5978 @opindex Wno-float-equal
5979 Warn if floating-point values are used in equality comparisons.
5980
5981 The idea behind this is that sometimes it is convenient (for the
5982 programmer) to consider floating-point values as approximations to
5983 infinitely precise real numbers. If you are doing this, then you need
5984 to compute (by analyzing the code, or in some other way) the maximum or
5985 likely maximum error that the computation introduces, and allow for it
5986 when performing comparisons (and when producing output, but that's a
5987 different problem). In particular, instead of testing for equality, you
5988 should check to see whether the two values have ranges that overlap; and
5989 this is done with the relational operators, so equality comparisons are
5990 probably mistaken.
5991
5992 @item -Wtraditional @r{(C and Objective-C only)}
5993 @opindex Wtraditional
5994 @opindex Wno-traditional
5995 Warn about certain constructs that behave differently in traditional and
5996 ISO C@. Also warn about ISO C constructs that have no traditional C
5997 equivalent, and/or problematic constructs that should be avoided.
5998
5999 @itemize @bullet
6000 @item
6001 Macro parameters that appear within string literals in the macro body.
6002 In traditional C macro replacement takes place within string literals,
6003 but in ISO C it does not.
6004
6005 @item
6006 In traditional C, some preprocessor directives did not exist.
6007 Traditional preprocessors only considered a line to be a directive
6008 if the @samp{#} appeared in column 1 on the line. Therefore
6009 @option{-Wtraditional} warns about directives that traditional C
6010 understands but ignores because the @samp{#} does not appear as the
6011 first character on the line. It also suggests you hide directives like
6012 @code{#pragma} not understood by traditional C by indenting them. Some
6013 traditional implementations do not recognize @code{#elif}, so this option
6014 suggests avoiding it altogether.
6015
6016 @item
6017 A function-like macro that appears without arguments.
6018
6019 @item
6020 The unary plus operator.
6021
6022 @item
6023 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6024 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6025 constants.) Note, these suffixes appear in macros defined in the system
6026 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6027 Use of these macros in user code might normally lead to spurious
6028 warnings, however GCC's integrated preprocessor has enough context to
6029 avoid warning in these cases.
6030
6031 @item
6032 A function declared external in one block and then used after the end of
6033 the block.
6034
6035 @item
6036 A @code{switch} statement has an operand of type @code{long}.
6037
6038 @item
6039 A non-@code{static} function declaration follows a @code{static} one.
6040 This construct is not accepted by some traditional C compilers.
6041
6042 @item
6043 The ISO type of an integer constant has a different width or
6044 signedness from its traditional type. This warning is only issued if
6045 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6046 typically represent bit patterns, are not warned about.
6047
6048 @item
6049 Usage of ISO string concatenation is detected.
6050
6051 @item
6052 Initialization of automatic aggregates.
6053
6054 @item
6055 Identifier conflicts with labels. Traditional C lacks a separate
6056 namespace for labels.
6057
6058 @item
6059 Initialization of unions. If the initializer is zero, the warning is
6060 omitted. This is done under the assumption that the zero initializer in
6061 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6062 initializer warnings and relies on default initialization to zero in the
6063 traditional C case.
6064
6065 @item
6066 Conversions by prototypes between fixed/floating-point values and vice
6067 versa. The absence of these prototypes when compiling with traditional
6068 C causes serious problems. This is a subset of the possible
6069 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6070
6071 @item
6072 Use of ISO C style function definitions. This warning intentionally is
6073 @emph{not} issued for prototype declarations or variadic functions
6074 because these ISO C features appear in your code when using
6075 libiberty's traditional C compatibility macros, @code{PARAMS} and
6076 @code{VPARAMS}. This warning is also bypassed for nested functions
6077 because that feature is already a GCC extension and thus not relevant to
6078 traditional C compatibility.
6079 @end itemize
6080
6081 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6082 @opindex Wtraditional-conversion
6083 @opindex Wno-traditional-conversion
6084 Warn if a prototype causes a type conversion that is different from what
6085 would happen to the same argument in the absence of a prototype. This
6086 includes conversions of fixed point to floating and vice versa, and
6087 conversions changing the width or signedness of a fixed-point argument
6088 except when the same as the default promotion.
6089
6090 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6091 @opindex Wdeclaration-after-statement
6092 @opindex Wno-declaration-after-statement
6093 Warn when a declaration is found after a statement in a block. This
6094 construct, known from C++, was introduced with ISO C99 and is by default
6095 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6096
6097 @item -Wshadow
6098 @opindex Wshadow
6099 @opindex Wno-shadow
6100 Warn whenever a local variable or type declaration shadows another
6101 variable, parameter, type, class member (in C++), or instance variable
6102 (in Objective-C) or whenever a built-in function is shadowed. Note
6103 that in C++, the compiler warns if a local variable shadows an
6104 explicit typedef, but not if it shadows a struct/class/enum.
6105 Same as @option{-Wshadow=global}.
6106
6107 @item -Wno-shadow-ivar @r{(Objective-C only)}
6108 @opindex Wno-shadow-ivar
6109 @opindex Wshadow-ivar
6110 Do not warn whenever a local variable shadows an instance variable in an
6111 Objective-C method.
6112
6113 @item -Wshadow=global
6114 @opindex Wshadow=local
6115 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6116
6117 @item -Wshadow=local
6118 @opindex Wshadow=local
6119 Warn when a local variable shadows another local variable or parameter.
6120 This warning is enabled by @option{-Wshadow=global}.
6121
6122 @item -Wshadow=compatible-local
6123 @opindex Wshadow=compatible-local
6124 Warn when a local variable shadows another local variable or parameter
6125 whose type is compatible with that of the shadowing variable. In C++,
6126 type compatibility here means the type of the shadowing variable can be
6127 converted to that of the shadowed variable. The creation of this flag
6128 (in addition to @option{-Wshadow=local}) is based on the idea that when
6129 a local variable shadows another one of incompatible type, it is most
6130 likely intentional, not a bug or typo, as shown in the following example:
6131
6132 @smallexample
6133 @group
6134 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6135 @{
6136 for (int i = 0; i < N; ++i)
6137 @{
6138 ...
6139 @}
6140 ...
6141 @}
6142 @end group
6143 @end smallexample
6144
6145 Since the two variable @code{i} in the example above have incompatible types,
6146 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6147 Because their types are incompatible, if a programmer accidentally uses one
6148 in place of the other, type checking will catch that and emit an error or
6149 warning. So not warning (about shadowing) in this case will not lead to
6150 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6151 possibly reduce the number of warnings triggered by intentional shadowing.
6152
6153 This warning is enabled by @option{-Wshadow=local}.
6154
6155 @item -Wlarger-than=@var{byte-size}
6156 @opindex Wlarger-than=
6157 @opindex Wlarger-than-@var{byte-size}
6158 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6159 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6160 Warnings controlled by the option can be disabled either by specifying
6161 @var{byte-size} of @samp{SIZE_MAX} or more or by
6162 @option{-Wno-larger-than}.
6163
6164 @item -Wno-larger-than
6165 @opindex Wno-larger-than
6166 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6167 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6168
6169 @item -Wframe-larger-than=@var{byte-size}
6170 @opindex Wframe-larger-than=
6171 @opindex Wno-frame-larger-than
6172 Warn if the size of a function frame exceeds @var{byte-size}.
6173 The computation done to determine the stack frame size is approximate
6174 and not conservative.
6175 The actual requirements may be somewhat greater than @var{byte-size}
6176 even if you do not get a warning. In addition, any space allocated
6177 via @code{alloca}, variable-length arrays, or related constructs
6178 is not included by the compiler when determining
6179 whether or not to issue a warning.
6180 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6181 Warnings controlled by the option can be disabled either by specifying
6182 @var{byte-size} of @samp{SIZE_MAX} or more or by
6183 @option{-Wno-frame-larger-than}.
6184
6185 @item -Wno-frame-larger-than
6186 @opindex Wno-frame-larger-than
6187 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6188 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6189
6190 @item -Wno-free-nonheap-object
6191 @opindex Wno-free-nonheap-object
6192 @opindex Wfree-nonheap-object
6193 Do not warn when attempting to free an object that was not allocated
6194 on the heap.
6195
6196 @item -Wstack-usage=@var{byte-size}
6197 @opindex Wstack-usage
6198 @opindex Wno-stack-usage
6199 Warn if the stack usage of a function might exceed @var{byte-size}.
6200 The computation done to determine the stack usage is conservative.
6201 Any space allocated via @code{alloca}, variable-length arrays, or related
6202 constructs is included by the compiler when determining whether or not to
6203 issue a warning.
6204
6205 The message is in keeping with the output of @option{-fstack-usage}.
6206
6207 @itemize
6208 @item
6209 If the stack usage is fully static but exceeds the specified amount, it's:
6210
6211 @smallexample
6212 warning: stack usage is 1120 bytes
6213 @end smallexample
6214 @item
6215 If the stack usage is (partly) dynamic but bounded, it's:
6216
6217 @smallexample
6218 warning: stack usage might be 1648 bytes
6219 @end smallexample
6220 @item
6221 If the stack usage is (partly) dynamic and not bounded, it's:
6222
6223 @smallexample
6224 warning: stack usage might be unbounded
6225 @end smallexample
6226 @end itemize
6227
6228 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6229 Warnings controlled by the option can be disabled either by specifying
6230 @var{byte-size} of @samp{SIZE_MAX} or more or by
6231 @option{-Wno-stack-usage}.
6232
6233 @item -Wno-stack-usage
6234 @opindex Wno-stack-usage
6235 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6236 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6237
6238 @item -Wunsafe-loop-optimizations
6239 @opindex Wunsafe-loop-optimizations
6240 @opindex Wno-unsafe-loop-optimizations
6241 Warn if the loop cannot be optimized because the compiler cannot
6242 assume anything on the bounds of the loop indices. With
6243 @option{-funsafe-loop-optimizations} warn if the compiler makes
6244 such assumptions.
6245
6246 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6247 @opindex Wno-pedantic-ms-format
6248 @opindex Wpedantic-ms-format
6249 When used in combination with @option{-Wformat}
6250 and @option{-pedantic} without GNU extensions, this option
6251 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6252 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6253 which depend on the MS runtime.
6254
6255 @item -Waligned-new
6256 @opindex Waligned-new
6257 @opindex Wno-aligned-new
6258 Warn about a new-expression of a type that requires greater alignment
6259 than the @code{alignof(std::max_align_t)} but uses an allocation
6260 function without an explicit alignment parameter. This option is
6261 enabled by @option{-Wall}.
6262
6263 Normally this only warns about global allocation functions, but
6264 @option{-Waligned-new=all} also warns about class member allocation
6265 functions.
6266
6267 @item -Wplacement-new
6268 @itemx -Wplacement-new=@var{n}
6269 @opindex Wplacement-new
6270 @opindex Wno-placement-new
6271 Warn about placement new expressions with undefined behavior, such as
6272 constructing an object in a buffer that is smaller than the type of
6273 the object. For example, the placement new expression below is diagnosed
6274 because it attempts to construct an array of 64 integers in a buffer only
6275 64 bytes large.
6276 @smallexample
6277 char buf [64];
6278 new (buf) int[64];
6279 @end smallexample
6280 This warning is enabled by default.
6281
6282 @table @gcctabopt
6283 @item -Wplacement-new=1
6284 This is the default warning level of @option{-Wplacement-new}. At this
6285 level the warning is not issued for some strictly undefined constructs that
6286 GCC allows as extensions for compatibility with legacy code. For example,
6287 the following @code{new} expression is not diagnosed at this level even
6288 though it has undefined behavior according to the C++ standard because
6289 it writes past the end of the one-element array.
6290 @smallexample
6291 struct S @{ int n, a[1]; @};
6292 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6293 new (s->a)int [32]();
6294 @end smallexample
6295
6296 @item -Wplacement-new=2
6297 At this level, in addition to diagnosing all the same constructs as at level
6298 1, a diagnostic is also issued for placement new expressions that construct
6299 an object in the last member of structure whose type is an array of a single
6300 element and whose size is less than the size of the object being constructed.
6301 While the previous example would be diagnosed, the following construct makes
6302 use of the flexible member array extension to avoid the warning at level 2.
6303 @smallexample
6304 struct S @{ int n, a[]; @};
6305 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6306 new (s->a)int [32]();
6307 @end smallexample
6308
6309 @end table
6310
6311 @item -Wpointer-arith
6312 @opindex Wpointer-arith
6313 @opindex Wno-pointer-arith
6314 Warn about anything that depends on the ``size of'' a function type or
6315 of @code{void}. GNU C assigns these types a size of 1, for
6316 convenience in calculations with @code{void *} pointers and pointers
6317 to functions. In C++, warn also when an arithmetic operation involves
6318 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6319
6320 @item -Wpointer-compare
6321 @opindex Wpointer-compare
6322 @opindex Wno-pointer-compare
6323 Warn if a pointer is compared with a zero character constant. This usually
6324 means that the pointer was meant to be dereferenced. For example:
6325
6326 @smallexample
6327 const char *p = foo ();
6328 if (p == '\0')
6329 return 42;
6330 @end smallexample
6331
6332 Note that the code above is invalid in C++11.
6333
6334 This warning is enabled by default.
6335
6336 @item -Wtype-limits
6337 @opindex Wtype-limits
6338 @opindex Wno-type-limits
6339 Warn if a comparison is always true or always false due to the limited
6340 range of the data type, but do not warn for constant expressions. For
6341 example, warn if an unsigned variable is compared against zero with
6342 @code{<} or @code{>=}. This warning is also enabled by
6343 @option{-Wextra}.
6344
6345 @item -Wabsolute-value @r{(C and Objective-C only)}
6346 @opindex Wabsolute-value
6347 @opindex Wno-absolute-value
6348 Warn when a wrong absolute value function seems to be used or when it
6349 does not have any effect because its argument is an unsigned type.
6350 This warning be suppressed with an explicit type cast and it is also
6351 enabled by @option{-Wextra}.
6352
6353 @include cppwarnopts.texi
6354
6355 @item -Wbad-function-cast @r{(C and Objective-C only)}
6356 @opindex Wbad-function-cast
6357 @opindex Wno-bad-function-cast
6358 Warn when a function call is cast to a non-matching type.
6359 For example, warn if a call to a function returning an integer type
6360 is cast to a pointer type.
6361
6362 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6363 @opindex Wc90-c99-compat
6364 @opindex Wno-c90-c99-compat
6365 Warn about features not present in ISO C90, but present in ISO C99.
6366 For instance, warn about use of variable length arrays, @code{long long}
6367 type, @code{bool} type, compound literals, designated initializers, and so
6368 on. This option is independent of the standards mode. Warnings are disabled
6369 in the expression that follows @code{__extension__}.
6370
6371 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6372 @opindex Wc99-c11-compat
6373 @opindex Wno-c99-c11-compat
6374 Warn about features not present in ISO C99, but present in ISO C11.
6375 For instance, warn about use of anonymous structures and unions,
6376 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6377 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6378 and so on. This option is independent of the standards mode. Warnings are
6379 disabled in the expression that follows @code{__extension__}.
6380
6381 @item -Wc++-compat @r{(C and Objective-C only)}
6382 @opindex Wc++-compat
6383 @opindex Wno-c++-compat
6384 Warn about ISO C constructs that are outside of the common subset of
6385 ISO C and ISO C++, e.g.@: request for implicit conversion from
6386 @code{void *} to a pointer to non-@code{void} type.
6387
6388 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6389 @opindex Wc++11-compat
6390 @opindex Wno-c++11-compat
6391 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6392 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6393 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6394 enabled by @option{-Wall}.
6395
6396 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6397 @opindex Wc++14-compat
6398 @opindex Wno-c++14-compat
6399 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6400 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6401
6402 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6403 @opindex Wc++17-compat
6404 @opindex Wno-c++17-compat
6405 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6406 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6407
6408 @item -Wcast-qual
6409 @opindex Wcast-qual
6410 @opindex Wno-cast-qual
6411 Warn whenever a pointer is cast so as to remove a type qualifier from
6412 the target type. For example, warn if a @code{const char *} is cast
6413 to an ordinary @code{char *}.
6414
6415 Also warn when making a cast that introduces a type qualifier in an
6416 unsafe way. For example, casting @code{char **} to @code{const char **}
6417 is unsafe, as in this example:
6418
6419 @smallexample
6420 /* p is char ** value. */
6421 const char **q = (const char **) p;
6422 /* Assignment of readonly string to const char * is OK. */
6423 *q = "string";
6424 /* Now char** pointer points to read-only memory. */
6425 **p = 'b';
6426 @end smallexample
6427
6428 @item -Wcast-align
6429 @opindex Wcast-align
6430 @opindex Wno-cast-align
6431 Warn whenever a pointer is cast such that the required alignment of the
6432 target is increased. For example, warn if a @code{char *} is cast to
6433 an @code{int *} on machines where integers can only be accessed at
6434 two- or four-byte boundaries.
6435
6436 @item -Wcast-align=strict
6437 @opindex Wcast-align=strict
6438 Warn whenever a pointer is cast such that the required alignment of the
6439 target is increased. For example, warn if a @code{char *} is cast to
6440 an @code{int *} regardless of the target machine.
6441
6442 @item -Wcast-function-type
6443 @opindex Wcast-function-type
6444 @opindex Wno-cast-function-type
6445 Warn when a function pointer is cast to an incompatible function pointer.
6446 In a cast involving function types with a variable argument list only
6447 the types of initial arguments that are provided are considered.
6448 Any parameter of pointer-type matches any other pointer-type. Any benign
6449 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6450 on ILP32 targets. Likewise type qualifiers are ignored. The function
6451 type @code{void (*) (void)} is special and matches everything, which can
6452 be used to suppress this warning.
6453 In a cast involving pointer to member types this warning warns whenever
6454 the type cast is changing the pointer to member type.
6455 This warning is enabled by @option{-Wextra}.
6456
6457 @item -Wwrite-strings
6458 @opindex Wwrite-strings
6459 @opindex Wno-write-strings
6460 When compiling C, give string constants the type @code{const
6461 char[@var{length}]} so that copying the address of one into a
6462 non-@code{const} @code{char *} pointer produces a warning. These
6463 warnings help you find at compile time code that can try to write
6464 into a string constant, but only if you have been very careful about
6465 using @code{const} in declarations and prototypes. Otherwise, it is
6466 just a nuisance. This is why we did not make @option{-Wall} request
6467 these warnings.
6468
6469 When compiling C++, warn about the deprecated conversion from string
6470 literals to @code{char *}. This warning is enabled by default for C++
6471 programs.
6472
6473 @item -Wcatch-value
6474 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6475 @opindex Wcatch-value
6476 @opindex Wno-catch-value
6477 Warn about catch handlers that do not catch via reference.
6478 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6479 warn about polymorphic class types that are caught by value.
6480 With @option{-Wcatch-value=2} warn about all class types that are caught
6481 by value. With @option{-Wcatch-value=3} warn about all types that are
6482 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6483
6484 @item -Wclobbered
6485 @opindex Wclobbered
6486 @opindex Wno-clobbered
6487 Warn for variables that might be changed by @code{longjmp} or
6488 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6489
6490 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6491 @opindex Wconditionally-supported
6492 @opindex Wno-conditionally-supported
6493 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6494
6495 @item -Wconversion
6496 @opindex Wconversion
6497 @opindex Wno-conversion
6498 Warn for implicit conversions that may alter a value. This includes
6499 conversions between real and integer, like @code{abs (x)} when
6500 @code{x} is @code{double}; conversions between signed and unsigned,
6501 like @code{unsigned ui = -1}; and conversions to smaller types, like
6502 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6503 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6504 changed by the conversion like in @code{abs (2.0)}. Warnings about
6505 conversions between signed and unsigned integers can be disabled by
6506 using @option{-Wno-sign-conversion}.
6507
6508 For C++, also warn for confusing overload resolution for user-defined
6509 conversions; and conversions that never use a type conversion
6510 operator: conversions to @code{void}, the same type, a base class or a
6511 reference to them. Warnings about conversions between signed and
6512 unsigned integers are disabled by default in C++ unless
6513 @option{-Wsign-conversion} is explicitly enabled.
6514
6515 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6516 @opindex Wconversion-null
6517 @opindex Wno-conversion-null
6518 Do not warn for conversions between @code{NULL} and non-pointer
6519 types. @option{-Wconversion-null} is enabled by default.
6520
6521 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6522 @opindex Wzero-as-null-pointer-constant
6523 @opindex Wno-zero-as-null-pointer-constant
6524 Warn when a literal @samp{0} is used as null pointer constant. This can
6525 be useful to facilitate the conversion to @code{nullptr} in C++11.
6526
6527 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6528 @opindex Wsubobject-linkage
6529 @opindex Wno-subobject-linkage
6530 Warn if a class type has a base or a field whose type uses the anonymous
6531 namespace or depends on a type with no linkage. If a type A depends on
6532 a type B with no or internal linkage, defining it in multiple
6533 translation units would be an ODR violation because the meaning of B
6534 is different in each translation unit. If A only appears in a single
6535 translation unit, the best way to silence the warning is to give it
6536 internal linkage by putting it in an anonymous namespace as well. The
6537 compiler doesn't give this warning for types defined in the main .C
6538 file, as those are unlikely to have multiple definitions.
6539 @option{-Wsubobject-linkage} is enabled by default.
6540
6541 @item -Wdangling-else
6542 @opindex Wdangling-else
6543 @opindex Wno-dangling-else
6544 Warn about constructions where there may be confusion to which
6545 @code{if} statement an @code{else} branch belongs. Here is an example of
6546 such a case:
6547
6548 @smallexample
6549 @group
6550 @{
6551 if (a)
6552 if (b)
6553 foo ();
6554 else
6555 bar ();
6556 @}
6557 @end group
6558 @end smallexample
6559
6560 In C/C++, every @code{else} branch belongs to the innermost possible
6561 @code{if} statement, which in this example is @code{if (b)}. This is
6562 often not what the programmer expected, as illustrated in the above
6563 example by indentation the programmer chose. When there is the
6564 potential for this confusion, GCC issues a warning when this flag
6565 is specified. To eliminate the warning, add explicit braces around
6566 the innermost @code{if} statement so there is no way the @code{else}
6567 can belong to the enclosing @code{if}. The resulting code
6568 looks like this:
6569
6570 @smallexample
6571 @group
6572 @{
6573 if (a)
6574 @{
6575 if (b)
6576 foo ();
6577 else
6578 bar ();
6579 @}
6580 @}
6581 @end group
6582 @end smallexample
6583
6584 This warning is enabled by @option{-Wparentheses}.
6585
6586 @item -Wdate-time
6587 @opindex Wdate-time
6588 @opindex Wno-date-time
6589 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6590 are encountered as they might prevent bit-wise-identical reproducible
6591 compilations.
6592
6593 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6594 @opindex Wdelete-incomplete
6595 @opindex Wno-delete-incomplete
6596 Warn when deleting a pointer to incomplete type, which may cause
6597 undefined behavior at runtime. This warning is enabled by default.
6598
6599 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6600 @opindex Wuseless-cast
6601 @opindex Wno-useless-cast
6602 Warn when an expression is casted to its own type.
6603
6604 @item -Wempty-body
6605 @opindex Wempty-body
6606 @opindex Wno-empty-body
6607 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6608 while} statement. This warning is also enabled by @option{-Wextra}.
6609
6610 @item -Wenum-compare
6611 @opindex Wenum-compare
6612 @opindex Wno-enum-compare
6613 Warn about a comparison between values of different enumerated types.
6614 In C++ enumerated type mismatches in conditional expressions are also
6615 diagnosed and the warning is enabled by default. In C this warning is
6616 enabled by @option{-Wall}.
6617
6618 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6619 @opindex Wextra-semi
6620 @opindex Wno-extra-semi
6621 Warn about redundant semicolon after in-class function definition.
6622
6623 @item -Wjump-misses-init @r{(C, Objective-C only)}
6624 @opindex Wjump-misses-init
6625 @opindex Wno-jump-misses-init
6626 Warn if a @code{goto} statement or a @code{switch} statement jumps
6627 forward across the initialization of a variable, or jumps backward to a
6628 label after the variable has been initialized. This only warns about
6629 variables that are initialized when they are declared. This warning is
6630 only supported for C and Objective-C; in C++ this sort of branch is an
6631 error in any case.
6632
6633 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6634 can be disabled with the @option{-Wno-jump-misses-init} option.
6635
6636 @item -Wsign-compare
6637 @opindex Wsign-compare
6638 @opindex Wno-sign-compare
6639 @cindex warning for comparison of signed and unsigned values
6640 @cindex comparison of signed and unsigned values, warning
6641 @cindex signed and unsigned values, comparison warning
6642 Warn when a comparison between signed and unsigned values could produce
6643 an incorrect result when the signed value is converted to unsigned.
6644 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6645 also enabled by @option{-Wextra}.
6646
6647 @item -Wsign-conversion
6648 @opindex Wsign-conversion
6649 @opindex Wno-sign-conversion
6650 Warn for implicit conversions that may change the sign of an integer
6651 value, like assigning a signed integer expression to an unsigned
6652 integer variable. An explicit cast silences the warning. In C, this
6653 option is enabled also by @option{-Wconversion}.
6654
6655 @item -Wfloat-conversion
6656 @opindex Wfloat-conversion
6657 @opindex Wno-float-conversion
6658 Warn for implicit conversions that reduce the precision of a real value.
6659 This includes conversions from real to integer, and from higher precision
6660 real to lower precision real values. This option is also enabled by
6661 @option{-Wconversion}.
6662
6663 @item -Wno-scalar-storage-order
6664 @opindex Wno-scalar-storage-order
6665 @opindex Wscalar-storage-order
6666 Do not warn on suspicious constructs involving reverse scalar storage order.
6667
6668 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6669 @opindex Wsized-deallocation
6670 @opindex Wno-sized-deallocation
6671 Warn about a definition of an unsized deallocation function
6672 @smallexample
6673 void operator delete (void *) noexcept;
6674 void operator delete[] (void *) noexcept;
6675 @end smallexample
6676 without a definition of the corresponding sized deallocation function
6677 @smallexample
6678 void operator delete (void *, std::size_t) noexcept;
6679 void operator delete[] (void *, std::size_t) noexcept;
6680 @end smallexample
6681 or vice versa. Enabled by @option{-Wextra} along with
6682 @option{-fsized-deallocation}.
6683
6684 @item -Wsizeof-pointer-div
6685 @opindex Wsizeof-pointer-div
6686 @opindex Wno-sizeof-pointer-div
6687 Warn for suspicious divisions of two sizeof expressions that divide
6688 the pointer size by the element size, which is the usual way to compute
6689 the array size but won't work out correctly with pointers. This warning
6690 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6691 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6692
6693 @item -Wsizeof-pointer-memaccess
6694 @opindex Wsizeof-pointer-memaccess
6695 @opindex Wno-sizeof-pointer-memaccess
6696 Warn for suspicious length parameters to certain string and memory built-in
6697 functions if the argument uses @code{sizeof}. This warning triggers for
6698 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6699 an array, but a pointer, and suggests a possible fix, or about
6700 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6701 also warns about calls to bounded string copy functions like @code{strncat}
6702 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6703 the source array. For example, in the following function the call to
6704 @code{strncat} specifies the size of the source string as the bound. That
6705 is almost certainly a mistake and so the call is diagnosed.
6706 @smallexample
6707 void make_file (const char *name)
6708 @{
6709 char path[PATH_MAX];
6710 strncpy (path, name, sizeof path - 1);
6711 strncat (path, ".text", sizeof ".text");
6712 @dots{}
6713 @}
6714 @end smallexample
6715
6716 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6717
6718 @item -Wsizeof-array-argument
6719 @opindex Wsizeof-array-argument
6720 @opindex Wno-sizeof-array-argument
6721 Warn when the @code{sizeof} operator is applied to a parameter that is
6722 declared as an array in a function definition. This warning is enabled by
6723 default for C and C++ programs.
6724
6725 @item -Wmemset-elt-size
6726 @opindex Wmemset-elt-size
6727 @opindex Wno-memset-elt-size
6728 Warn for suspicious calls to the @code{memset} built-in function, if the
6729 first argument references an array, and the third argument is a number
6730 equal to the number of elements, but not equal to the size of the array
6731 in memory. This indicates that the user has omitted a multiplication by
6732 the element size. This warning is enabled by @option{-Wall}.
6733
6734 @item -Wmemset-transposed-args
6735 @opindex Wmemset-transposed-args
6736 @opindex Wno-memset-transposed-args
6737 Warn for suspicious calls to the @code{memset} built-in function, if the
6738 second argument is not zero and the third argument is zero. This warns e.g.@:
6739 about @code{memset (buf, sizeof buf, 0)} where most probably
6740 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6741 is only emitted if the third argument is literal zero. If it is some
6742 expression that is folded to zero, a cast of zero to some type, etc.,
6743 it is far less likely that the user has mistakenly exchanged the arguments
6744 and no warning is emitted. This warning is enabled by @option{-Wall}.
6745
6746 @item -Waddress
6747 @opindex Waddress
6748 @opindex Wno-address
6749 Warn about suspicious uses of memory addresses. These include using
6750 the address of a function in a conditional expression, such as
6751 @code{void func(void); if (func)}, and comparisons against the memory
6752 address of a string literal, such as @code{if (x == "abc")}. Such
6753 uses typically indicate a programmer error: the address of a function
6754 always evaluates to true, so their use in a conditional usually
6755 indicate that the programmer forgot the parentheses in a function
6756 call; and comparisons against string literals result in unspecified
6757 behavior and are not portable in C, so they usually indicate that the
6758 programmer intended to use @code{strcmp}. This warning is enabled by
6759 @option{-Wall}.
6760
6761 @item -Wlogical-op
6762 @opindex Wlogical-op
6763 @opindex Wno-logical-op
6764 Warn about suspicious uses of logical operators in expressions.
6765 This includes using logical operators in contexts where a
6766 bit-wise operator is likely to be expected. Also warns when
6767 the operands of a logical operator are the same:
6768 @smallexample
6769 extern int a;
6770 if (a < 0 && a < 0) @{ @dots{} @}
6771 @end smallexample
6772
6773 @item -Wlogical-not-parentheses
6774 @opindex Wlogical-not-parentheses
6775 @opindex Wno-logical-not-parentheses
6776 Warn about logical not used on the left hand side operand of a comparison.
6777 This option does not warn if the right operand is considered to be a boolean
6778 expression. Its purpose is to detect suspicious code like the following:
6779 @smallexample
6780 int a;
6781 @dots{}
6782 if (!a > 1) @{ @dots{} @}
6783 @end smallexample
6784
6785 It is possible to suppress the warning by wrapping the LHS into
6786 parentheses:
6787 @smallexample
6788 if ((!a) > 1) @{ @dots{} @}
6789 @end smallexample
6790
6791 This warning is enabled by @option{-Wall}.
6792
6793 @item -Waggregate-return
6794 @opindex Waggregate-return
6795 @opindex Wno-aggregate-return
6796 Warn if any functions that return structures or unions are defined or
6797 called. (In languages where you can return an array, this also elicits
6798 a warning.)
6799
6800 @item -Wno-aggressive-loop-optimizations
6801 @opindex Wno-aggressive-loop-optimizations
6802 @opindex Waggressive-loop-optimizations
6803 Warn if in a loop with constant number of iterations the compiler detects
6804 undefined behavior in some statement during one or more of the iterations.
6805
6806 @item -Wno-attributes
6807 @opindex Wno-attributes
6808 @opindex Wattributes
6809 Do not warn if an unexpected @code{__attribute__} is used, such as
6810 unrecognized attributes, function attributes applied to variables,
6811 etc. This does not stop errors for incorrect use of supported
6812 attributes.
6813
6814 @item -Wno-builtin-declaration-mismatch
6815 @opindex Wno-builtin-declaration-mismatch
6816 @opindex Wbuiltin-declaration-mismatch
6817 Warn if a built-in function is declared with the wrong signature or
6818 as non-function.
6819 This warning is enabled by default.
6820
6821 @item -Wno-builtin-macro-redefined
6822 @opindex Wno-builtin-macro-redefined
6823 @opindex Wbuiltin-macro-redefined
6824 Do not warn if certain built-in macros are redefined. This suppresses
6825 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6826 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6827
6828 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6829 @opindex Wstrict-prototypes
6830 @opindex Wno-strict-prototypes
6831 Warn if a function is declared or defined without specifying the
6832 argument types. (An old-style function definition is permitted without
6833 a warning if preceded by a declaration that specifies the argument
6834 types.)
6835
6836 @item -Wold-style-declaration @r{(C and Objective-C only)}
6837 @opindex Wold-style-declaration
6838 @opindex Wno-old-style-declaration
6839 Warn for obsolescent usages, according to the C Standard, in a
6840 declaration. For example, warn if storage-class specifiers like
6841 @code{static} are not the first things in a declaration. This warning
6842 is also enabled by @option{-Wextra}.
6843
6844 @item -Wold-style-definition @r{(C and Objective-C only)}
6845 @opindex Wold-style-definition
6846 @opindex Wno-old-style-definition
6847 Warn if an old-style function definition is used. A warning is given
6848 even if there is a previous prototype.
6849
6850 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6851 @opindex Wmissing-parameter-type
6852 @opindex Wno-missing-parameter-type
6853 A function parameter is declared without a type specifier in K&R-style
6854 functions:
6855
6856 @smallexample
6857 void foo(bar) @{ @}
6858 @end smallexample
6859
6860 This warning is also enabled by @option{-Wextra}.
6861
6862 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6863 @opindex Wmissing-prototypes
6864 @opindex Wno-missing-prototypes
6865 Warn if a global function is defined without a previous prototype
6866 declaration. This warning is issued even if the definition itself
6867 provides a prototype. Use this option to detect global functions
6868 that do not have a matching prototype declaration in a header file.
6869 This option is not valid for C++ because all function declarations
6870 provide prototypes and a non-matching declaration declares an
6871 overload rather than conflict with an earlier declaration.
6872 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6873
6874 @item -Wmissing-declarations
6875 @opindex Wmissing-declarations
6876 @opindex Wno-missing-declarations
6877 Warn if a global function is defined without a previous declaration.
6878 Do so even if the definition itself provides a prototype.
6879 Use this option to detect global functions that are not declared in
6880 header files. In C, no warnings are issued for functions with previous
6881 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6882 missing prototypes. In C++, no warnings are issued for function templates,
6883 or for inline functions, or for functions in anonymous namespaces.
6884
6885 @item -Wmissing-field-initializers
6886 @opindex Wmissing-field-initializers
6887 @opindex Wno-missing-field-initializers
6888 @opindex W
6889 @opindex Wextra
6890 @opindex Wno-extra
6891 Warn if a structure's initializer has some fields missing. For
6892 example, the following code causes such a warning, because
6893 @code{x.h} is implicitly zero:
6894
6895 @smallexample
6896 struct s @{ int f, g, h; @};
6897 struct s x = @{ 3, 4 @};
6898 @end smallexample
6899
6900 This option does not warn about designated initializers, so the following
6901 modification does not trigger a warning:
6902
6903 @smallexample
6904 struct s @{ int f, g, h; @};
6905 struct s x = @{ .f = 3, .g = 4 @};
6906 @end smallexample
6907
6908 In C this option does not warn about the universal zero initializer
6909 @samp{@{ 0 @}}:
6910
6911 @smallexample
6912 struct s @{ int f, g, h; @};
6913 struct s x = @{ 0 @};
6914 @end smallexample
6915
6916 Likewise, in C++ this option does not warn about the empty @{ @}
6917 initializer, for example:
6918
6919 @smallexample
6920 struct s @{ int f, g, h; @};
6921 s x = @{ @};
6922 @end smallexample
6923
6924 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6925 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6926
6927 @item -Wno-multichar
6928 @opindex Wno-multichar
6929 @opindex Wmultichar
6930 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6931 Usually they indicate a typo in the user's code, as they have
6932 implementation-defined values, and should not be used in portable code.
6933
6934 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6935 @opindex Wnormalized=
6936 @opindex Wnormalized
6937 @opindex Wno-normalized
6938 @cindex NFC
6939 @cindex NFKC
6940 @cindex character set, input normalization
6941 In ISO C and ISO C++, two identifiers are different if they are
6942 different sequences of characters. However, sometimes when characters
6943 outside the basic ASCII character set are used, you can have two
6944 different character sequences that look the same. To avoid confusion,
6945 the ISO 10646 standard sets out some @dfn{normalization rules} which
6946 when applied ensure that two sequences that look the same are turned into
6947 the same sequence. GCC can warn you if you are using identifiers that
6948 have not been normalized; this option controls that warning.
6949
6950 There are four levels of warning supported by GCC@. The default is
6951 @option{-Wnormalized=nfc}, which warns about any identifier that is
6952 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6953 recommended form for most uses. It is equivalent to
6954 @option{-Wnormalized}.
6955
6956 Unfortunately, there are some characters allowed in identifiers by
6957 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6958 identifiers. That is, there's no way to use these symbols in portable
6959 ISO C or C++ and have all your identifiers in NFC@.
6960 @option{-Wnormalized=id} suppresses the warning for these characters.
6961 It is hoped that future versions of the standards involved will correct
6962 this, which is why this option is not the default.
6963
6964 You can switch the warning off for all characters by writing
6965 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6966 only do this if you are using some other normalization scheme (like
6967 ``D''), because otherwise you can easily create bugs that are
6968 literally impossible to see.
6969
6970 Some characters in ISO 10646 have distinct meanings but look identical
6971 in some fonts or display methodologies, especially once formatting has
6972 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6973 LETTER N'', displays just like a regular @code{n} that has been
6974 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6975 normalization scheme to convert all these into a standard form as
6976 well, and GCC warns if your code is not in NFKC if you use
6977 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6978 about every identifier that contains the letter O because it might be
6979 confused with the digit 0, and so is not the default, but may be
6980 useful as a local coding convention if the programming environment
6981 cannot be fixed to display these characters distinctly.
6982
6983 @item -Wno-attribute-warning
6984 @opindex Wno-attribute-warning
6985 @opindex Wattribute-warning
6986 Do not warn about usage of functions (@pxref{Function Attributes})
6987 declared with @code{warning} attribute. By default, this warning is
6988 enabled. @option{-Wno-attribute-warning} can be used to disable the
6989 warning or @option{-Wno-error=attribute-warning} can be used to
6990 disable the error when compiled with @option{-Werror} flag.
6991
6992 @item -Wno-deprecated
6993 @opindex Wno-deprecated
6994 @opindex Wdeprecated
6995 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6996
6997 @item -Wno-deprecated-declarations
6998 @opindex Wno-deprecated-declarations
6999 @opindex Wdeprecated-declarations
7000 Do not warn about uses of functions (@pxref{Function Attributes}),
7001 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7002 Attributes}) marked as deprecated by using the @code{deprecated}
7003 attribute.
7004
7005 @item -Wno-overflow
7006 @opindex Wno-overflow
7007 @opindex Woverflow
7008 Do not warn about compile-time overflow in constant expressions.
7009
7010 @item -Wno-odr
7011 @opindex Wno-odr
7012 @opindex Wodr
7013 Warn about One Definition Rule violations during link-time optimization.
7014 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
7015
7016 @item -Wopenmp-simd
7017 @opindex Wopenmp-simd
7018 @opindex Wno-openmp-simd
7019 Warn if the vectorizer cost model overrides the OpenMP
7020 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7021 option can be used to relax the cost model.
7022
7023 @item -Woverride-init @r{(C and Objective-C only)}
7024 @opindex Woverride-init
7025 @opindex Wno-override-init
7026 @opindex W
7027 @opindex Wextra
7028 @opindex Wno-extra
7029 Warn if an initialized field without side effects is overridden when
7030 using designated initializers (@pxref{Designated Inits, , Designated
7031 Initializers}).
7032
7033 This warning is included in @option{-Wextra}. To get other
7034 @option{-Wextra} warnings without this one, use @option{-Wextra
7035 -Wno-override-init}.
7036
7037 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7038 @opindex Woverride-init-side-effects
7039 @opindex Wno-override-init-side-effects
7040 Warn if an initialized field with side effects is overridden when
7041 using designated initializers (@pxref{Designated Inits, , Designated
7042 Initializers}). This warning is enabled by default.
7043
7044 @item -Wpacked
7045 @opindex Wpacked
7046 @opindex Wno-packed
7047 Warn if a structure is given the packed attribute, but the packed
7048 attribute has no effect on the layout or size of the structure.
7049 Such structures may be mis-aligned for little benefit. For
7050 instance, in this code, the variable @code{f.x} in @code{struct bar}
7051 is misaligned even though @code{struct bar} does not itself
7052 have the packed attribute:
7053
7054 @smallexample
7055 @group
7056 struct foo @{
7057 int x;
7058 char a, b, c, d;
7059 @} __attribute__((packed));
7060 struct bar @{
7061 char z;
7062 struct foo f;
7063 @};
7064 @end group
7065 @end smallexample
7066
7067 @item -Wpacked-bitfield-compat
7068 @opindex Wpacked-bitfield-compat
7069 @opindex Wno-packed-bitfield-compat
7070 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7071 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7072 the change can lead to differences in the structure layout. GCC
7073 informs you when the offset of such a field has changed in GCC 4.4.
7074 For example there is no longer a 4-bit padding between field @code{a}
7075 and @code{b} in this structure:
7076
7077 @smallexample
7078 struct foo
7079 @{
7080 char a:4;
7081 char b:8;
7082 @} __attribute__ ((packed));
7083 @end smallexample
7084
7085 This warning is enabled by default. Use
7086 @option{-Wno-packed-bitfield-compat} to disable this warning.
7087
7088 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7089 @opindex Wpacked-not-aligned
7090 @opindex Wno-packed-not-aligned
7091 Warn if a structure field with explicitly specified alignment in a
7092 packed struct or union is misaligned. For example, a warning will
7093 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7094 'struct S' is less than 8}, in this code:
7095
7096 @smallexample
7097 @group
7098 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7099 struct __attribute__ ((packed)) S @{
7100 struct S8 s8;
7101 @};
7102 @end group
7103 @end smallexample
7104
7105 This warning is enabled by @option{-Wall}.
7106
7107 @item -Wpadded
7108 @opindex Wpadded
7109 @opindex Wno-padded
7110 Warn if padding is included in a structure, either to align an element
7111 of the structure or to align the whole structure. Sometimes when this
7112 happens it is possible to rearrange the fields of the structure to
7113 reduce the padding and so make the structure smaller.
7114
7115 @item -Wredundant-decls
7116 @opindex Wredundant-decls
7117 @opindex Wno-redundant-decls
7118 Warn if anything is declared more than once in the same scope, even in
7119 cases where multiple declaration is valid and changes nothing.
7120
7121 @item -Wno-restrict
7122 @opindex Wrestrict
7123 @opindex Wno-restrict
7124 Warn when an object referenced by a @code{restrict}-qualified parameter
7125 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7126 argument, or when copies between such objects overlap. For example,
7127 the call to the @code{strcpy} function below attempts to truncate the string
7128 by replacing its initial characters with the last four. However, because
7129 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7130 the call is diagnosed.
7131
7132 @smallexample
7133 void foo (void)
7134 @{
7135 char a[] = "abcd1234";
7136 strcpy (a, a + 4);
7137 @dots{}
7138 @}
7139 @end smallexample
7140 The @option{-Wrestrict} option detects some instances of simple overlap
7141 even without optimization but works best at @option{-O2} and above. It
7142 is included in @option{-Wall}.
7143
7144 @item -Wnested-externs @r{(C and Objective-C only)}
7145 @opindex Wnested-externs
7146 @opindex Wno-nested-externs
7147 Warn if an @code{extern} declaration is encountered within a function.
7148
7149 @item -Wno-inherited-variadic-ctor
7150 @opindex Winherited-variadic-ctor
7151 @opindex Wno-inherited-variadic-ctor
7152 Suppress warnings about use of C++11 inheriting constructors when the
7153 base class inherited from has a C variadic constructor; the warning is
7154 on by default because the ellipsis is not inherited.
7155
7156 @item -Winline
7157 @opindex Winline
7158 @opindex Wno-inline
7159 Warn if a function that is declared as inline cannot be inlined.
7160 Even with this option, the compiler does not warn about failures to
7161 inline functions declared in system headers.
7162
7163 The compiler uses a variety of heuristics to determine whether or not
7164 to inline a function. For example, the compiler takes into account
7165 the size of the function being inlined and the amount of inlining
7166 that has already been done in the current function. Therefore,
7167 seemingly insignificant changes in the source program can cause the
7168 warnings produced by @option{-Winline} to appear or disappear.
7169
7170 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7171 @opindex Wno-invalid-offsetof
7172 @opindex Winvalid-offsetof
7173 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7174 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7175 to a non-standard-layout type is undefined. In existing C++ implementations,
7176 however, @code{offsetof} typically gives meaningful results.
7177 This flag is for users who are aware that they are
7178 writing nonportable code and who have deliberately chosen to ignore the
7179 warning about it.
7180
7181 The restrictions on @code{offsetof} may be relaxed in a future version
7182 of the C++ standard.
7183
7184 @item -Wint-in-bool-context
7185 @opindex Wint-in-bool-context
7186 @opindex Wno-int-in-bool-context
7187 Warn for suspicious use of integer values where boolean values are expected,
7188 such as conditional expressions (?:) using non-boolean integer constants in
7189 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7190 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7191 for all kinds of multiplications regardless of the data type.
7192 This warning is enabled by @option{-Wall}.
7193
7194 @item -Wno-int-to-pointer-cast
7195 @opindex Wno-int-to-pointer-cast
7196 @opindex Wint-to-pointer-cast
7197 Suppress warnings from casts to pointer type of an integer of a
7198 different size. In C++, casting to a pointer type of smaller size is
7199 an error. @option{Wint-to-pointer-cast} is enabled by default.
7200
7201
7202 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7203 @opindex Wno-pointer-to-int-cast
7204 @opindex Wpointer-to-int-cast
7205 Suppress warnings from casts from a pointer to an integer type of a
7206 different size.
7207
7208 @item -Winvalid-pch
7209 @opindex Winvalid-pch
7210 @opindex Wno-invalid-pch
7211 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7212 the search path but cannot be used.
7213
7214 @item -Wlong-long
7215 @opindex Wlong-long
7216 @opindex Wno-long-long
7217 Warn if @code{long long} type is used. This is enabled by either
7218 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7219 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7220
7221 @item -Wvariadic-macros
7222 @opindex Wvariadic-macros
7223 @opindex Wno-variadic-macros
7224 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7225 alternate syntax is used in ISO C99 mode. This is enabled by either
7226 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7227 messages, use @option{-Wno-variadic-macros}.
7228
7229 @item -Wvarargs
7230 @opindex Wvarargs
7231 @opindex Wno-varargs
7232 Warn upon questionable usage of the macros used to handle variable
7233 arguments like @code{va_start}. This is default. To inhibit the
7234 warning messages, use @option{-Wno-varargs}.
7235
7236 @item -Wvector-operation-performance
7237 @opindex Wvector-operation-performance
7238 @opindex Wno-vector-operation-performance
7239 Warn if vector operation is not implemented via SIMD capabilities of the
7240 architecture. Mainly useful for the performance tuning.
7241 Vector operation can be implemented @code{piecewise}, which means that the
7242 scalar operation is performed on every vector element;
7243 @code{in parallel}, which means that the vector operation is implemented
7244 using scalars of wider type, which normally is more performance efficient;
7245 and @code{as a single scalar}, which means that vector fits into a
7246 scalar type.
7247
7248 @item -Wno-virtual-move-assign
7249 @opindex Wvirtual-move-assign
7250 @opindex Wno-virtual-move-assign
7251 Suppress warnings about inheriting from a virtual base with a
7252 non-trivial C++11 move assignment operator. This is dangerous because
7253 if the virtual base is reachable along more than one path, it is
7254 moved multiple times, which can mean both objects end up in the
7255 moved-from state. If the move assignment operator is written to avoid
7256 moving from a moved-from object, this warning can be disabled.
7257
7258 @item -Wvla
7259 @opindex Wvla
7260 @opindex Wno-vla
7261 Warn if a variable-length array is used in the code.
7262 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7263 the variable-length array.
7264
7265 @item -Wvla-larger-than=@var{byte-size}
7266 @opindex Wvla-larger-than=
7267 @opindex Wno-vla-larger-than
7268 If this option is used, the compiler will warn for declarations of
7269 variable-length arrays whose size is either unbounded, or bounded
7270 by an argument that allows the array size to exceed @var{byte-size}
7271 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7272 works, but with variable-length arrays.
7273
7274 Note that GCC may optimize small variable-length arrays of a known
7275 value into plain arrays, so this warning may not get triggered for
7276 such arrays.
7277
7278 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7279 is typically only effective when @option{-ftree-vrp} is active (default
7280 for @option{-O2} and above).
7281
7282 See also @option{-Walloca-larger-than=@var{byte-size}}.
7283
7284 @item -Wno-vla-larger-than
7285 @opindex Wno-vla-larger-than
7286 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7287 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7288
7289 @item -Wvolatile-register-var
7290 @opindex Wvolatile-register-var
7291 @opindex Wno-volatile-register-var
7292 Warn if a register variable is declared volatile. The volatile
7293 modifier does not inhibit all optimizations that may eliminate reads
7294 and/or writes to register variables. This warning is enabled by
7295 @option{-Wall}.
7296
7297 @item -Wdisabled-optimization
7298 @opindex Wdisabled-optimization
7299 @opindex Wno-disabled-optimization
7300 Warn if a requested optimization pass is disabled. This warning does
7301 not generally indicate that there is anything wrong with your code; it
7302 merely indicates that GCC's optimizers are unable to handle the code
7303 effectively. Often, the problem is that your code is too big or too
7304 complex; GCC refuses to optimize programs when the optimization
7305 itself is likely to take inordinate amounts of time.
7306
7307 @item -Wpointer-sign @r{(C and Objective-C only)}
7308 @opindex Wpointer-sign
7309 @opindex Wno-pointer-sign
7310 Warn for pointer argument passing or assignment with different signedness.
7311 This option is only supported for C and Objective-C@. It is implied by
7312 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7313 @option{-Wno-pointer-sign}.
7314
7315 @item -Wstack-protector
7316 @opindex Wstack-protector
7317 @opindex Wno-stack-protector
7318 This option is only active when @option{-fstack-protector} is active. It
7319 warns about functions that are not protected against stack smashing.
7320
7321 @item -Woverlength-strings
7322 @opindex Woverlength-strings
7323 @opindex Wno-overlength-strings
7324 Warn about string constants that are longer than the ``minimum
7325 maximum'' length specified in the C standard. Modern compilers
7326 generally allow string constants that are much longer than the
7327 standard's minimum limit, but very portable programs should avoid
7328 using longer strings.
7329
7330 The limit applies @emph{after} string constant concatenation, and does
7331 not count the trailing NUL@. In C90, the limit was 509 characters; in
7332 C99, it was raised to 4095. C++98 does not specify a normative
7333 minimum maximum, so we do not diagnose overlength strings in C++@.
7334
7335 This option is implied by @option{-Wpedantic}, and can be disabled with
7336 @option{-Wno-overlength-strings}.
7337
7338 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7339 @opindex Wunsuffixed-float-constants
7340 @opindex Wno-unsuffixed-float-constants
7341
7342 Issue a warning for any floating constant that does not have
7343 a suffix. When used together with @option{-Wsystem-headers} it
7344 warns about such constants in system header files. This can be useful
7345 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7346 from the decimal floating-point extension to C99.
7347
7348 @item -Wno-designated-init @r{(C and Objective-C only)}
7349 Suppress warnings when a positional initializer is used to initialize
7350 a structure that has been marked with the @code{designated_init}
7351 attribute.
7352
7353 @item -Whsa
7354 Issue a warning when HSAIL cannot be emitted for the compiled function or
7355 OpenMP construct.
7356
7357 @end table
7358
7359 @node Debugging Options
7360 @section Options for Debugging Your Program
7361 @cindex options, debugging
7362 @cindex debugging information options
7363
7364 To tell GCC to emit extra information for use by a debugger, in almost
7365 all cases you need only to add @option{-g} to your other options.
7366
7367 GCC allows you to use @option{-g} with
7368 @option{-O}. The shortcuts taken by optimized code may occasionally
7369 be surprising: some variables you declared may not exist
7370 at all; flow of control may briefly move where you did not expect it;
7371 some statements may not be executed because they compute constant
7372 results or their values are already at hand; some statements may
7373 execute in different places because they have been moved out of loops.
7374 Nevertheless it is possible to debug optimized output. This makes
7375 it reasonable to use the optimizer for programs that might have bugs.
7376
7377 If you are not using some other optimization option, consider
7378 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7379 With no @option{-O} option at all, some compiler passes that collect
7380 information useful for debugging do not run at all, so that
7381 @option{-Og} may result in a better debugging experience.
7382
7383 @table @gcctabopt
7384 @item -g
7385 @opindex g
7386 Produce debugging information in the operating system's native format
7387 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7388 information.
7389
7390 On most systems that use stabs format, @option{-g} enables use of extra
7391 debugging information that only GDB can use; this extra information
7392 makes debugging work better in GDB but probably makes other debuggers
7393 crash or
7394 refuse to read the program. If you want to control for certain whether
7395 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7396 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7397
7398 @item -ggdb
7399 @opindex ggdb
7400 Produce debugging information for use by GDB@. This means to use the
7401 most expressive format available (DWARF, stabs, or the native format
7402 if neither of those are supported), including GDB extensions if at all
7403 possible.
7404
7405 @item -gdwarf
7406 @itemx -gdwarf-@var{version}
7407 @opindex gdwarf
7408 Produce debugging information in DWARF format (if that is supported).
7409 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7410 for most targets is 4. DWARF Version 5 is only experimental.
7411
7412 Note that with DWARF Version 2, some ports require and always
7413 use some non-conflicting DWARF 3 extensions in the unwind tables.
7414
7415 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7416 for maximum benefit.
7417
7418 GCC no longer supports DWARF Version 1, which is substantially
7419 different than Version 2 and later. For historical reasons, some
7420 other DWARF-related options such as
7421 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7422 in their names, but apply to all currently-supported versions of DWARF.
7423
7424 @item -gstabs
7425 @opindex gstabs
7426 Produce debugging information in stabs format (if that is supported),
7427 without GDB extensions. This is the format used by DBX on most BSD
7428 systems. On MIPS, Alpha and System V Release 4 systems this option
7429 produces stabs debugging output that is not understood by DBX@.
7430 On System V Release 4 systems this option requires the GNU assembler.
7431
7432 @item -gstabs+
7433 @opindex gstabs+
7434 Produce debugging information in stabs format (if that is supported),
7435 using GNU extensions understood only by the GNU debugger (GDB)@. The
7436 use of these extensions is likely to make other debuggers crash or
7437 refuse to read the program.
7438
7439 @item -gxcoff
7440 @opindex gxcoff
7441 Produce debugging information in XCOFF format (if that is supported).
7442 This is the format used by the DBX debugger on IBM RS/6000 systems.
7443
7444 @item -gxcoff+
7445 @opindex gxcoff+
7446 Produce debugging information in XCOFF format (if that is supported),
7447 using GNU extensions understood only by the GNU debugger (GDB)@. The
7448 use of these extensions is likely to make other debuggers crash or
7449 refuse to read the program, and may cause assemblers other than the GNU
7450 assembler (GAS) to fail with an error.
7451
7452 @item -gvms
7453 @opindex gvms
7454 Produce debugging information in Alpha/VMS debug format (if that is
7455 supported). This is the format used by DEBUG on Alpha/VMS systems.
7456
7457 @item -g@var{level}
7458 @itemx -ggdb@var{level}
7459 @itemx -gstabs@var{level}
7460 @itemx -gxcoff@var{level}
7461 @itemx -gvms@var{level}
7462 Request debugging information and also use @var{level} to specify how
7463 much information. The default level is 2.
7464
7465 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7466 @option{-g}.
7467
7468 Level 1 produces minimal information, enough for making backtraces in
7469 parts of the program that you don't plan to debug. This includes
7470 descriptions of functions and external variables, and line number
7471 tables, but no information about local variables.
7472
7473 Level 3 includes extra information, such as all the macro definitions
7474 present in the program. Some debuggers support macro expansion when
7475 you use @option{-g3}.
7476
7477 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7478 confusion with @option{-gdwarf-@var{level}}.
7479 Instead use an additional @option{-g@var{level}} option to change the
7480 debug level for DWARF.
7481
7482 @item -feliminate-unused-debug-symbols
7483 @opindex feliminate-unused-debug-symbols
7484 Produce debugging information in stabs format (if that is supported),
7485 for only symbols that are actually used.
7486
7487 @item -femit-class-debug-always
7488 @opindex femit-class-debug-always
7489 Instead of emitting debugging information for a C++ class in only one
7490 object file, emit it in all object files using the class. This option
7491 should be used only with debuggers that are unable to handle the way GCC
7492 normally emits debugging information for classes because using this
7493 option increases the size of debugging information by as much as a
7494 factor of two.
7495
7496 @item -fno-merge-debug-strings
7497 @opindex fmerge-debug-strings
7498 @opindex fno-merge-debug-strings
7499 Direct the linker to not merge together strings in the debugging
7500 information that are identical in different object files. Merging is
7501 not supported by all assemblers or linkers. Merging decreases the size
7502 of the debug information in the output file at the cost of increasing
7503 link processing time. Merging is enabled by default.
7504
7505 @item -fdebug-prefix-map=@var{old}=@var{new}
7506 @opindex fdebug-prefix-map
7507 When compiling files residing in directory @file{@var{old}}, record
7508 debugging information describing them as if the files resided in
7509 directory @file{@var{new}} instead. This can be used to replace a
7510 build-time path with an install-time path in the debug info. It can
7511 also be used to change an absolute path to a relative path by using
7512 @file{.} for @var{new}. This can give more reproducible builds, which
7513 are location independent, but may require an extra command to tell GDB
7514 where to find the source files. See also @option{-ffile-prefix-map}.
7515
7516 @item -fvar-tracking
7517 @opindex fvar-tracking
7518 Run variable tracking pass. It computes where variables are stored at each
7519 position in code. Better debugging information is then generated
7520 (if the debugging information format supports this information).
7521
7522 It is enabled by default when compiling with optimization (@option{-Os},
7523 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7524 the debug info format supports it.
7525
7526 @item -fvar-tracking-assignments
7527 @opindex fvar-tracking-assignments
7528 @opindex fno-var-tracking-assignments
7529 Annotate assignments to user variables early in the compilation and
7530 attempt to carry the annotations over throughout the compilation all the
7531 way to the end, in an attempt to improve debug information while
7532 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7533
7534 It can be enabled even if var-tracking is disabled, in which case
7535 annotations are created and maintained, but discarded at the end.
7536 By default, this flag is enabled together with @option{-fvar-tracking},
7537 except when selective scheduling is enabled.
7538
7539 @item -gsplit-dwarf
7540 @opindex gsplit-dwarf
7541 Separate as much DWARF debugging information as possible into a
7542 separate output file with the extension @file{.dwo}. This option allows
7543 the build system to avoid linking files with debug information. To
7544 be useful, this option requires a debugger capable of reading @file{.dwo}
7545 files.
7546
7547 @item -gdescribe-dies
7548 @opindex gdescribe-dies
7549 Add description attributes to some DWARF DIEs that have no name attribute,
7550 such as artificial variables, external references and call site
7551 parameter DIEs.
7552
7553 @item -gpubnames
7554 @opindex gpubnames
7555 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7556
7557 @item -ggnu-pubnames
7558 @opindex ggnu-pubnames
7559 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7560 suitable for conversion into a GDB@ index. This option is only useful
7561 with a linker that can produce GDB@ index version 7.
7562
7563 @item -fdebug-types-section
7564 @opindex fdebug-types-section
7565 @opindex fno-debug-types-section
7566 When using DWARF Version 4 or higher, type DIEs can be put into
7567 their own @code{.debug_types} section instead of making them part of the
7568 @code{.debug_info} section. It is more efficient to put them in a separate
7569 comdat section since the linker can then remove duplicates.
7570 But not all DWARF consumers support @code{.debug_types} sections yet
7571 and on some objects @code{.debug_types} produces larger instead of smaller
7572 debugging information.
7573
7574 @item -grecord-gcc-switches
7575 @itemx -gno-record-gcc-switches
7576 @opindex grecord-gcc-switches
7577 @opindex gno-record-gcc-switches
7578 This switch causes the command-line options used to invoke the
7579 compiler that may affect code generation to be appended to the
7580 DW_AT_producer attribute in DWARF debugging information. The options
7581 are concatenated with spaces separating them from each other and from
7582 the compiler version.
7583 It is enabled by default.
7584 See also @option{-frecord-gcc-switches} for another
7585 way of storing compiler options into the object file.
7586
7587 @item -gstrict-dwarf
7588 @opindex gstrict-dwarf
7589 Disallow using extensions of later DWARF standard version than selected
7590 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7591 DWARF extensions from later standard versions is allowed.
7592
7593 @item -gno-strict-dwarf
7594 @opindex gno-strict-dwarf
7595 Allow using extensions of later DWARF standard version than selected with
7596 @option{-gdwarf-@var{version}}.
7597
7598 @item -gas-loc-support
7599 @opindex gas-loc-support
7600 Inform the compiler that the assembler supports @code{.loc} directives.
7601 It may then use them for the assembler to generate DWARF2+ line number
7602 tables.
7603
7604 This is generally desirable, because assembler-generated line-number
7605 tables are a lot more compact than those the compiler can generate
7606 itself.
7607
7608 This option will be enabled by default if, at GCC configure time, the
7609 assembler was found to support such directives.
7610
7611 @item -gno-as-loc-support
7612 @opindex gno-as-loc-support
7613 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7614 line number tables are to be generated.
7615
7616 @item gas-locview-support
7617 @opindex gas-locview-support
7618 Inform the compiler that the assembler supports @code{view} assignment
7619 and reset assertion checking in @code{.loc} directives.
7620
7621 This option will be enabled by default if, at GCC configure time, the
7622 assembler was found to support them.
7623
7624 @item gno-as-locview-support
7625 Force GCC to assign view numbers internally, if
7626 @option{-gvariable-location-views} are explicitly requested.
7627
7628 @item -gcolumn-info
7629 @itemx -gno-column-info
7630 @opindex gcolumn-info
7631 @opindex gno-column-info
7632 Emit location column information into DWARF debugging information, rather
7633 than just file and line.
7634 This option is enabled by default.
7635
7636 @item -gstatement-frontiers
7637 @itemx -gno-statement-frontiers
7638 @opindex gstatement-frontiers
7639 @opindex gno-statement-frontiers
7640 This option causes GCC to create markers in the internal representation
7641 at the beginning of statements, and to keep them roughly in place
7642 throughout compilation, using them to guide the output of @code{is_stmt}
7643 markers in the line number table. This is enabled by default when
7644 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7645 @dots{}), and outputting DWARF 2 debug information at the normal level.
7646
7647 @item -gvariable-location-views
7648 @itemx -gvariable-location-views=incompat5
7649 @itemx -gno-variable-location-views
7650 @opindex gvariable-location-views
7651 @opindex gvariable-location-views=incompat5
7652 @opindex gno-variable-location-views
7653 Augment variable location lists with progressive view numbers implied
7654 from the line number table. This enables debug information consumers to
7655 inspect state at certain points of the program, even if no instructions
7656 associated with the corresponding source locations are present at that
7657 point. If the assembler lacks support for view numbers in line number
7658 tables, this will cause the compiler to emit the line number table,
7659 which generally makes them somewhat less compact. The augmented line
7660 number tables and location lists are fully backward-compatible, so they
7661 can be consumed by debug information consumers that are not aware of
7662 these augmentations, but they won't derive any benefit from them either.
7663
7664 This is enabled by default when outputting DWARF 2 debug information at
7665 the normal level, as long as there is assembler support,
7666 @option{-fvar-tracking-assignments} is enabled and
7667 @option{-gstrict-dwarf} is not. When assembler support is not
7668 available, this may still be enabled, but it will force GCC to output
7669 internal line number tables, and if
7670 @option{-ginternal-reset-location-views} is not enabled, that will most
7671 certainly lead to silently mismatching location views.
7672
7673 There is a proposed representation for view numbers that is not backward
7674 compatible with the location list format introduced in DWARF 5, that can
7675 be enabled with @option{-gvariable-location-views=incompat5}. This
7676 option may be removed in the future, is only provided as a reference
7677 implementation of the proposed representation. Debug information
7678 consumers are not expected to support this extended format, and they
7679 would be rendered unable to decode location lists using it.
7680
7681 @item -ginternal-reset-location-views
7682 @itemx -gnointernal-reset-location-views
7683 @opindex ginternal-reset-location-views
7684 @opindex gno-internal-reset-location-views
7685 Attempt to determine location views that can be omitted from location
7686 view lists. This requires the compiler to have very accurate insn
7687 length estimates, which isn't always the case, and it may cause
7688 incorrect view lists to be generated silently when using an assembler
7689 that does not support location view lists. The GNU assembler will flag
7690 any such error as a @code{view number mismatch}. This is only enabled
7691 on ports that define a reliable estimation function.
7692
7693 @item -ginline-points
7694 @itemx -gno-inline-points
7695 @opindex ginline-points
7696 @opindex gno-inline-points
7697 Generate extended debug information for inlined functions. Location
7698 view tracking markers are inserted at inlined entry points, so that
7699 address and view numbers can be computed and output in debug
7700 information. This can be enabled independently of location views, in
7701 which case the view numbers won't be output, but it can only be enabled
7702 along with statement frontiers, and it is only enabled by default if
7703 location views are enabled.
7704
7705 @item -gz@r{[}=@var{type}@r{]}
7706 @opindex gz
7707 Produce compressed debug sections in DWARF format, if that is supported.
7708 If @var{type} is not given, the default type depends on the capabilities
7709 of the assembler and linker used. @var{type} may be one of
7710 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7711 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7712 compression in traditional GNU format). If the linker doesn't support
7713 writing compressed debug sections, the option is rejected. Otherwise,
7714 if the assembler does not support them, @option{-gz} is silently ignored
7715 when producing object files.
7716
7717 @item -femit-struct-debug-baseonly
7718 @opindex femit-struct-debug-baseonly
7719 Emit debug information for struct-like types
7720 only when the base name of the compilation source file
7721 matches the base name of file in which the struct is defined.
7722
7723 This option substantially reduces the size of debugging information,
7724 but at significant potential loss in type information to the debugger.
7725 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7726 See @option{-femit-struct-debug-detailed} for more detailed control.
7727
7728 This option works only with DWARF debug output.
7729
7730 @item -femit-struct-debug-reduced
7731 @opindex femit-struct-debug-reduced
7732 Emit debug information for struct-like types
7733 only when the base name of the compilation source file
7734 matches the base name of file in which the type is defined,
7735 unless the struct is a template or defined in a system header.
7736
7737 This option significantly reduces the size of debugging information,
7738 with some potential loss in type information to the debugger.
7739 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7740 See @option{-femit-struct-debug-detailed} for more detailed control.
7741
7742 This option works only with DWARF debug output.
7743
7744 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7745 @opindex femit-struct-debug-detailed
7746 Specify the struct-like types
7747 for which the compiler generates debug information.
7748 The intent is to reduce duplicate struct debug information
7749 between different object files within the same program.
7750
7751 This option is a detailed version of
7752 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7753 which serves for most needs.
7754
7755 A specification has the syntax@*
7756 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7757
7758 The optional first word limits the specification to
7759 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7760 A struct type is used directly when it is the type of a variable, member.
7761 Indirect uses arise through pointers to structs.
7762 That is, when use of an incomplete struct is valid, the use is indirect.
7763 An example is
7764 @samp{struct one direct; struct two * indirect;}.
7765
7766 The optional second word limits the specification to
7767 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7768 Generic structs are a bit complicated to explain.
7769 For C++, these are non-explicit specializations of template classes,
7770 or non-template classes within the above.
7771 Other programming languages have generics,
7772 but @option{-femit-struct-debug-detailed} does not yet implement them.
7773
7774 The third word specifies the source files for those
7775 structs for which the compiler should emit debug information.
7776 The values @samp{none} and @samp{any} have the normal meaning.
7777 The value @samp{base} means that
7778 the base of name of the file in which the type declaration appears
7779 must match the base of the name of the main compilation file.
7780 In practice, this means that when compiling @file{foo.c}, debug information
7781 is generated for types declared in that file and @file{foo.h},
7782 but not other header files.
7783 The value @samp{sys} means those types satisfying @samp{base}
7784 or declared in system or compiler headers.
7785
7786 You may need to experiment to determine the best settings for your application.
7787
7788 The default is @option{-femit-struct-debug-detailed=all}.
7789
7790 This option works only with DWARF debug output.
7791
7792 @item -fno-dwarf2-cfi-asm
7793 @opindex fdwarf2-cfi-asm
7794 @opindex fno-dwarf2-cfi-asm
7795 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7796 instead of using GAS @code{.cfi_*} directives.
7797
7798 @item -fno-eliminate-unused-debug-types
7799 @opindex feliminate-unused-debug-types
7800 @opindex fno-eliminate-unused-debug-types
7801 Normally, when producing DWARF output, GCC avoids producing debug symbol
7802 output for types that are nowhere used in the source file being compiled.
7803 Sometimes it is useful to have GCC emit debugging
7804 information for all types declared in a compilation
7805 unit, regardless of whether or not they are actually used
7806 in that compilation unit, for example
7807 if, in the debugger, you want to cast a value to a type that is
7808 not actually used in your program (but is declared). More often,
7809 however, this results in a significant amount of wasted space.
7810 @end table
7811
7812 @node Optimize Options
7813 @section Options That Control Optimization
7814 @cindex optimize options
7815 @cindex options, optimization
7816
7817 These options control various sorts of optimizations.
7818
7819 Without any optimization option, the compiler's goal is to reduce the
7820 cost of compilation and to make debugging produce the expected
7821 results. Statements are independent: if you stop the program with a
7822 breakpoint between statements, you can then assign a new value to any
7823 variable or change the program counter to any other statement in the
7824 function and get exactly the results you expect from the source
7825 code.
7826
7827 Turning on optimization flags makes the compiler attempt to improve
7828 the performance and/or code size at the expense of compilation time
7829 and possibly the ability to debug the program.
7830
7831 The compiler performs optimization based on the knowledge it has of the
7832 program. Compiling multiple files at once to a single output file mode allows
7833 the compiler to use information gained from all of the files when compiling
7834 each of them.
7835
7836 Not all optimizations are controlled directly by a flag. Only
7837 optimizations that have a flag are listed in this section.
7838
7839 Most optimizations are only enabled if an @option{-O} level is set on
7840 the command line. Otherwise they are disabled, even if individual
7841 optimization flags are specified.
7842
7843 Depending on the target and how GCC was configured, a slightly different
7844 set of optimizations may be enabled at each @option{-O} level than
7845 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7846 to find out the exact set of optimizations that are enabled at each level.
7847 @xref{Overall Options}, for examples.
7848
7849 @table @gcctabopt
7850 @item -O
7851 @itemx -O1
7852 @opindex O
7853 @opindex O1
7854 Optimize. Optimizing compilation takes somewhat more time, and a lot
7855 more memory for a large function.
7856
7857 With @option{-O}, the compiler tries to reduce code size and execution
7858 time, without performing any optimizations that take a great deal of
7859 compilation time.
7860
7861 @option{-O} turns on the following optimization flags:
7862 @gccoptlist{
7863 -fauto-inc-dec @gol
7864 -fbranch-count-reg @gol
7865 -fcombine-stack-adjustments @gol
7866 -fcompare-elim @gol
7867 -fcprop-registers @gol
7868 -fdce @gol
7869 -fdefer-pop @gol
7870 -fdelayed-branch @gol
7871 -fdse @gol
7872 -fforward-propagate @gol
7873 -fguess-branch-probability @gol
7874 -fif-conversion2 @gol
7875 -fif-conversion @gol
7876 -finline-functions-called-once @gol
7877 -fipa-pure-const @gol
7878 -fipa-profile @gol
7879 -fipa-reference @gol
7880 -fmerge-constants @gol
7881 -fmove-loop-invariants @gol
7882 -fomit-frame-pointer @gol
7883 -freorder-blocks @gol
7884 -fshrink-wrap @gol
7885 -fshrink-wrap-separate @gol
7886 -fsplit-wide-types @gol
7887 -fssa-backprop @gol
7888 -fssa-phiopt @gol
7889 -ftree-bit-ccp @gol
7890 -ftree-ccp @gol
7891 -ftree-ch @gol
7892 -ftree-coalesce-vars @gol
7893 -ftree-copy-prop @gol
7894 -ftree-dce @gol
7895 -ftree-dominator-opts @gol
7896 -ftree-dse @gol
7897 -ftree-forwprop @gol
7898 -ftree-fre @gol
7899 -ftree-phiprop @gol
7900 -ftree-scev-cprop @gol
7901 -ftree-sink @gol
7902 -ftree-slsr @gol
7903 -ftree-sra @gol
7904 -ftree-pta @gol
7905 -ftree-ter @gol
7906 -funit-at-a-time}
7907
7908 @item -O2
7909 @opindex O2
7910 Optimize even more. GCC performs nearly all supported optimizations
7911 that do not involve a space-speed tradeoff.
7912 As compared to @option{-O}, this option increases both compilation time
7913 and the performance of the generated code.
7914
7915 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7916 also turns on the following optimization flags:
7917 @gccoptlist{-fthread-jumps @gol
7918 -falign-functions -falign-jumps @gol
7919 -falign-loops -falign-labels @gol
7920 -fcaller-saves @gol
7921 -fcrossjumping @gol
7922 -fcse-follow-jumps -fcse-skip-blocks @gol
7923 -fdelete-null-pointer-checks @gol
7924 -fdevirtualize -fdevirtualize-speculatively @gol
7925 -fexpensive-optimizations @gol
7926 -fgcse -fgcse-lm @gol
7927 -fhoist-adjacent-loads @gol
7928 -finline-small-functions @gol
7929 -findirect-inlining @gol
7930 -fipa-cp @gol
7931 -fipa-bit-cp @gol
7932 -fipa-vrp @gol
7933 -fipa-sra @gol
7934 -fipa-icf @gol
7935 -fisolate-erroneous-paths-dereference @gol
7936 -flra-remat @gol
7937 -foptimize-sibling-calls @gol
7938 -foptimize-strlen @gol
7939 -fpartial-inlining @gol
7940 -fpeephole2 @gol
7941 -freorder-blocks-algorithm=stc @gol
7942 -freorder-blocks-and-partition -freorder-functions @gol
7943 -frerun-cse-after-loop @gol
7944 -fsched-interblock -fsched-spec @gol
7945 -fschedule-insns -fschedule-insns2 @gol
7946 -fstore-merging @gol
7947 -fstrict-aliasing @gol
7948 -ftree-builtin-call-dce @gol
7949 -ftree-switch-conversion -ftree-tail-merge @gol
7950 -fcode-hoisting @gol
7951 -ftree-pre @gol
7952 -ftree-vrp @gol
7953 -fipa-ra}
7954
7955 Please note the warning under @option{-fgcse} about
7956 invoking @option{-O2} on programs that use computed gotos.
7957
7958 @item -O3
7959 @opindex O3
7960 Optimize yet more. @option{-O3} turns on all optimizations specified
7961 by @option{-O2} and also turns on the following optimization flags:
7962 @gccoptlist{-finline-functions @gol
7963 -funswitch-loops @gol
7964 -fpredictive-commoning @gol
7965 -fgcse-after-reload @gol
7966 -ftree-loop-vectorize @gol
7967 -ftree-loop-distribution @gol
7968 -ftree-loop-distribute-patterns @gol
7969 -floop-interchange @gol
7970 -floop-unroll-and-jam @gol
7971 -fsplit-paths @gol
7972 -ftree-slp-vectorize @gol
7973 -fvect-cost-model @gol
7974 -ftree-partial-pre @gol
7975 -fpeel-loops @gol
7976 -fipa-cp-clone}
7977
7978 @item -O0
7979 @opindex O0
7980 Reduce compilation time and make debugging produce the expected
7981 results. This is the default.
7982
7983 @item -Os
7984 @opindex Os
7985 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7986 do not typically increase code size. It also performs further
7987 optimizations designed to reduce code size.
7988
7989 @option{-Os} disables the following optimization flags:
7990 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7991 -falign-labels -fprefetch-loop-arrays}
7992
7993 @item -Ofast
7994 @opindex Ofast
7995 Disregard strict standards compliance. @option{-Ofast} enables all
7996 @option{-O3} optimizations. It also enables optimizations that are not
7997 valid for all standard-compliant programs.
7998 It turns on @option{-ffast-math} and the Fortran-specific
7999 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8000 specified, and @option{-fno-protect-parens}.
8001
8002 @item -Og
8003 @opindex Og
8004 Optimize debugging experience. @option{-Og} enables optimizations
8005 that do not interfere with debugging. It should be the optimization
8006 level of choice for the standard edit-compile-debug cycle, offering
8007 a reasonable level of optimization while maintaining fast compilation
8008 and a good debugging experience.
8009 @end table
8010
8011 If you use multiple @option{-O} options, with or without level numbers,
8012 the last such option is the one that is effective.
8013
8014 Options of the form @option{-f@var{flag}} specify machine-independent
8015 flags. Most flags have both positive and negative forms; the negative
8016 form of @option{-ffoo} is @option{-fno-foo}. In the table
8017 below, only one of the forms is listed---the one you typically
8018 use. You can figure out the other form by either removing @samp{no-}
8019 or adding it.
8020
8021 The following options control specific optimizations. They are either
8022 activated by @option{-O} options or are related to ones that are. You
8023 can use the following flags in the rare cases when ``fine-tuning'' of
8024 optimizations to be performed is desired.
8025
8026 @table @gcctabopt
8027 @item -fno-defer-pop
8028 @opindex fno-defer-pop
8029 Always pop the arguments to each function call as soon as that function
8030 returns. For machines that must pop arguments after a function call,
8031 the compiler normally lets arguments accumulate on the stack for several
8032 function calls and pops them all at once.
8033
8034 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8035
8036 @item -fforward-propagate
8037 @opindex fforward-propagate
8038 Perform a forward propagation pass on RTL@. The pass tries to combine two
8039 instructions and checks if the result can be simplified. If loop unrolling
8040 is active, two passes are performed and the second is scheduled after
8041 loop unrolling.
8042
8043 This option is enabled by default at optimization levels @option{-O},
8044 @option{-O2}, @option{-O3}, @option{-Os}.
8045
8046 @item -ffp-contract=@var{style}
8047 @opindex ffp-contract
8048 @option{-ffp-contract=off} disables floating-point expression contraction.
8049 @option{-ffp-contract=fast} enables floating-point expression contraction
8050 such as forming of fused multiply-add operations if the target has
8051 native support for them.
8052 @option{-ffp-contract=on} enables floating-point expression contraction
8053 if allowed by the language standard. This is currently not implemented
8054 and treated equal to @option{-ffp-contract=off}.
8055
8056 The default is @option{-ffp-contract=fast}.
8057
8058 @item -fomit-frame-pointer
8059 @opindex fomit-frame-pointer
8060 Omit the frame pointer in functions that don't need one. This avoids the
8061 instructions to save, set up and restore the frame pointer; on many targets
8062 it also makes an extra register available.
8063
8064 On some targets this flag has no effect because the standard calling sequence
8065 always uses a frame pointer, so it cannot be omitted.
8066
8067 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8068 is used in all functions. Several targets always omit the frame pointer in
8069 leaf functions.
8070
8071 Enabled by default at @option{-O} and higher.
8072
8073 @item -foptimize-sibling-calls
8074 @opindex foptimize-sibling-calls
8075 Optimize sibling and tail recursive calls.
8076
8077 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8078
8079 @item -foptimize-strlen
8080 @opindex foptimize-strlen
8081 Optimize various standard C string functions (e.g.@: @code{strlen},
8082 @code{strchr} or @code{strcpy}) and
8083 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8084
8085 Enabled at levels @option{-O2}, @option{-O3}.
8086
8087 @item -fno-inline
8088 @opindex fno-inline
8089 Do not expand any functions inline apart from those marked with
8090 the @code{always_inline} attribute. This is the default when not
8091 optimizing.
8092
8093 Single functions can be exempted from inlining by marking them
8094 with the @code{noinline} attribute.
8095
8096 @item -finline-small-functions
8097 @opindex finline-small-functions
8098 Integrate functions into their callers when their body is smaller than expected
8099 function call code (so overall size of program gets smaller). The compiler
8100 heuristically decides which functions are simple enough to be worth integrating
8101 in this way. This inlining applies to all functions, even those not declared
8102 inline.
8103
8104 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8105
8106 @item -findirect-inlining
8107 @opindex findirect-inlining
8108 Inline also indirect calls that are discovered to be known at compile
8109 time thanks to previous inlining. This option has any effect only
8110 when inlining itself is turned on by the @option{-finline-functions}
8111 or @option{-finline-small-functions} options.
8112
8113 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8114
8115 @item -finline-functions
8116 @opindex finline-functions
8117 Consider all functions for inlining, even if they are not declared inline.
8118 The compiler heuristically decides which functions are worth integrating
8119 in this way.
8120
8121 If all calls to a given function are integrated, and the function is
8122 declared @code{static}, then the function is normally not output as
8123 assembler code in its own right.
8124
8125 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8126
8127 @item -finline-functions-called-once
8128 @opindex finline-functions-called-once
8129 Consider all @code{static} functions called once for inlining into their
8130 caller even if they are not marked @code{inline}. If a call to a given
8131 function is integrated, then the function is not output as assembler code
8132 in its own right.
8133
8134 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
8135
8136 @item -fearly-inlining
8137 @opindex fearly-inlining
8138 Inline functions marked by @code{always_inline} and functions whose body seems
8139 smaller than the function call overhead early before doing
8140 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8141 makes profiling significantly cheaper and usually inlining faster on programs
8142 having large chains of nested wrapper functions.
8143
8144 Enabled by default.
8145
8146 @item -fipa-sra
8147 @opindex fipa-sra
8148 Perform interprocedural scalar replacement of aggregates, removal of
8149 unused parameters and replacement of parameters passed by reference
8150 by parameters passed by value.
8151
8152 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8153
8154 @item -finline-limit=@var{n}
8155 @opindex finline-limit
8156 By default, GCC limits the size of functions that can be inlined. This flag
8157 allows coarse control of this limit. @var{n} is the size of functions that
8158 can be inlined in number of pseudo instructions.
8159
8160 Inlining is actually controlled by a number of parameters, which may be
8161 specified individually by using @option{--param @var{name}=@var{value}}.
8162 The @option{-finline-limit=@var{n}} option sets some of these parameters
8163 as follows:
8164
8165 @table @gcctabopt
8166 @item max-inline-insns-single
8167 is set to @var{n}/2.
8168 @item max-inline-insns-auto
8169 is set to @var{n}/2.
8170 @end table
8171
8172 See below for a documentation of the individual
8173 parameters controlling inlining and for the defaults of these parameters.
8174
8175 @emph{Note:} there may be no value to @option{-finline-limit} that results
8176 in default behavior.
8177
8178 @emph{Note:} pseudo instruction represents, in this particular context, an
8179 abstract measurement of function's size. In no way does it represent a count
8180 of assembly instructions and as such its exact meaning might change from one
8181 release to an another.
8182
8183 @item -fno-keep-inline-dllexport
8184 @opindex fno-keep-inline-dllexport
8185 This is a more fine-grained version of @option{-fkeep-inline-functions},
8186 which applies only to functions that are declared using the @code{dllexport}
8187 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8188 Functions}.
8189
8190 @item -fkeep-inline-functions
8191 @opindex fkeep-inline-functions
8192 In C, emit @code{static} functions that are declared @code{inline}
8193 into the object file, even if the function has been inlined into all
8194 of its callers. This switch does not affect functions using the
8195 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8196 inline functions into the object file.
8197
8198 @item -fkeep-static-functions
8199 @opindex fkeep-static-functions
8200 Emit @code{static} functions into the object file, even if the function
8201 is never used.
8202
8203 @item -fkeep-static-consts
8204 @opindex fkeep-static-consts
8205 Emit variables declared @code{static const} when optimization isn't turned
8206 on, even if the variables aren't referenced.
8207
8208 GCC enables this option by default. If you want to force the compiler to
8209 check if a variable is referenced, regardless of whether or not
8210 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8211
8212 @item -fmerge-constants
8213 @opindex fmerge-constants
8214 Attempt to merge identical constants (string constants and floating-point
8215 constants) across compilation units.
8216
8217 This option is the default for optimized compilation if the assembler and
8218 linker support it. Use @option{-fno-merge-constants} to inhibit this
8219 behavior.
8220
8221 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8222
8223 @item -fmerge-all-constants
8224 @opindex fmerge-all-constants
8225 Attempt to merge identical constants and identical variables.
8226
8227 This option implies @option{-fmerge-constants}. In addition to
8228 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8229 arrays or initialized constant variables with integral or floating-point
8230 types. Languages like C or C++ require each variable, including multiple
8231 instances of the same variable in recursive calls, to have distinct locations,
8232 so using this option results in non-conforming
8233 behavior.
8234
8235 @item -fmodulo-sched
8236 @opindex fmodulo-sched
8237 Perform swing modulo scheduling immediately before the first scheduling
8238 pass. This pass looks at innermost loops and reorders their
8239 instructions by overlapping different iterations.
8240
8241 @item -fmodulo-sched-allow-regmoves
8242 @opindex fmodulo-sched-allow-regmoves
8243 Perform more aggressive SMS-based modulo scheduling with register moves
8244 allowed. By setting this flag certain anti-dependences edges are
8245 deleted, which triggers the generation of reg-moves based on the
8246 life-range analysis. This option is effective only with
8247 @option{-fmodulo-sched} enabled.
8248
8249 @item -fno-branch-count-reg
8250 @opindex fno-branch-count-reg
8251 Avoid running a pass scanning for opportunities to use ``decrement and
8252 branch'' instructions on a count register instead of generating sequences
8253 of instructions that decrement a register, compare it against zero, and
8254 then branch based upon the result. This option is only meaningful on
8255 architectures that support such instructions, which include x86, PowerPC,
8256 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8257 doesn't remove the decrement and branch instructions from the generated
8258 instruction stream introduced by other optimization passes.
8259
8260 Enabled by default at @option{-O1} and higher.
8261
8262 The default is @option{-fbranch-count-reg}.
8263
8264 @item -fno-function-cse
8265 @opindex fno-function-cse
8266 Do not put function addresses in registers; make each instruction that
8267 calls a constant function contain the function's address explicitly.
8268
8269 This option results in less efficient code, but some strange hacks
8270 that alter the assembler output may be confused by the optimizations
8271 performed when this option is not used.
8272
8273 The default is @option{-ffunction-cse}
8274
8275 @item -fno-zero-initialized-in-bss
8276 @opindex fno-zero-initialized-in-bss
8277 If the target supports a BSS section, GCC by default puts variables that
8278 are initialized to zero into BSS@. This can save space in the resulting
8279 code.
8280
8281 This option turns off this behavior because some programs explicitly
8282 rely on variables going to the data section---e.g., so that the
8283 resulting executable can find the beginning of that section and/or make
8284 assumptions based on that.
8285
8286 The default is @option{-fzero-initialized-in-bss}.
8287
8288 @item -fthread-jumps
8289 @opindex fthread-jumps
8290 Perform optimizations that check to see if a jump branches to a
8291 location where another comparison subsumed by the first is found. If
8292 so, the first branch is redirected to either the destination of the
8293 second branch or a point immediately following it, depending on whether
8294 the condition is known to be true or false.
8295
8296 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8297
8298 @item -fsplit-wide-types
8299 @opindex fsplit-wide-types
8300 When using a type that occupies multiple registers, such as @code{long
8301 long} on a 32-bit system, split the registers apart and allocate them
8302 independently. This normally generates better code for those types,
8303 but may make debugging more difficult.
8304
8305 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8306 @option{-Os}.
8307
8308 @item -fcse-follow-jumps
8309 @opindex fcse-follow-jumps
8310 In common subexpression elimination (CSE), scan through jump instructions
8311 when the target of the jump is not reached by any other path. For
8312 example, when CSE encounters an @code{if} statement with an
8313 @code{else} clause, CSE follows the jump when the condition
8314 tested is false.
8315
8316 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8317
8318 @item -fcse-skip-blocks
8319 @opindex fcse-skip-blocks
8320 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8321 follow jumps that conditionally skip over blocks. When CSE
8322 encounters a simple @code{if} statement with no else clause,
8323 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8324 body of the @code{if}.
8325
8326 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8327
8328 @item -frerun-cse-after-loop
8329 @opindex frerun-cse-after-loop
8330 Re-run common subexpression elimination after loop optimizations are
8331 performed.
8332
8333 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8334
8335 @item -fgcse
8336 @opindex fgcse
8337 Perform a global common subexpression elimination pass.
8338 This pass also performs global constant and copy propagation.
8339
8340 @emph{Note:} When compiling a program using computed gotos, a GCC
8341 extension, you may get better run-time performance if you disable
8342 the global common subexpression elimination pass by adding
8343 @option{-fno-gcse} to the command line.
8344
8345 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8346
8347 @item -fgcse-lm
8348 @opindex fgcse-lm
8349 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8350 attempts to move loads that are only killed by stores into themselves. This
8351 allows a loop containing a load/store sequence to be changed to a load outside
8352 the loop, and a copy/store within the loop.
8353
8354 Enabled by default when @option{-fgcse} is enabled.
8355
8356 @item -fgcse-sm
8357 @opindex fgcse-sm
8358 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8359 global common subexpression elimination. This pass attempts to move
8360 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8361 loops containing a load/store sequence can be changed to a load before
8362 the loop and a store after the loop.
8363
8364 Not enabled at any optimization level.
8365
8366 @item -fgcse-las
8367 @opindex fgcse-las
8368 When @option{-fgcse-las} is enabled, the global common subexpression
8369 elimination pass eliminates redundant loads that come after stores to the
8370 same memory location (both partial and full redundancies).
8371
8372 Not enabled at any optimization level.
8373
8374 @item -fgcse-after-reload
8375 @opindex fgcse-after-reload
8376 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8377 pass is performed after reload. The purpose of this pass is to clean up
8378 redundant spilling.
8379
8380 @item -faggressive-loop-optimizations
8381 @opindex faggressive-loop-optimizations
8382 This option tells the loop optimizer to use language constraints to
8383 derive bounds for the number of iterations of a loop. This assumes that
8384 loop code does not invoke undefined behavior by for example causing signed
8385 integer overflows or out-of-bound array accesses. The bounds for the
8386 number of iterations of a loop are used to guide loop unrolling and peeling
8387 and loop exit test optimizations.
8388 This option is enabled by default.
8389
8390 @item -funconstrained-commons
8391 @opindex funconstrained-commons
8392 This option tells the compiler that variables declared in common blocks
8393 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8394 prevents certain optimizations that depend on knowing the array bounds.
8395
8396 @item -fcrossjumping
8397 @opindex fcrossjumping
8398 Perform cross-jumping transformation.
8399 This transformation unifies equivalent code and saves code size. The
8400 resulting code may or may not perform better than without cross-jumping.
8401
8402 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8403
8404 @item -fauto-inc-dec
8405 @opindex fauto-inc-dec
8406 Combine increments or decrements of addresses with memory accesses.
8407 This pass is always skipped on architectures that do not have
8408 instructions to support this. Enabled by default at @option{-O} and
8409 higher on architectures that support this.
8410
8411 @item -fdce
8412 @opindex fdce
8413 Perform dead code elimination (DCE) on RTL@.
8414 Enabled by default at @option{-O} and higher.
8415
8416 @item -fdse
8417 @opindex fdse
8418 Perform dead store elimination (DSE) on RTL@.
8419 Enabled by default at @option{-O} and higher.
8420
8421 @item -fif-conversion
8422 @opindex fif-conversion
8423 Attempt to transform conditional jumps into branch-less equivalents. This
8424 includes use of conditional moves, min, max, set flags and abs instructions, and
8425 some tricks doable by standard arithmetics. The use of conditional execution
8426 on chips where it is available is controlled by @option{-fif-conversion2}.
8427
8428 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8429
8430 @item -fif-conversion2
8431 @opindex fif-conversion2
8432 Use conditional execution (where available) to transform conditional jumps into
8433 branch-less equivalents.
8434
8435 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8436
8437 @item -fdeclone-ctor-dtor
8438 @opindex fdeclone-ctor-dtor
8439 The C++ ABI requires multiple entry points for constructors and
8440 destructors: one for a base subobject, one for a complete object, and
8441 one for a virtual destructor that calls operator delete afterwards.
8442 For a hierarchy with virtual bases, the base and complete variants are
8443 clones, which means two copies of the function. With this option, the
8444 base and complete variants are changed to be thunks that call a common
8445 implementation.
8446
8447 Enabled by @option{-Os}.
8448
8449 @item -fdelete-null-pointer-checks
8450 @opindex fdelete-null-pointer-checks
8451 Assume that programs cannot safely dereference null pointers, and that
8452 no code or data element resides at address zero.
8453 This option enables simple constant
8454 folding optimizations at all optimization levels. In addition, other
8455 optimization passes in GCC use this flag to control global dataflow
8456 analyses that eliminate useless checks for null pointers; these assume
8457 that a memory access to address zero always results in a trap, so
8458 that if a pointer is checked after it has already been dereferenced,
8459 it cannot be null.
8460
8461 Note however that in some environments this assumption is not true.
8462 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8463 for programs that depend on that behavior.
8464
8465 This option is enabled by default on most targets. On Nios II ELF, it
8466 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8467
8468 Passes that use the dataflow information
8469 are enabled independently at different optimization levels.
8470
8471 @item -fdevirtualize
8472 @opindex fdevirtualize
8473 Attempt to convert calls to virtual functions to direct calls. This
8474 is done both within a procedure and interprocedurally as part of
8475 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8476 propagation (@option{-fipa-cp}).
8477 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8478
8479 @item -fdevirtualize-speculatively
8480 @opindex fdevirtualize-speculatively
8481 Attempt to convert calls to virtual functions to speculative direct calls.
8482 Based on the analysis of the type inheritance graph, determine for a given call
8483 the set of likely targets. If the set is small, preferably of size 1, change
8484 the call into a conditional deciding between direct and indirect calls. The
8485 speculative calls enable more optimizations, such as inlining. When they seem
8486 useless after further optimization, they are converted back into original form.
8487
8488 @item -fdevirtualize-at-ltrans
8489 @opindex fdevirtualize-at-ltrans
8490 Stream extra information needed for aggressive devirtualization when running
8491 the link-time optimizer in local transformation mode.
8492 This option enables more devirtualization but
8493 significantly increases the size of streamed data. For this reason it is
8494 disabled by default.
8495
8496 @item -fexpensive-optimizations
8497 @opindex fexpensive-optimizations
8498 Perform a number of minor optimizations that are relatively expensive.
8499
8500 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8501
8502 @item -free
8503 @opindex free
8504 Attempt to remove redundant extension instructions. This is especially
8505 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8506 registers after writing to their lower 32-bit half.
8507
8508 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8509 @option{-O3}, @option{-Os}.
8510
8511 @item -fno-lifetime-dse
8512 @opindex fno-lifetime-dse
8513 In C++ the value of an object is only affected by changes within its
8514 lifetime: when the constructor begins, the object has an indeterminate
8515 value, and any changes during the lifetime of the object are dead when
8516 the object is destroyed. Normally dead store elimination will take
8517 advantage of this; if your code relies on the value of the object
8518 storage persisting beyond the lifetime of the object, you can use this
8519 flag to disable this optimization. To preserve stores before the
8520 constructor starts (e.g.@: because your operator new clears the object
8521 storage) but still treat the object as dead after the destructor you,
8522 can use @option{-flifetime-dse=1}. The default behavior can be
8523 explicitly selected with @option{-flifetime-dse=2}.
8524 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8525
8526 @item -flive-range-shrinkage
8527 @opindex flive-range-shrinkage
8528 Attempt to decrease register pressure through register live range
8529 shrinkage. This is helpful for fast processors with small or moderate
8530 size register sets.
8531
8532 @item -fira-algorithm=@var{algorithm}
8533 @opindex fira-algorithm
8534 Use the specified coloring algorithm for the integrated register
8535 allocator. The @var{algorithm} argument can be @samp{priority}, which
8536 specifies Chow's priority coloring, or @samp{CB}, which specifies
8537 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8538 for all architectures, but for those targets that do support it, it is
8539 the default because it generates better code.
8540
8541 @item -fira-region=@var{region}
8542 @opindex fira-region
8543 Use specified regions for the integrated register allocator. The
8544 @var{region} argument should be one of the following:
8545
8546 @table @samp
8547
8548 @item all
8549 Use all loops as register allocation regions.
8550 This can give the best results for machines with a small and/or
8551 irregular register set.
8552
8553 @item mixed
8554 Use all loops except for loops with small register pressure
8555 as the regions. This value usually gives
8556 the best results in most cases and for most architectures,
8557 and is enabled by default when compiling with optimization for speed
8558 (@option{-O}, @option{-O2}, @dots{}).
8559
8560 @item one
8561 Use all functions as a single region.
8562 This typically results in the smallest code size, and is enabled by default for
8563 @option{-Os} or @option{-O0}.
8564
8565 @end table
8566
8567 @item -fira-hoist-pressure
8568 @opindex fira-hoist-pressure
8569 Use IRA to evaluate register pressure in the code hoisting pass for
8570 decisions to hoist expressions. This option usually results in smaller
8571 code, but it can slow the compiler down.
8572
8573 This option is enabled at level @option{-Os} for all targets.
8574
8575 @item -fira-loop-pressure
8576 @opindex fira-loop-pressure
8577 Use IRA to evaluate register pressure in loops for decisions to move
8578 loop invariants. This option usually results in generation
8579 of faster and smaller code on machines with large register files (>= 32
8580 registers), but it can slow the compiler down.
8581
8582 This option is enabled at level @option{-O3} for some targets.
8583
8584 @item -fno-ira-share-save-slots
8585 @opindex fno-ira-share-save-slots
8586 Disable sharing of stack slots used for saving call-used hard
8587 registers living through a call. Each hard register gets a
8588 separate stack slot, and as a result function stack frames are
8589 larger.
8590
8591 @item -fno-ira-share-spill-slots
8592 @opindex fno-ira-share-spill-slots
8593 Disable sharing of stack slots allocated for pseudo-registers. Each
8594 pseudo-register that does not get a hard register gets a separate
8595 stack slot, and as a result function stack frames are larger.
8596
8597 @item -flra-remat
8598 @opindex flra-remat
8599 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8600 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8601 values if it is profitable.
8602
8603 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8604
8605 @item -fdelayed-branch
8606 @opindex fdelayed-branch
8607 If supported for the target machine, attempt to reorder instructions
8608 to exploit instruction slots available after delayed branch
8609 instructions.
8610
8611 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
8612 but not at @option{-Og}.
8613
8614 @item -fschedule-insns
8615 @opindex fschedule-insns
8616 If supported for the target machine, attempt to reorder instructions to
8617 eliminate execution stalls due to required data being unavailable. This
8618 helps machines that have slow floating point or memory load instructions
8619 by allowing other instructions to be issued until the result of the load
8620 or floating-point instruction is required.
8621
8622 Enabled at levels @option{-O2}, @option{-O3}.
8623
8624 @item -fschedule-insns2
8625 @opindex fschedule-insns2
8626 Similar to @option{-fschedule-insns}, but requests an additional pass of
8627 instruction scheduling after register allocation has been done. This is
8628 especially useful on machines with a relatively small number of
8629 registers and where memory load instructions take more than one cycle.
8630
8631 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8632
8633 @item -fno-sched-interblock
8634 @opindex fno-sched-interblock
8635 Don't schedule instructions across basic blocks. This is normally
8636 enabled by default when scheduling before register allocation, i.e.@:
8637 with @option{-fschedule-insns} or at @option{-O2} or higher.
8638
8639 @item -fno-sched-spec
8640 @opindex fno-sched-spec
8641 Don't allow speculative motion of non-load instructions. This is normally
8642 enabled by default when scheduling before register allocation, i.e.@:
8643 with @option{-fschedule-insns} or at @option{-O2} or higher.
8644
8645 @item -fsched-pressure
8646 @opindex fsched-pressure
8647 Enable register pressure sensitive insn scheduling before register
8648 allocation. This only makes sense when scheduling before register
8649 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8650 @option{-O2} or higher. Usage of this option can improve the
8651 generated code and decrease its size by preventing register pressure
8652 increase above the number of available hard registers and subsequent
8653 spills in register allocation.
8654
8655 @item -fsched-spec-load
8656 @opindex fsched-spec-load
8657 Allow speculative motion of some load instructions. This only makes
8658 sense when scheduling before register allocation, i.e.@: with
8659 @option{-fschedule-insns} or at @option{-O2} or higher.
8660
8661 @item -fsched-spec-load-dangerous
8662 @opindex fsched-spec-load-dangerous
8663 Allow speculative motion of more load instructions. This only makes
8664 sense when scheduling before register allocation, i.e.@: with
8665 @option{-fschedule-insns} or at @option{-O2} or higher.
8666
8667 @item -fsched-stalled-insns
8668 @itemx -fsched-stalled-insns=@var{n}
8669 @opindex fsched-stalled-insns
8670 Define how many insns (if any) can be moved prematurely from the queue
8671 of stalled insns into the ready list during the second scheduling pass.
8672 @option{-fno-sched-stalled-insns} means that no insns are moved
8673 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8674 on how many queued insns can be moved prematurely.
8675 @option{-fsched-stalled-insns} without a value is equivalent to
8676 @option{-fsched-stalled-insns=1}.
8677
8678 @item -fsched-stalled-insns-dep
8679 @itemx -fsched-stalled-insns-dep=@var{n}
8680 @opindex fsched-stalled-insns-dep
8681 Define how many insn groups (cycles) are examined for a dependency
8682 on a stalled insn that is a candidate for premature removal from the queue
8683 of stalled insns. This has an effect only during the second scheduling pass,
8684 and only if @option{-fsched-stalled-insns} is used.
8685 @option{-fno-sched-stalled-insns-dep} is equivalent to
8686 @option{-fsched-stalled-insns-dep=0}.
8687 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8688 @option{-fsched-stalled-insns-dep=1}.
8689
8690 @item -fsched2-use-superblocks
8691 @opindex fsched2-use-superblocks
8692 When scheduling after register allocation, use superblock scheduling.
8693 This allows motion across basic block boundaries,
8694 resulting in faster schedules. This option is experimental, as not all machine
8695 descriptions used by GCC model the CPU closely enough to avoid unreliable
8696 results from the algorithm.
8697
8698 This only makes sense when scheduling after register allocation, i.e.@: with
8699 @option{-fschedule-insns2} or at @option{-O2} or higher.
8700
8701 @item -fsched-group-heuristic
8702 @opindex fsched-group-heuristic
8703 Enable the group heuristic in the scheduler. This heuristic favors
8704 the instruction that belongs to a schedule group. This is enabled
8705 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8706 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8707
8708 @item -fsched-critical-path-heuristic
8709 @opindex fsched-critical-path-heuristic
8710 Enable the critical-path heuristic in the scheduler. This heuristic favors
8711 instructions on the critical path. This is enabled by default when
8712 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8713 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8714
8715 @item -fsched-spec-insn-heuristic
8716 @opindex fsched-spec-insn-heuristic
8717 Enable the speculative instruction heuristic in the scheduler. This
8718 heuristic favors speculative instructions with greater dependency weakness.
8719 This is enabled by default when scheduling is enabled, i.e.@:
8720 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8721 or at @option{-O2} or higher.
8722
8723 @item -fsched-rank-heuristic
8724 @opindex fsched-rank-heuristic
8725 Enable the rank heuristic in the scheduler. This heuristic favors
8726 the instruction belonging to a basic block with greater size or frequency.
8727 This is enabled by default when scheduling is enabled, i.e.@:
8728 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8729 at @option{-O2} or higher.
8730
8731 @item -fsched-last-insn-heuristic
8732 @opindex fsched-last-insn-heuristic
8733 Enable the last-instruction heuristic in the scheduler. This heuristic
8734 favors the instruction that is less dependent on the last instruction
8735 scheduled. This is enabled by default when scheduling is enabled,
8736 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8737 at @option{-O2} or higher.
8738
8739 @item -fsched-dep-count-heuristic
8740 @opindex fsched-dep-count-heuristic
8741 Enable the dependent-count heuristic in the scheduler. This heuristic
8742 favors the instruction that has more instructions depending on it.
8743 This is enabled by default when scheduling is enabled, i.e.@:
8744 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8745 at @option{-O2} or higher.
8746
8747 @item -freschedule-modulo-scheduled-loops
8748 @opindex freschedule-modulo-scheduled-loops
8749 Modulo scheduling is performed before traditional scheduling. If a loop
8750 is modulo scheduled, later scheduling passes may change its schedule.
8751 Use this option to control that behavior.
8752
8753 @item -fselective-scheduling
8754 @opindex fselective-scheduling
8755 Schedule instructions using selective scheduling algorithm. Selective
8756 scheduling runs instead of the first scheduler pass.
8757
8758 @item -fselective-scheduling2
8759 @opindex fselective-scheduling2
8760 Schedule instructions using selective scheduling algorithm. Selective
8761 scheduling runs instead of the second scheduler pass.
8762
8763 @item -fsel-sched-pipelining
8764 @opindex fsel-sched-pipelining
8765 Enable software pipelining of innermost loops during selective scheduling.
8766 This option has no effect unless one of @option{-fselective-scheduling} or
8767 @option{-fselective-scheduling2} is turned on.
8768
8769 @item -fsel-sched-pipelining-outer-loops
8770 @opindex fsel-sched-pipelining-outer-loops
8771 When pipelining loops during selective scheduling, also pipeline outer loops.
8772 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8773
8774 @item -fsemantic-interposition
8775 @opindex fsemantic-interposition
8776 Some object formats, like ELF, allow interposing of symbols by the
8777 dynamic linker.
8778 This means that for symbols exported from the DSO, the compiler cannot perform
8779 interprocedural propagation, inlining and other optimizations in anticipation
8780 that the function or variable in question may change. While this feature is
8781 useful, for example, to rewrite memory allocation functions by a debugging
8782 implementation, it is expensive in the terms of code quality.
8783 With @option{-fno-semantic-interposition} the compiler assumes that
8784 if interposition happens for functions the overwriting function will have
8785 precisely the same semantics (and side effects).
8786 Similarly if interposition happens
8787 for variables, the constructor of the variable will be the same. The flag
8788 has no effect for functions explicitly declared inline
8789 (where it is never allowed for interposition to change semantics)
8790 and for symbols explicitly declared weak.
8791
8792 @item -fshrink-wrap
8793 @opindex fshrink-wrap
8794 Emit function prologues only before parts of the function that need it,
8795 rather than at the top of the function. This flag is enabled by default at
8796 @option{-O} and higher.
8797
8798 @item -fshrink-wrap-separate
8799 @opindex fshrink-wrap-separate
8800 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8801 those parts are only executed when needed.
8802 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8803 is also turned on and the target supports this.
8804
8805 @item -fcaller-saves
8806 @opindex fcaller-saves
8807 Enable allocation of values to registers that are clobbered by
8808 function calls, by emitting extra instructions to save and restore the
8809 registers around such calls. Such allocation is done only when it
8810 seems to result in better code.
8811
8812 This option is always enabled by default on certain machines, usually
8813 those which have no call-preserved registers to use instead.
8814
8815 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8816
8817 @item -fcombine-stack-adjustments
8818 @opindex fcombine-stack-adjustments
8819 Tracks stack adjustments (pushes and pops) and stack memory references
8820 and then tries to find ways to combine them.
8821
8822 Enabled by default at @option{-O1} and higher.
8823
8824 @item -fipa-ra
8825 @opindex fipa-ra
8826 Use caller save registers for allocation if those registers are not used by
8827 any called function. In that case it is not necessary to save and restore
8828 them around calls. This is only possible if called functions are part of
8829 same compilation unit as current function and they are compiled before it.
8830
8831 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8832 is disabled if generated code will be instrumented for profiling
8833 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8834 exactly (this happens on targets that do not expose prologues
8835 and epilogues in RTL).
8836
8837 @item -fconserve-stack
8838 @opindex fconserve-stack
8839 Attempt to minimize stack usage. The compiler attempts to use less
8840 stack space, even if that makes the program slower. This option
8841 implies setting the @option{large-stack-frame} parameter to 100
8842 and the @option{large-stack-frame-growth} parameter to 400.
8843
8844 @item -ftree-reassoc
8845 @opindex ftree-reassoc
8846 Perform reassociation on trees. This flag is enabled by default
8847 at @option{-O} and higher.
8848
8849 @item -fcode-hoisting
8850 @opindex fcode-hoisting
8851 Perform code hoisting. Code hoisting tries to move the
8852 evaluation of expressions executed on all paths to the function exit
8853 as early as possible. This is especially useful as a code size
8854 optimization, but it often helps for code speed as well.
8855 This flag is enabled by default at @option{-O2} and higher.
8856
8857 @item -ftree-pre
8858 @opindex ftree-pre
8859 Perform partial redundancy elimination (PRE) on trees. This flag is
8860 enabled by default at @option{-O2} and @option{-O3}.
8861
8862 @item -ftree-partial-pre
8863 @opindex ftree-partial-pre
8864 Make partial redundancy elimination (PRE) more aggressive. This flag is
8865 enabled by default at @option{-O3}.
8866
8867 @item -ftree-forwprop
8868 @opindex ftree-forwprop
8869 Perform forward propagation on trees. This flag is enabled by default
8870 at @option{-O} and higher.
8871
8872 @item -ftree-fre
8873 @opindex ftree-fre
8874 Perform full redundancy elimination (FRE) on trees. The difference
8875 between FRE and PRE is that FRE only considers expressions
8876 that are computed on all paths leading to the redundant computation.
8877 This analysis is faster than PRE, though it exposes fewer redundancies.
8878 This flag is enabled by default at @option{-O} and higher.
8879
8880 @item -ftree-phiprop
8881 @opindex ftree-phiprop
8882 Perform hoisting of loads from conditional pointers on trees. This
8883 pass is enabled by default at @option{-O} and higher.
8884
8885 @item -fhoist-adjacent-loads
8886 @opindex fhoist-adjacent-loads
8887 Speculatively hoist loads from both branches of an if-then-else if the
8888 loads are from adjacent locations in the same structure and the target
8889 architecture has a conditional move instruction. This flag is enabled
8890 by default at @option{-O2} and higher.
8891
8892 @item -ftree-copy-prop
8893 @opindex ftree-copy-prop
8894 Perform copy propagation on trees. This pass eliminates unnecessary
8895 copy operations. This flag is enabled by default at @option{-O} and
8896 higher.
8897
8898 @item -fipa-pure-const
8899 @opindex fipa-pure-const
8900 Discover which functions are pure or constant.
8901 Enabled by default at @option{-O} and higher.
8902
8903 @item -fipa-reference
8904 @opindex fipa-reference
8905 Discover which static variables do not escape the
8906 compilation unit.
8907 Enabled by default at @option{-O} and higher.
8908
8909 @item -fipa-pta
8910 @opindex fipa-pta
8911 Perform interprocedural pointer analysis and interprocedural modification
8912 and reference analysis. This option can cause excessive memory and
8913 compile-time usage on large compilation units. It is not enabled by
8914 default at any optimization level.
8915
8916 @item -fipa-profile
8917 @opindex fipa-profile
8918 Perform interprocedural profile propagation. The functions called only from
8919 cold functions are marked as cold. Also functions executed once (such as
8920 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8921 functions and loop less parts of functions executed once are then optimized for
8922 size.
8923 Enabled by default at @option{-O} and higher.
8924
8925 @item -fipa-cp
8926 @opindex fipa-cp
8927 Perform interprocedural constant propagation.
8928 This optimization analyzes the program to determine when values passed
8929 to functions are constants and then optimizes accordingly.
8930 This optimization can substantially increase performance
8931 if the application has constants passed to functions.
8932 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8933
8934 @item -fipa-cp-clone
8935 @opindex fipa-cp-clone
8936 Perform function cloning to make interprocedural constant propagation stronger.
8937 When enabled, interprocedural constant propagation performs function cloning
8938 when externally visible function can be called with constant arguments.
8939 Because this optimization can create multiple copies of functions,
8940 it may significantly increase code size
8941 (see @option{--param ipcp-unit-growth=@var{value}}).
8942 This flag is enabled by default at @option{-O3}.
8943
8944 @item -fipa-bit-cp
8945 @opindex fipa-bit-cp
8946 When enabled, perform interprocedural bitwise constant
8947 propagation. This flag is enabled by default at @option{-O2}. It
8948 requires that @option{-fipa-cp} is enabled.
8949
8950 @item -fipa-vrp
8951 @opindex fipa-vrp
8952 When enabled, perform interprocedural propagation of value
8953 ranges. This flag is enabled by default at @option{-O2}. It requires
8954 that @option{-fipa-cp} is enabled.
8955
8956 @item -fipa-icf
8957 @opindex fipa-icf
8958 Perform Identical Code Folding for functions and read-only variables.
8959 The optimization reduces code size and may disturb unwind stacks by replacing
8960 a function by equivalent one with a different name. The optimization works
8961 more effectively with link-time optimization enabled.
8962
8963 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8964 works on different levels and thus the optimizations are not same - there are
8965 equivalences that are found only by GCC and equivalences found only by Gold.
8966
8967 This flag is enabled by default at @option{-O2} and @option{-Os}.
8968
8969 @item -fisolate-erroneous-paths-dereference
8970 @opindex fisolate-erroneous-paths-dereference
8971 Detect paths that trigger erroneous or undefined behavior due to
8972 dereferencing a null pointer. Isolate those paths from the main control
8973 flow and turn the statement with erroneous or undefined behavior into a trap.
8974 This flag is enabled by default at @option{-O2} and higher and depends on
8975 @option{-fdelete-null-pointer-checks} also being enabled.
8976
8977 @item -fisolate-erroneous-paths-attribute
8978 @opindex fisolate-erroneous-paths-attribute
8979 Detect paths that trigger erroneous or undefined behavior due to a null value
8980 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8981 attribute. Isolate those paths from the main control flow and turn the
8982 statement with erroneous or undefined behavior into a trap. This is not
8983 currently enabled, but may be enabled by @option{-O2} in the future.
8984
8985 @item -ftree-sink
8986 @opindex ftree-sink
8987 Perform forward store motion on trees. This flag is
8988 enabled by default at @option{-O} and higher.
8989
8990 @item -ftree-bit-ccp
8991 @opindex ftree-bit-ccp
8992 Perform sparse conditional bit constant propagation on trees and propagate
8993 pointer alignment information.
8994 This pass only operates on local scalar variables and is enabled by default
8995 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8996
8997 @item -ftree-ccp
8998 @opindex ftree-ccp
8999 Perform sparse conditional constant propagation (CCP) on trees. This
9000 pass only operates on local scalar variables and is enabled by default
9001 at @option{-O} and higher.
9002
9003 @item -fssa-backprop
9004 @opindex fssa-backprop
9005 Propagate information about uses of a value up the definition chain
9006 in order to simplify the definitions. For example, this pass strips
9007 sign operations if the sign of a value never matters. The flag is
9008 enabled by default at @option{-O} and higher.
9009
9010 @item -fssa-phiopt
9011 @opindex fssa-phiopt
9012 Perform pattern matching on SSA PHI nodes to optimize conditional
9013 code. This pass is enabled by default at @option{-O} and higher.
9014
9015 @item -ftree-switch-conversion
9016 @opindex ftree-switch-conversion
9017 Perform conversion of simple initializations in a switch to
9018 initializations from a scalar array. This flag is enabled by default
9019 at @option{-O2} and higher.
9020
9021 @item -ftree-tail-merge
9022 @opindex ftree-tail-merge
9023 Look for identical code sequences. When found, replace one with a jump to the
9024 other. This optimization is known as tail merging or cross jumping. This flag
9025 is enabled by default at @option{-O2} and higher. The compilation time
9026 in this pass can
9027 be limited using @option{max-tail-merge-comparisons} parameter and
9028 @option{max-tail-merge-iterations} parameter.
9029
9030 @item -ftree-dce
9031 @opindex ftree-dce
9032 Perform dead code elimination (DCE) on trees. This flag is enabled by
9033 default at @option{-O} and higher.
9034
9035 @item -ftree-builtin-call-dce
9036 @opindex ftree-builtin-call-dce
9037 Perform conditional dead code elimination (DCE) for calls to built-in functions
9038 that may set @code{errno} but are otherwise free of side effects. This flag is
9039 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9040 specified.
9041
9042 @item -ftree-dominator-opts
9043 @opindex ftree-dominator-opts
9044 Perform a variety of simple scalar cleanups (constant/copy
9045 propagation, redundancy elimination, range propagation and expression
9046 simplification) based on a dominator tree traversal. This also
9047 performs jump threading (to reduce jumps to jumps). This flag is
9048 enabled by default at @option{-O} and higher.
9049
9050 @item -ftree-dse
9051 @opindex ftree-dse
9052 Perform dead store elimination (DSE) on trees. A dead store is a store into
9053 a memory location that is later overwritten by another store without
9054 any intervening loads. In this case the earlier store can be deleted. This
9055 flag is enabled by default at @option{-O} and higher.
9056
9057 @item -ftree-ch
9058 @opindex ftree-ch
9059 Perform loop header copying on trees. This is beneficial since it increases
9060 effectiveness of code motion optimizations. It also saves one jump. This flag
9061 is enabled by default at @option{-O} and higher. It is not enabled
9062 for @option{-Os}, since it usually increases code size.
9063
9064 @item -ftree-loop-optimize
9065 @opindex ftree-loop-optimize
9066 Perform loop optimizations on trees. This flag is enabled by default
9067 at @option{-O} and higher.
9068
9069 @item -ftree-loop-linear
9070 @itemx -floop-strip-mine
9071 @itemx -floop-block
9072 @opindex ftree-loop-linear
9073 @opindex floop-strip-mine
9074 @opindex floop-block
9075 Perform loop nest optimizations. Same as
9076 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9077 to be configured with @option{--with-isl} to enable the Graphite loop
9078 transformation infrastructure.
9079
9080 @item -fgraphite-identity
9081 @opindex fgraphite-identity
9082 Enable the identity transformation for graphite. For every SCoP we generate
9083 the polyhedral representation and transform it back to gimple. Using
9084 @option{-fgraphite-identity} we can check the costs or benefits of the
9085 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9086 are also performed by the code generator isl, like index splitting and
9087 dead code elimination in loops.
9088
9089 @item -floop-nest-optimize
9090 @opindex floop-nest-optimize
9091 Enable the isl based loop nest optimizer. This is a generic loop nest
9092 optimizer based on the Pluto optimization algorithms. It calculates a loop
9093 structure optimized for data-locality and parallelism. This option
9094 is experimental.
9095
9096 @item -floop-parallelize-all
9097 @opindex floop-parallelize-all
9098 Use the Graphite data dependence analysis to identify loops that can
9099 be parallelized. Parallelize all the loops that can be analyzed to
9100 not contain loop carried dependences without checking that it is
9101 profitable to parallelize the loops.
9102
9103 @item -ftree-coalesce-vars
9104 @opindex ftree-coalesce-vars
9105 While transforming the program out of the SSA representation, attempt to
9106 reduce copying by coalescing versions of different user-defined
9107 variables, instead of just compiler temporaries. This may severely
9108 limit the ability to debug an optimized program compiled with
9109 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9110 prevents SSA coalescing of user variables. This option is enabled by
9111 default if optimization is enabled, and it does very little otherwise.
9112
9113 @item -ftree-loop-if-convert
9114 @opindex ftree-loop-if-convert
9115 Attempt to transform conditional jumps in the innermost loops to
9116 branch-less equivalents. The intent is to remove control-flow from
9117 the innermost loops in order to improve the ability of the
9118 vectorization pass to handle these loops. This is enabled by default
9119 if vectorization is enabled.
9120
9121 @item -ftree-loop-distribution
9122 @opindex ftree-loop-distribution
9123 Perform loop distribution. This flag can improve cache performance on
9124 big loop bodies and allow further loop optimizations, like
9125 parallelization or vectorization, to take place. For example, the loop
9126 @smallexample
9127 DO I = 1, N
9128 A(I) = B(I) + C
9129 D(I) = E(I) * F
9130 ENDDO
9131 @end smallexample
9132 is transformed to
9133 @smallexample
9134 DO I = 1, N
9135 A(I) = B(I) + C
9136 ENDDO
9137 DO I = 1, N
9138 D(I) = E(I) * F
9139 ENDDO
9140 @end smallexample
9141
9142 @item -ftree-loop-distribute-patterns
9143 @opindex ftree-loop-distribute-patterns
9144 Perform loop distribution of patterns that can be code generated with
9145 calls to a library. This flag is enabled by default at @option{-O3}.
9146
9147 This pass distributes the initialization loops and generates a call to
9148 memset zero. For example, the loop
9149 @smallexample
9150 DO I = 1, N
9151 A(I) = 0
9152 B(I) = A(I) + I
9153 ENDDO
9154 @end smallexample
9155 is transformed to
9156 @smallexample
9157 DO I = 1, N
9158 A(I) = 0
9159 ENDDO
9160 DO I = 1, N
9161 B(I) = A(I) + I
9162 ENDDO
9163 @end smallexample
9164 and the initialization loop is transformed into a call to memset zero.
9165
9166 @item -floop-interchange
9167 @opindex floop-interchange
9168 Perform loop interchange outside of graphite. This flag can improve cache
9169 performance on loop nest and allow further loop optimizations, like
9170 vectorization, to take place. For example, the loop
9171 @smallexample
9172 for (int i = 0; i < N; i++)
9173 for (int j = 0; j < N; j++)
9174 for (int k = 0; k < N; k++)
9175 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9176 @end smallexample
9177 is transformed to
9178 @smallexample
9179 for (int i = 0; i < N; i++)
9180 for (int k = 0; k < N; k++)
9181 for (int j = 0; j < N; j++)
9182 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9183 @end smallexample
9184 This flag is enabled by default at @option{-O3}.
9185
9186 @item -floop-unroll-and-jam
9187 @opindex floop-unroll-and-jam
9188 Apply unroll and jam transformations on feasible loops. In a loop
9189 nest this unrolls the outer loop by some factor and fuses the resulting
9190 multiple inner loops. This flag is enabled by default at @option{-O3}.
9191
9192 @item -ftree-loop-im
9193 @opindex ftree-loop-im
9194 Perform loop invariant motion on trees. This pass moves only invariants that
9195 are hard to handle at RTL level (function calls, operations that expand to
9196 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9197 operands of conditions that are invariant out of the loop, so that we can use
9198 just trivial invariantness analysis in loop unswitching. The pass also includes
9199 store motion.
9200
9201 @item -ftree-loop-ivcanon
9202 @opindex ftree-loop-ivcanon
9203 Create a canonical counter for number of iterations in loops for which
9204 determining number of iterations requires complicated analysis. Later
9205 optimizations then may determine the number easily. Useful especially
9206 in connection with unrolling.
9207
9208 @item -ftree-scev-cprop
9209 @opindex ftree-scev-cprop
9210 Perform final value replacement. If a variable is modified in a loop
9211 in such a way that its value when exiting the loop can be determined using
9212 only its initial value and the number of loop iterations, replace uses of
9213 the final value by such a computation, provided it is sufficiently cheap.
9214 This reduces data dependencies and may allow further simplifications.
9215 Enabled by default at @option{-O} and higher.
9216
9217 @item -fivopts
9218 @opindex fivopts
9219 Perform induction variable optimizations (strength reduction, induction
9220 variable merging and induction variable elimination) on trees.
9221
9222 @item -ftree-parallelize-loops=n
9223 @opindex ftree-parallelize-loops
9224 Parallelize loops, i.e., split their iteration space to run in n threads.
9225 This is only possible for loops whose iterations are independent
9226 and can be arbitrarily reordered. The optimization is only
9227 profitable on multiprocessor machines, for loops that are CPU-intensive,
9228 rather than constrained e.g.@: by memory bandwidth. This option
9229 implies @option{-pthread}, and thus is only supported on targets
9230 that have support for @option{-pthread}.
9231
9232 @item -ftree-pta
9233 @opindex ftree-pta
9234 Perform function-local points-to analysis on trees. This flag is
9235 enabled by default at @option{-O} and higher.
9236
9237 @item -ftree-sra
9238 @opindex ftree-sra
9239 Perform scalar replacement of aggregates. This pass replaces structure
9240 references with scalars to prevent committing structures to memory too
9241 early. This flag is enabled by default at @option{-O} and higher.
9242
9243 @item -fstore-merging
9244 @opindex fstore-merging
9245 Perform merging of narrow stores to consecutive memory addresses. This pass
9246 merges contiguous stores of immediate values narrower than a word into fewer
9247 wider stores to reduce the number of instructions. This is enabled by default
9248 at @option{-O2} and higher as well as @option{-Os}.
9249
9250 @item -ftree-ter
9251 @opindex ftree-ter
9252 Perform temporary expression replacement during the SSA->normal phase. Single
9253 use/single def temporaries are replaced at their use location with their
9254 defining expression. This results in non-GIMPLE code, but gives the expanders
9255 much more complex trees to work on resulting in better RTL generation. This is
9256 enabled by default at @option{-O} and higher.
9257
9258 @item -ftree-slsr
9259 @opindex ftree-slsr
9260 Perform straight-line strength reduction on trees. This recognizes related
9261 expressions involving multiplications and replaces them by less expensive
9262 calculations when possible. This is enabled by default at @option{-O} and
9263 higher.
9264
9265 @item -ftree-vectorize
9266 @opindex ftree-vectorize
9267 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9268 and @option{-ftree-slp-vectorize} if not explicitly specified.
9269
9270 @item -ftree-loop-vectorize
9271 @opindex ftree-loop-vectorize
9272 Perform loop vectorization on trees. This flag is enabled by default at
9273 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9274
9275 @item -ftree-slp-vectorize
9276 @opindex ftree-slp-vectorize
9277 Perform basic block vectorization on trees. This flag is enabled by default at
9278 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9279
9280 @item -fvect-cost-model=@var{model}
9281 @opindex fvect-cost-model
9282 Alter the cost model used for vectorization. The @var{model} argument
9283 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9284 With the @samp{unlimited} model the vectorized code-path is assumed
9285 to be profitable while with the @samp{dynamic} model a runtime check
9286 guards the vectorized code-path to enable it only for iteration
9287 counts that will likely execute faster than when executing the original
9288 scalar loop. The @samp{cheap} model disables vectorization of
9289 loops where doing so would be cost prohibitive for example due to
9290 required runtime checks for data dependence or alignment but otherwise
9291 is equal to the @samp{dynamic} model.
9292 The default cost model depends on other optimization flags and is
9293 either @samp{dynamic} or @samp{cheap}.
9294
9295 @item -fsimd-cost-model=@var{model}
9296 @opindex fsimd-cost-model
9297 Alter the cost model used for vectorization of loops marked with the OpenMP
9298 simd directive. The @var{model} argument should be one of
9299 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9300 have the same meaning as described in @option{-fvect-cost-model} and by
9301 default a cost model defined with @option{-fvect-cost-model} is used.
9302
9303 @item -ftree-vrp
9304 @opindex ftree-vrp
9305 Perform Value Range Propagation on trees. This is similar to the
9306 constant propagation pass, but instead of values, ranges of values are
9307 propagated. This allows the optimizers to remove unnecessary range
9308 checks like array bound checks and null pointer checks. This is
9309 enabled by default at @option{-O2} and higher. Null pointer check
9310 elimination is only done if @option{-fdelete-null-pointer-checks} is
9311 enabled.
9312
9313 @item -fsplit-paths
9314 @opindex fsplit-paths
9315 Split paths leading to loop backedges. This can improve dead code
9316 elimination and common subexpression elimination. This is enabled by
9317 default at @option{-O2} and above.
9318
9319 @item -fsplit-ivs-in-unroller
9320 @opindex fsplit-ivs-in-unroller
9321 Enables expression of values of induction variables in later iterations
9322 of the unrolled loop using the value in the first iteration. This breaks
9323 long dependency chains, thus improving efficiency of the scheduling passes.
9324
9325 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9326 same effect. However, that is not reliable in cases where the loop body
9327 is more complicated than a single basic block. It also does not work at all
9328 on some architectures due to restrictions in the CSE pass.
9329
9330 This optimization is enabled by default.
9331
9332 @item -fvariable-expansion-in-unroller
9333 @opindex fvariable-expansion-in-unroller
9334 With this option, the compiler creates multiple copies of some
9335 local variables when unrolling a loop, which can result in superior code.
9336
9337 @item -fpartial-inlining
9338 @opindex fpartial-inlining
9339 Inline parts of functions. This option has any effect only
9340 when inlining itself is turned on by the @option{-finline-functions}
9341 or @option{-finline-small-functions} options.
9342
9343 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9344
9345 @item -fpredictive-commoning
9346 @opindex fpredictive-commoning
9347 Perform predictive commoning optimization, i.e., reusing computations
9348 (especially memory loads and stores) performed in previous
9349 iterations of loops.
9350
9351 This option is enabled at level @option{-O3}.
9352
9353 @item -fprefetch-loop-arrays
9354 @opindex fprefetch-loop-arrays
9355 If supported by the target machine, generate instructions to prefetch
9356 memory to improve the performance of loops that access large arrays.
9357
9358 This option may generate better or worse code; results are highly
9359 dependent on the structure of loops within the source code.
9360
9361 Disabled at level @option{-Os}.
9362
9363 @item -fno-printf-return-value
9364 @opindex fno-printf-return-value
9365 Do not substitute constants for known return value of formatted output
9366 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9367 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9368 transformation allows GCC to optimize or even eliminate branches based
9369 on the known return value of these functions called with arguments that
9370 are either constant, or whose values are known to be in a range that
9371 makes determining the exact return value possible. For example, when
9372 @option{-fprintf-return-value} is in effect, both the branch and the
9373 body of the @code{if} statement (but not the call to @code{snprint})
9374 can be optimized away when @code{i} is a 32-bit or smaller integer
9375 because the return value is guaranteed to be at most 8.
9376
9377 @smallexample
9378 char buf[9];
9379 if (snprintf (buf, "%08x", i) >= sizeof buf)
9380 @dots{}
9381 @end smallexample
9382
9383 The @option{-fprintf-return-value} option relies on other optimizations
9384 and yields best results with @option{-O2} and above. It works in tandem
9385 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9386 options. The @option{-fprintf-return-value} option is enabled by default.
9387
9388 @item -fno-peephole
9389 @itemx -fno-peephole2
9390 @opindex fno-peephole
9391 @opindex fno-peephole2
9392 Disable any machine-specific peephole optimizations. The difference
9393 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9394 are implemented in the compiler; some targets use one, some use the
9395 other, a few use both.
9396
9397 @option{-fpeephole} is enabled by default.
9398 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9399
9400 @item -fno-guess-branch-probability
9401 @opindex fno-guess-branch-probability
9402 Do not guess branch probabilities using heuristics.
9403
9404 GCC uses heuristics to guess branch probabilities if they are
9405 not provided by profiling feedback (@option{-fprofile-arcs}). These
9406 heuristics are based on the control flow graph. If some branch probabilities
9407 are specified by @code{__builtin_expect}, then the heuristics are
9408 used to guess branch probabilities for the rest of the control flow graph,
9409 taking the @code{__builtin_expect} info into account. The interactions
9410 between the heuristics and @code{__builtin_expect} can be complex, and in
9411 some cases, it may be useful to disable the heuristics so that the effects
9412 of @code{__builtin_expect} are easier to understand.
9413
9414 It is also possible to specify expected probability of the expression
9415 with @code{__builtin_expect_with_probability} built-in function.
9416
9417 The default is @option{-fguess-branch-probability} at levels
9418 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9419
9420 @item -freorder-blocks
9421 @opindex freorder-blocks
9422 Reorder basic blocks in the compiled function in order to reduce number of
9423 taken branches and improve code locality.
9424
9425 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9426
9427 @item -freorder-blocks-algorithm=@var{algorithm}
9428 @opindex freorder-blocks-algorithm
9429 Use the specified algorithm for basic block reordering. The
9430 @var{algorithm} argument can be @samp{simple}, which does not increase
9431 code size (except sometimes due to secondary effects like alignment),
9432 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9433 put all often executed code together, minimizing the number of branches
9434 executed by making extra copies of code.
9435
9436 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9437 @samp{stc} at levels @option{-O2}, @option{-O3}.
9438
9439 @item -freorder-blocks-and-partition
9440 @opindex freorder-blocks-and-partition
9441 In addition to reordering basic blocks in the compiled function, in order
9442 to reduce number of taken branches, partitions hot and cold basic blocks
9443 into separate sections of the assembly and @file{.o} files, to improve
9444 paging and cache locality performance.
9445
9446 This optimization is automatically turned off in the presence of
9447 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9448 section attribute and on any architecture that does not support named
9449 sections. When @option{-fsplit-stack} is used this option is not
9450 enabled by default (to avoid linker errors), but may be enabled
9451 explicitly (if using a working linker).
9452
9453 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9454
9455 @item -freorder-functions
9456 @opindex freorder-functions
9457 Reorder functions in the object file in order to
9458 improve code locality. This is implemented by using special
9459 subsections @code{.text.hot} for most frequently executed functions and
9460 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9461 the linker so object file format must support named sections and linker must
9462 place them in a reasonable way.
9463
9464 Also profile feedback must be available to make this option effective. See
9465 @option{-fprofile-arcs} for details.
9466
9467 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9468
9469 @item -fstrict-aliasing
9470 @opindex fstrict-aliasing
9471 Allow the compiler to assume the strictest aliasing rules applicable to
9472 the language being compiled. For C (and C++), this activates
9473 optimizations based on the type of expressions. In particular, an
9474 object of one type is assumed never to reside at the same address as an
9475 object of a different type, unless the types are almost the same. For
9476 example, an @code{unsigned int} can alias an @code{int}, but not a
9477 @code{void*} or a @code{double}. A character type may alias any other
9478 type.
9479
9480 @anchor{Type-punning}Pay special attention to code like this:
9481 @smallexample
9482 union a_union @{
9483 int i;
9484 double d;
9485 @};
9486
9487 int f() @{
9488 union a_union t;
9489 t.d = 3.0;
9490 return t.i;
9491 @}
9492 @end smallexample
9493 The practice of reading from a different union member than the one most
9494 recently written to (called ``type-punning'') is common. Even with
9495 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9496 is accessed through the union type. So, the code above works as
9497 expected. @xref{Structures unions enumerations and bit-fields
9498 implementation}. However, this code might not:
9499 @smallexample
9500 int f() @{
9501 union a_union t;
9502 int* ip;
9503 t.d = 3.0;
9504 ip = &t.i;
9505 return *ip;
9506 @}
9507 @end smallexample
9508
9509 Similarly, access by taking the address, casting the resulting pointer
9510 and dereferencing the result has undefined behavior, even if the cast
9511 uses a union type, e.g.:
9512 @smallexample
9513 int f() @{
9514 double d = 3.0;
9515 return ((union a_union *) &d)->i;
9516 @}
9517 @end smallexample
9518
9519 The @option{-fstrict-aliasing} option is enabled at levels
9520 @option{-O2}, @option{-O3}, @option{-Os}.
9521
9522 @item -falign-functions
9523 @itemx -falign-functions=@var{n}
9524 @itemx -falign-functions=@var{n}:@var{m}
9525 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9526 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9527 @opindex falign-functions
9528 Align the start of functions to the next power-of-two greater than
9529 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9530 the first @var{m} bytes of the function can be fetched by the CPU
9531 without crossing an @var{n}-byte alignment boundary.
9532
9533 If @var{m} is not specified, it defaults to @var{n}.
9534
9535 Examples: @option{-falign-functions=32} aligns functions to the next
9536 32-byte boundary, @option{-falign-functions=24} aligns to the next
9537 32-byte boundary only if this can be done by skipping 23 bytes or less,
9538 @option{-falign-functions=32:7} aligns to the next
9539 32-byte boundary only if this can be done by skipping 6 bytes or less.
9540
9541 The second pair of @var{n2}:@var{m2} values allows you to specify
9542 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9543 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9544 otherwise aligns to the next 32-byte boundary if this can be done
9545 by skipping 2 bytes or less.
9546 If @var{m2} is not specified, it defaults to @var{n2}.
9547
9548 Some assemblers only support this flag when @var{n} is a power of two;
9549 in that case, it is rounded up.
9550
9551 @option{-fno-align-functions} and @option{-falign-functions=1} are
9552 equivalent and mean that functions are not aligned.
9553
9554 If @var{n} is not specified or is zero, use a machine-dependent default.
9555 The maximum allowed @var{n} option value is 65536.
9556
9557 Enabled at levels @option{-O2}, @option{-O3}.
9558
9559 @item -flimit-function-alignment
9560 If this option is enabled, the compiler tries to avoid unnecessarily
9561 overaligning functions. It attempts to instruct the assembler to align
9562 by the amount specified by @option{-falign-functions}, but not to
9563 skip more bytes than the size of the function.
9564
9565 @item -falign-labels
9566 @itemx -falign-labels=@var{n}
9567 @itemx -falign-labels=@var{n}:@var{m}
9568 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9569 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9570 @opindex falign-labels
9571 Align all branch targets to a power-of-two boundary.
9572
9573 Parameters of this option are analogous to the @option{-falign-functions} option.
9574 @option{-fno-align-labels} and @option{-falign-labels=1} are
9575 equivalent and mean that labels are not aligned.
9576
9577 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9578 are greater than this value, then their values are used instead.
9579
9580 If @var{n} is not specified or is zero, use a machine-dependent default
9581 which is very likely to be @samp{1}, meaning no alignment.
9582 The maximum allowed @var{n} option value is 65536.
9583
9584 Enabled at levels @option{-O2}, @option{-O3}.
9585
9586 @item -falign-loops
9587 @itemx -falign-loops=@var{n}
9588 @itemx -falign-loops=@var{n}:@var{m}
9589 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9590 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9591 @opindex falign-loops
9592 Align loops to a power-of-two boundary. If the loops are executed
9593 many times, this makes up for any execution of the dummy padding
9594 instructions.
9595
9596 Parameters of this option are analogous to the @option{-falign-functions} option.
9597 @option{-fno-align-loops} and @option{-falign-loops=1} are
9598 equivalent and mean that loops are not aligned.
9599 The maximum allowed @var{n} option value is 65536.
9600
9601 If @var{n} is not specified or is zero, use a machine-dependent default.
9602
9603 Enabled at levels @option{-O2}, @option{-O3}.
9604
9605 @item -falign-jumps
9606 @itemx -falign-jumps=@var{n}
9607 @itemx -falign-jumps=@var{n}:@var{m}
9608 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9609 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9610 @opindex falign-jumps
9611 Align branch targets to a power-of-two boundary, for branch targets
9612 where the targets can only be reached by jumping. In this case,
9613 no dummy operations need be executed.
9614
9615 Parameters of this option are analogous to the @option{-falign-functions} option.
9616 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9617 equivalent and mean that loops are not aligned.
9618
9619 If @var{n} is not specified or is zero, use a machine-dependent default.
9620 The maximum allowed @var{n} option value is 65536.
9621
9622 Enabled at levels @option{-O2}, @option{-O3}.
9623
9624 @item -funit-at-a-time
9625 @opindex funit-at-a-time
9626 This option is left for compatibility reasons. @option{-funit-at-a-time}
9627 has no effect, while @option{-fno-unit-at-a-time} implies
9628 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9629
9630 Enabled by default.
9631
9632 @item -fno-toplevel-reorder
9633 @opindex fno-toplevel-reorder
9634 Do not reorder top-level functions, variables, and @code{asm}
9635 statements. Output them in the same order that they appear in the
9636 input file. When this option is used, unreferenced static variables
9637 are not removed. This option is intended to support existing code
9638 that relies on a particular ordering. For new code, it is better to
9639 use attributes when possible.
9640
9641 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9642 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9643 targets.
9644
9645 @item -fweb
9646 @opindex fweb
9647 Constructs webs as commonly used for register allocation purposes and assign
9648 each web individual pseudo register. This allows the register allocation pass
9649 to operate on pseudos directly, but also strengthens several other optimization
9650 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9651 however, make debugging impossible, since variables no longer stay in a
9652 ``home register''.
9653
9654 Enabled by default with @option{-funroll-loops}.
9655
9656 @item -fwhole-program
9657 @opindex fwhole-program
9658 Assume that the current compilation unit represents the whole program being
9659 compiled. All public functions and variables with the exception of @code{main}
9660 and those merged by attribute @code{externally_visible} become static functions
9661 and in effect are optimized more aggressively by interprocedural optimizers.
9662
9663 This option should not be used in combination with @option{-flto}.
9664 Instead relying on a linker plugin should provide safer and more precise
9665 information.
9666
9667 @item -flto[=@var{n}]
9668 @opindex flto
9669 This option runs the standard link-time optimizer. When invoked
9670 with source code, it generates GIMPLE (one of GCC's internal
9671 representations) and writes it to special ELF sections in the object
9672 file. When the object files are linked together, all the function
9673 bodies are read from these ELF sections and instantiated as if they
9674 had been part of the same translation unit.
9675
9676 To use the link-time optimizer, @option{-flto} and optimization
9677 options should be specified at compile time and during the final link.
9678 It is recommended that you compile all the files participating in the
9679 same link with the same options and also specify those options at
9680 link time.
9681 For example:
9682
9683 @smallexample
9684 gcc -c -O2 -flto foo.c
9685 gcc -c -O2 -flto bar.c
9686 gcc -o myprog -flto -O2 foo.o bar.o
9687 @end smallexample
9688
9689 The first two invocations to GCC save a bytecode representation
9690 of GIMPLE into special ELF sections inside @file{foo.o} and
9691 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9692 @file{foo.o} and @file{bar.o}, merges the two files into a single
9693 internal image, and compiles the result as usual. Since both
9694 @file{foo.o} and @file{bar.o} are merged into a single image, this
9695 causes all the interprocedural analyses and optimizations in GCC to
9696 work across the two files as if they were a single one. This means,
9697 for example, that the inliner is able to inline functions in
9698 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9699
9700 Another (simpler) way to enable link-time optimization is:
9701
9702 @smallexample
9703 gcc -o myprog -flto -O2 foo.c bar.c
9704 @end smallexample
9705
9706 The above generates bytecode for @file{foo.c} and @file{bar.c},
9707 merges them together into a single GIMPLE representation and optimizes
9708 them as usual to produce @file{myprog}.
9709
9710 The only important thing to keep in mind is that to enable link-time
9711 optimizations you need to use the GCC driver to perform the link step.
9712 GCC then automatically performs link-time optimization if any of the
9713 objects involved were compiled with the @option{-flto} command-line option.
9714 You generally
9715 should specify the optimization options to be used for link-time
9716 optimization though GCC tries to be clever at guessing an
9717 optimization level to use from the options used at compile time
9718 if you fail to specify one at link time. You can always override
9719 the automatic decision to do link-time optimization
9720 by passing @option{-fno-lto} to the link command.
9721
9722 To make whole program optimization effective, it is necessary to make
9723 certain whole program assumptions. The compiler needs to know
9724 what functions and variables can be accessed by libraries and runtime
9725 outside of the link-time optimized unit. When supported by the linker,
9726 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9727 to the compiler about used and externally visible symbols. When
9728 the linker plugin is not available, @option{-fwhole-program} should be
9729 used to allow the compiler to make these assumptions, which leads
9730 to more aggressive optimization decisions.
9731
9732 When @option{-fuse-linker-plugin} is not enabled, when a file is
9733 compiled with @option{-flto}, the generated object file is larger than
9734 a regular object file because it contains GIMPLE bytecodes and the usual
9735 final code (see @option{-ffat-lto-objects}. This means that
9736 object files with LTO information can be linked as normal object
9737 files; if @option{-fno-lto} is passed to the linker, no
9738 interprocedural optimizations are applied. Note that when
9739 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9740 but you cannot perform a regular, non-LTO link on them.
9741
9742 Additionally, the optimization flags used to compile individual files
9743 are not necessarily related to those used at link time. For instance,
9744
9745 @smallexample
9746 gcc -c -O0 -ffat-lto-objects -flto foo.c
9747 gcc -c -O0 -ffat-lto-objects -flto bar.c
9748 gcc -o myprog -O3 foo.o bar.o
9749 @end smallexample
9750
9751 This produces individual object files with unoptimized assembler
9752 code, but the resulting binary @file{myprog} is optimized at
9753 @option{-O3}. If, instead, the final binary is generated with
9754 @option{-fno-lto}, then @file{myprog} is not optimized.
9755
9756 When producing the final binary, GCC only
9757 applies link-time optimizations to those files that contain bytecode.
9758 Therefore, you can mix and match object files and libraries with
9759 GIMPLE bytecodes and final object code. GCC automatically selects
9760 which files to optimize in LTO mode and which files to link without
9761 further processing.
9762
9763 There are some code generation flags preserved by GCC when
9764 generating bytecodes, as they need to be used during the final link
9765 stage. Generally options specified at link time override those
9766 specified at compile time.
9767
9768 If you do not specify an optimization level option @option{-O} at
9769 link time, then GCC uses the highest optimization level
9770 used when compiling the object files.
9771
9772 Currently, the following options and their settings are taken from
9773 the first object file that explicitly specifies them:
9774 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9775 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9776 and all the @option{-m} target flags.
9777
9778 Certain ABI-changing flags are required to match in all compilation units,
9779 and trying to override this at link time with a conflicting value
9780 is ignored. This includes options such as @option{-freg-struct-return}
9781 and @option{-fpcc-struct-return}.
9782
9783 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9784 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9785 are passed through to the link stage and merged conservatively for
9786 conflicting translation units. Specifically
9787 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9788 precedence; and for example @option{-ffp-contract=off} takes precedence
9789 over @option{-ffp-contract=fast}. You can override them at link time.
9790
9791 If LTO encounters objects with C linkage declared with incompatible
9792 types in separate translation units to be linked together (undefined
9793 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9794 issued. The behavior is still undefined at run time. Similar
9795 diagnostics may be raised for other languages.
9796
9797 Another feature of LTO is that it is possible to apply interprocedural
9798 optimizations on files written in different languages:
9799
9800 @smallexample
9801 gcc -c -flto foo.c
9802 g++ -c -flto bar.cc
9803 gfortran -c -flto baz.f90
9804 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9805 @end smallexample
9806
9807 Notice that the final link is done with @command{g++} to get the C++
9808 runtime libraries and @option{-lgfortran} is added to get the Fortran
9809 runtime libraries. In general, when mixing languages in LTO mode, you
9810 should use the same link command options as when mixing languages in a
9811 regular (non-LTO) compilation.
9812
9813 If object files containing GIMPLE bytecode are stored in a library archive, say
9814 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9815 are using a linker with plugin support. To create static libraries suitable
9816 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9817 and @command{ranlib};
9818 to show the symbols of object files with GIMPLE bytecode, use
9819 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9820 and @command{nm} have been compiled with plugin support. At link time, use the
9821 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9822 the LTO optimization process:
9823
9824 @smallexample
9825 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9826 @end smallexample
9827
9828 With the linker plugin enabled, the linker extracts the needed
9829 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9830 to make them part of the aggregated GIMPLE image to be optimized.
9831
9832 If you are not using a linker with plugin support and/or do not
9833 enable the linker plugin, then the objects inside @file{libfoo.a}
9834 are extracted and linked as usual, but they do not participate
9835 in the LTO optimization process. In order to make a static library suitable
9836 for both LTO optimization and usual linkage, compile its object files with
9837 @option{-flto} @option{-ffat-lto-objects}.
9838
9839 Link-time optimizations do not require the presence of the whole program to
9840 operate. If the program does not require any symbols to be exported, it is
9841 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9842 the interprocedural optimizers to use more aggressive assumptions which may
9843 lead to improved optimization opportunities.
9844 Use of @option{-fwhole-program} is not needed when linker plugin is
9845 active (see @option{-fuse-linker-plugin}).
9846
9847 The current implementation of LTO makes no
9848 attempt to generate bytecode that is portable between different
9849 types of hosts. The bytecode files are versioned and there is a
9850 strict version check, so bytecode files generated in one version of
9851 GCC do not work with an older or newer version of GCC.
9852
9853 Link-time optimization does not work well with generation of debugging
9854 information on systems other than those using a combination of ELF and
9855 DWARF.
9856
9857 If you specify the optional @var{n}, the optimization and code
9858 generation done at link time is executed in parallel using @var{n}
9859 parallel jobs by utilizing an installed @command{make} program. The
9860 environment variable @env{MAKE} may be used to override the program
9861 used. The default value for @var{n} is 1.
9862
9863 You can also specify @option{-flto=jobserver} to use GNU make's
9864 job server mode to determine the number of parallel jobs. This
9865 is useful when the Makefile calling GCC is already executing in parallel.
9866 You must prepend a @samp{+} to the command recipe in the parent Makefile
9867 for this to work. This option likely only works if @env{MAKE} is
9868 GNU make.
9869
9870 @item -flto-partition=@var{alg}
9871 @opindex flto-partition
9872 Specify the partitioning algorithm used by the link-time optimizer.
9873 The value is either @samp{1to1} to specify a partitioning mirroring
9874 the original source files or @samp{balanced} to specify partitioning
9875 into equally sized chunks (whenever possible) or @samp{max} to create
9876 new partition for every symbol where possible. Specifying @samp{none}
9877 as an algorithm disables partitioning and streaming completely.
9878 The default value is @samp{balanced}. While @samp{1to1} can be used
9879 as an workaround for various code ordering issues, the @samp{max}
9880 partitioning is intended for internal testing only.
9881 The value @samp{one} specifies that exactly one partition should be
9882 used while the value @samp{none} bypasses partitioning and executes
9883 the link-time optimization step directly from the WPA phase.
9884
9885 @item -flto-odr-type-merging
9886 @opindex flto-odr-type-merging
9887 Enable streaming of mangled types names of C++ types and their unification
9888 at link time. This increases size of LTO object files, but enables
9889 diagnostics about One Definition Rule violations.
9890
9891 @item -flto-compression-level=@var{n}
9892 @opindex flto-compression-level
9893 This option specifies the level of compression used for intermediate
9894 language written to LTO object files, and is only meaningful in
9895 conjunction with LTO mode (@option{-flto}). Valid
9896 values are 0 (no compression) to 9 (maximum compression). Values
9897 outside this range are clamped to either 0 or 9. If the option is not
9898 given, a default balanced compression setting is used.
9899
9900 @item -fuse-linker-plugin
9901 @opindex fuse-linker-plugin
9902 Enables the use of a linker plugin during link-time optimization. This
9903 option relies on plugin support in the linker, which is available in gold
9904 or in GNU ld 2.21 or newer.
9905
9906 This option enables the extraction of object files with GIMPLE bytecode out
9907 of library archives. This improves the quality of optimization by exposing
9908 more code to the link-time optimizer. This information specifies what
9909 symbols can be accessed externally (by non-LTO object or during dynamic
9910 linking). Resulting code quality improvements on binaries (and shared
9911 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9912 See @option{-flto} for a description of the effect of this flag and how to
9913 use it.
9914
9915 This option is enabled by default when LTO support in GCC is enabled
9916 and GCC was configured for use with
9917 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9918
9919 @item -ffat-lto-objects
9920 @opindex ffat-lto-objects
9921 Fat LTO objects are object files that contain both the intermediate language
9922 and the object code. This makes them usable for both LTO linking and normal
9923 linking. This option is effective only when compiling with @option{-flto}
9924 and is ignored at link time.
9925
9926 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9927 requires the complete toolchain to be aware of LTO. It requires a linker with
9928 linker plugin support for basic functionality. Additionally,
9929 @command{nm}, @command{ar} and @command{ranlib}
9930 need to support linker plugins to allow a full-featured build environment
9931 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9932 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9933 to these tools. With non fat LTO makefiles need to be modified to use them.
9934
9935 Note that modern binutils provide plugin auto-load mechanism.
9936 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
9937 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
9938 @command{gcc-ranlib}).
9939
9940 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9941 support.
9942
9943 @item -fcompare-elim
9944 @opindex fcompare-elim
9945 After register allocation and post-register allocation instruction splitting,
9946 identify arithmetic instructions that compute processor flags similar to a
9947 comparison operation based on that arithmetic. If possible, eliminate the
9948 explicit comparison operation.
9949
9950 This pass only applies to certain targets that cannot explicitly represent
9951 the comparison operation before register allocation is complete.
9952
9953 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9954
9955 @item -fcprop-registers
9956 @opindex fcprop-registers
9957 After register allocation and post-register allocation instruction splitting,
9958 perform a copy-propagation pass to try to reduce scheduling dependencies
9959 and occasionally eliminate the copy.
9960
9961 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9962
9963 @item -fprofile-correction
9964 @opindex fprofile-correction
9965 Profiles collected using an instrumented binary for multi-threaded programs may
9966 be inconsistent due to missed counter updates. When this option is specified,
9967 GCC uses heuristics to correct or smooth out such inconsistencies. By
9968 default, GCC emits an error message when an inconsistent profile is detected.
9969
9970 @item -fprofile-use
9971 @itemx -fprofile-use=@var{path}
9972 @opindex fprofile-use
9973 Enable profile feedback-directed optimizations,
9974 and the following optimizations
9975 which are generally profitable only with profile feedback available:
9976 @option{-fbranch-probabilities}, @option{-fvpt},
9977 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9978 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9979
9980 Before you can use this option, you must first generate profiling information.
9981 @xref{Instrumentation Options}, for information about the
9982 @option{-fprofile-generate} option.
9983
9984 By default, GCC emits an error message if the feedback profiles do not
9985 match the source code. This error can be turned into a warning by using
9986 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
9987 optimized code. Additionally, by default, GCC also emits a warning message if
9988 the feedback profiles do not exist (See @option{-Wmissing-profile}).
9989
9990 If @var{path} is specified, GCC looks at the @var{path} to find
9991 the profile feedback data files. See @option{-fprofile-dir}.
9992
9993 @item -fauto-profile
9994 @itemx -fauto-profile=@var{path}
9995 @opindex fauto-profile
9996 Enable sampling-based feedback-directed optimizations,
9997 and the following optimizations
9998 which are generally profitable only with profile feedback available:
9999 @option{-fbranch-probabilities}, @option{-fvpt},
10000 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
10001 @option{-ftree-vectorize},
10002 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
10003 @option{-fpredictive-commoning}, @option{-funswitch-loops},
10004 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
10005
10006 @var{path} is the name of a file containing AutoFDO profile information.
10007 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10008
10009 Producing an AutoFDO profile data file requires running your program
10010 with the @command{perf} utility on a supported GNU/Linux target system.
10011 For more information, see @uref{https://perf.wiki.kernel.org/}.
10012
10013 E.g.
10014 @smallexample
10015 perf record -e br_inst_retired:near_taken -b -o perf.data \
10016 -- your_program
10017 @end smallexample
10018
10019 Then use the @command{create_gcov} tool to convert the raw profile data
10020 to a format that can be used by GCC.@ You must also supply the
10021 unstripped binary for your program to this tool.
10022 See @uref{https://github.com/google/autofdo}.
10023
10024 E.g.
10025 @smallexample
10026 create_gcov --binary=your_program.unstripped --profile=perf.data \
10027 --gcov=profile.afdo
10028 @end smallexample
10029 @end table
10030
10031 The following options control compiler behavior regarding floating-point
10032 arithmetic. These options trade off between speed and
10033 correctness. All must be specifically enabled.
10034
10035 @table @gcctabopt
10036 @item -ffloat-store
10037 @opindex ffloat-store
10038 Do not store floating-point variables in registers, and inhibit other
10039 options that might change whether a floating-point value is taken from a
10040 register or memory.
10041
10042 @cindex floating-point precision
10043 This option prevents undesirable excess precision on machines such as
10044 the 68000 where the floating registers (of the 68881) keep more
10045 precision than a @code{double} is supposed to have. Similarly for the
10046 x86 architecture. For most programs, the excess precision does only
10047 good, but a few programs rely on the precise definition of IEEE floating
10048 point. Use @option{-ffloat-store} for such programs, after modifying
10049 them to store all pertinent intermediate computations into variables.
10050
10051 @item -fexcess-precision=@var{style}
10052 @opindex fexcess-precision
10053 This option allows further control over excess precision on machines
10054 where floating-point operations occur in a format with more precision or
10055 range than the IEEE standard and interchange floating-point types. By
10056 default, @option{-fexcess-precision=fast} is in effect; this means that
10057 operations may be carried out in a wider precision than the types specified
10058 in the source if that would result in faster code, and it is unpredictable
10059 when rounding to the types specified in the source code takes place.
10060 When compiling C, if @option{-fexcess-precision=standard} is specified then
10061 excess precision follows the rules specified in ISO C99; in particular,
10062 both casts and assignments cause values to be rounded to their
10063 semantic types (whereas @option{-ffloat-store} only affects
10064 assignments). This option is enabled by default for C if a strict
10065 conformance option such as @option{-std=c99} is used.
10066 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10067 regardless of whether a strict conformance option is used.
10068
10069 @opindex mfpmath
10070 @option{-fexcess-precision=standard} is not implemented for languages
10071 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10072 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10073 semantics apply without excess precision, and in the latter, rounding
10074 is unpredictable.
10075
10076 @item -ffast-math
10077 @opindex ffast-math
10078 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10079 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10080 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10081 @option{-fexcess-precision=fast}.
10082
10083 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10084
10085 This option is not turned on by any @option{-O} option besides
10086 @option{-Ofast} since it can result in incorrect output for programs
10087 that depend on an exact implementation of IEEE or ISO rules/specifications
10088 for math functions. It may, however, yield faster code for programs
10089 that do not require the guarantees of these specifications.
10090
10091 @item -fno-math-errno
10092 @opindex fno-math-errno
10093 Do not set @code{errno} after calling math functions that are executed
10094 with a single instruction, e.g., @code{sqrt}. A program that relies on
10095 IEEE exceptions for math error handling may want to use this flag
10096 for speed while maintaining IEEE arithmetic compatibility.
10097
10098 This option is not turned on by any @option{-O} option since
10099 it can result in incorrect output for programs that depend on
10100 an exact implementation of IEEE or ISO rules/specifications for
10101 math functions. It may, however, yield faster code for programs
10102 that do not require the guarantees of these specifications.
10103
10104 The default is @option{-fmath-errno}.
10105
10106 On Darwin systems, the math library never sets @code{errno}. There is
10107 therefore no reason for the compiler to consider the possibility that
10108 it might, and @option{-fno-math-errno} is the default.
10109
10110 @item -funsafe-math-optimizations
10111 @opindex funsafe-math-optimizations
10112
10113 Allow optimizations for floating-point arithmetic that (a) assume
10114 that arguments and results are valid and (b) may violate IEEE or
10115 ANSI standards. When used at link time, it may include libraries
10116 or startup files that change the default FPU control word or other
10117 similar optimizations.
10118
10119 This option is not turned on by any @option{-O} option since
10120 it can result in incorrect output for programs that depend on
10121 an exact implementation of IEEE or ISO rules/specifications for
10122 math functions. It may, however, yield faster code for programs
10123 that do not require the guarantees of these specifications.
10124 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10125 @option{-fassociative-math} and @option{-freciprocal-math}.
10126
10127 The default is @option{-fno-unsafe-math-optimizations}.
10128
10129 @item -fassociative-math
10130 @opindex fassociative-math
10131
10132 Allow re-association of operands in series of floating-point operations.
10133 This violates the ISO C and C++ language standard by possibly changing
10134 computation result. NOTE: re-ordering may change the sign of zero as
10135 well as ignore NaNs and inhibit or create underflow or overflow (and
10136 thus cannot be used on code that relies on rounding behavior like
10137 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10138 and thus may not be used when ordered comparisons are required.
10139 This option requires that both @option{-fno-signed-zeros} and
10140 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10141 much sense with @option{-frounding-math}. For Fortran the option
10142 is automatically enabled when both @option{-fno-signed-zeros} and
10143 @option{-fno-trapping-math} are in effect.
10144
10145 The default is @option{-fno-associative-math}.
10146
10147 @item -freciprocal-math
10148 @opindex freciprocal-math
10149
10150 Allow the reciprocal of a value to be used instead of dividing by
10151 the value if this enables optimizations. For example @code{x / y}
10152 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10153 is subject to common subexpression elimination. Note that this loses
10154 precision and increases the number of flops operating on the value.
10155
10156 The default is @option{-fno-reciprocal-math}.
10157
10158 @item -ffinite-math-only
10159 @opindex ffinite-math-only
10160 Allow optimizations for floating-point arithmetic that assume
10161 that arguments and results are not NaNs or +-Infs.
10162
10163 This option is not turned on by any @option{-O} option since
10164 it can result in incorrect output for programs that depend on
10165 an exact implementation of IEEE or ISO rules/specifications for
10166 math functions. It may, however, yield faster code for programs
10167 that do not require the guarantees of these specifications.
10168
10169 The default is @option{-fno-finite-math-only}.
10170
10171 @item -fno-signed-zeros
10172 @opindex fno-signed-zeros
10173 Allow optimizations for floating-point arithmetic that ignore the
10174 signedness of zero. IEEE arithmetic specifies the behavior of
10175 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10176 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10177 This option implies that the sign of a zero result isn't significant.
10178
10179 The default is @option{-fsigned-zeros}.
10180
10181 @item -fno-trapping-math
10182 @opindex fno-trapping-math
10183 Compile code assuming that floating-point operations cannot generate
10184 user-visible traps. These traps include division by zero, overflow,
10185 underflow, inexact result and invalid operation. This option requires
10186 that @option{-fno-signaling-nans} be in effect. Setting this option may
10187 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10188
10189 This option should never be turned on by any @option{-O} option since
10190 it can result in incorrect output for programs that depend on
10191 an exact implementation of IEEE or ISO rules/specifications for
10192 math functions.
10193
10194 The default is @option{-ftrapping-math}.
10195
10196 @item -frounding-math
10197 @opindex frounding-math
10198 Disable transformations and optimizations that assume default floating-point
10199 rounding behavior. This is round-to-zero for all floating point
10200 to integer conversions, and round-to-nearest for all other arithmetic
10201 truncations. This option should be specified for programs that change
10202 the FP rounding mode dynamically, or that may be executed with a
10203 non-default rounding mode. This option disables constant folding of
10204 floating-point expressions at compile time (which may be affected by
10205 rounding mode) and arithmetic transformations that are unsafe in the
10206 presence of sign-dependent rounding modes.
10207
10208 The default is @option{-fno-rounding-math}.
10209
10210 This option is experimental and does not currently guarantee to
10211 disable all GCC optimizations that are affected by rounding mode.
10212 Future versions of GCC may provide finer control of this setting
10213 using C99's @code{FENV_ACCESS} pragma. This command-line option
10214 will be used to specify the default state for @code{FENV_ACCESS}.
10215
10216 @item -fsignaling-nans
10217 @opindex fsignaling-nans
10218 Compile code assuming that IEEE signaling NaNs may generate user-visible
10219 traps during floating-point operations. Setting this option disables
10220 optimizations that may change the number of exceptions visible with
10221 signaling NaNs. This option implies @option{-ftrapping-math}.
10222
10223 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10224 be defined.
10225
10226 The default is @option{-fno-signaling-nans}.
10227
10228 This option is experimental and does not currently guarantee to
10229 disable all GCC optimizations that affect signaling NaN behavior.
10230
10231 @item -fno-fp-int-builtin-inexact
10232 @opindex fno-fp-int-builtin-inexact
10233 Do not allow the built-in functions @code{ceil}, @code{floor},
10234 @code{round} and @code{trunc}, and their @code{float} and @code{long
10235 double} variants, to generate code that raises the ``inexact''
10236 floating-point exception for noninteger arguments. ISO C99 and C11
10237 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10238 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10239 functions to do so.
10240
10241 The default is @option{-ffp-int-builtin-inexact}, allowing the
10242 exception to be raised. This option does nothing unless
10243 @option{-ftrapping-math} is in effect.
10244
10245 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10246 generate a call to a library function then the ``inexact'' exception
10247 may be raised if the library implementation does not follow TS 18661.
10248
10249 @item -fsingle-precision-constant
10250 @opindex fsingle-precision-constant
10251 Treat floating-point constants as single precision instead of
10252 implicitly converting them to double-precision constants.
10253
10254 @item -fcx-limited-range
10255 @opindex fcx-limited-range
10256 When enabled, this option states that a range reduction step is not
10257 needed when performing complex division. Also, there is no checking
10258 whether the result of a complex multiplication or division is @code{NaN
10259 + I*NaN}, with an attempt to rescue the situation in that case. The
10260 default is @option{-fno-cx-limited-range}, but is enabled by
10261 @option{-ffast-math}.
10262
10263 This option controls the default setting of the ISO C99
10264 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10265 all languages.
10266
10267 @item -fcx-fortran-rules
10268 @opindex fcx-fortran-rules
10269 Complex multiplication and division follow Fortran rules. Range
10270 reduction is done as part of complex division, but there is no checking
10271 whether the result of a complex multiplication or division is @code{NaN
10272 + I*NaN}, with an attempt to rescue the situation in that case.
10273
10274 The default is @option{-fno-cx-fortran-rules}.
10275
10276 @end table
10277
10278 The following options control optimizations that may improve
10279 performance, but are not enabled by any @option{-O} options. This
10280 section includes experimental options that may produce broken code.
10281
10282 @table @gcctabopt
10283 @item -fbranch-probabilities
10284 @opindex fbranch-probabilities
10285 After running a program compiled with @option{-fprofile-arcs}
10286 (@pxref{Instrumentation Options}),
10287 you can compile it a second time using
10288 @option{-fbranch-probabilities}, to improve optimizations based on
10289 the number of times each branch was taken. When a program
10290 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10291 counts to a file called @file{@var{sourcename}.gcda} for each source
10292 file. The information in this data file is very dependent on the
10293 structure of the generated code, so you must use the same source code
10294 and the same optimization options for both compilations.
10295
10296 With @option{-fbranch-probabilities}, GCC puts a
10297 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10298 These can be used to improve optimization. Currently, they are only
10299 used in one place: in @file{reorg.c}, instead of guessing which path a
10300 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10301 exactly determine which path is taken more often.
10302
10303 @item -fprofile-values
10304 @opindex fprofile-values
10305 If combined with @option{-fprofile-arcs}, it adds code so that some
10306 data about values of expressions in the program is gathered.
10307
10308 With @option{-fbranch-probabilities}, it reads back the data gathered
10309 from profiling values of expressions for usage in optimizations.
10310
10311 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
10312
10313 @item -fprofile-reorder-functions
10314 @opindex fprofile-reorder-functions
10315 Function reordering based on profile instrumentation collects
10316 first time of execution of a function and orders these functions
10317 in ascending order.
10318
10319 Enabled with @option{-fprofile-use}.
10320
10321 @item -fvpt
10322 @opindex fvpt
10323 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10324 to add code to gather information about values of expressions.
10325
10326 With @option{-fbranch-probabilities}, it reads back the data gathered
10327 and actually performs the optimizations based on them.
10328 Currently the optimizations include specialization of division operations
10329 using the knowledge about the value of the denominator.
10330
10331 @item -frename-registers
10332 @opindex frename-registers
10333 Attempt to avoid false dependencies in scheduled code by making use
10334 of registers left over after register allocation. This optimization
10335 most benefits processors with lots of registers. Depending on the
10336 debug information format adopted by the target, however, it can
10337 make debugging impossible, since variables no longer stay in
10338 a ``home register''.
10339
10340 Enabled by default with @option{-funroll-loops}.
10341
10342 @item -fschedule-fusion
10343 @opindex fschedule-fusion
10344 Performs a target dependent pass over the instruction stream to schedule
10345 instructions of same type together because target machine can execute them
10346 more efficiently if they are adjacent to each other in the instruction flow.
10347
10348 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10349
10350 @item -ftracer
10351 @opindex ftracer
10352 Perform tail duplication to enlarge superblock size. This transformation
10353 simplifies the control flow of the function allowing other optimizations to do
10354 a better job.
10355
10356 Enabled with @option{-fprofile-use}.
10357
10358 @item -funroll-loops
10359 @opindex funroll-loops
10360 Unroll loops whose number of iterations can be determined at compile time or
10361 upon entry to the loop. @option{-funroll-loops} implies
10362 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10363 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10364 a small constant number of iterations). This option makes code larger, and may
10365 or may not make it run faster.
10366
10367 Enabled with @option{-fprofile-use}.
10368
10369 @item -funroll-all-loops
10370 @opindex funroll-all-loops
10371 Unroll all loops, even if their number of iterations is uncertain when
10372 the loop is entered. This usually makes programs run more slowly.
10373 @option{-funroll-all-loops} implies the same options as
10374 @option{-funroll-loops}.
10375
10376 @item -fpeel-loops
10377 @opindex fpeel-loops
10378 Peels loops for which there is enough information that they do not
10379 roll much (from profile feedback or static analysis). It also turns on
10380 complete loop peeling (i.e.@: complete removal of loops with small constant
10381 number of iterations).
10382
10383 Enabled with @option{-O3} and/or @option{-fprofile-use}.
10384
10385 @item -fmove-loop-invariants
10386 @opindex fmove-loop-invariants
10387 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10388 at level @option{-O1}
10389
10390 @item -fsplit-loops
10391 @opindex fsplit-loops
10392 Split a loop into two if it contains a condition that's always true
10393 for one side of the iteration space and false for the other.
10394
10395 @item -funswitch-loops
10396 @opindex funswitch-loops
10397 Move branches with loop invariant conditions out of the loop, with duplicates
10398 of the loop on both branches (modified according to result of the condition).
10399
10400 @item -ffunction-sections
10401 @itemx -fdata-sections
10402 @opindex ffunction-sections
10403 @opindex fdata-sections
10404 Place each function or data item into its own section in the output
10405 file if the target supports arbitrary sections. The name of the
10406 function or the name of the data item determines the section's name
10407 in the output file.
10408
10409 Use these options on systems where the linker can perform optimizations to
10410 improve locality of reference in the instruction space. Most systems using the
10411 ELF object format have linkers with such optimizations. On AIX, the linker
10412 rearranges sections (CSECTs) based on the call graph. The performance impact
10413 varies.
10414
10415 Together with a linker garbage collection (linker @option{--gc-sections}
10416 option) these options may lead to smaller statically-linked executables (after
10417 stripping).
10418
10419 On ELF/DWARF systems these options do not degenerate the quality of the debug
10420 information. There could be issues with other object files/debug info formats.
10421
10422 Only use these options when there are significant benefits from doing so. When
10423 you specify these options, the assembler and linker create larger object and
10424 executable files and are also slower. These options affect code generation.
10425 They prevent optimizations by the compiler and assembler using relative
10426 locations inside a translation unit since the locations are unknown until
10427 link time. An example of such an optimization is relaxing calls to short call
10428 instructions.
10429
10430 @item -fbranch-target-load-optimize
10431 @opindex fbranch-target-load-optimize
10432 Perform branch target register load optimization before prologue / epilogue
10433 threading.
10434 The use of target registers can typically be exposed only during reload,
10435 thus hoisting loads out of loops and doing inter-block scheduling needs
10436 a separate optimization pass.
10437
10438 @item -fbranch-target-load-optimize2
10439 @opindex fbranch-target-load-optimize2
10440 Perform branch target register load optimization after prologue / epilogue
10441 threading.
10442
10443 @item -fbtr-bb-exclusive
10444 @opindex fbtr-bb-exclusive
10445 When performing branch target register load optimization, don't reuse
10446 branch target registers within any basic block.
10447
10448 @item -fstdarg-opt
10449 @opindex fstdarg-opt
10450 Optimize the prologue of variadic argument functions with respect to usage of
10451 those arguments.
10452
10453 @item -fsection-anchors
10454 @opindex fsection-anchors
10455 Try to reduce the number of symbolic address calculations by using
10456 shared ``anchor'' symbols to address nearby objects. This transformation
10457 can help to reduce the number of GOT entries and GOT accesses on some
10458 targets.
10459
10460 For example, the implementation of the following function @code{foo}:
10461
10462 @smallexample
10463 static int a, b, c;
10464 int foo (void) @{ return a + b + c; @}
10465 @end smallexample
10466
10467 @noindent
10468 usually calculates the addresses of all three variables, but if you
10469 compile it with @option{-fsection-anchors}, it accesses the variables
10470 from a common anchor point instead. The effect is similar to the
10471 following pseudocode (which isn't valid C):
10472
10473 @smallexample
10474 int foo (void)
10475 @{
10476 register int *xr = &x;
10477 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10478 @}
10479 @end smallexample
10480
10481 Not all targets support this option.
10482
10483 @item --param @var{name}=@var{value}
10484 @opindex param
10485 In some places, GCC uses various constants to control the amount of
10486 optimization that is done. For example, GCC does not inline functions
10487 that contain more than a certain number of instructions. You can
10488 control some of these constants on the command line using the
10489 @option{--param} option.
10490
10491 The names of specific parameters, and the meaning of the values, are
10492 tied to the internals of the compiler, and are subject to change
10493 without notice in future releases.
10494
10495 In order to get minimal, maximal and default value of a parameter,
10496 one can use @option{--help=param -Q} options.
10497
10498 In each case, the @var{value} is an integer. The allowable choices for
10499 @var{name} are:
10500
10501 @table @gcctabopt
10502 @item predictable-branch-outcome
10503 When branch is predicted to be taken with probability lower than this threshold
10504 (in percent), then it is considered well predictable.
10505
10506 @item max-rtl-if-conversion-insns
10507 RTL if-conversion tries to remove conditional branches around a block and
10508 replace them with conditionally executed instructions. This parameter
10509 gives the maximum number of instructions in a block which should be
10510 considered for if-conversion. The compiler will
10511 also use other heuristics to decide whether if-conversion is likely to be
10512 profitable.
10513
10514 @item max-rtl-if-conversion-predictable-cost
10515 @itemx max-rtl-if-conversion-unpredictable-cost
10516 RTL if-conversion will try to remove conditional branches around a block
10517 and replace them with conditionally executed instructions. These parameters
10518 give the maximum permissible cost for the sequence that would be generated
10519 by if-conversion depending on whether the branch is statically determined
10520 to be predictable or not. The units for this parameter are the same as
10521 those for the GCC internal seq_cost metric. The compiler will try to
10522 provide a reasonable default for this parameter using the BRANCH_COST
10523 target macro.
10524
10525 @item max-crossjump-edges
10526 The maximum number of incoming edges to consider for cross-jumping.
10527 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10528 the number of edges incoming to each block. Increasing values mean
10529 more aggressive optimization, making the compilation time increase with
10530 probably small improvement in executable size.
10531
10532 @item min-crossjump-insns
10533 The minimum number of instructions that must be matched at the end
10534 of two blocks before cross-jumping is performed on them. This
10535 value is ignored in the case where all instructions in the block being
10536 cross-jumped from are matched.
10537
10538 @item max-grow-copy-bb-insns
10539 The maximum code size expansion factor when copying basic blocks
10540 instead of jumping. The expansion is relative to a jump instruction.
10541
10542 @item max-goto-duplication-insns
10543 The maximum number of instructions to duplicate to a block that jumps
10544 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10545 passes, GCC factors computed gotos early in the compilation process,
10546 and unfactors them as late as possible. Only computed jumps at the
10547 end of a basic blocks with no more than max-goto-duplication-insns are
10548 unfactored.
10549
10550 @item max-delay-slot-insn-search
10551 The maximum number of instructions to consider when looking for an
10552 instruction to fill a delay slot. If more than this arbitrary number of
10553 instructions are searched, the time savings from filling the delay slot
10554 are minimal, so stop searching. Increasing values mean more
10555 aggressive optimization, making the compilation time increase with probably
10556 small improvement in execution time.
10557
10558 @item max-delay-slot-live-search
10559 When trying to fill delay slots, the maximum number of instructions to
10560 consider when searching for a block with valid live register
10561 information. Increasing this arbitrarily chosen value means more
10562 aggressive optimization, increasing the compilation time. This parameter
10563 should be removed when the delay slot code is rewritten to maintain the
10564 control-flow graph.
10565
10566 @item max-gcse-memory
10567 The approximate maximum amount of memory that can be allocated in
10568 order to perform the global common subexpression elimination
10569 optimization. If more memory than specified is required, the
10570 optimization is not done.
10571
10572 @item max-gcse-insertion-ratio
10573 If the ratio of expression insertions to deletions is larger than this value
10574 for any expression, then RTL PRE inserts or removes the expression and thus
10575 leaves partially redundant computations in the instruction stream.
10576
10577 @item max-pending-list-length
10578 The maximum number of pending dependencies scheduling allows
10579 before flushing the current state and starting over. Large functions
10580 with few branches or calls can create excessively large lists which
10581 needlessly consume memory and resources.
10582
10583 @item max-modulo-backtrack-attempts
10584 The maximum number of backtrack attempts the scheduler should make
10585 when modulo scheduling a loop. Larger values can exponentially increase
10586 compilation time.
10587
10588 @item max-inline-insns-single
10589 Several parameters control the tree inliner used in GCC@.
10590 This number sets the maximum number of instructions (counted in GCC's
10591 internal representation) in a single function that the tree inliner
10592 considers for inlining. This only affects functions declared
10593 inline and methods implemented in a class declaration (C++).
10594
10595 @item max-inline-insns-auto
10596 When you use @option{-finline-functions} (included in @option{-O3}),
10597 a lot of functions that would otherwise not be considered for inlining
10598 by the compiler are investigated. To those functions, a different
10599 (more restrictive) limit compared to functions declared inline can
10600 be applied.
10601
10602 @item inline-min-speedup
10603 When estimated performance improvement of caller + callee runtime exceeds this
10604 threshold (in percent), the function can be inlined regardless of the limit on
10605 @option{--param max-inline-insns-single} and @option{--param
10606 max-inline-insns-auto}.
10607
10608 @item large-function-insns
10609 The limit specifying really large functions. For functions larger than this
10610 limit after inlining, inlining is constrained by
10611 @option{--param large-function-growth}. This parameter is useful primarily
10612 to avoid extreme compilation time caused by non-linear algorithms used by the
10613 back end.
10614
10615 @item large-function-growth
10616 Specifies maximal growth of large function caused by inlining in percents.
10617 For example, parameter value 100 limits large function growth to 2.0 times
10618 the original size.
10619
10620 @item large-unit-insns
10621 The limit specifying large translation unit. Growth caused by inlining of
10622 units larger than this limit is limited by @option{--param inline-unit-growth}.
10623 For small units this might be too tight.
10624 For example, consider a unit consisting of function A
10625 that is inline and B that just calls A three times. If B is small relative to
10626 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10627 large units consisting of small inlineable functions, however, the overall unit
10628 growth limit is needed to avoid exponential explosion of code size. Thus for
10629 smaller units, the size is increased to @option{--param large-unit-insns}
10630 before applying @option{--param inline-unit-growth}.
10631
10632 @item inline-unit-growth
10633 Specifies maximal overall growth of the compilation unit caused by inlining.
10634 For example, parameter value 20 limits unit growth to 1.2 times the original
10635 size. Cold functions (either marked cold via an attribute or by profile
10636 feedback) are not accounted into the unit size.
10637
10638 @item ipcp-unit-growth
10639 Specifies maximal overall growth of the compilation unit caused by
10640 interprocedural constant propagation. For example, parameter value 10 limits
10641 unit growth to 1.1 times the original size.
10642
10643 @item large-stack-frame
10644 The limit specifying large stack frames. While inlining the algorithm is trying
10645 to not grow past this limit too much.
10646
10647 @item large-stack-frame-growth
10648 Specifies maximal growth of large stack frames caused by inlining in percents.
10649 For example, parameter value 1000 limits large stack frame growth to 11 times
10650 the original size.
10651
10652 @item max-inline-insns-recursive
10653 @itemx max-inline-insns-recursive-auto
10654 Specifies the maximum number of instructions an out-of-line copy of a
10655 self-recursive inline
10656 function can grow into by performing recursive inlining.
10657
10658 @option{--param max-inline-insns-recursive} applies to functions
10659 declared inline.
10660 For functions not declared inline, recursive inlining
10661 happens only when @option{-finline-functions} (included in @option{-O3}) is
10662 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
10663
10664 @item max-inline-recursive-depth
10665 @itemx max-inline-recursive-depth-auto
10666 Specifies the maximum recursion depth used for recursive inlining.
10667
10668 @option{--param max-inline-recursive-depth} applies to functions
10669 declared inline. For functions not declared inline, recursive inlining
10670 happens only when @option{-finline-functions} (included in @option{-O3}) is
10671 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
10672
10673 @item min-inline-recursive-probability
10674 Recursive inlining is profitable only for function having deep recursion
10675 in average and can hurt for function having little recursion depth by
10676 increasing the prologue size or complexity of function body to other
10677 optimizers.
10678
10679 When profile feedback is available (see @option{-fprofile-generate}) the actual
10680 recursion depth can be guessed from the probability that function recurses
10681 via a given call expression. This parameter limits inlining only to call
10682 expressions whose probability exceeds the given threshold (in percents).
10683
10684 @item early-inlining-insns
10685 Specify growth that the early inliner can make. In effect it increases
10686 the amount of inlining for code having a large abstraction penalty.
10687
10688 @item max-early-inliner-iterations
10689 Limit of iterations of the early inliner. This basically bounds
10690 the number of nested indirect calls the early inliner can resolve.
10691 Deeper chains are still handled by late inlining.
10692
10693 @item comdat-sharing-probability
10694 Probability (in percent) that C++ inline function with comdat visibility
10695 are shared across multiple compilation units.
10696
10697 @item profile-func-internal-id
10698 A parameter to control whether to use function internal id in profile
10699 database lookup. If the value is 0, the compiler uses an id that
10700 is based on function assembler name and filename, which makes old profile
10701 data more tolerant to source changes such as function reordering etc.
10702
10703 @item min-vect-loop-bound
10704 The minimum number of iterations under which loops are not vectorized
10705 when @option{-ftree-vectorize} is used. The number of iterations after
10706 vectorization needs to be greater than the value specified by this option
10707 to allow vectorization.
10708
10709 @item gcse-cost-distance-ratio
10710 Scaling factor in calculation of maximum distance an expression
10711 can be moved by GCSE optimizations. This is currently supported only in the
10712 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10713 is with simple expressions, i.e., the expressions that have cost
10714 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10715 hoisting of simple expressions.
10716
10717 @item gcse-unrestricted-cost
10718 Cost, roughly measured as the cost of a single typical machine
10719 instruction, at which GCSE optimizations do not constrain
10720 the distance an expression can travel. This is currently
10721 supported only in the code hoisting pass. The lesser the cost,
10722 the more aggressive code hoisting is. Specifying 0
10723 allows all expressions to travel unrestricted distances.
10724
10725 @item max-hoist-depth
10726 The depth of search in the dominator tree for expressions to hoist.
10727 This is used to avoid quadratic behavior in hoisting algorithm.
10728 The value of 0 does not limit on the search, but may slow down compilation
10729 of huge functions.
10730
10731 @item max-tail-merge-comparisons
10732 The maximum amount of similar bbs to compare a bb with. This is used to
10733 avoid quadratic behavior in tree tail merging.
10734
10735 @item max-tail-merge-iterations
10736 The maximum amount of iterations of the pass over the function. This is used to
10737 limit compilation time in tree tail merging.
10738
10739 @item store-merging-allow-unaligned
10740 Allow the store merging pass to introduce unaligned stores if it is legal to
10741 do so.
10742
10743 @item max-stores-to-merge
10744 The maximum number of stores to attempt to merge into wider stores in the store
10745 merging pass.
10746
10747 @item max-unrolled-insns
10748 The maximum number of instructions that a loop may have to be unrolled.
10749 If a loop is unrolled, this parameter also determines how many times
10750 the loop code is unrolled.
10751
10752 @item max-average-unrolled-insns
10753 The maximum number of instructions biased by probabilities of their execution
10754 that a loop may have to be unrolled. If a loop is unrolled,
10755 this parameter also determines how many times the loop code is unrolled.
10756
10757 @item max-unroll-times
10758 The maximum number of unrollings of a single loop.
10759
10760 @item max-peeled-insns
10761 The maximum number of instructions that a loop may have to be peeled.
10762 If a loop is peeled, this parameter also determines how many times
10763 the loop code is peeled.
10764
10765 @item max-peel-times
10766 The maximum number of peelings of a single loop.
10767
10768 @item max-peel-branches
10769 The maximum number of branches on the hot path through the peeled sequence.
10770
10771 @item max-completely-peeled-insns
10772 The maximum number of insns of a completely peeled loop.
10773
10774 @item max-completely-peel-times
10775 The maximum number of iterations of a loop to be suitable for complete peeling.
10776
10777 @item max-completely-peel-loop-nest-depth
10778 The maximum depth of a loop nest suitable for complete peeling.
10779
10780 @item max-unswitch-insns
10781 The maximum number of insns of an unswitched loop.
10782
10783 @item max-unswitch-level
10784 The maximum number of branches unswitched in a single loop.
10785
10786 @item lim-expensive
10787 The minimum cost of an expensive expression in the loop invariant motion.
10788
10789 @item iv-consider-all-candidates-bound
10790 Bound on number of candidates for induction variables, below which
10791 all candidates are considered for each use in induction variable
10792 optimizations. If there are more candidates than this,
10793 only the most relevant ones are considered to avoid quadratic time complexity.
10794
10795 @item iv-max-considered-uses
10796 The induction variable optimizations give up on loops that contain more
10797 induction variable uses.
10798
10799 @item iv-always-prune-cand-set-bound
10800 If the number of candidates in the set is smaller than this value,
10801 always try to remove unnecessary ivs from the set
10802 when adding a new one.
10803
10804 @item avg-loop-niter
10805 Average number of iterations of a loop.
10806
10807 @item dse-max-object-size
10808 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10809 Larger values may result in larger compilation times.
10810
10811 @item dse-max-alias-queries-per-store
10812 Maximum number of queries into the alias oracle per store.
10813 Larger values result in larger compilation times and may result in more
10814 removed dead stores.
10815
10816 @item scev-max-expr-size
10817 Bound on size of expressions used in the scalar evolutions analyzer.
10818 Large expressions slow the analyzer.
10819
10820 @item scev-max-expr-complexity
10821 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10822 Complex expressions slow the analyzer.
10823
10824 @item max-tree-if-conversion-phi-args
10825 Maximum number of arguments in a PHI supported by TREE if conversion
10826 unless the loop is marked with simd pragma.
10827
10828 @item vect-max-version-for-alignment-checks
10829 The maximum number of run-time checks that can be performed when
10830 doing loop versioning for alignment in the vectorizer.
10831
10832 @item vect-max-version-for-alias-checks
10833 The maximum number of run-time checks that can be performed when
10834 doing loop versioning for alias in the vectorizer.
10835
10836 @item vect-max-peeling-for-alignment
10837 The maximum number of loop peels to enhance access alignment
10838 for vectorizer. Value -1 means no limit.
10839
10840 @item max-iterations-to-track
10841 The maximum number of iterations of a loop the brute-force algorithm
10842 for analysis of the number of iterations of the loop tries to evaluate.
10843
10844 @item hot-bb-count-ws-permille
10845 A basic block profile count is considered hot if it contributes to
10846 the given permillage (i.e.@: 0...1000) of the entire profiled execution.
10847
10848 @item hot-bb-frequency-fraction
10849 Select fraction of the entry block frequency of executions of basic block in
10850 function given basic block needs to have to be considered hot.
10851
10852 @item max-predicted-iterations
10853 The maximum number of loop iterations we predict statically. This is useful
10854 in cases where a function contains a single loop with known bound and
10855 another loop with unknown bound.
10856 The known number of iterations is predicted correctly, while
10857 the unknown number of iterations average to roughly 10. This means that the
10858 loop without bounds appears artificially cold relative to the other one.
10859
10860 @item builtin-expect-probability
10861 Control the probability of the expression having the specified value. This
10862 parameter takes a percentage (i.e.@: 0 ... 100) as input.
10863
10864 @item builtin-string-cmp-inline-length
10865 The maximum length of a constant string for a builtin string cmp call
10866 eligible for inlining.
10867
10868 @item align-threshold
10869
10870 Select fraction of the maximal frequency of executions of a basic block in
10871 a function to align the basic block.
10872
10873 @item align-loop-iterations
10874
10875 A loop expected to iterate at least the selected number of iterations is
10876 aligned.
10877
10878 @item tracer-dynamic-coverage
10879 @itemx tracer-dynamic-coverage-feedback
10880
10881 This value is used to limit superblock formation once the given percentage of
10882 executed instructions is covered. This limits unnecessary code size
10883 expansion.
10884
10885 The @option{tracer-dynamic-coverage-feedback} parameter
10886 is used only when profile
10887 feedback is available. The real profiles (as opposed to statically estimated
10888 ones) are much less balanced allowing the threshold to be larger value.
10889
10890 @item tracer-max-code-growth
10891 Stop tail duplication once code growth has reached given percentage. This is
10892 a rather artificial limit, as most of the duplicates are eliminated later in
10893 cross jumping, so it may be set to much higher values than is the desired code
10894 growth.
10895
10896 @item tracer-min-branch-ratio
10897
10898 Stop reverse growth when the reverse probability of best edge is less than this
10899 threshold (in percent).
10900
10901 @item tracer-min-branch-probability
10902 @itemx tracer-min-branch-probability-feedback
10903
10904 Stop forward growth if the best edge has probability lower than this
10905 threshold.
10906
10907 Similarly to @option{tracer-dynamic-coverage} two parameters are
10908 provided. @option{tracer-min-branch-probability-feedback} is used for
10909 compilation with profile feedback and @option{tracer-min-branch-probability}
10910 compilation without. The value for compilation with profile feedback
10911 needs to be more conservative (higher) in order to make tracer
10912 effective.
10913
10914 @item stack-clash-protection-guard-size
10915 Specify the size of the operating system provided stack guard as
10916 2 raised to @var{num} bytes. Higher values may reduce the
10917 number of explicit probes, but a value larger than the operating system
10918 provided guard will leave code vulnerable to stack clash style attacks.
10919
10920 @item stack-clash-protection-probe-interval
10921 Stack clash protection involves probing stack space as it is allocated. This
10922 param controls the maximum distance between probes into the stack as 2 raised
10923 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
10924 larger than the operating system provided guard will leave code vulnerable to
10925 stack clash style attacks.
10926
10927 @item max-cse-path-length
10928
10929 The maximum number of basic blocks on path that CSE considers.
10930
10931 @item max-cse-insns
10932 The maximum number of instructions CSE processes before flushing.
10933
10934 @item ggc-min-expand
10935
10936 GCC uses a garbage collector to manage its own memory allocation. This
10937 parameter specifies the minimum percentage by which the garbage
10938 collector's heap should be allowed to expand between collections.
10939 Tuning this may improve compilation speed; it has no effect on code
10940 generation.
10941
10942 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10943 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10944 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10945 GCC is not able to calculate RAM on a particular platform, the lower
10946 bound of 30% is used. Setting this parameter and
10947 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10948 every opportunity. This is extremely slow, but can be useful for
10949 debugging.
10950
10951 @item ggc-min-heapsize
10952
10953 Minimum size of the garbage collector's heap before it begins bothering
10954 to collect garbage. The first collection occurs after the heap expands
10955 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10956 tuning this may improve compilation speed, and has no effect on code
10957 generation.
10958
10959 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10960 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10961 with a lower bound of 4096 (four megabytes) and an upper bound of
10962 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10963 particular platform, the lower bound is used. Setting this parameter
10964 very large effectively disables garbage collection. Setting this
10965 parameter and @option{ggc-min-expand} to zero causes a full collection
10966 to occur at every opportunity.
10967
10968 @item max-reload-search-insns
10969 The maximum number of instruction reload should look backward for equivalent
10970 register. Increasing values mean more aggressive optimization, making the
10971 compilation time increase with probably slightly better performance.
10972
10973 @item max-cselib-memory-locations
10974 The maximum number of memory locations cselib should take into account.
10975 Increasing values mean more aggressive optimization, making the compilation time
10976 increase with probably slightly better performance.
10977
10978 @item max-sched-ready-insns
10979 The maximum number of instructions ready to be issued the scheduler should
10980 consider at any given time during the first scheduling pass. Increasing
10981 values mean more thorough searches, making the compilation time increase
10982 with probably little benefit.
10983
10984 @item max-sched-region-blocks
10985 The maximum number of blocks in a region to be considered for
10986 interblock scheduling.
10987
10988 @item max-pipeline-region-blocks
10989 The maximum number of blocks in a region to be considered for
10990 pipelining in the selective scheduler.
10991
10992 @item max-sched-region-insns
10993 The maximum number of insns in a region to be considered for
10994 interblock scheduling.
10995
10996 @item max-pipeline-region-insns
10997 The maximum number of insns in a region to be considered for
10998 pipelining in the selective scheduler.
10999
11000 @item min-spec-prob
11001 The minimum probability (in percents) of reaching a source block
11002 for interblock speculative scheduling.
11003
11004 @item max-sched-extend-regions-iters
11005 The maximum number of iterations through CFG to extend regions.
11006 A value of 0 disables region extensions.
11007
11008 @item max-sched-insn-conflict-delay
11009 The maximum conflict delay for an insn to be considered for speculative motion.
11010
11011 @item sched-spec-prob-cutoff
11012 The minimal probability of speculation success (in percents), so that
11013 speculative insns are scheduled.
11014
11015 @item sched-state-edge-prob-cutoff
11016 The minimum probability an edge must have for the scheduler to save its
11017 state across it.
11018
11019 @item sched-mem-true-dep-cost
11020 Minimal distance (in CPU cycles) between store and load targeting same
11021 memory locations.
11022
11023 @item selsched-max-lookahead
11024 The maximum size of the lookahead window of selective scheduling. It is a
11025 depth of search for available instructions.
11026
11027 @item selsched-max-sched-times
11028 The maximum number of times that an instruction is scheduled during
11029 selective scheduling. This is the limit on the number of iterations
11030 through which the instruction may be pipelined.
11031
11032 @item selsched-insns-to-rename
11033 The maximum number of best instructions in the ready list that are considered
11034 for renaming in the selective scheduler.
11035
11036 @item sms-min-sc
11037 The minimum value of stage count that swing modulo scheduler
11038 generates.
11039
11040 @item max-last-value-rtl
11041 The maximum size measured as number of RTLs that can be recorded in an expression
11042 in combiner for a pseudo register as last known value of that register.
11043
11044 @item max-combine-insns
11045 The maximum number of instructions the RTL combiner tries to combine.
11046
11047 @item integer-share-limit
11048 Small integer constants can use a shared data structure, reducing the
11049 compiler's memory usage and increasing its speed. This sets the maximum
11050 value of a shared integer constant.
11051
11052 @item ssp-buffer-size
11053 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11054 protection when @option{-fstack-protection} is used.
11055
11056 @item min-size-for-stack-sharing
11057 The minimum size of variables taking part in stack slot sharing when not
11058 optimizing.
11059
11060 @item max-jump-thread-duplication-stmts
11061 Maximum number of statements allowed in a block that needs to be
11062 duplicated when threading jumps.
11063
11064 @item max-fields-for-field-sensitive
11065 Maximum number of fields in a structure treated in
11066 a field sensitive manner during pointer analysis.
11067
11068 @item prefetch-latency
11069 Estimate on average number of instructions that are executed before
11070 prefetch finishes. The distance prefetched ahead is proportional
11071 to this constant. Increasing this number may also lead to less
11072 streams being prefetched (see @option{simultaneous-prefetches}).
11073
11074 @item simultaneous-prefetches
11075 Maximum number of prefetches that can run at the same time.
11076
11077 @item l1-cache-line-size
11078 The size of cache line in L1 cache, in bytes.
11079
11080 @item l1-cache-size
11081 The size of L1 cache, in kilobytes.
11082
11083 @item l2-cache-size
11084 The size of L2 cache, in kilobytes.
11085
11086 @item prefetch-dynamic-strides
11087 Whether the loop array prefetch pass should issue software prefetch hints
11088 for strides that are non-constant. In some cases this may be
11089 beneficial, though the fact the stride is non-constant may make it
11090 hard to predict when there is clear benefit to issuing these hints.
11091
11092 Set to 1 if the prefetch hints should be issued for non-constant
11093 strides. Set to 0 if prefetch hints should be issued only for strides that
11094 are known to be constant and below @option{prefetch-minimum-stride}.
11095
11096 @item prefetch-minimum-stride
11097 Minimum constant stride, in bytes, to start using prefetch hints for. If
11098 the stride is less than this threshold, prefetch hints will not be issued.
11099
11100 This setting is useful for processors that have hardware prefetchers, in
11101 which case there may be conflicts between the hardware prefetchers and
11102 the software prefetchers. If the hardware prefetchers have a maximum
11103 stride they can handle, it should be used here to improve the use of
11104 software prefetchers.
11105
11106 A value of -1 means we don't have a threshold and therefore
11107 prefetch hints can be issued for any constant stride.
11108
11109 This setting is only useful for strides that are known and constant.
11110
11111 @item loop-interchange-max-num-stmts
11112 The maximum number of stmts in a loop to be interchanged.
11113
11114 @item loop-interchange-stride-ratio
11115 The minimum ratio between stride of two loops for interchange to be profitable.
11116
11117 @item min-insn-to-prefetch-ratio
11118 The minimum ratio between the number of instructions and the
11119 number of prefetches to enable prefetching in a loop.
11120
11121 @item prefetch-min-insn-to-mem-ratio
11122 The minimum ratio between the number of instructions and the
11123 number of memory references to enable prefetching in a loop.
11124
11125 @item use-canonical-types
11126 Whether the compiler should use the ``canonical'' type system.
11127 Should always be 1, which uses a more efficient internal
11128 mechanism for comparing types in C++ and Objective-C++. However, if
11129 bugs in the canonical type system are causing compilation failures,
11130 set this value to 0 to disable canonical types.
11131
11132 @item switch-conversion-max-branch-ratio
11133 Switch initialization conversion refuses to create arrays that are
11134 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11135 branches in the switch.
11136
11137 @item max-partial-antic-length
11138 Maximum length of the partial antic set computed during the tree
11139 partial redundancy elimination optimization (@option{-ftree-pre}) when
11140 optimizing at @option{-O3} and above. For some sorts of source code
11141 the enhanced partial redundancy elimination optimization can run away,
11142 consuming all of the memory available on the host machine. This
11143 parameter sets a limit on the length of the sets that are computed,
11144 which prevents the runaway behavior. Setting a value of 0 for
11145 this parameter allows an unlimited set length.
11146
11147 @item rpo-vn-max-loop-depth
11148 Maximum loop depth that is value-numbered optimistically.
11149 When the limit hits the innermost
11150 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11151 loop nest are value-numbered optimistically and the remaining ones not.
11152
11153 @item sccvn-max-alias-queries-per-access
11154 Maximum number of alias-oracle queries we perform when looking for
11155 redundancies for loads and stores. If this limit is hit the search
11156 is aborted and the load or store is not considered redundant. The
11157 number of queries is algorithmically limited to the number of
11158 stores on all paths from the load to the function entry.
11159
11160 @item ira-max-loops-num
11161 IRA uses regional register allocation by default. If a function
11162 contains more loops than the number given by this parameter, only at most
11163 the given number of the most frequently-executed loops form regions
11164 for regional register allocation.
11165
11166 @item ira-max-conflict-table-size
11167 Although IRA uses a sophisticated algorithm to compress the conflict
11168 table, the table can still require excessive amounts of memory for
11169 huge functions. If the conflict table for a function could be more
11170 than the size in MB given by this parameter, the register allocator
11171 instead uses a faster, simpler, and lower-quality
11172 algorithm that does not require building a pseudo-register conflict table.
11173
11174 @item ira-loop-reserved-regs
11175 IRA can be used to evaluate more accurate register pressure in loops
11176 for decisions to move loop invariants (see @option{-O3}). The number
11177 of available registers reserved for some other purposes is given
11178 by this parameter. Default of the parameter
11179 is the best found from numerous experiments.
11180
11181 @item lra-inheritance-ebb-probability-cutoff
11182 LRA tries to reuse values reloaded in registers in subsequent insns.
11183 This optimization is called inheritance. EBB is used as a region to
11184 do this optimization. The parameter defines a minimal fall-through
11185 edge probability in percentage used to add BB to inheritance EBB in
11186 LRA. The default value was chosen
11187 from numerous runs of SPEC2000 on x86-64.
11188
11189 @item loop-invariant-max-bbs-in-loop
11190 Loop invariant motion can be very expensive, both in compilation time and
11191 in amount of needed compile-time memory, with very large loops. Loops
11192 with more basic blocks than this parameter won't have loop invariant
11193 motion optimization performed on them.
11194
11195 @item loop-max-datarefs-for-datadeps
11196 Building data dependencies is expensive for very large loops. This
11197 parameter limits the number of data references in loops that are
11198 considered for data dependence analysis. These large loops are no
11199 handled by the optimizations using loop data dependencies.
11200
11201 @item max-vartrack-size
11202 Sets a maximum number of hash table slots to use during variable
11203 tracking dataflow analysis of any function. If this limit is exceeded
11204 with variable tracking at assignments enabled, analysis for that
11205 function is retried without it, after removing all debug insns from
11206 the function. If the limit is exceeded even without debug insns, var
11207 tracking analysis is completely disabled for the function. Setting
11208 the parameter to zero makes it unlimited.
11209
11210 @item max-vartrack-expr-depth
11211 Sets a maximum number of recursion levels when attempting to map
11212 variable names or debug temporaries to value expressions. This trades
11213 compilation time for more complete debug information. If this is set too
11214 low, value expressions that are available and could be represented in
11215 debug information may end up not being used; setting this higher may
11216 enable the compiler to find more complex debug expressions, but compile
11217 time and memory use may grow.
11218
11219 @item max-debug-marker-count
11220 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11221 markers) to avoid complexity explosion at inlining or expanding to RTL.
11222 If a function has more such gimple stmts than the set limit, such stmts
11223 will be dropped from the inlined copy of a function, and from its RTL
11224 expansion.
11225
11226 @item min-nondebug-insn-uid
11227 Use uids starting at this parameter for nondebug insns. The range below
11228 the parameter is reserved exclusively for debug insns created by
11229 @option{-fvar-tracking-assignments}, but debug insns may get
11230 (non-overlapping) uids above it if the reserved range is exhausted.
11231
11232 @item ipa-sra-ptr-growth-factor
11233 IPA-SRA replaces a pointer to an aggregate with one or more new
11234 parameters only when their cumulative size is less or equal to
11235 @option{ipa-sra-ptr-growth-factor} times the size of the original
11236 pointer parameter.
11237
11238 @item sra-max-scalarization-size-Ospeed
11239 @itemx sra-max-scalarization-size-Osize
11240 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11241 replace scalar parts of aggregates with uses of independent scalar
11242 variables. These parameters control the maximum size, in storage units,
11243 of aggregate which is considered for replacement when compiling for
11244 speed
11245 (@option{sra-max-scalarization-size-Ospeed}) or size
11246 (@option{sra-max-scalarization-size-Osize}) respectively.
11247
11248 @item tm-max-aggregate-size
11249 When making copies of thread-local variables in a transaction, this
11250 parameter specifies the size in bytes after which variables are
11251 saved with the logging functions as opposed to save/restore code
11252 sequence pairs. This option only applies when using
11253 @option{-fgnu-tm}.
11254
11255 @item graphite-max-nb-scop-params
11256 To avoid exponential effects in the Graphite loop transforms, the
11257 number of parameters in a Static Control Part (SCoP) is bounded.
11258 A value of zero can be used to lift
11259 the bound. A variable whose value is unknown at compilation time and
11260 defined outside a SCoP is a parameter of the SCoP.
11261
11262 @item loop-block-tile-size
11263 Loop blocking or strip mining transforms, enabled with
11264 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11265 loop in the loop nest by a given number of iterations. The strip
11266 length can be changed using the @option{loop-block-tile-size}
11267 parameter.
11268
11269 @item ipa-cp-value-list-size
11270 IPA-CP attempts to track all possible values and types passed to a function's
11271 parameter in order to propagate them and perform devirtualization.
11272 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11273 stores per one formal parameter of a function.
11274
11275 @item ipa-cp-eval-threshold
11276 IPA-CP calculates its own score of cloning profitability heuristics
11277 and performs those cloning opportunities with scores that exceed
11278 @option{ipa-cp-eval-threshold}.
11279
11280 @item ipa-cp-recursion-penalty
11281 Percentage penalty the recursive functions will receive when they
11282 are evaluated for cloning.
11283
11284 @item ipa-cp-single-call-penalty
11285 Percentage penalty functions containing a single call to another
11286 function will receive when they are evaluated for cloning.
11287
11288 @item ipa-max-agg-items
11289 IPA-CP is also capable to propagate a number of scalar values passed
11290 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11291 number of such values per one parameter.
11292
11293 @item ipa-cp-loop-hint-bonus
11294 When IPA-CP determines that a cloning candidate would make the number
11295 of iterations of a loop known, it adds a bonus of
11296 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11297 the candidate.
11298
11299 @item ipa-cp-array-index-hint-bonus
11300 When IPA-CP determines that a cloning candidate would make the index of
11301 an array access known, it adds a bonus of
11302 @option{ipa-cp-array-index-hint-bonus} to the profitability
11303 score of the candidate.
11304
11305 @item ipa-max-aa-steps
11306 During its analysis of function bodies, IPA-CP employs alias analysis
11307 in order to track values pointed to by function parameters. In order
11308 not spend too much time analyzing huge functions, it gives up and
11309 consider all memory clobbered after examining
11310 @option{ipa-max-aa-steps} statements modifying memory.
11311
11312 @item lto-partitions
11313 Specify desired number of partitions produced during WHOPR compilation.
11314 The number of partitions should exceed the number of CPUs used for compilation.
11315
11316 @item lto-min-partition
11317 Size of minimal partition for WHOPR (in estimated instructions).
11318 This prevents expenses of splitting very small programs into too many
11319 partitions.
11320
11321 @item lto-max-partition
11322 Size of max partition for WHOPR (in estimated instructions).
11323 to provide an upper bound for individual size of partition.
11324 Meant to be used only with balanced partitioning.
11325
11326 @item cxx-max-namespaces-for-diagnostic-help
11327 The maximum number of namespaces to consult for suggestions when C++
11328 name lookup fails for an identifier.
11329
11330 @item sink-frequency-threshold
11331 The maximum relative execution frequency (in percents) of the target block
11332 relative to a statement's original block to allow statement sinking of a
11333 statement. Larger numbers result in more aggressive statement sinking.
11334 A small positive adjustment is applied for
11335 statements with memory operands as those are even more profitable so sink.
11336
11337 @item max-stores-to-sink
11338 The maximum number of conditional store pairs that can be sunk. Set to 0
11339 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11340 (@option{-ftree-loop-if-convert}) is disabled.
11341
11342 @item allow-store-data-races
11343 Allow optimizers to introduce new data races on stores.
11344 Set to 1 to allow, otherwise to 0.
11345
11346 @item case-values-threshold
11347 The smallest number of different values for which it is best to use a
11348 jump-table instead of a tree of conditional branches. If the value is
11349 0, use the default for the machine.
11350
11351 @item tree-reassoc-width
11352 Set the maximum number of instructions executed in parallel in
11353 reassociated tree. This parameter overrides target dependent
11354 heuristics used by default if has non zero value.
11355
11356 @item sched-pressure-algorithm
11357 Choose between the two available implementations of
11358 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11359 and is the more likely to prevent instructions from being reordered.
11360 Algorithm 2 was designed to be a compromise between the relatively
11361 conservative approach taken by algorithm 1 and the rather aggressive
11362 approach taken by the default scheduler. It relies more heavily on
11363 having a regular register file and accurate register pressure classes.
11364 See @file{haifa-sched.c} in the GCC sources for more details.
11365
11366 The default choice depends on the target.
11367
11368 @item max-slsr-cand-scan
11369 Set the maximum number of existing candidates that are considered when
11370 seeking a basis for a new straight-line strength reduction candidate.
11371
11372 @item asan-globals
11373 Enable buffer overflow detection for global objects. This kind
11374 of protection is enabled by default if you are using
11375 @option{-fsanitize=address} option.
11376 To disable global objects protection use @option{--param asan-globals=0}.
11377
11378 @item asan-stack
11379 Enable buffer overflow detection for stack objects. This kind of
11380 protection is enabled by default when using @option{-fsanitize=address}.
11381 To disable stack protection use @option{--param asan-stack=0} option.
11382
11383 @item asan-instrument-reads
11384 Enable buffer overflow detection for memory reads. This kind of
11385 protection is enabled by default when using @option{-fsanitize=address}.
11386 To disable memory reads protection use
11387 @option{--param asan-instrument-reads=0}.
11388
11389 @item asan-instrument-writes
11390 Enable buffer overflow detection for memory writes. This kind of
11391 protection is enabled by default when using @option{-fsanitize=address}.
11392 To disable memory writes protection use
11393 @option{--param asan-instrument-writes=0} option.
11394
11395 @item asan-memintrin
11396 Enable detection for built-in functions. This kind of protection
11397 is enabled by default when using @option{-fsanitize=address}.
11398 To disable built-in functions protection use
11399 @option{--param asan-memintrin=0}.
11400
11401 @item asan-use-after-return
11402 Enable detection of use-after-return. This kind of protection
11403 is enabled by default when using the @option{-fsanitize=address} option.
11404 To disable it use @option{--param asan-use-after-return=0}.
11405
11406 Note: By default the check is disabled at run time. To enable it,
11407 add @code{detect_stack_use_after_return=1} to the environment variable
11408 @env{ASAN_OPTIONS}.
11409
11410 @item asan-instrumentation-with-call-threshold
11411 If number of memory accesses in function being instrumented
11412 is greater or equal to this number, use callbacks instead of inline checks.
11413 E.g. to disable inline code use
11414 @option{--param asan-instrumentation-with-call-threshold=0}.
11415
11416 @item use-after-scope-direct-emission-threshold
11417 If the size of a local variable in bytes is smaller or equal to this
11418 number, directly poison (or unpoison) shadow memory instead of using
11419 run-time callbacks.
11420
11421 @item max-fsm-thread-path-insns
11422 Maximum number of instructions to copy when duplicating blocks on a
11423 finite state automaton jump thread path.
11424
11425 @item max-fsm-thread-length
11426 Maximum number of basic blocks on a finite state automaton jump thread
11427 path.
11428
11429 @item max-fsm-thread-paths
11430 Maximum number of new jump thread paths to create for a finite state
11431 automaton.
11432
11433 @item parloops-chunk-size
11434 Chunk size of omp schedule for loops parallelized by parloops.
11435
11436 @item parloops-schedule
11437 Schedule type of omp schedule for loops parallelized by parloops (static,
11438 dynamic, guided, auto, runtime).
11439
11440 @item parloops-min-per-thread
11441 The minimum number of iterations per thread of an innermost parallelized
11442 loop for which the parallelized variant is preferred over the single threaded
11443 one. Note that for a parallelized loop nest the
11444 minimum number of iterations of the outermost loop per thread is two.
11445
11446 @item max-ssa-name-query-depth
11447 Maximum depth of recursion when querying properties of SSA names in things
11448 like fold routines. One level of recursion corresponds to following a
11449 use-def chain.
11450
11451 @item hsa-gen-debug-stores
11452 Enable emission of special debug stores within HSA kernels which are
11453 then read and reported by libgomp plugin. Generation of these stores
11454 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11455 enable it.
11456
11457 @item max-speculative-devirt-maydefs
11458 The maximum number of may-defs we analyze when looking for a must-def
11459 specifying the dynamic type of an object that invokes a virtual call
11460 we may be able to devirtualize speculatively.
11461
11462 @item max-vrp-switch-assertions
11463 The maximum number of assertions to add along the default edge of a switch
11464 statement during VRP.
11465
11466 @item unroll-jam-min-percent
11467 The minimum percentage of memory references that must be optimized
11468 away for the unroll-and-jam transformation to be considered profitable.
11469
11470 @item unroll-jam-max-unroll
11471 The maximum number of times the outer loop should be unrolled by
11472 the unroll-and-jam transformation.
11473
11474 @item max-rtl-if-conversion-unpredictable-cost
11475 Maximum permissible cost for the sequence that would be generated
11476 by the RTL if-conversion pass for a branch that is considered unpredictable.
11477
11478 @item max-variable-expansions-in-unroller
11479 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
11480 of times that an individual variable will be expanded during loop unrolling.
11481
11482 @item tracer-min-branch-probability-feedback
11483 Stop forward growth if the probability of best edge is less than
11484 this threshold (in percent). Used when profile feedback is available.
11485
11486 @item partial-inlining-entry-probability
11487 Maximum probability of the entry BB of split region
11488 (in percent relative to entry BB of the function)
11489 to make partial inlining happen.
11490
11491 @item max-tracked-strlens
11492 Maximum number of strings for which strlen optimization pass will
11493 track string lengths.
11494
11495 @item gcse-after-reload-partial-fraction
11496 The threshold ratio for performing partial redundancy
11497 elimination after reload.
11498
11499 @item gcse-after-reload-critical-fraction
11500 The threshold ratio of critical edges execution count that
11501 permit performing redundancy elimination after reload.
11502
11503 @item max-loop-header-insns
11504 The maximum number of insns in loop header duplicated
11505 by the copy loop headers pass.
11506
11507 @item vect-epilogues-nomask
11508 Enable loop epilogue vectorization using smaller vector size.
11509
11510 @item slp-max-insns-in-bb
11511 Maximum number of instructions in basic block to be
11512 considered for SLP vectorization.
11513
11514 @item avoid-fma-max-bits
11515 Maximum number of bits for which we avoid creating FMAs.
11516
11517 @item sms-loop-average-count-threshold
11518 A threshold on the average loop count considered by the swing modulo scheduler.
11519
11520 @item sms-dfa-history
11521 The number of cycles the swing modulo scheduler considers when checking
11522 conflicts using DFA.
11523
11524 @item hot-bb-count-fraction
11525 Select fraction of the maximal count of repetitions of basic block
11526 in program given basic block needs
11527 to have to be considered hot (used in non-LTO mode)
11528
11529 @item max-inline-insns-recursive-auto
11530 The maximum number of instructions non-inline function
11531 can grow to via recursive inlining.
11532
11533 @item graphite-allow-codegen-errors
11534 Whether codegen errors should be ICEs when @option{-fchecking}.
11535
11536 @item sms-max-ii-factor
11537 A factor for tuning the upper bound that swing modulo scheduler
11538 uses for scheduling a loop.
11539
11540 @item lra-max-considered-reload-pseudos
11541 The max number of reload pseudos which are considered during
11542 spilling a non-reload pseudo.
11543
11544 @item max-pow-sqrt-depth
11545 Maximum depth of sqrt chains to use when synthesizing exponentiation
11546 by a real constant.
11547
11548 @item max-dse-active-local-stores
11549 Maximum number of active local stores in RTL dead store elimination.
11550
11551 @item asan-instrument-allocas
11552 Enable asan allocas/VLAs protection.
11553
11554 @item max-iterations-computation-cost
11555 Bound on the cost of an expression to compute the number of iterations.
11556
11557 @item max-isl-operations
11558 Maximum number of isl operations, 0 means unlimited.
11559
11560 @item graphite-max-arrays-per-scop
11561 Maximum number of arrays per scop.
11562
11563 @item max-vartrack-reverse-op-size
11564 Max. size of loc list for which reverse ops should be added.
11565
11566 @item unlikely-bb-count-fraction
11567 The minimum fraction of profile runs a given basic block execution count
11568 must be not to be considered unlikely.
11569
11570 @item tracer-dynamic-coverage-feedback
11571 The percentage of function, weighted by execution frequency,
11572 that must be covered by trace formation.
11573 Used when profile feedback is available.
11574
11575 @item max-inline-recursive-depth-auto
11576 The maximum depth of recursive inlining for non-inline functions.
11577
11578 @item fsm-scale-path-stmts
11579 Scale factor to apply to the number of statements in a threading path
11580 when comparing to the number of (scaled) blocks.
11581
11582 @item fsm-maximum-phi-arguments
11583 Maximum number of arguments a PHI may have before the FSM threader
11584 will not try to thread through its block.
11585
11586 @item uninit-control-dep-attempts
11587 Maximum number of nested calls to search for control dependencies
11588 during uninitialized variable analysis.
11589
11590 @item indir-call-topn-profile
11591 Track top N target addresses in indirect-call profile.
11592
11593 @item max-once-peeled-insns
11594 The maximum number of insns of a peeled loop that rolls only once.
11595
11596 @item sra-max-scalarization-size-Osize
11597 Maximum size, in storage units, of an aggregate
11598 which should be considered for scalarization when compiling for size.
11599
11600 @item fsm-scale-path-blocks
11601 Scale factor to apply to the number of blocks in a threading path
11602 when comparing to the number of (scaled) statements.
11603
11604 @item sched-autopref-queue-depth
11605 Hardware autoprefetcher scheduler model control flag.
11606 Number of lookahead cycles the model looks into; at '
11607 ' only enable instruction sorting heuristic.
11608
11609
11610 @end table
11611 @end table
11612
11613 @node Instrumentation Options
11614 @section Program Instrumentation Options
11615 @cindex instrumentation options
11616 @cindex program instrumentation options
11617 @cindex run-time error checking options
11618 @cindex profiling options
11619 @cindex options, program instrumentation
11620 @cindex options, run-time error checking
11621 @cindex options, profiling
11622
11623 GCC supports a number of command-line options that control adding
11624 run-time instrumentation to the code it normally generates.
11625 For example, one purpose of instrumentation is collect profiling
11626 statistics for use in finding program hot spots, code coverage
11627 analysis, or profile-guided optimizations.
11628 Another class of program instrumentation is adding run-time checking
11629 to detect programming errors like invalid pointer
11630 dereferences or out-of-bounds array accesses, as well as deliberately
11631 hostile attacks such as stack smashing or C++ vtable hijacking.
11632 There is also a general hook which can be used to implement other
11633 forms of tracing or function-level instrumentation for debug or
11634 program analysis purposes.
11635
11636 @table @gcctabopt
11637 @cindex @command{prof}
11638 @item -p
11639 @opindex p
11640 Generate extra code to write profile information suitable for the
11641 analysis program @command{prof}. You must use this option when compiling
11642 the source files you want data about, and you must also use it when
11643 linking.
11644
11645 @cindex @command{gprof}
11646 @item -pg
11647 @opindex pg
11648 Generate extra code to write profile information suitable for the
11649 analysis program @command{gprof}. You must use this option when compiling
11650 the source files you want data about, and you must also use it when
11651 linking.
11652
11653 @item -fprofile-arcs
11654 @opindex fprofile-arcs
11655 Add code so that program flow @dfn{arcs} are instrumented. During
11656 execution the program records how many times each branch and call is
11657 executed and how many times it is taken or returns. On targets that support
11658 constructors with priority support, profiling properly handles constructors,
11659 destructors and C++ constructors (and destructors) of classes which are used
11660 as a type of a global variable.
11661
11662 When the compiled
11663 program exits it saves this data to a file called
11664 @file{@var{auxname}.gcda} for each source file. The data may be used for
11665 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11666 test coverage analysis (@option{-ftest-coverage}). Each object file's
11667 @var{auxname} is generated from the name of the output file, if
11668 explicitly specified and it is not the final executable, otherwise it is
11669 the basename of the source file. In both cases any suffix is removed
11670 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11671 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11672 @xref{Cross-profiling}.
11673
11674 @cindex @command{gcov}
11675 @item --coverage
11676 @opindex coverage
11677
11678 This option is used to compile and link code instrumented for coverage
11679 analysis. The option is a synonym for @option{-fprofile-arcs}
11680 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11681 linking). See the documentation for those options for more details.
11682
11683 @itemize
11684
11685 @item
11686 Compile the source files with @option{-fprofile-arcs} plus optimization
11687 and code generation options. For test coverage analysis, use the
11688 additional @option{-ftest-coverage} option. You do not need to profile
11689 every source file in a program.
11690
11691 @item
11692 Compile the source files additionally with @option{-fprofile-abs-path}
11693 to create absolute path names in the @file{.gcno} files. This allows
11694 @command{gcov} to find the correct sources in projects where compilations
11695 occur with different working directories.
11696
11697 @item
11698 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11699 (the latter implies the former).
11700
11701 @item
11702 Run the program on a representative workload to generate the arc profile
11703 information. This may be repeated any number of times. You can run
11704 concurrent instances of your program, and provided that the file system
11705 supports locking, the data files will be correctly updated. Unless
11706 a strict ISO C dialect option is in effect, @code{fork} calls are
11707 detected and correctly handled without double counting.
11708
11709 @item
11710 For profile-directed optimizations, compile the source files again with
11711 the same optimization and code generation options plus
11712 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11713 Control Optimization}).
11714
11715 @item
11716 For test coverage analysis, use @command{gcov} to produce human readable
11717 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11718 @command{gcov} documentation for further information.
11719
11720 @end itemize
11721
11722 With @option{-fprofile-arcs}, for each function of your program GCC
11723 creates a program flow graph, then finds a spanning tree for the graph.
11724 Only arcs that are not on the spanning tree have to be instrumented: the
11725 compiler adds code to count the number of times that these arcs are
11726 executed. When an arc is the only exit or only entrance to a block, the
11727 instrumentation code can be added to the block; otherwise, a new basic
11728 block must be created to hold the instrumentation code.
11729
11730 @need 2000
11731 @item -ftest-coverage
11732 @opindex ftest-coverage
11733 Produce a notes file that the @command{gcov} code-coverage utility
11734 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11735 show program coverage. Each source file's note file is called
11736 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11737 above for a description of @var{auxname} and instructions on how to
11738 generate test coverage data. Coverage data matches the source files
11739 more closely if you do not optimize.
11740
11741 @item -fprofile-abs-path
11742 @opindex fprofile-abs-path
11743 Automatically convert relative source file names to absolute path names
11744 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11745 sources in projects where compilations occur with different working
11746 directories.
11747
11748 @item -fprofile-dir=@var{path}
11749 @opindex fprofile-dir
11750
11751 Set the directory to search for the profile data files in to @var{path}.
11752 This option affects only the profile data generated by
11753 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11754 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11755 and its related options. Both absolute and relative paths can be used.
11756 By default, GCC uses the current directory as @var{path}, thus the
11757 profile data file appears in the same directory as the object file.
11758 In order to prevent the file name clashing, if the object file name is
11759 not an absolute path, we mangle the absolute path of the
11760 @file{@var{sourcename}.gcda} file and use it as the file name of a
11761 @file{.gcda} file.
11762
11763 When an executable is run in a massive parallel environment, it is recommended
11764 to save profile to different folders. That can be done with variables
11765 in @var{path} that are exported during run-time:
11766
11767 @table @gcctabopt
11768
11769 @item %p
11770 process ID.
11771
11772 @item %q@{VAR@}
11773 value of environment variable @var{VAR}
11774
11775 @end table
11776
11777 @item -fprofile-generate
11778 @itemx -fprofile-generate=@var{path}
11779 @opindex fprofile-generate
11780
11781 Enable options usually used for instrumenting application to produce
11782 profile useful for later recompilation with profile feedback based
11783 optimization. You must use @option{-fprofile-generate} both when
11784 compiling and when linking your program.
11785
11786 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11787
11788 If @var{path} is specified, GCC looks at the @var{path} to find
11789 the profile feedback data files. See @option{-fprofile-dir}.
11790
11791 To optimize the program based on the collected profile information, use
11792 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11793
11794 @item -fprofile-update=@var{method}
11795 @opindex fprofile-update
11796
11797 Alter the update method for an application instrumented for profile
11798 feedback based optimization. The @var{method} argument should be one of
11799 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11800 The first one is useful for single-threaded applications,
11801 while the second one prevents profile corruption by emitting thread-safe code.
11802
11803 @strong{Warning:} When an application does not properly join all threads
11804 (or creates an detached thread), a profile file can be still corrupted.
11805
11806 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11807 when supported by a target, or to @samp{single} otherwise. The GCC driver
11808 automatically selects @samp{prefer-atomic} when @option{-pthread}
11809 is present in the command line.
11810
11811 @item -fsanitize=address
11812 @opindex fsanitize=address
11813 Enable AddressSanitizer, a fast memory error detector.
11814 Memory access instructions are instrumented to detect
11815 out-of-bounds and use-after-free bugs.
11816 The option enables @option{-fsanitize-address-use-after-scope}.
11817 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11818 more details. The run-time behavior can be influenced using the
11819 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11820 the available options are shown at startup of the instrumented program. See
11821 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11822 for a list of supported options.
11823 The option cannot be combined with @option{-fsanitize=thread}.
11824
11825 @item -fsanitize=kernel-address
11826 @opindex fsanitize=kernel-address
11827 Enable AddressSanitizer for Linux kernel.
11828 See @uref{https://github.com/google/kasan/wiki} for more details.
11829
11830 @item -fsanitize=pointer-compare
11831 @opindex fsanitize=pointer-compare
11832 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11833 The option must be combined with either @option{-fsanitize=kernel-address} or
11834 @option{-fsanitize=address}
11835 The option cannot be combined with @option{-fsanitize=thread}.
11836 Note: By default the check is disabled at run time. To enable it,
11837 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11838 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11839 invalid operation only when both pointers are non-null.
11840
11841 @item -fsanitize=pointer-subtract
11842 @opindex fsanitize=pointer-subtract
11843 Instrument subtraction with pointer operands.
11844 The option must be combined with either @option{-fsanitize=kernel-address} or
11845 @option{-fsanitize=address}
11846 The option cannot be combined with @option{-fsanitize=thread}.
11847 Note: By default the check is disabled at run time. To enable it,
11848 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11849 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11850 invalid operation only when both pointers are non-null.
11851
11852 @item -fsanitize=thread
11853 @opindex fsanitize=thread
11854 Enable ThreadSanitizer, a fast data race detector.
11855 Memory access instructions are instrumented to detect
11856 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11857 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11858 environment variable; see
11859 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11860 supported options.
11861 The option cannot be combined with @option{-fsanitize=address},
11862 @option{-fsanitize=leak}.
11863
11864 Note that sanitized atomic builtins cannot throw exceptions when
11865 operating on invalid memory addresses with non-call exceptions
11866 (@option{-fnon-call-exceptions}).
11867
11868 @item -fsanitize=leak
11869 @opindex fsanitize=leak
11870 Enable LeakSanitizer, a memory leak detector.
11871 This option only matters for linking of executables and
11872 the executable is linked against a library that overrides @code{malloc}
11873 and other allocator functions. See
11874 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11875 details. The run-time behavior can be influenced using the
11876 @env{LSAN_OPTIONS} environment variable.
11877 The option cannot be combined with @option{-fsanitize=thread}.
11878
11879 @item -fsanitize=undefined
11880 @opindex fsanitize=undefined
11881 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11882 Various computations are instrumented to detect undefined behavior
11883 at runtime. Current suboptions are:
11884
11885 @table @gcctabopt
11886
11887 @item -fsanitize=shift
11888 @opindex fsanitize=shift
11889 This option enables checking that the result of a shift operation is
11890 not undefined. Note that what exactly is considered undefined differs
11891 slightly between C and C++, as well as between ISO C90 and C99, etc.
11892 This option has two suboptions, @option{-fsanitize=shift-base} and
11893 @option{-fsanitize=shift-exponent}.
11894
11895 @item -fsanitize=shift-exponent
11896 @opindex fsanitize=shift-exponent
11897 This option enables checking that the second argument of a shift operation
11898 is not negative and is smaller than the precision of the promoted first
11899 argument.
11900
11901 @item -fsanitize=shift-base
11902 @opindex fsanitize=shift-base
11903 If the second argument of a shift operation is within range, check that the
11904 result of a shift operation is not undefined. Note that what exactly is
11905 considered undefined differs slightly between C and C++, as well as between
11906 ISO C90 and C99, etc.
11907
11908 @item -fsanitize=integer-divide-by-zero
11909 @opindex fsanitize=integer-divide-by-zero
11910 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11911
11912 @item -fsanitize=unreachable
11913 @opindex fsanitize=unreachable
11914 With this option, the compiler turns the @code{__builtin_unreachable}
11915 call into a diagnostics message call instead. When reaching the
11916 @code{__builtin_unreachable} call, the behavior is undefined.
11917
11918 @item -fsanitize=vla-bound
11919 @opindex fsanitize=vla-bound
11920 This option instructs the compiler to check that the size of a variable
11921 length array is positive.
11922
11923 @item -fsanitize=null
11924 @opindex fsanitize=null
11925 This option enables pointer checking. Particularly, the application
11926 built with this option turned on will issue an error message when it
11927 tries to dereference a NULL pointer, or if a reference (possibly an
11928 rvalue reference) is bound to a NULL pointer, or if a method is invoked
11929 on an object pointed by a NULL pointer.
11930
11931 @item -fsanitize=return
11932 @opindex fsanitize=return
11933 This option enables return statement checking. Programs
11934 built with this option turned on will issue an error message
11935 when the end of a non-void function is reached without actually
11936 returning a value. This option works in C++ only.
11937
11938 @item -fsanitize=signed-integer-overflow
11939 @opindex fsanitize=signed-integer-overflow
11940 This option enables signed integer overflow checking. We check that
11941 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11942 does not overflow in the signed arithmetics. Note, integer promotion
11943 rules must be taken into account. That is, the following is not an
11944 overflow:
11945 @smallexample
11946 signed char a = SCHAR_MAX;
11947 a++;
11948 @end smallexample
11949
11950 @item -fsanitize=bounds
11951 @opindex fsanitize=bounds
11952 This option enables instrumentation of array bounds. Various out of bounds
11953 accesses are detected. Flexible array members, flexible array member-like
11954 arrays, and initializers of variables with static storage are not instrumented.
11955
11956 @item -fsanitize=bounds-strict
11957 @opindex fsanitize=bounds-strict
11958 This option enables strict instrumentation of array bounds. Most out of bounds
11959 accesses are detected, including flexible array members and flexible array
11960 member-like arrays. Initializers of variables with static storage are not
11961 instrumented.
11962
11963 @item -fsanitize=alignment
11964 @opindex fsanitize=alignment
11965
11966 This option enables checking of alignment of pointers when they are
11967 dereferenced, or when a reference is bound to insufficiently aligned target,
11968 or when a method or constructor is invoked on insufficiently aligned object.
11969
11970 @item -fsanitize=object-size
11971 @opindex fsanitize=object-size
11972 This option enables instrumentation of memory references using the
11973 @code{__builtin_object_size} function. Various out of bounds pointer
11974 accesses are detected.
11975
11976 @item -fsanitize=float-divide-by-zero
11977 @opindex fsanitize=float-divide-by-zero
11978 Detect floating-point division by zero. Unlike other similar options,
11979 @option{-fsanitize=float-divide-by-zero} is not enabled by
11980 @option{-fsanitize=undefined}, since floating-point division by zero can
11981 be a legitimate way of obtaining infinities and NaNs.
11982
11983 @item -fsanitize=float-cast-overflow
11984 @opindex fsanitize=float-cast-overflow
11985 This option enables floating-point type to integer conversion checking.
11986 We check that the result of the conversion does not overflow.
11987 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11988 not enabled by @option{-fsanitize=undefined}.
11989 This option does not work well with @code{FE_INVALID} exceptions enabled.
11990
11991 @item -fsanitize=nonnull-attribute
11992 @opindex fsanitize=nonnull-attribute
11993
11994 This option enables instrumentation of calls, checking whether null values
11995 are not passed to arguments marked as requiring a non-null value by the
11996 @code{nonnull} function attribute.
11997
11998 @item -fsanitize=returns-nonnull-attribute
11999 @opindex fsanitize=returns-nonnull-attribute
12000
12001 This option enables instrumentation of return statements in functions
12002 marked with @code{returns_nonnull} function attribute, to detect returning
12003 of null values from such functions.
12004
12005 @item -fsanitize=bool
12006 @opindex fsanitize=bool
12007
12008 This option enables instrumentation of loads from bool. If a value other
12009 than 0/1 is loaded, a run-time error is issued.
12010
12011 @item -fsanitize=enum
12012 @opindex fsanitize=enum
12013
12014 This option enables instrumentation of loads from an enum type. If
12015 a value outside the range of values for the enum type is loaded,
12016 a run-time error is issued.
12017
12018 @item -fsanitize=vptr
12019 @opindex fsanitize=vptr
12020
12021 This option enables instrumentation of C++ member function calls, member
12022 accesses and some conversions between pointers to base and derived classes,
12023 to verify the referenced object has the correct dynamic type.
12024
12025 @item -fsanitize=pointer-overflow
12026 @opindex fsanitize=pointer-overflow
12027
12028 This option enables instrumentation of pointer arithmetics. If the pointer
12029 arithmetics overflows, a run-time error is issued.
12030
12031 @item -fsanitize=builtin
12032 @opindex fsanitize=builtin
12033
12034 This option enables instrumentation of arguments to selected builtin
12035 functions. If an invalid value is passed to such arguments, a run-time
12036 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12037 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12038 by this option.
12039
12040 @end table
12041
12042 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12043 @option{-fsanitize=undefined} gives a diagnostic message.
12044 This currently works only for the C family of languages.
12045
12046 @item -fno-sanitize=all
12047 @opindex fno-sanitize=all
12048
12049 This option disables all previously enabled sanitizers.
12050 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12051 together.
12052
12053 @item -fasan-shadow-offset=@var{number}
12054 @opindex fasan-shadow-offset
12055 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12056 It is useful for experimenting with different shadow memory layouts in
12057 Kernel AddressSanitizer.
12058
12059 @item -fsanitize-sections=@var{s1},@var{s2},...
12060 @opindex fsanitize-sections
12061 Sanitize global variables in selected user-defined sections. @var{si} may
12062 contain wildcards.
12063
12064 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12065 @opindex fsanitize-recover
12066 @opindex fno-sanitize-recover
12067 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12068 mentioned in comma-separated list of @var{opts}. Enabling this option
12069 for a sanitizer component causes it to attempt to continue
12070 running the program as if no error happened. This means multiple
12071 runtime errors can be reported in a single program run, and the exit
12072 code of the program may indicate success even when errors
12073 have been reported. The @option{-fno-sanitize-recover=} option
12074 can be used to alter
12075 this behavior: only the first detected error is reported
12076 and program then exits with a non-zero exit code.
12077
12078 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12079 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12080 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12081 @option{-fsanitize=bounds-strict},
12082 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12083 For these sanitizers error recovery is turned on by default,
12084 except @option{-fsanitize=address}, for which this feature is experimental.
12085 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12086 accepted, the former enables recovery for all sanitizers that support it,
12087 the latter disables recovery for all sanitizers that support it.
12088
12089 Even if a recovery mode is turned on the compiler side, it needs to be also
12090 enabled on the runtime library side, otherwise the failures are still fatal.
12091 The runtime library defaults to @code{halt_on_error=0} for
12092 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12093 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12094 setting the @code{halt_on_error} flag in the corresponding environment variable.
12095
12096 Syntax without an explicit @var{opts} parameter is deprecated. It is
12097 equivalent to specifying an @var{opts} list of:
12098
12099 @smallexample
12100 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12101 @end smallexample
12102
12103 @item -fsanitize-address-use-after-scope
12104 @opindex fsanitize-address-use-after-scope
12105 Enable sanitization of local variables to detect use-after-scope bugs.
12106 The option sets @option{-fstack-reuse} to @samp{none}.
12107
12108 @item -fsanitize-undefined-trap-on-error
12109 @opindex fsanitize-undefined-trap-on-error
12110 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12111 report undefined behavior using @code{__builtin_trap} rather than
12112 a @code{libubsan} library routine. The advantage of this is that the
12113 @code{libubsan} library is not needed and is not linked in, so this
12114 is usable even in freestanding environments.
12115
12116 @item -fsanitize-coverage=trace-pc
12117 @opindex fsanitize-coverage=trace-pc
12118 Enable coverage-guided fuzzing code instrumentation.
12119 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12120
12121 @item -fsanitize-coverage=trace-cmp
12122 @opindex fsanitize-coverage=trace-cmp
12123 Enable dataflow guided fuzzing code instrumentation.
12124 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12125 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12126 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12127 variable or @code{__sanitizer_cov_trace_const_cmp1},
12128 @code{__sanitizer_cov_trace_const_cmp2},
12129 @code{__sanitizer_cov_trace_const_cmp4} or
12130 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12131 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12132 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12133 @code{__sanitizer_cov_trace_switch} for switch statements.
12134
12135 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12136 @opindex fcf-protection
12137 Enable code instrumentation of control-flow transfers to increase
12138 program security by checking that target addresses of control-flow
12139 transfer instructions (such as indirect function call, function return,
12140 indirect jump) are valid. This prevents diverting the flow of control
12141 to an unexpected target. This is intended to protect against such
12142 threats as Return-oriented Programming (ROP), and similarly
12143 call/jmp-oriented programming (COP/JOP).
12144
12145 The value @code{branch} tells the compiler to implement checking of
12146 validity of control-flow transfer at the point of indirect branch
12147 instructions, i.e.@: call/jmp instructions. The value @code{return}
12148 implements checking of validity at the point of returning from a
12149 function. The value @code{full} is an alias for specifying both
12150 @code{branch} and @code{return}. The value @code{none} turns off
12151 instrumentation.
12152
12153 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12154 used. The first bit of @code{__CET__} is set to 1 for the value
12155 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12156 the @code{return}.
12157
12158 You can also use the @code{nocf_check} attribute to identify
12159 which functions and calls should be skipped from instrumentation
12160 (@pxref{Function Attributes}).
12161
12162 Currently the x86 GNU/Linux target provides an implementation based
12163 on Intel Control-flow Enforcement Technology (CET).
12164
12165 @item -fstack-protector
12166 @opindex fstack-protector
12167 Emit extra code to check for buffer overflows, such as stack smashing
12168 attacks. This is done by adding a guard variable to functions with
12169 vulnerable objects. This includes functions that call @code{alloca}, and
12170 functions with buffers larger than 8 bytes. The guards are initialized
12171 when a function is entered and then checked when the function exits.
12172 If a guard check fails, an error message is printed and the program exits.
12173
12174 @item -fstack-protector-all
12175 @opindex fstack-protector-all
12176 Like @option{-fstack-protector} except that all functions are protected.
12177
12178 @item -fstack-protector-strong
12179 @opindex fstack-protector-strong
12180 Like @option{-fstack-protector} but includes additional functions to
12181 be protected --- those that have local array definitions, or have
12182 references to local frame addresses.
12183
12184 @item -fstack-protector-explicit
12185 @opindex fstack-protector-explicit
12186 Like @option{-fstack-protector} but only protects those functions which
12187 have the @code{stack_protect} attribute.
12188
12189 @item -fstack-check
12190 @opindex fstack-check
12191 Generate code to verify that you do not go beyond the boundary of the
12192 stack. You should specify this flag if you are running in an
12193 environment with multiple threads, but you only rarely need to specify it in
12194 a single-threaded environment since stack overflow is automatically
12195 detected on nearly all systems if there is only one stack.
12196
12197 Note that this switch does not actually cause checking to be done; the
12198 operating system or the language runtime must do that. The switch causes
12199 generation of code to ensure that they see the stack being extended.
12200
12201 You can additionally specify a string parameter: @samp{no} means no
12202 checking, @samp{generic} means force the use of old-style checking,
12203 @samp{specific} means use the best checking method and is equivalent
12204 to bare @option{-fstack-check}.
12205
12206 Old-style checking is a generic mechanism that requires no specific
12207 target support in the compiler but comes with the following drawbacks:
12208
12209 @enumerate
12210 @item
12211 Modified allocation strategy for large objects: they are always
12212 allocated dynamically if their size exceeds a fixed threshold. Note this
12213 may change the semantics of some code.
12214
12215 @item
12216 Fixed limit on the size of the static frame of functions: when it is
12217 topped by a particular function, stack checking is not reliable and
12218 a warning is issued by the compiler.
12219
12220 @item
12221 Inefficiency: because of both the modified allocation strategy and the
12222 generic implementation, code performance is hampered.
12223 @end enumerate
12224
12225 Note that old-style stack checking is also the fallback method for
12226 @samp{specific} if no target support has been added in the compiler.
12227
12228 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12229 and stack overflows. @samp{specific} is an excellent choice when compiling
12230 Ada code. It is not generally sufficient to protect against stack-clash
12231 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12232
12233 @item -fstack-clash-protection
12234 @opindex fstack-clash-protection
12235 Generate code to prevent stack clash style attacks. When this option is
12236 enabled, the compiler will only allocate one page of stack space at a time
12237 and each page is accessed immediately after allocation. Thus, it prevents
12238 allocations from jumping over any stack guard page provided by the
12239 operating system.
12240
12241 Most targets do not fully support stack clash protection. However, on
12242 those targets @option{-fstack-clash-protection} will protect dynamic stack
12243 allocations. @option{-fstack-clash-protection} may also provide limited
12244 protection for static stack allocations if the target supports
12245 @option{-fstack-check=specific}.
12246
12247 @item -fstack-limit-register=@var{reg}
12248 @itemx -fstack-limit-symbol=@var{sym}
12249 @itemx -fno-stack-limit
12250 @opindex fstack-limit-register
12251 @opindex fstack-limit-symbol
12252 @opindex fno-stack-limit
12253 Generate code to ensure that the stack does not grow beyond a certain value,
12254 either the value of a register or the address of a symbol. If a larger
12255 stack is required, a signal is raised at run time. For most targets,
12256 the signal is raised before the stack overruns the boundary, so
12257 it is possible to catch the signal without taking special precautions.
12258
12259 For instance, if the stack starts at absolute address @samp{0x80000000}
12260 and grows downwards, you can use the flags
12261 @option{-fstack-limit-symbol=__stack_limit} and
12262 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12263 of 128KB@. Note that this may only work with the GNU linker.
12264
12265 You can locally override stack limit checking by using the
12266 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12267
12268 @item -fsplit-stack
12269 @opindex fsplit-stack
12270 Generate code to automatically split the stack before it overflows.
12271 The resulting program has a discontiguous stack which can only
12272 overflow if the program is unable to allocate any more memory. This
12273 is most useful when running threaded programs, as it is no longer
12274 necessary to calculate a good stack size to use for each thread. This
12275 is currently only implemented for the x86 targets running
12276 GNU/Linux.
12277
12278 When code compiled with @option{-fsplit-stack} calls code compiled
12279 without @option{-fsplit-stack}, there may not be much stack space
12280 available for the latter code to run. If compiling all code,
12281 including library code, with @option{-fsplit-stack} is not an option,
12282 then the linker can fix up these calls so that the code compiled
12283 without @option{-fsplit-stack} always has a large stack. Support for
12284 this is implemented in the gold linker in GNU binutils release 2.21
12285 and later.
12286
12287 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12288 @opindex fvtable-verify
12289 This option is only available when compiling C++ code.
12290 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12291 feature that verifies at run time, for every virtual call, that
12292 the vtable pointer through which the call is made is valid for the type of
12293 the object, and has not been corrupted or overwritten. If an invalid vtable
12294 pointer is detected at run time, an error is reported and execution of the
12295 program is immediately halted.
12296
12297 This option causes run-time data structures to be built at program startup,
12298 which are used for verifying the vtable pointers.
12299 The options @samp{std} and @samp{preinit}
12300 control the timing of when these data structures are built. In both cases the
12301 data structures are built before execution reaches @code{main}. Using
12302 @option{-fvtable-verify=std} causes the data structures to be built after
12303 shared libraries have been loaded and initialized.
12304 @option{-fvtable-verify=preinit} causes them to be built before shared
12305 libraries have been loaded and initialized.
12306
12307 If this option appears multiple times in the command line with different
12308 values specified, @samp{none} takes highest priority over both @samp{std} and
12309 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12310
12311 @item -fvtv-debug
12312 @opindex fvtv-debug
12313 When used in conjunction with @option{-fvtable-verify=std} or
12314 @option{-fvtable-verify=preinit}, causes debug versions of the
12315 runtime functions for the vtable verification feature to be called.
12316 This flag also causes the compiler to log information about which
12317 vtable pointers it finds for each class.
12318 This information is written to a file named @file{vtv_set_ptr_data.log}
12319 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12320 if that is defined or the current working directory otherwise.
12321
12322 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12323 file, be sure to delete any existing one.
12324
12325 @item -fvtv-counts
12326 @opindex fvtv-counts
12327 This is a debugging flag. When used in conjunction with
12328 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12329 causes the compiler to keep track of the total number of virtual calls
12330 it encounters and the number of verifications it inserts. It also
12331 counts the number of calls to certain run-time library functions
12332 that it inserts and logs this information for each compilation unit.
12333 The compiler writes this information to a file named
12334 @file{vtv_count_data.log} in the directory named by the environment
12335 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12336 directory otherwise. It also counts the size of the vtable pointer sets
12337 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12338 in the same directory.
12339
12340 Note: This feature @emph{appends} data to the log files. To get fresh log
12341 files, be sure to delete any existing ones.
12342
12343 @item -finstrument-functions
12344 @opindex finstrument-functions
12345 Generate instrumentation calls for entry and exit to functions. Just
12346 after function entry and just before function exit, the following
12347 profiling functions are called with the address of the current
12348 function and its call site. (On some platforms,
12349 @code{__builtin_return_address} does not work beyond the current
12350 function, so the call site information may not be available to the
12351 profiling functions otherwise.)
12352
12353 @smallexample
12354 void __cyg_profile_func_enter (void *this_fn,
12355 void *call_site);
12356 void __cyg_profile_func_exit (void *this_fn,
12357 void *call_site);
12358 @end smallexample
12359
12360 The first argument is the address of the start of the current function,
12361 which may be looked up exactly in the symbol table.
12362
12363 This instrumentation is also done for functions expanded inline in other
12364 functions. The profiling calls indicate where, conceptually, the
12365 inline function is entered and exited. This means that addressable
12366 versions of such functions must be available. If all your uses of a
12367 function are expanded inline, this may mean an additional expansion of
12368 code size. If you use @code{extern inline} in your C code, an
12369 addressable version of such functions must be provided. (This is
12370 normally the case anyway, but if you get lucky and the optimizer always
12371 expands the functions inline, you might have gotten away without
12372 providing static copies.)
12373
12374 A function may be given the attribute @code{no_instrument_function}, in
12375 which case this instrumentation is not done. This can be used, for
12376 example, for the profiling functions listed above, high-priority
12377 interrupt routines, and any functions from which the profiling functions
12378 cannot safely be called (perhaps signal handlers, if the profiling
12379 routines generate output or allocate memory).
12380
12381 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12382 @opindex finstrument-functions-exclude-file-list
12383
12384 Set the list of functions that are excluded from instrumentation (see
12385 the description of @option{-finstrument-functions}). If the file that
12386 contains a function definition matches with one of @var{file}, then
12387 that function is not instrumented. The match is done on substrings:
12388 if the @var{file} parameter is a substring of the file name, it is
12389 considered to be a match.
12390
12391 For example:
12392
12393 @smallexample
12394 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12395 @end smallexample
12396
12397 @noindent
12398 excludes any inline function defined in files whose pathnames
12399 contain @file{/bits/stl} or @file{include/sys}.
12400
12401 If, for some reason, you want to include letter @samp{,} in one of
12402 @var{sym}, write @samp{\,}. For example,
12403 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12404 (note the single quote surrounding the option).
12405
12406 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12407 @opindex finstrument-functions-exclude-function-list
12408
12409 This is similar to @option{-finstrument-functions-exclude-file-list},
12410 but this option sets the list of function names to be excluded from
12411 instrumentation. The function name to be matched is its user-visible
12412 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12413 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12414 match is done on substrings: if the @var{sym} parameter is a substring
12415 of the function name, it is considered to be a match. For C99 and C++
12416 extended identifiers, the function name must be given in UTF-8, not
12417 using universal character names.
12418
12419 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12420 @opindex fpatchable-function-entry
12421 Generate @var{N} NOPs right at the beginning
12422 of each function, with the function entry point before the @var{M}th NOP.
12423 If @var{M} is omitted, it defaults to @code{0} so the
12424 function entry points to the address just at the first NOP.
12425 The NOP instructions reserve extra space which can be used to patch in
12426 any desired instrumentation at run time, provided that the code segment
12427 is writable. The amount of space is controllable indirectly via
12428 the number of NOPs; the NOP instruction used corresponds to the instruction
12429 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12430 is target-specific and may also depend on the architecture variant and/or
12431 other compilation options.
12432
12433 For run-time identification, the starting addresses of these areas,
12434 which correspond to their respective function entries minus @var{M},
12435 are additionally collected in the @code{__patchable_function_entries}
12436 section of the resulting binary.
12437
12438 Note that the value of @code{__attribute__ ((patchable_function_entry
12439 (N,M)))} takes precedence over command-line option
12440 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12441 the area size or to remove it completely on a single function.
12442 If @code{N=0}, no pad location is recorded.
12443
12444 The NOP instructions are inserted at---and maybe before, depending on
12445 @var{M}---the function entry address, even before the prologue.
12446
12447 @end table
12448
12449
12450 @node Preprocessor Options
12451 @section Options Controlling the Preprocessor
12452 @cindex preprocessor options
12453 @cindex options, preprocessor
12454
12455 These options control the C preprocessor, which is run on each C source
12456 file before actual compilation.
12457
12458 If you use the @option{-E} option, nothing is done except preprocessing.
12459 Some of these options make sense only together with @option{-E} because
12460 they cause the preprocessor output to be unsuitable for actual
12461 compilation.
12462
12463 In addition to the options listed here, there are a number of options
12464 to control search paths for include files documented in
12465 @ref{Directory Options}.
12466 Options to control preprocessor diagnostics are listed in
12467 @ref{Warning Options}.
12468
12469 @table @gcctabopt
12470 @include cppopts.texi
12471
12472 @item -Wp,@var{option}
12473 @opindex Wp
12474 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12475 and pass @var{option} directly through to the preprocessor. If
12476 @var{option} contains commas, it is split into multiple options at the
12477 commas. However, many options are modified, translated or interpreted
12478 by the compiler driver before being passed to the preprocessor, and
12479 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12480 interface is undocumented and subject to change, so whenever possible
12481 you should avoid using @option{-Wp} and let the driver handle the
12482 options instead.
12483
12484 @item -Xpreprocessor @var{option}
12485 @opindex Xpreprocessor
12486 Pass @var{option} as an option to the preprocessor. You can use this to
12487 supply system-specific preprocessor options that GCC does not
12488 recognize.
12489
12490 If you want to pass an option that takes an argument, you must use
12491 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12492
12493 @item -no-integrated-cpp
12494 @opindex no-integrated-cpp
12495 Perform preprocessing as a separate pass before compilation.
12496 By default, GCC performs preprocessing as an integrated part of
12497 input tokenization and parsing.
12498 If this option is provided, the appropriate language front end
12499 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12500 and Objective-C, respectively) is instead invoked twice,
12501 once for preprocessing only and once for actual compilation
12502 of the preprocessed input.
12503 This option may be useful in conjunction with the @option{-B} or
12504 @option{-wrapper} options to specify an alternate preprocessor or
12505 perform additional processing of the program source between
12506 normal preprocessing and compilation.
12507
12508 @end table
12509
12510 @node Assembler Options
12511 @section Passing Options to the Assembler
12512
12513 @c prevent bad page break with this line
12514 You can pass options to the assembler.
12515
12516 @table @gcctabopt
12517 @item -Wa,@var{option}
12518 @opindex Wa
12519 Pass @var{option} as an option to the assembler. If @var{option}
12520 contains commas, it is split into multiple options at the commas.
12521
12522 @item -Xassembler @var{option}
12523 @opindex Xassembler
12524 Pass @var{option} as an option to the assembler. You can use this to
12525 supply system-specific assembler options that GCC does not
12526 recognize.
12527
12528 If you want to pass an option that takes an argument, you must use
12529 @option{-Xassembler} twice, once for the option and once for the argument.
12530
12531 @end table
12532
12533 @node Link Options
12534 @section Options for Linking
12535 @cindex link options
12536 @cindex options, linking
12537
12538 These options come into play when the compiler links object files into
12539 an executable output file. They are meaningless if the compiler is
12540 not doing a link step.
12541
12542 @table @gcctabopt
12543 @cindex file names
12544 @item @var{object-file-name}
12545 A file name that does not end in a special recognized suffix is
12546 considered to name an object file or library. (Object files are
12547 distinguished from libraries by the linker according to the file
12548 contents.) If linking is done, these object files are used as input
12549 to the linker.
12550
12551 @item -c
12552 @itemx -S
12553 @itemx -E
12554 @opindex c
12555 @opindex S
12556 @opindex E
12557 If any of these options is used, then the linker is not run, and
12558 object file names should not be used as arguments. @xref{Overall
12559 Options}.
12560
12561 @item -flinker-output=@var{type}
12562 @opindex flinker-output
12563 This option controls the code generation of the link time optimizer. By
12564 default the linker output is determined by the linker plugin automatically. For
12565 debugging the compiler and in the case of incremental linking to non-lto object
12566 file is desired, it may be useful to control the type manually.
12567
12568 If @var{type} is @samp{exec} the code generation is configured to produce static
12569 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
12570
12571 If @var{type} is @samp{dyn} the code generation is configured to produce shared
12572 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
12573 enabled automatically. This makes it possible to build shared libraries without
12574 position independent code on architectures this is possible, i.e.@: on x86.
12575
12576 If @var{type} is @samp{pie} the code generation is configured to produce
12577 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
12578 except that @option{-fpie} is not disabled if specified at compilation time.
12579
12580 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
12581 done. The sections containing intermediate code for link-time optimization are
12582 merged, pre-optimized, and output to the resulting object file. In addition, if
12583 @option{-ffat-lto-objects} is specified the binary code is produced for future
12584 non-lto linking. The object file produced by incremental linking will be smaller
12585 than a static library produced from the same object files. At link-time the
12586 result of incremental linking will also load faster to compiler than a static
12587 library assuming that majority of objects in the library are used.
12588
12589 Finally @samp{nolto-rel} configure compiler to for incremental linking where
12590 code generation is forced, final binary is produced and the intermediate code
12591 for later link-time optimization is stripped. When multiple object files are
12592 linked together the resulting code will be optimized better than with link time
12593 optimizations disabled (for example, the cross-module inlining will happen),
12594 most of benefits of whole program optimizations are however lost.
12595
12596 During the incremental link (by @option{-r}) the linker plugin will default to
12597 @option{rel}. With current interfaces to GNU Binutils it is however not
12598 possible to link incrementally LTO objects and non-LTO objects into a single
12599 mixed object file. In the case any of object files in incremental link can not
12600 be used for link-time optimization the linker plugin will output warning and
12601 use @samp{nolto-rel}. To maintain the whole program optimization it is
12602 recommended to link such objects into static library instead. Alternatively it
12603 is possible to use H.J. Lu's binutils with support for mixed objects.
12604
12605 @item -fuse-ld=bfd
12606 @opindex fuse-ld=bfd
12607 Use the @command{bfd} linker instead of the default linker.
12608
12609 @item -fuse-ld=gold
12610 @opindex fuse-ld=gold
12611 Use the @command{gold} linker instead of the default linker.
12612
12613 @cindex Libraries
12614 @item -l@var{library}
12615 @itemx -l @var{library}
12616 @opindex l
12617 Search the library named @var{library} when linking. (The second
12618 alternative with the library as a separate argument is only for
12619 POSIX compliance and is not recommended.)
12620
12621 It makes a difference where in the command you write this option; the
12622 linker searches and processes libraries and object files in the order they
12623 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12624 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12625 to functions in @samp{z}, those functions may not be loaded.
12626
12627 The linker searches a standard list of directories for the library,
12628 which is actually a file named @file{lib@var{library}.a}. The linker
12629 then uses this file as if it had been specified precisely by name.
12630
12631 The directories searched include several standard system directories
12632 plus any that you specify with @option{-L}.
12633
12634 Normally the files found this way are library files---archive files
12635 whose members are object files. The linker handles an archive file by
12636 scanning through it for members which define symbols that have so far
12637 been referenced but not defined. But if the file that is found is an
12638 ordinary object file, it is linked in the usual fashion. The only
12639 difference between using an @option{-l} option and specifying a file name
12640 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12641 and searches several directories.
12642
12643 @item -lobjc
12644 @opindex lobjc
12645 You need this special case of the @option{-l} option in order to
12646 link an Objective-C or Objective-C++ program.
12647
12648 @item -nostartfiles
12649 @opindex nostartfiles
12650 Do not use the standard system startup files when linking.
12651 The standard system libraries are used normally, unless @option{-nostdlib},
12652 @option{-nolibc}, or @option{-nodefaultlibs} is used.
12653
12654 @item -nodefaultlibs
12655 @opindex nodefaultlibs
12656 Do not use the standard system libraries when linking.
12657 Only the libraries you specify are passed to the linker, and options
12658 specifying linkage of the system libraries, such as @option{-static-libgcc}
12659 or @option{-shared-libgcc}, are ignored.
12660 The standard startup files are used normally, unless @option{-nostartfiles}
12661 is used.
12662
12663 The compiler may generate calls to @code{memcmp},
12664 @code{memset}, @code{memcpy} and @code{memmove}.
12665 These entries are usually resolved by entries in
12666 libc. These entry points should be supplied through some other
12667 mechanism when this option is specified.
12668
12669 @item -nolibc
12670 @opindex nolibc
12671 Do not use the C library or system libraries tightly coupled with it when
12672 linking. Still link with the startup files, @file{libgcc} or toolchain
12673 provided language support libraries such as @file{libgnat}, @file{libgfortran}
12674 or @file{libstdc++} unless options preventing their inclusion are used as
12675 well. This typically removes @option{-lc} from the link command line, as well
12676 as system libraries that normally go with it and become meaningless when
12677 absence of a C library is assumed, for example @option{-lpthread} or
12678 @option{-lm} in some configurations. This is intended for bare-board
12679 targets when there is indeed no C library available.
12680
12681 @item -nostdlib
12682 @opindex nostdlib
12683 Do not use the standard system startup files or libraries when linking.
12684 No startup files and only the libraries you specify are passed to
12685 the linker, and options specifying linkage of the system libraries, such as
12686 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12687
12688 The compiler may generate calls to @code{memcmp}, @code{memset},
12689 @code{memcpy} and @code{memmove}.
12690 These entries are usually resolved by entries in
12691 libc. These entry points should be supplied through some other
12692 mechanism when this option is specified.
12693
12694 @cindex @option{-lgcc}, use with @option{-nostdlib}
12695 @cindex @option{-nostdlib} and unresolved references
12696 @cindex unresolved references and @option{-nostdlib}
12697 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12698 @cindex @option{-nodefaultlibs} and unresolved references
12699 @cindex unresolved references and @option{-nodefaultlibs}
12700 One of the standard libraries bypassed by @option{-nostdlib} and
12701 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12702 which GCC uses to overcome shortcomings of particular machines, or special
12703 needs for some languages.
12704 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12705 Collection (GCC) Internals},
12706 for more discussion of @file{libgcc.a}.)
12707 In most cases, you need @file{libgcc.a} even when you want to avoid
12708 other standard libraries. In other words, when you specify @option{-nostdlib}
12709 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12710 This ensures that you have no unresolved references to internal GCC
12711 library subroutines.
12712 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12713 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12714 GNU Compiler Collection (GCC) Internals}.)
12715
12716 @item -e @var{entry}
12717 @itemx --entry=@var{entry}
12718 @opindex e
12719 @opindex entry
12720
12721 Specify that the program entry point is @var{entry}. The argument is
12722 interpreted by the linker; the GNU linker accepts either a symbol name
12723 or an address.
12724
12725 @item -pie
12726 @opindex pie
12727 Produce a dynamically linked position independent executable on targets
12728 that support it. For predictable results, you must also specify the same
12729 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12730 or model suboptions) when you specify this linker option.
12731
12732 @item -no-pie
12733 @opindex no-pie
12734 Don't produce a dynamically linked position independent executable.
12735
12736 @item -static-pie
12737 @opindex static-pie
12738 Produce a static position independent executable on targets that support
12739 it. A static position independent executable is similar to a static
12740 executable, but can be loaded at any address without a dynamic linker.
12741 For predictable results, you must also specify the same set of options
12742 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12743 suboptions) when you specify this linker option.
12744
12745 @item -pthread
12746 @opindex pthread
12747 Link with the POSIX threads library. This option is supported on
12748 GNU/Linux targets, most other Unix derivatives, and also on
12749 x86 Cygwin and MinGW targets. On some targets this option also sets
12750 flags for the preprocessor, so it should be used consistently for both
12751 compilation and linking.
12752
12753 @item -r
12754 @opindex r
12755 Produce a relocatable object as output. This is also known as partial
12756 linking.
12757
12758 @item -rdynamic
12759 @opindex rdynamic
12760 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12761 that support it. This instructs the linker to add all symbols, not
12762 only used ones, to the dynamic symbol table. This option is needed
12763 for some uses of @code{dlopen} or to allow obtaining backtraces
12764 from within a program.
12765
12766 @item -s
12767 @opindex s
12768 Remove all symbol table and relocation information from the executable.
12769
12770 @item -static
12771 @opindex static
12772 On systems that support dynamic linking, this overrides @option{-pie}
12773 and prevents linking with the shared libraries. On other systems, this
12774 option has no effect.
12775
12776 @item -shared
12777 @opindex shared
12778 Produce a shared object which can then be linked with other objects to
12779 form an executable. Not all systems support this option. For predictable
12780 results, you must also specify the same set of options used for compilation
12781 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12782 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12783 needs to build supplementary stub code for constructors to work. On
12784 multi-libbed systems, @samp{gcc -shared} must select the correct support
12785 libraries to link against. Failing to supply the correct flags may lead
12786 to subtle defects. Supplying them in cases where they are not necessary
12787 is innocuous.}
12788
12789 @item -shared-libgcc
12790 @itemx -static-libgcc
12791 @opindex shared-libgcc
12792 @opindex static-libgcc
12793 On systems that provide @file{libgcc} as a shared library, these options
12794 force the use of either the shared or static version, respectively.
12795 If no shared version of @file{libgcc} was built when the compiler was
12796 configured, these options have no effect.
12797
12798 There are several situations in which an application should use the
12799 shared @file{libgcc} instead of the static version. The most common
12800 of these is when the application wishes to throw and catch exceptions
12801 across different shared libraries. In that case, each of the libraries
12802 as well as the application itself should use the shared @file{libgcc}.
12803
12804 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
12805 whenever you build a shared library or a main executable, because C++
12806 programs typically use exceptions, so this is the right thing to do.
12807
12808 If, instead, you use the GCC driver to create shared libraries, you may
12809 find that they are not always linked with the shared @file{libgcc}.
12810 If GCC finds, at its configuration time, that you have a non-GNU linker
12811 or a GNU linker that does not support option @option{--eh-frame-hdr},
12812 it links the shared version of @file{libgcc} into shared libraries
12813 by default. Otherwise, it takes advantage of the linker and optimizes
12814 away the linking with the shared version of @file{libgcc}, linking with
12815 the static version of libgcc by default. This allows exceptions to
12816 propagate through such shared libraries, without incurring relocation
12817 costs at library load time.
12818
12819 However, if a library or main executable is supposed to throw or catch
12820 exceptions, you must link it using the G++ driver, or using the option
12821 @option{-shared-libgcc}, such that it is linked with the shared
12822 @file{libgcc}.
12823
12824 @item -static-libasan
12825 @opindex static-libasan
12826 When the @option{-fsanitize=address} option is used to link a program,
12827 the GCC driver automatically links against @option{libasan}. If
12828 @file{libasan} is available as a shared library, and the @option{-static}
12829 option is not used, then this links against the shared version of
12830 @file{libasan}. The @option{-static-libasan} option directs the GCC
12831 driver to link @file{libasan} statically, without necessarily linking
12832 other libraries statically.
12833
12834 @item -static-libtsan
12835 @opindex static-libtsan
12836 When the @option{-fsanitize=thread} option is used to link a program,
12837 the GCC driver automatically links against @option{libtsan}. If
12838 @file{libtsan} is available as a shared library, and the @option{-static}
12839 option is not used, then this links against the shared version of
12840 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12841 driver to link @file{libtsan} statically, without necessarily linking
12842 other libraries statically.
12843
12844 @item -static-liblsan
12845 @opindex static-liblsan
12846 When the @option{-fsanitize=leak} option is used to link a program,
12847 the GCC driver automatically links against @option{liblsan}. If
12848 @file{liblsan} is available as a shared library, and the @option{-static}
12849 option is not used, then this links against the shared version of
12850 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12851 driver to link @file{liblsan} statically, without necessarily linking
12852 other libraries statically.
12853
12854 @item -static-libubsan
12855 @opindex static-libubsan
12856 When the @option{-fsanitize=undefined} option is used to link a program,
12857 the GCC driver automatically links against @option{libubsan}. If
12858 @file{libubsan} is available as a shared library, and the @option{-static}
12859 option is not used, then this links against the shared version of
12860 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12861 driver to link @file{libubsan} statically, without necessarily linking
12862 other libraries statically.
12863
12864 @item -static-libstdc++
12865 @opindex static-libstdc++
12866 When the @command{g++} program is used to link a C++ program, it
12867 normally automatically links against @option{libstdc++}. If
12868 @file{libstdc++} is available as a shared library, and the
12869 @option{-static} option is not used, then this links against the
12870 shared version of @file{libstdc++}. That is normally fine. However, it
12871 is sometimes useful to freeze the version of @file{libstdc++} used by
12872 the program without going all the way to a fully static link. The
12873 @option{-static-libstdc++} option directs the @command{g++} driver to
12874 link @file{libstdc++} statically, without necessarily linking other
12875 libraries statically.
12876
12877 @item -symbolic
12878 @opindex symbolic
12879 Bind references to global symbols when building a shared object. Warn
12880 about any unresolved references (unless overridden by the link editor
12881 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12882 this option.
12883
12884 @item -T @var{script}
12885 @opindex T
12886 @cindex linker script
12887 Use @var{script} as the linker script. This option is supported by most
12888 systems using the GNU linker. On some targets, such as bare-board
12889 targets without an operating system, the @option{-T} option may be required
12890 when linking to avoid references to undefined symbols.
12891
12892 @item -Xlinker @var{option}
12893 @opindex Xlinker
12894 Pass @var{option} as an option to the linker. You can use this to
12895 supply system-specific linker options that GCC does not recognize.
12896
12897 If you want to pass an option that takes a separate argument, you must use
12898 @option{-Xlinker} twice, once for the option and once for the argument.
12899 For example, to pass @option{-assert definitions}, you must write
12900 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12901 @option{-Xlinker "-assert definitions"}, because this passes the entire
12902 string as a single argument, which is not what the linker expects.
12903
12904 When using the GNU linker, it is usually more convenient to pass
12905 arguments to linker options using the @option{@var{option}=@var{value}}
12906 syntax than as separate arguments. For example, you can specify
12907 @option{-Xlinker -Map=output.map} rather than
12908 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12909 this syntax for command-line options.
12910
12911 @item -Wl,@var{option}
12912 @opindex Wl
12913 Pass @var{option} as an option to the linker. If @var{option} contains
12914 commas, it is split into multiple options at the commas. You can use this
12915 syntax to pass an argument to the option.
12916 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12917 linker. When using the GNU linker, you can also get the same effect with
12918 @option{-Wl,-Map=output.map}.
12919
12920 @item -u @var{symbol}
12921 @opindex u
12922 Pretend the symbol @var{symbol} is undefined, to force linking of
12923 library modules to define it. You can use @option{-u} multiple times with
12924 different symbols to force loading of additional library modules.
12925
12926 @item -z @var{keyword}
12927 @opindex z
12928 @option{-z} is passed directly on to the linker along with the keyword
12929 @var{keyword}. See the section in the documentation of your linker for
12930 permitted values and their meanings.
12931 @end table
12932
12933 @node Directory Options
12934 @section Options for Directory Search
12935 @cindex directory options
12936 @cindex options, directory search
12937 @cindex search path
12938
12939 These options specify directories to search for header files, for
12940 libraries and for parts of the compiler:
12941
12942 @table @gcctabopt
12943 @include cppdiropts.texi
12944
12945 @item -iplugindir=@var{dir}
12946 @opindex iplugindir=
12947 Set the directory to search for plugins that are passed
12948 by @option{-fplugin=@var{name}} instead of
12949 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12950 to be used by the user, but only passed by the driver.
12951
12952 @item -L@var{dir}
12953 @opindex L
12954 Add directory @var{dir} to the list of directories to be searched
12955 for @option{-l}.
12956
12957 @item -B@var{prefix}
12958 @opindex B
12959 This option specifies where to find the executables, libraries,
12960 include files, and data files of the compiler itself.
12961
12962 The compiler driver program runs one or more of the subprograms
12963 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12964 @var{prefix} as a prefix for each program it tries to run, both with and
12965 without @samp{@var{machine}/@var{version}/} for the corresponding target
12966 machine and compiler version.
12967
12968 For each subprogram to be run, the compiler driver first tries the
12969 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12970 is not specified, the driver tries two standard prefixes,
12971 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12972 those results in a file name that is found, the unmodified program
12973 name is searched for using the directories specified in your
12974 @env{PATH} environment variable.
12975
12976 The compiler checks to see if the path provided by @option{-B}
12977 refers to a directory, and if necessary it adds a directory
12978 separator character at the end of the path.
12979
12980 @option{-B} prefixes that effectively specify directory names also apply
12981 to libraries in the linker, because the compiler translates these
12982 options into @option{-L} options for the linker. They also apply to
12983 include files in the preprocessor, because the compiler translates these
12984 options into @option{-isystem} options for the preprocessor. In this case,
12985 the compiler appends @samp{include} to the prefix.
12986
12987 The runtime support file @file{libgcc.a} can also be searched for using
12988 the @option{-B} prefix, if needed. If it is not found there, the two
12989 standard prefixes above are tried, and that is all. The file is left
12990 out of the link if it is not found by those means.
12991
12992 Another way to specify a prefix much like the @option{-B} prefix is to use
12993 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12994 Variables}.
12995
12996 As a special kludge, if the path provided by @option{-B} is
12997 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12998 9, then it is replaced by @file{[dir/]include}. This is to help
12999 with boot-strapping the compiler.
13000
13001 @item -no-canonical-prefixes
13002 @opindex no-canonical-prefixes
13003 Do not expand any symbolic links, resolve references to @samp{/../}
13004 or @samp{/./}, or make the path absolute when generating a relative
13005 prefix.
13006
13007 @item --sysroot=@var{dir}
13008 @opindex sysroot
13009 Use @var{dir} as the logical root directory for headers and libraries.
13010 For example, if the compiler normally searches for headers in
13011 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13012 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13013
13014 If you use both this option and the @option{-isysroot} option, then
13015 the @option{--sysroot} option applies to libraries, but the
13016 @option{-isysroot} option applies to header files.
13017
13018 The GNU linker (beginning with version 2.16) has the necessary support
13019 for this option. If your linker does not support this option, the
13020 header file aspect of @option{--sysroot} still works, but the
13021 library aspect does not.
13022
13023 @item --no-sysroot-suffix
13024 @opindex no-sysroot-suffix
13025 For some targets, a suffix is added to the root directory specified
13026 with @option{--sysroot}, depending on the other options used, so that
13027 headers may for example be found in
13028 @file{@var{dir}/@var{suffix}/usr/include} instead of
13029 @file{@var{dir}/usr/include}. This option disables the addition of
13030 such a suffix.
13031
13032 @end table
13033
13034 @node Code Gen Options
13035 @section Options for Code Generation Conventions
13036 @cindex code generation conventions
13037 @cindex options, code generation
13038 @cindex run-time options
13039
13040 These machine-independent options control the interface conventions
13041 used in code generation.
13042
13043 Most of them have both positive and negative forms; the negative form
13044 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13045 one of the forms is listed---the one that is not the default. You
13046 can figure out the other form by either removing @samp{no-} or adding
13047 it.
13048
13049 @table @gcctabopt
13050 @item -fstack-reuse=@var{reuse-level}
13051 @opindex fstack_reuse
13052 This option controls stack space reuse for user declared local/auto variables
13053 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13054 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13055 local variables and temporaries, @samp{named_vars} enables the reuse only for
13056 user defined local variables with names, and @samp{none} disables stack reuse
13057 completely. The default value is @samp{all}. The option is needed when the
13058 program extends the lifetime of a scoped local variable or a compiler generated
13059 temporary beyond the end point defined by the language. When a lifetime of
13060 a variable ends, and if the variable lives in memory, the optimizing compiler
13061 has the freedom to reuse its stack space with other temporaries or scoped
13062 local variables whose live range does not overlap with it. Legacy code extending
13063 local lifetime is likely to break with the stack reuse optimization.
13064
13065 For example,
13066
13067 @smallexample
13068 int *p;
13069 @{
13070 int local1;
13071
13072 p = &local1;
13073 local1 = 10;
13074 ....
13075 @}
13076 @{
13077 int local2;
13078 local2 = 20;
13079 ...
13080 @}
13081
13082 if (*p == 10) // out of scope use of local1
13083 @{
13084
13085 @}
13086 @end smallexample
13087
13088 Another example:
13089 @smallexample
13090
13091 struct A
13092 @{
13093 A(int k) : i(k), j(k) @{ @}
13094 int i;
13095 int j;
13096 @};
13097
13098 A *ap;
13099
13100 void foo(const A& ar)
13101 @{
13102 ap = &ar;
13103 @}
13104
13105 void bar()
13106 @{
13107 foo(A(10)); // temp object's lifetime ends when foo returns
13108
13109 @{
13110 A a(20);
13111 ....
13112 @}
13113 ap->i+= 10; // ap references out of scope temp whose space
13114 // is reused with a. What is the value of ap->i?
13115 @}
13116
13117 @end smallexample
13118
13119 The lifetime of a compiler generated temporary is well defined by the C++
13120 standard. When a lifetime of a temporary ends, and if the temporary lives
13121 in memory, the optimizing compiler has the freedom to reuse its stack
13122 space with other temporaries or scoped local variables whose live range
13123 does not overlap with it. However some of the legacy code relies on
13124 the behavior of older compilers in which temporaries' stack space is
13125 not reused, the aggressive stack reuse can lead to runtime errors. This
13126 option is used to control the temporary stack reuse optimization.
13127
13128 @item -ftrapv
13129 @opindex ftrapv
13130 This option generates traps for signed overflow on addition, subtraction,
13131 multiplication operations.
13132 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13133 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13134 @option{-fwrapv} being effective. Note that only active options override, so
13135 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13136 results in @option{-ftrapv} being effective.
13137
13138 @item -fwrapv
13139 @opindex fwrapv
13140 This option instructs the compiler to assume that signed arithmetic
13141 overflow of addition, subtraction and multiplication wraps around
13142 using twos-complement representation. This flag enables some optimizations
13143 and disables others.
13144 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13145 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13146 @option{-fwrapv} being effective. Note that only active options override, so
13147 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13148 results in @option{-ftrapv} being effective.
13149
13150 @item -fwrapv-pointer
13151 @opindex fwrapv-pointer
13152 This option instructs the compiler to assume that pointer arithmetic
13153 overflow on addition and subtraction wraps around using twos-complement
13154 representation. This flag disables some optimizations which assume
13155 pointer overflow is invalid.
13156
13157 @item -fstrict-overflow
13158 @opindex fstrict-overflow
13159 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13160 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13161
13162 @item -fexceptions
13163 @opindex fexceptions
13164 Enable exception handling. Generates extra code needed to propagate
13165 exceptions. For some targets, this implies GCC generates frame
13166 unwind information for all functions, which can produce significant data
13167 size overhead, although it does not affect execution. If you do not
13168 specify this option, GCC enables it by default for languages like
13169 C++ that normally require exception handling, and disables it for
13170 languages like C that do not normally require it. However, you may need
13171 to enable this option when compiling C code that needs to interoperate
13172 properly with exception handlers written in C++. You may also wish to
13173 disable this option if you are compiling older C++ programs that don't
13174 use exception handling.
13175
13176 @item -fnon-call-exceptions
13177 @opindex fnon-call-exceptions
13178 Generate code that allows trapping instructions to throw exceptions.
13179 Note that this requires platform-specific runtime support that does
13180 not exist everywhere. Moreover, it only allows @emph{trapping}
13181 instructions to throw exceptions, i.e.@: memory references or floating-point
13182 instructions. It does not allow exceptions to be thrown from
13183 arbitrary signal handlers such as @code{SIGALRM}.
13184
13185 @item -fdelete-dead-exceptions
13186 @opindex fdelete-dead-exceptions
13187 Consider that instructions that may throw exceptions but don't otherwise
13188 contribute to the execution of the program can be optimized away.
13189 This option is enabled by default for the Ada front end, as permitted by
13190 the Ada language specification.
13191 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13192
13193 @item -funwind-tables
13194 @opindex funwind-tables
13195 Similar to @option{-fexceptions}, except that it just generates any needed
13196 static data, but does not affect the generated code in any other way.
13197 You normally do not need to enable this option; instead, a language processor
13198 that needs this handling enables it on your behalf.
13199
13200 @item -fasynchronous-unwind-tables
13201 @opindex fasynchronous-unwind-tables
13202 Generate unwind table in DWARF format, if supported by target machine. The
13203 table is exact at each instruction boundary, so it can be used for stack
13204 unwinding from asynchronous events (such as debugger or garbage collector).
13205
13206 @item -fno-gnu-unique
13207 @opindex fno-gnu-unique
13208 On systems with recent GNU assembler and C library, the C++ compiler
13209 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13210 of template static data members and static local variables in inline
13211 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13212 is necessary to avoid problems with a library used by two different
13213 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13214 therefore disagreeing with the other one about the binding of the
13215 symbol. But this causes @code{dlclose} to be ignored for affected
13216 DSOs; if your program relies on reinitialization of a DSO via
13217 @code{dlclose} and @code{dlopen}, you can use
13218 @option{-fno-gnu-unique}.
13219
13220 @item -fpcc-struct-return
13221 @opindex fpcc-struct-return
13222 Return ``short'' @code{struct} and @code{union} values in memory like
13223 longer ones, rather than in registers. This convention is less
13224 efficient, but it has the advantage of allowing intercallability between
13225 GCC-compiled files and files compiled with other compilers, particularly
13226 the Portable C Compiler (pcc).
13227
13228 The precise convention for returning structures in memory depends
13229 on the target configuration macros.
13230
13231 Short structures and unions are those whose size and alignment match
13232 that of some integer type.
13233
13234 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13235 switch is not binary compatible with code compiled with the
13236 @option{-freg-struct-return} switch.
13237 Use it to conform to a non-default application binary interface.
13238
13239 @item -freg-struct-return
13240 @opindex freg-struct-return
13241 Return @code{struct} and @code{union} values in registers when possible.
13242 This is more efficient for small structures than
13243 @option{-fpcc-struct-return}.
13244
13245 If you specify neither @option{-fpcc-struct-return} nor
13246 @option{-freg-struct-return}, GCC defaults to whichever convention is
13247 standard for the target. If there is no standard convention, GCC
13248 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13249 the principal compiler. In those cases, we can choose the standard, and
13250 we chose the more efficient register return alternative.
13251
13252 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13253 switch is not binary compatible with code compiled with the
13254 @option{-fpcc-struct-return} switch.
13255 Use it to conform to a non-default application binary interface.
13256
13257 @item -fshort-enums
13258 @opindex fshort-enums
13259 Allocate to an @code{enum} type only as many bytes as it needs for the
13260 declared range of possible values. Specifically, the @code{enum} type
13261 is equivalent to the smallest integer type that has enough room.
13262
13263 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13264 code that is not binary compatible with code generated without that switch.
13265 Use it to conform to a non-default application binary interface.
13266
13267 @item -fshort-wchar
13268 @opindex fshort-wchar
13269 Override the underlying type for @code{wchar_t} to be @code{short
13270 unsigned int} instead of the default for the target. This option is
13271 useful for building programs to run under WINE@.
13272
13273 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13274 code that is not binary compatible with code generated without that switch.
13275 Use it to conform to a non-default application binary interface.
13276
13277 @item -fno-common
13278 @opindex fno-common
13279 @cindex tentative definitions
13280 In C code, this option controls the placement of global variables
13281 defined without an initializer, known as @dfn{tentative definitions}
13282 in the C standard. Tentative definitions are distinct from declarations
13283 of a variable with the @code{extern} keyword, which do not allocate storage.
13284
13285 Unix C compilers have traditionally allocated storage for
13286 uninitialized global variables in a common block. This allows the
13287 linker to resolve all tentative definitions of the same variable
13288 in different compilation units to the same object, or to a non-tentative
13289 definition.
13290 This is the behavior specified by @option{-fcommon}, and is the default for
13291 GCC on most targets.
13292 On the other hand, this behavior is not required by ISO
13293 C, and on some targets may carry a speed or code size penalty on
13294 variable references.
13295
13296 The @option{-fno-common} option specifies that the compiler should instead
13297 place uninitialized global variables in the BSS section of the object file.
13298 This inhibits the merging of tentative definitions by the linker so
13299 you get a multiple-definition error if the same
13300 variable is defined in more than one compilation unit.
13301 Compiling with @option{-fno-common} is useful on targets for which
13302 it provides better performance, or if you wish to verify that the
13303 program will work on other systems that always treat uninitialized
13304 variable definitions this way.
13305
13306 @item -fno-ident
13307 @opindex fno-ident
13308 Ignore the @code{#ident} directive.
13309
13310 @item -finhibit-size-directive
13311 @opindex finhibit-size-directive
13312 Don't output a @code{.size} assembler directive, or anything else that
13313 would cause trouble if the function is split in the middle, and the
13314 two halves are placed at locations far apart in memory. This option is
13315 used when compiling @file{crtstuff.c}; you should not need to use it
13316 for anything else.
13317
13318 @item -fverbose-asm
13319 @opindex fverbose-asm
13320 Put extra commentary information in the generated assembly code to
13321 make it more readable. This option is generally only of use to those
13322 who actually need to read the generated assembly code (perhaps while
13323 debugging the compiler itself).
13324
13325 @option{-fno-verbose-asm}, the default, causes the
13326 extra information to be omitted and is useful when comparing two assembler
13327 files.
13328
13329 The added comments include:
13330
13331 @itemize @bullet
13332
13333 @item
13334 information on the compiler version and command-line options,
13335
13336 @item
13337 the source code lines associated with the assembly instructions,
13338 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13339
13340 @item
13341 hints on which high-level expressions correspond to
13342 the various assembly instruction operands.
13343
13344 @end itemize
13345
13346 For example, given this C source file:
13347
13348 @smallexample
13349 int test (int n)
13350 @{
13351 int i;
13352 int total = 0;
13353
13354 for (i = 0; i < n; i++)
13355 total += i * i;
13356
13357 return total;
13358 @}
13359 @end smallexample
13360
13361 compiling to (x86_64) assembly via @option{-S} and emitting the result
13362 direct to stdout via @option{-o} @option{-}
13363
13364 @smallexample
13365 gcc -S test.c -fverbose-asm -Os -o -
13366 @end smallexample
13367
13368 gives output similar to this:
13369
13370 @smallexample
13371 .file "test.c"
13372 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13373 [...snip...]
13374 # options passed:
13375 [...snip...]
13376
13377 .text
13378 .globl test
13379 .type test, @@function
13380 test:
13381 .LFB0:
13382 .cfi_startproc
13383 # test.c:4: int total = 0;
13384 xorl %eax, %eax # <retval>
13385 # test.c:6: for (i = 0; i < n; i++)
13386 xorl %edx, %edx # i
13387 .L2:
13388 # test.c:6: for (i = 0; i < n; i++)
13389 cmpl %edi, %edx # n, i
13390 jge .L5 #,
13391 # test.c:7: total += i * i;
13392 movl %edx, %ecx # i, tmp92
13393 imull %edx, %ecx # i, tmp92
13394 # test.c:6: for (i = 0; i < n; i++)
13395 incl %edx # i
13396 # test.c:7: total += i * i;
13397 addl %ecx, %eax # tmp92, <retval>
13398 jmp .L2 #
13399 .L5:
13400 # test.c:10: @}
13401 ret
13402 .cfi_endproc
13403 .LFE0:
13404 .size test, .-test
13405 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13406 .section .note.GNU-stack,"",@@progbits
13407 @end smallexample
13408
13409 The comments are intended for humans rather than machines and hence the
13410 precise format of the comments is subject to change.
13411
13412 @item -frecord-gcc-switches
13413 @opindex frecord-gcc-switches
13414 This switch causes the command line used to invoke the
13415 compiler to be recorded into the object file that is being created.
13416 This switch is only implemented on some targets and the exact format
13417 of the recording is target and binary file format dependent, but it
13418 usually takes the form of a section containing ASCII text. This
13419 switch is related to the @option{-fverbose-asm} switch, but that
13420 switch only records information in the assembler output file as
13421 comments, so it never reaches the object file.
13422 See also @option{-grecord-gcc-switches} for another
13423 way of storing compiler options into the object file.
13424
13425 @item -fpic
13426 @opindex fpic
13427 @cindex global offset table
13428 @cindex PIC
13429 Generate position-independent code (PIC) suitable for use in a shared
13430 library, if supported for the target machine. Such code accesses all
13431 constant addresses through a global offset table (GOT)@. The dynamic
13432 loader resolves the GOT entries when the program starts (the dynamic
13433 loader is not part of GCC; it is part of the operating system). If
13434 the GOT size for the linked executable exceeds a machine-specific
13435 maximum size, you get an error message from the linker indicating that
13436 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13437 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13438 on the m68k and RS/6000. The x86 has no such limit.)
13439
13440 Position-independent code requires special support, and therefore works
13441 only on certain machines. For the x86, GCC supports PIC for System V
13442 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13443 position-independent.
13444
13445 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13446 are defined to 1.
13447
13448 @item -fPIC
13449 @opindex fPIC
13450 If supported for the target machine, emit position-independent code,
13451 suitable for dynamic linking and avoiding any limit on the size of the
13452 global offset table. This option makes a difference on AArch64, m68k,
13453 PowerPC and SPARC@.
13454
13455 Position-independent code requires special support, and therefore works
13456 only on certain machines.
13457
13458 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13459 are defined to 2.
13460
13461 @item -fpie
13462 @itemx -fPIE
13463 @opindex fpie
13464 @opindex fPIE
13465 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13466 generated position-independent code can be only linked into executables.
13467 Usually these options are used to compile code that will be linked using
13468 the @option{-pie} GCC option.
13469
13470 @option{-fpie} and @option{-fPIE} both define the macros
13471 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13472 for @option{-fpie} and 2 for @option{-fPIE}.
13473
13474 @item -fno-plt
13475 @opindex fno-plt
13476 Do not use the PLT for external function calls in position-independent code.
13477 Instead, load the callee address at call sites from the GOT and branch to it.
13478 This leads to more efficient code by eliminating PLT stubs and exposing
13479 GOT loads to optimizations. On architectures such as 32-bit x86 where
13480 PLT stubs expect the GOT pointer in a specific register, this gives more
13481 register allocation freedom to the compiler.
13482 Lazy binding requires use of the PLT;
13483 with @option{-fno-plt} all external symbols are resolved at load time.
13484
13485 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13486 through the PLT for specific external functions.
13487
13488 In position-dependent code, a few targets also convert calls to
13489 functions that are marked to not use the PLT to use the GOT instead.
13490
13491 @item -fno-jump-tables
13492 @opindex fno-jump-tables
13493 Do not use jump tables for switch statements even where it would be
13494 more efficient than other code generation strategies. This option is
13495 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13496 building code that forms part of a dynamic linker and cannot
13497 reference the address of a jump table. On some targets, jump tables
13498 do not require a GOT and this option is not needed.
13499
13500 @item -ffixed-@var{reg}
13501 @opindex ffixed
13502 Treat the register named @var{reg} as a fixed register; generated code
13503 should never refer to it (except perhaps as a stack pointer, frame
13504 pointer or in some other fixed role).
13505
13506 @var{reg} must be the name of a register. The register names accepted
13507 are machine-specific and are defined in the @code{REGISTER_NAMES}
13508 macro in the machine description macro file.
13509
13510 This flag does not have a negative form, because it specifies a
13511 three-way choice.
13512
13513 @item -fcall-used-@var{reg}
13514 @opindex fcall-used
13515 Treat the register named @var{reg} as an allocable register that is
13516 clobbered by function calls. It may be allocated for temporaries or
13517 variables that do not live across a call. Functions compiled this way
13518 do not save and restore the register @var{reg}.
13519
13520 It is an error to use this flag with the frame pointer or stack pointer.
13521 Use of this flag for other registers that have fixed pervasive roles in
13522 the machine's execution model produces disastrous results.
13523
13524 This flag does not have a negative form, because it specifies a
13525 three-way choice.
13526
13527 @item -fcall-saved-@var{reg}
13528 @opindex fcall-saved
13529 Treat the register named @var{reg} as an allocable register saved by
13530 functions. It may be allocated even for temporaries or variables that
13531 live across a call. Functions compiled this way save and restore
13532 the register @var{reg} if they use it.
13533
13534 It is an error to use this flag with the frame pointer or stack pointer.
13535 Use of this flag for other registers that have fixed pervasive roles in
13536 the machine's execution model produces disastrous results.
13537
13538 A different sort of disaster results from the use of this flag for
13539 a register in which function values may be returned.
13540
13541 This flag does not have a negative form, because it specifies a
13542 three-way choice.
13543
13544 @item -fpack-struct[=@var{n}]
13545 @opindex fpack-struct
13546 Without a value specified, pack all structure members together without
13547 holes. When a value is specified (which must be a small power of two), pack
13548 structure members according to this value, representing the maximum
13549 alignment (that is, objects with default alignment requirements larger than
13550 this are output potentially unaligned at the next fitting location.
13551
13552 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13553 code that is not binary compatible with code generated without that switch.
13554 Additionally, it makes the code suboptimal.
13555 Use it to conform to a non-default application binary interface.
13556
13557 @item -fleading-underscore
13558 @opindex fleading-underscore
13559 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13560 change the way C symbols are represented in the object file. One use
13561 is to help link with legacy assembly code.
13562
13563 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13564 generate code that is not binary compatible with code generated without that
13565 switch. Use it to conform to a non-default application binary interface.
13566 Not all targets provide complete support for this switch.
13567
13568 @item -ftls-model=@var{model}
13569 @opindex ftls-model
13570 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13571 The @var{model} argument should be one of @samp{global-dynamic},
13572 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13573 Note that the choice is subject to optimization: the compiler may use
13574 a more efficient model for symbols not visible outside of the translation
13575 unit, or if @option{-fpic} is not given on the command line.
13576
13577 The default without @option{-fpic} is @samp{initial-exec}; with
13578 @option{-fpic} the default is @samp{global-dynamic}.
13579
13580 @item -ftrampolines
13581 @opindex ftrampolines
13582 For targets that normally need trampolines for nested functions, always
13583 generate them instead of using descriptors. Otherwise, for targets that
13584 do not need them, like for example HP-PA or IA-64, do nothing.
13585
13586 A trampoline is a small piece of code that is created at run time on the
13587 stack when the address of a nested function is taken, and is used to call
13588 the nested function indirectly. Therefore, it requires the stack to be
13589 made executable in order for the program to work properly.
13590
13591 @option{-fno-trampolines} is enabled by default on a language by language
13592 basis to let the compiler avoid generating them, if it computes that this
13593 is safe, and replace them with descriptors. Descriptors are made up of data
13594 only, but the generated code must be prepared to deal with them. As of this
13595 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13596
13597 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13598 @option{-fno-trampolines} are not binary compatible if nested functions are
13599 present. This option must therefore be used on a program-wide basis and be
13600 manipulated with extreme care.
13601
13602 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13603 @opindex fvisibility
13604 Set the default ELF image symbol visibility to the specified option---all
13605 symbols are marked with this unless overridden within the code.
13606 Using this feature can very substantially improve linking and
13607 load times of shared object libraries, produce more optimized
13608 code, provide near-perfect API export and prevent symbol clashes.
13609 It is @strong{strongly} recommended that you use this in any shared objects
13610 you distribute.
13611
13612 Despite the nomenclature, @samp{default} always means public; i.e.,
13613 available to be linked against from outside the shared object.
13614 @samp{protected} and @samp{internal} are pretty useless in real-world
13615 usage so the only other commonly used option is @samp{hidden}.
13616 The default if @option{-fvisibility} isn't specified is
13617 @samp{default}, i.e., make every symbol public.
13618
13619 A good explanation of the benefits offered by ensuring ELF
13620 symbols have the correct visibility is given by ``How To Write
13621 Shared Libraries'' by Ulrich Drepper (which can be found at
13622 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13623 solution made possible by this option to marking things hidden when
13624 the default is public is to make the default hidden and mark things
13625 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13626 and @code{__attribute__ ((visibility("default")))} instead of
13627 @code{__declspec(dllexport)} you get almost identical semantics with
13628 identical syntax. This is a great boon to those working with
13629 cross-platform projects.
13630
13631 For those adding visibility support to existing code, you may find
13632 @code{#pragma GCC visibility} of use. This works by you enclosing
13633 the declarations you wish to set visibility for with (for example)
13634 @code{#pragma GCC visibility push(hidden)} and
13635 @code{#pragma GCC visibility pop}.
13636 Bear in mind that symbol visibility should be viewed @strong{as
13637 part of the API interface contract} and thus all new code should
13638 always specify visibility when it is not the default; i.e., declarations
13639 only for use within the local DSO should @strong{always} be marked explicitly
13640 as hidden as so to avoid PLT indirection overheads---making this
13641 abundantly clear also aids readability and self-documentation of the code.
13642 Note that due to ISO C++ specification requirements, @code{operator new} and
13643 @code{operator delete} must always be of default visibility.
13644
13645 Be aware that headers from outside your project, in particular system
13646 headers and headers from any other library you use, may not be
13647 expecting to be compiled with visibility other than the default. You
13648 may need to explicitly say @code{#pragma GCC visibility push(default)}
13649 before including any such headers.
13650
13651 @code{extern} declarations are not affected by @option{-fvisibility}, so
13652 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13653 no modifications. However, this means that calls to @code{extern}
13654 functions with no explicit visibility use the PLT, so it is more
13655 effective to use @code{__attribute ((visibility))} and/or
13656 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13657 declarations should be treated as hidden.
13658
13659 Note that @option{-fvisibility} does affect C++ vague linkage
13660 entities. This means that, for instance, an exception class that is
13661 be thrown between DSOs must be explicitly marked with default
13662 visibility so that the @samp{type_info} nodes are unified between
13663 the DSOs.
13664
13665 An overview of these techniques, their benefits and how to use them
13666 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13667
13668 @item -fstrict-volatile-bitfields
13669 @opindex fstrict-volatile-bitfields
13670 This option should be used if accesses to volatile bit-fields (or other
13671 structure fields, although the compiler usually honors those types
13672 anyway) should use a single access of the width of the
13673 field's type, aligned to a natural alignment if possible. For
13674 example, targets with memory-mapped peripheral registers might require
13675 all such accesses to be 16 bits wide; with this flag you can
13676 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13677 is 16 bits on these targets) to force GCC to use 16-bit accesses
13678 instead of, perhaps, a more efficient 32-bit access.
13679
13680 If this option is disabled, the compiler uses the most efficient
13681 instruction. In the previous example, that might be a 32-bit load
13682 instruction, even though that accesses bytes that do not contain
13683 any portion of the bit-field, or memory-mapped registers unrelated to
13684 the one being updated.
13685
13686 In some cases, such as when the @code{packed} attribute is applied to a
13687 structure field, it may not be possible to access the field with a single
13688 read or write that is correctly aligned for the target machine. In this
13689 case GCC falls back to generating multiple accesses rather than code that
13690 will fault or truncate the result at run time.
13691
13692 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13693 not allowed to touch non bit-field members. It is therefore recommended
13694 to define all bits of the field's type as bit-field members.
13695
13696 The default value of this option is determined by the application binary
13697 interface for the target processor.
13698
13699 @item -fsync-libcalls
13700 @opindex fsync-libcalls
13701 This option controls whether any out-of-line instance of the @code{__sync}
13702 family of functions may be used to implement the C++11 @code{__atomic}
13703 family of functions.
13704
13705 The default value of this option is enabled, thus the only useful form
13706 of the option is @option{-fno-sync-libcalls}. This option is used in
13707 the implementation of the @file{libatomic} runtime library.
13708
13709 @end table
13710
13711 @node Developer Options
13712 @section GCC Developer Options
13713 @cindex developer options
13714 @cindex debugging GCC
13715 @cindex debug dump options
13716 @cindex dump options
13717 @cindex compilation statistics
13718
13719 This section describes command-line options that are primarily of
13720 interest to GCC developers, including options to support compiler
13721 testing and investigation of compiler bugs and compile-time
13722 performance problems. This includes options that produce debug dumps
13723 at various points in the compilation; that print statistics such as
13724 memory use and execution time; and that print information about GCC's
13725 configuration, such as where it searches for libraries. You should
13726 rarely need to use any of these options for ordinary compilation and
13727 linking tasks.
13728
13729 Many developer options that cause GCC to dump output to a file take an
13730 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
13731 or @samp{-} to dump to standard output, and @samp{stderr} for standard
13732 error.
13733
13734 If @samp{=@var{filename}} is omitted, a default dump file name is
13735 constructed by concatenating the base dump file name, a pass number,
13736 phase letter, and pass name. The base dump file name is the name of
13737 output file produced by the compiler if explicitly specified and not
13738 an executable; otherwise it is the source file name.
13739 The pass number is determined by the order passes are registered with
13740 the compiler's pass manager.
13741 This is generally the same as the order of execution, but passes
13742 registered by plugins, target-specific passes, or passes that are
13743 otherwise registered late are numbered higher than the pass named
13744 @samp{final}, even if they are executed earlier. The phase letter is
13745 one of @samp{i} (inter-procedural analysis), @samp{l}
13746 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
13747 The files are created in the directory of the output file.
13748
13749 @table @gcctabopt
13750
13751 @item -d@var{letters}
13752 @itemx -fdump-rtl-@var{pass}
13753 @itemx -fdump-rtl-@var{pass}=@var{filename}
13754 @opindex d
13755 @opindex fdump-rtl-@var{pass}
13756 Says to make debugging dumps during compilation at times specified by
13757 @var{letters}. This is used for debugging the RTL-based passes of the
13758 compiler.
13759
13760 Some @option{-d@var{letters}} switches have different meaning when
13761 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13762 for information about preprocessor-specific dump options.
13763
13764 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13765 @option{-d} option @var{letters}. Here are the possible
13766 letters for use in @var{pass} and @var{letters}, and their meanings:
13767
13768 @table @gcctabopt
13769
13770 @item -fdump-rtl-alignments
13771 @opindex fdump-rtl-alignments
13772 Dump after branch alignments have been computed.
13773
13774 @item -fdump-rtl-asmcons
13775 @opindex fdump-rtl-asmcons
13776 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13777
13778 @item -fdump-rtl-auto_inc_dec
13779 @opindex fdump-rtl-auto_inc_dec
13780 Dump after auto-inc-dec discovery. This pass is only run on
13781 architectures that have auto inc or auto dec instructions.
13782
13783 @item -fdump-rtl-barriers
13784 @opindex fdump-rtl-barriers
13785 Dump after cleaning up the barrier instructions.
13786
13787 @item -fdump-rtl-bbpart
13788 @opindex fdump-rtl-bbpart
13789 Dump after partitioning hot and cold basic blocks.
13790
13791 @item -fdump-rtl-bbro
13792 @opindex fdump-rtl-bbro
13793 Dump after block reordering.
13794
13795 @item -fdump-rtl-btl1
13796 @itemx -fdump-rtl-btl2
13797 @opindex fdump-rtl-btl2
13798 @opindex fdump-rtl-btl2
13799 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13800 after the two branch
13801 target load optimization passes.
13802
13803 @item -fdump-rtl-bypass
13804 @opindex fdump-rtl-bypass
13805 Dump after jump bypassing and control flow optimizations.
13806
13807 @item -fdump-rtl-combine
13808 @opindex fdump-rtl-combine
13809 Dump after the RTL instruction combination pass.
13810
13811 @item -fdump-rtl-compgotos
13812 @opindex fdump-rtl-compgotos
13813 Dump after duplicating the computed gotos.
13814
13815 @item -fdump-rtl-ce1
13816 @itemx -fdump-rtl-ce2
13817 @itemx -fdump-rtl-ce3
13818 @opindex fdump-rtl-ce1
13819 @opindex fdump-rtl-ce2
13820 @opindex fdump-rtl-ce3
13821 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13822 @option{-fdump-rtl-ce3} enable dumping after the three
13823 if conversion passes.
13824
13825 @item -fdump-rtl-cprop_hardreg
13826 @opindex fdump-rtl-cprop_hardreg
13827 Dump after hard register copy propagation.
13828
13829 @item -fdump-rtl-csa
13830 @opindex fdump-rtl-csa
13831 Dump after combining stack adjustments.
13832
13833 @item -fdump-rtl-cse1
13834 @itemx -fdump-rtl-cse2
13835 @opindex fdump-rtl-cse1
13836 @opindex fdump-rtl-cse2
13837 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13838 the two common subexpression elimination passes.
13839
13840 @item -fdump-rtl-dce
13841 @opindex fdump-rtl-dce
13842 Dump after the standalone dead code elimination passes.
13843
13844 @item -fdump-rtl-dbr
13845 @opindex fdump-rtl-dbr
13846 Dump after delayed branch scheduling.
13847
13848 @item -fdump-rtl-dce1
13849 @itemx -fdump-rtl-dce2
13850 @opindex fdump-rtl-dce1
13851 @opindex fdump-rtl-dce2
13852 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13853 the two dead store elimination passes.
13854
13855 @item -fdump-rtl-eh
13856 @opindex fdump-rtl-eh
13857 Dump after finalization of EH handling code.
13858
13859 @item -fdump-rtl-eh_ranges
13860 @opindex fdump-rtl-eh_ranges
13861 Dump after conversion of EH handling range regions.
13862
13863 @item -fdump-rtl-expand
13864 @opindex fdump-rtl-expand
13865 Dump after RTL generation.
13866
13867 @item -fdump-rtl-fwprop1
13868 @itemx -fdump-rtl-fwprop2
13869 @opindex fdump-rtl-fwprop1
13870 @opindex fdump-rtl-fwprop2
13871 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13872 dumping after the two forward propagation passes.
13873
13874 @item -fdump-rtl-gcse1
13875 @itemx -fdump-rtl-gcse2
13876 @opindex fdump-rtl-gcse1
13877 @opindex fdump-rtl-gcse2
13878 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13879 after global common subexpression elimination.
13880
13881 @item -fdump-rtl-init-regs
13882 @opindex fdump-rtl-init-regs
13883 Dump after the initialization of the registers.
13884
13885 @item -fdump-rtl-initvals
13886 @opindex fdump-rtl-initvals
13887 Dump after the computation of the initial value sets.
13888
13889 @item -fdump-rtl-into_cfglayout
13890 @opindex fdump-rtl-into_cfglayout
13891 Dump after converting to cfglayout mode.
13892
13893 @item -fdump-rtl-ira
13894 @opindex fdump-rtl-ira
13895 Dump after iterated register allocation.
13896
13897 @item -fdump-rtl-jump
13898 @opindex fdump-rtl-jump
13899 Dump after the second jump optimization.
13900
13901 @item -fdump-rtl-loop2
13902 @opindex fdump-rtl-loop2
13903 @option{-fdump-rtl-loop2} enables dumping after the rtl
13904 loop optimization passes.
13905
13906 @item -fdump-rtl-mach
13907 @opindex fdump-rtl-mach
13908 Dump after performing the machine dependent reorganization pass, if that
13909 pass exists.
13910
13911 @item -fdump-rtl-mode_sw
13912 @opindex fdump-rtl-mode_sw
13913 Dump after removing redundant mode switches.
13914
13915 @item -fdump-rtl-rnreg
13916 @opindex fdump-rtl-rnreg
13917 Dump after register renumbering.
13918
13919 @item -fdump-rtl-outof_cfglayout
13920 @opindex fdump-rtl-outof_cfglayout
13921 Dump after converting from cfglayout mode.
13922
13923 @item -fdump-rtl-peephole2
13924 @opindex fdump-rtl-peephole2
13925 Dump after the peephole pass.
13926
13927 @item -fdump-rtl-postreload
13928 @opindex fdump-rtl-postreload
13929 Dump after post-reload optimizations.
13930
13931 @item -fdump-rtl-pro_and_epilogue
13932 @opindex fdump-rtl-pro_and_epilogue
13933 Dump after generating the function prologues and epilogues.
13934
13935 @item -fdump-rtl-sched1
13936 @itemx -fdump-rtl-sched2
13937 @opindex fdump-rtl-sched1
13938 @opindex fdump-rtl-sched2
13939 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13940 after the basic block scheduling passes.
13941
13942 @item -fdump-rtl-ree
13943 @opindex fdump-rtl-ree
13944 Dump after sign/zero extension elimination.
13945
13946 @item -fdump-rtl-seqabstr
13947 @opindex fdump-rtl-seqabstr
13948 Dump after common sequence discovery.
13949
13950 @item -fdump-rtl-shorten
13951 @opindex fdump-rtl-shorten
13952 Dump after shortening branches.
13953
13954 @item -fdump-rtl-sibling
13955 @opindex fdump-rtl-sibling
13956 Dump after sibling call optimizations.
13957
13958 @item -fdump-rtl-split1
13959 @itemx -fdump-rtl-split2
13960 @itemx -fdump-rtl-split3
13961 @itemx -fdump-rtl-split4
13962 @itemx -fdump-rtl-split5
13963 @opindex fdump-rtl-split1
13964 @opindex fdump-rtl-split2
13965 @opindex fdump-rtl-split3
13966 @opindex fdump-rtl-split4
13967 @opindex fdump-rtl-split5
13968 These options enable dumping after five rounds of
13969 instruction splitting.
13970
13971 @item -fdump-rtl-sms
13972 @opindex fdump-rtl-sms
13973 Dump after modulo scheduling. This pass is only run on some
13974 architectures.
13975
13976 @item -fdump-rtl-stack
13977 @opindex fdump-rtl-stack
13978 Dump after conversion from GCC's ``flat register file'' registers to the
13979 x87's stack-like registers. This pass is only run on x86 variants.
13980
13981 @item -fdump-rtl-subreg1
13982 @itemx -fdump-rtl-subreg2
13983 @opindex fdump-rtl-subreg1
13984 @opindex fdump-rtl-subreg2
13985 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13986 the two subreg expansion passes.
13987
13988 @item -fdump-rtl-unshare
13989 @opindex fdump-rtl-unshare
13990 Dump after all rtl has been unshared.
13991
13992 @item -fdump-rtl-vartrack
13993 @opindex fdump-rtl-vartrack
13994 Dump after variable tracking.
13995
13996 @item -fdump-rtl-vregs
13997 @opindex fdump-rtl-vregs
13998 Dump after converting virtual registers to hard registers.
13999
14000 @item -fdump-rtl-web
14001 @opindex fdump-rtl-web
14002 Dump after live range splitting.
14003
14004 @item -fdump-rtl-regclass
14005 @itemx -fdump-rtl-subregs_of_mode_init
14006 @itemx -fdump-rtl-subregs_of_mode_finish
14007 @itemx -fdump-rtl-dfinit
14008 @itemx -fdump-rtl-dfinish
14009 @opindex fdump-rtl-regclass
14010 @opindex fdump-rtl-subregs_of_mode_init
14011 @opindex fdump-rtl-subregs_of_mode_finish
14012 @opindex fdump-rtl-dfinit
14013 @opindex fdump-rtl-dfinish
14014 These dumps are defined but always produce empty files.
14015
14016 @item -da
14017 @itemx -fdump-rtl-all
14018 @opindex da
14019 @opindex fdump-rtl-all
14020 Produce all the dumps listed above.
14021
14022 @item -dA
14023 @opindex dA
14024 Annotate the assembler output with miscellaneous debugging information.
14025
14026 @item -dD
14027 @opindex dD
14028 Dump all macro definitions, at the end of preprocessing, in addition to
14029 normal output.
14030
14031 @item -dH
14032 @opindex dH
14033 Produce a core dump whenever an error occurs.
14034
14035 @item -dp
14036 @opindex dp
14037 Annotate the assembler output with a comment indicating which
14038 pattern and alternative is used. The length and cost of each instruction are
14039 also printed.
14040
14041 @item -dP
14042 @opindex dP
14043 Dump the RTL in the assembler output as a comment before each instruction.
14044 Also turns on @option{-dp} annotation.
14045
14046 @item -dx
14047 @opindex dx
14048 Just generate RTL for a function instead of compiling it. Usually used
14049 with @option{-fdump-rtl-expand}.
14050 @end table
14051
14052 @item -fdump-debug
14053 @opindex fdump-debug
14054 Dump debugging information generated during the debug
14055 generation phase.
14056
14057 @item -fdump-earlydebug
14058 @opindex fdump-earlydebug
14059 Dump debugging information generated during the early debug
14060 generation phase.
14061
14062 @item -fdump-noaddr
14063 @opindex fdump-noaddr
14064 When doing debugging dumps, suppress address output. This makes it more
14065 feasible to use diff on debugging dumps for compiler invocations with
14066 different compiler binaries and/or different
14067 text / bss / data / heap / stack / dso start locations.
14068
14069 @item -freport-bug
14070 @opindex freport-bug
14071 Collect and dump debug information into a temporary file if an
14072 internal compiler error (ICE) occurs.
14073
14074 @item -fdump-unnumbered
14075 @opindex fdump-unnumbered
14076 When doing debugging dumps, suppress instruction numbers and address output.
14077 This makes it more feasible to use diff on debugging dumps for compiler
14078 invocations with different options, in particular with and without
14079 @option{-g}.
14080
14081 @item -fdump-unnumbered-links
14082 @opindex fdump-unnumbered-links
14083 When doing debugging dumps (see @option{-d} option above), suppress
14084 instruction numbers for the links to the previous and next instructions
14085 in a sequence.
14086
14087 @item -fdump-ipa-@var{switch}
14088 @itemx -fdump-ipa-@var{switch}-@var{options}
14089 @opindex fdump-ipa
14090 Control the dumping at various stages of inter-procedural analysis
14091 language tree to a file. The file name is generated by appending a
14092 switch specific suffix to the source file name, and the file is created
14093 in the same directory as the output file. The following dumps are
14094 possible:
14095
14096 @table @samp
14097 @item all
14098 Enables all inter-procedural analysis dumps.
14099
14100 @item cgraph
14101 Dumps information about call-graph optimization, unused function removal,
14102 and inlining decisions.
14103
14104 @item inline
14105 Dump after function inlining.
14106
14107 @end table
14108
14109 Additionally, the options @option{-optimized}, @option{-missed},
14110 @option{-note}, and @option{-all} can be provided, with the same meaning
14111 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14112
14113 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14114 information on callsites that were inlined, along with callsites
14115 that were not inlined.
14116
14117 By default, the dump will contain messages about successful
14118 optimizations (equivalent to @option{-optimized}) together with
14119 low-level details about the analysis.
14120
14121 @item -fdump-lang-all
14122 @itemx -fdump-lang-@var{switch}
14123 @itemx -fdump-lang-@var{switch}-@var{options}
14124 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14125 @opindex fdump-lang-all
14126 @opindex fdump-lang
14127 Control the dumping of language-specific information. The @var{options}
14128 and @var{filename} portions behave as described in the
14129 @option{-fdump-tree} option. The following @var{switch} values are
14130 accepted:
14131
14132 @table @samp
14133 @item all
14134
14135 Enable all language-specific dumps.
14136
14137 @item class
14138 Dump class hierarchy information. Virtual table information is emitted
14139 unless '@option{slim}' is specified. This option is applicable to C++ only.
14140
14141 @item raw
14142 Dump the raw internal tree data. This option is applicable to C++ only.
14143
14144 @end table
14145
14146 @item -fdump-passes
14147 @opindex fdump-passes
14148 Print on @file{stderr} the list of optimization passes that are turned
14149 on and off by the current command-line options.
14150
14151 @item -fdump-statistics-@var{option}
14152 @opindex fdump-statistics
14153 Enable and control dumping of pass statistics in a separate file. The
14154 file name is generated by appending a suffix ending in
14155 @samp{.statistics} to the source file name, and the file is created in
14156 the same directory as the output file. If the @samp{-@var{option}}
14157 form is used, @samp{-stats} causes counters to be summed over the
14158 whole compilation unit while @samp{-details} dumps every event as
14159 the passes generate them. The default with no option is to sum
14160 counters for each function compiled.
14161
14162 @item -fdump-tree-all
14163 @itemx -fdump-tree-@var{switch}
14164 @itemx -fdump-tree-@var{switch}-@var{options}
14165 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14166 @opindex fdump-tree-all
14167 @opindex fdump-tree
14168 Control the dumping at various stages of processing the intermediate
14169 language tree to a file. If the @samp{-@var{options}}
14170 form is used, @var{options} is a list of @samp{-} separated options
14171 which control the details of the dump. Not all options are applicable
14172 to all dumps; those that are not meaningful are ignored. The
14173 following options are available
14174
14175 @table @samp
14176 @item address
14177 Print the address of each node. Usually this is not meaningful as it
14178 changes according to the environment and source file. Its primary use
14179 is for tying up a dump file with a debug environment.
14180 @item asmname
14181 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14182 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14183 use working backward from mangled names in the assembly file.
14184 @item slim
14185 When dumping front-end intermediate representations, inhibit dumping
14186 of members of a scope or body of a function merely because that scope
14187 has been reached. Only dump such items when they are directly reachable
14188 by some other path.
14189
14190 When dumping pretty-printed trees, this option inhibits dumping the
14191 bodies of control structures.
14192
14193 When dumping RTL, print the RTL in slim (condensed) form instead of
14194 the default LISP-like representation.
14195 @item raw
14196 Print a raw representation of the tree. By default, trees are
14197 pretty-printed into a C-like representation.
14198 @item details
14199 Enable more detailed dumps (not honored by every dump option). Also
14200 include information from the optimization passes.
14201 @item stats
14202 Enable dumping various statistics about the pass (not honored by every dump
14203 option).
14204 @item blocks
14205 Enable showing basic block boundaries (disabled in raw dumps).
14206 @item graph
14207 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14208 dump a representation of the control flow graph suitable for viewing with
14209 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14210 the file is pretty-printed as a subgraph, so that GraphViz can render them
14211 all in a single plot.
14212
14213 This option currently only works for RTL dumps, and the RTL is always
14214 dumped in slim form.
14215 @item vops
14216 Enable showing virtual operands for every statement.
14217 @item lineno
14218 Enable showing line numbers for statements.
14219 @item uid
14220 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14221 @item verbose
14222 Enable showing the tree dump for each statement.
14223 @item eh
14224 Enable showing the EH region number holding each statement.
14225 @item scev
14226 Enable showing scalar evolution analysis details.
14227 @item optimized
14228 Enable showing optimization information (only available in certain
14229 passes).
14230 @item missed
14231 Enable showing missed optimization information (only available in certain
14232 passes).
14233 @item note
14234 Enable other detailed optimization information (only available in
14235 certain passes).
14236 @item all
14237 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14238 and @option{lineno}.
14239 @item optall
14240 Turn on all optimization options, i.e., @option{optimized},
14241 @option{missed}, and @option{note}.
14242 @end table
14243
14244 To determine what tree dumps are available or find the dump for a pass
14245 of interest follow the steps below.
14246
14247 @enumerate
14248 @item
14249 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14250 look for a code that corresponds to the pass you are interested in.
14251 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14252 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14253 The number at the end distinguishes distinct invocations of the same pass.
14254 @item
14255 To enable the creation of the dump file, append the pass code to
14256 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14257 to enable the dump from the Early Value Range Propagation pass, invoke
14258 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14259 specify the name of the dump file. If you don't specify one, GCC
14260 creates as described below.
14261 @item
14262 Find the pass dump in a file whose name is composed of three components
14263 separated by a period: the name of the source file GCC was invoked to
14264 compile, a numeric suffix indicating the pass number followed by the
14265 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14266 and finally the pass code. For example, the Early VRP pass dump might
14267 be in a file named @file{myfile.c.038t.evrp} in the current working
14268 directory. Note that the numeric codes are not stable and may change
14269 from one version of GCC to another.
14270 @end enumerate
14271
14272 @item -fopt-info
14273 @itemx -fopt-info-@var{options}
14274 @itemx -fopt-info-@var{options}=@var{filename}
14275 @opindex fopt-info
14276 Controls optimization dumps from various optimization passes. If the
14277 @samp{-@var{options}} form is used, @var{options} is a list of
14278 @samp{-} separated option keywords to select the dump details and
14279 optimizations.
14280
14281 The @var{options} can be divided into three groups:
14282 @enumerate
14283 @item
14284 options describing what kinds of messages should be emitted,
14285 @item
14286 options describing the verbosity of the dump, and
14287 @item
14288 options describing which optimizations should be included.
14289 @end enumerate
14290 The options from each group can be freely mixed as they are
14291 non-overlapping. However, in case of any conflicts,
14292 the later options override the earlier options on the command
14293 line.
14294
14295 The following options control which kinds of messages should be emitted:
14296
14297 @table @samp
14298 @item optimized
14299 Print information when an optimization is successfully applied. It is
14300 up to a pass to decide which information is relevant. For example, the
14301 vectorizer passes print the source location of loops which are
14302 successfully vectorized.
14303 @item missed
14304 Print information about missed optimizations. Individual passes
14305 control which information to include in the output.
14306 @item note
14307 Print verbose information about optimizations, such as certain
14308 transformations, more detailed messages about decisions etc.
14309 @item all
14310 Print detailed optimization information. This includes
14311 @samp{optimized}, @samp{missed}, and @samp{note}.
14312 @end table
14313
14314 The following option controls the dump verbosity:
14315
14316 @table @samp
14317 @item internals
14318 By default, only ``high-level'' messages are emitted. This option enables
14319 additional, more detailed, messages, which are likely to only be of interest
14320 to GCC developers.
14321 @end table
14322
14323 One or more of the following option keywords can be used to describe a
14324 group of optimizations:
14325
14326 @table @samp
14327 @item ipa
14328 Enable dumps from all interprocedural optimizations.
14329 @item loop
14330 Enable dumps from all loop optimizations.
14331 @item inline
14332 Enable dumps from all inlining optimizations.
14333 @item omp
14334 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14335 @item vec
14336 Enable dumps from all vectorization optimizations.
14337 @item optall
14338 Enable dumps from all optimizations. This is a superset of
14339 the optimization groups listed above.
14340 @end table
14341
14342 If @var{options} is
14343 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
14344 about successful optimizations from all the passes, omitting messages
14345 that are treated as ``internals''.
14346
14347 If the @var{filename} is provided, then the dumps from all the
14348 applicable optimizations are concatenated into the @var{filename}.
14349 Otherwise the dump is output onto @file{stderr}. Though multiple
14350 @option{-fopt-info} options are accepted, only one of them can include
14351 a @var{filename}. If other filenames are provided then all but the
14352 first such option are ignored.
14353
14354 Note that the output @var{filename} is overwritten
14355 in case of multiple translation units. If a combined output from
14356 multiple translation units is desired, @file{stderr} should be used
14357 instead.
14358
14359 In the following example, the optimization info is output to
14360 @file{stderr}:
14361
14362 @smallexample
14363 gcc -O3 -fopt-info
14364 @end smallexample
14365
14366 This example:
14367 @smallexample
14368 gcc -O3 -fopt-info-missed=missed.all
14369 @end smallexample
14370
14371 @noindent
14372 outputs missed optimization report from all the passes into
14373 @file{missed.all}, and this one:
14374
14375 @smallexample
14376 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14377 @end smallexample
14378
14379 @noindent
14380 prints information about missed optimization opportunities from
14381 vectorization passes on @file{stderr}.
14382 Note that @option{-fopt-info-vec-missed} is equivalent to
14383 @option{-fopt-info-missed-vec}. The order of the optimization group
14384 names and message types listed after @option{-fopt-info} does not matter.
14385
14386 As another example,
14387 @smallexample
14388 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14389 @end smallexample
14390
14391 @noindent
14392 outputs information about missed optimizations as well as
14393 optimized locations from all the inlining passes into
14394 @file{inline.txt}.
14395
14396 Finally, consider:
14397
14398 @smallexample
14399 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14400 @end smallexample
14401
14402 @noindent
14403 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14404 in conflict since only one output file is allowed. In this case, only
14405 the first option takes effect and the subsequent options are
14406 ignored. Thus only @file{vec.miss} is produced which contains
14407 dumps from the vectorizer about missed opportunities.
14408
14409 @item -fsave-optimization-record
14410 @opindex fsave-optimization-record
14411 Write a SRCFILE.opt-record.json file detailing what optimizations
14412 were performed, for those optimizations that support @option{-fopt-info}.
14413
14414 This option is experimental and the format of the data within the JSON
14415 file is subject to change.
14416
14417 It is roughly equivalent to a machine-readable version of
14418 @option{-fopt-info-all}, as a collection of messages with source file,
14419 line number and column number, with the following additional data for
14420 each message:
14421
14422 @itemize @bullet
14423
14424 @item
14425 the execution count of the code being optimized, along with metadata about
14426 whether this was from actual profile data, or just an estimate, allowing
14427 consumers to prioritize messages by code hotness,
14428
14429 @item
14430 the function name of the code being optimized, where applicable,
14431
14432 @item
14433 the ``inlining chain'' for the code being optimized, so that when
14434 a function is inlined into several different places (which might
14435 themselves be inlined), the reader can distinguish between the copies,
14436
14437 @item
14438 objects identifying those parts of the message that refer to expressions,
14439 statements or symbol-table nodes, which of these categories they are, and,
14440 when available, their source code location,
14441
14442 @item
14443 the GCC pass that emitted the message, and
14444
14445 @item
14446 the location in GCC's own code from which the message was emitted
14447
14448 @end itemize
14449
14450 Additionally, some messages are logically nested within other
14451 messages, reflecting implementation details of the optimization
14452 passes.
14453
14454 @item -fsched-verbose=@var{n}
14455 @opindex fsched-verbose
14456 On targets that use instruction scheduling, this option controls the
14457 amount of debugging output the scheduler prints to the dump files.
14458
14459 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14460 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14461 For @var{n} greater than one, it also output basic block probabilities,
14462 detailed ready list information and unit/insn info. For @var{n} greater
14463 than two, it includes RTL at abort point, control-flow and regions info.
14464 And for @var{n} over four, @option{-fsched-verbose} also includes
14465 dependence info.
14466
14467
14468
14469 @item -fenable-@var{kind}-@var{pass}
14470 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14471 @opindex fdisable-
14472 @opindex fenable-
14473
14474 This is a set of options that are used to explicitly disable/enable
14475 optimization passes. These options are intended for use for debugging GCC.
14476 Compiler users should use regular options for enabling/disabling
14477 passes instead.
14478
14479 @table @gcctabopt
14480
14481 @item -fdisable-ipa-@var{pass}
14482 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14483 statically invoked in the compiler multiple times, the pass name should be
14484 appended with a sequential number starting from 1.
14485
14486 @item -fdisable-rtl-@var{pass}
14487 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14488 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14489 statically invoked in the compiler multiple times, the pass name should be
14490 appended with a sequential number starting from 1. @var{range-list} is a
14491 comma-separated list of function ranges or assembler names. Each range is a number
14492 pair separated by a colon. The range is inclusive in both ends. If the range
14493 is trivial, the number pair can be simplified as a single number. If the
14494 function's call graph node's @var{uid} falls within one of the specified ranges,
14495 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14496 function header of a dump file, and the pass names can be dumped by using
14497 option @option{-fdump-passes}.
14498
14499 @item -fdisable-tree-@var{pass}
14500 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14501 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14502 option arguments.
14503
14504 @item -fenable-ipa-@var{pass}
14505 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14506 statically invoked in the compiler multiple times, the pass name should be
14507 appended with a sequential number starting from 1.
14508
14509 @item -fenable-rtl-@var{pass}
14510 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14511 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14512 description and examples.
14513
14514 @item -fenable-tree-@var{pass}
14515 @itemx -fenable-tree-@var{pass}=@var{range-list}
14516 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14517 of option arguments.
14518
14519 @end table
14520
14521 Here are some examples showing uses of these options.
14522
14523 @smallexample
14524
14525 # disable ccp1 for all functions
14526 -fdisable-tree-ccp1
14527 # disable complete unroll for function whose cgraph node uid is 1
14528 -fenable-tree-cunroll=1
14529 # disable gcse2 for functions at the following ranges [1,1],
14530 # [300,400], and [400,1000]
14531 # disable gcse2 for functions foo and foo2
14532 -fdisable-rtl-gcse2=foo,foo2
14533 # disable early inlining
14534 -fdisable-tree-einline
14535 # disable ipa inlining
14536 -fdisable-ipa-inline
14537 # enable tree full unroll
14538 -fenable-tree-unroll
14539
14540 @end smallexample
14541
14542 @item -fchecking
14543 @itemx -fchecking=@var{n}
14544 @opindex fchecking
14545 @opindex fno-checking
14546 Enable internal consistency checking. The default depends on
14547 the compiler configuration. @option{-fchecking=2} enables further
14548 internal consistency checking that might affect code generation.
14549
14550 @item -frandom-seed=@var{string}
14551 @opindex frandom-seed
14552 This option provides a seed that GCC uses in place of
14553 random numbers in generating certain symbol names
14554 that have to be different in every compiled file. It is also used to
14555 place unique stamps in coverage data files and the object files that
14556 produce them. You can use the @option{-frandom-seed} option to produce
14557 reproducibly identical object files.
14558
14559 The @var{string} can either be a number (decimal, octal or hex) or an
14560 arbitrary string (in which case it's converted to a number by
14561 computing CRC32).
14562
14563 The @var{string} should be different for every file you compile.
14564
14565 @item -save-temps
14566 @itemx -save-temps=cwd
14567 @opindex save-temps
14568 Store the usual ``temporary'' intermediate files permanently; place them
14569 in the current directory and name them based on the source file. Thus,
14570 compiling @file{foo.c} with @option{-c -save-temps} produces files
14571 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14572 preprocessed @file{foo.i} output file even though the compiler now
14573 normally uses an integrated preprocessor.
14574
14575 When used in combination with the @option{-x} command-line option,
14576 @option{-save-temps} is sensible enough to avoid over writing an
14577 input source file with the same extension as an intermediate file.
14578 The corresponding intermediate file may be obtained by renaming the
14579 source file before using @option{-save-temps}.
14580
14581 If you invoke GCC in parallel, compiling several different source
14582 files that share a common base name in different subdirectories or the
14583 same source file compiled for multiple output destinations, it is
14584 likely that the different parallel compilers will interfere with each
14585 other, and overwrite the temporary files. For instance:
14586
14587 @smallexample
14588 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14589 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14590 @end smallexample
14591
14592 may result in @file{foo.i} and @file{foo.o} being written to
14593 simultaneously by both compilers.
14594
14595 @item -save-temps=obj
14596 @opindex save-temps=obj
14597 Store the usual ``temporary'' intermediate files permanently. If the
14598 @option{-o} option is used, the temporary files are based on the
14599 object file. If the @option{-o} option is not used, the
14600 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14601
14602 For example:
14603
14604 @smallexample
14605 gcc -save-temps=obj -c foo.c
14606 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14607 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14608 @end smallexample
14609
14610 @noindent
14611 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14612 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14613 @file{dir2/yfoobar.o}.
14614
14615 @item -time@r{[}=@var{file}@r{]}
14616 @opindex time
14617 Report the CPU time taken by each subprocess in the compilation
14618 sequence. For C source files, this is the compiler proper and assembler
14619 (plus the linker if linking is done).
14620
14621 Without the specification of an output file, the output looks like this:
14622
14623 @smallexample
14624 # cc1 0.12 0.01
14625 # as 0.00 0.01
14626 @end smallexample
14627
14628 The first number on each line is the ``user time'', that is time spent
14629 executing the program itself. The second number is ``system time'',
14630 time spent executing operating system routines on behalf of the program.
14631 Both numbers are in seconds.
14632
14633 With the specification of an output file, the output is appended to the
14634 named file, and it looks like this:
14635
14636 @smallexample
14637 0.12 0.01 cc1 @var{options}
14638 0.00 0.01 as @var{options}
14639 @end smallexample
14640
14641 The ``user time'' and the ``system time'' are moved before the program
14642 name, and the options passed to the program are displayed, so that one
14643 can later tell what file was being compiled, and with which options.
14644
14645 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14646 @opindex fdump-final-insns
14647 Dump the final internal representation (RTL) to @var{file}. If the
14648 optional argument is omitted (or if @var{file} is @code{.}), the name
14649 of the dump file is determined by appending @code{.gkd} to the
14650 compilation output file name.
14651
14652 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14653 @opindex fcompare-debug
14654 @opindex fno-compare-debug
14655 If no error occurs during compilation, run the compiler a second time,
14656 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14657 passed to the second compilation. Dump the final internal
14658 representation in both compilations, and print an error if they differ.
14659
14660 If the equal sign is omitted, the default @option{-gtoggle} is used.
14661
14662 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14663 and nonzero, implicitly enables @option{-fcompare-debug}. If
14664 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14665 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14666 is used.
14667
14668 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14669 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14670 of the final representation and the second compilation, preventing even
14671 @env{GCC_COMPARE_DEBUG} from taking effect.
14672
14673 To verify full coverage during @option{-fcompare-debug} testing, set
14674 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14675 which GCC rejects as an invalid option in any actual compilation
14676 (rather than preprocessing, assembly or linking). To get just a
14677 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14678 not overridden} will do.
14679
14680 @item -fcompare-debug-second
14681 @opindex fcompare-debug-second
14682 This option is implicitly passed to the compiler for the second
14683 compilation requested by @option{-fcompare-debug}, along with options to
14684 silence warnings, and omitting other options that would cause the compiler
14685 to produce output to files or to standard output as a side effect. Dump
14686 files and preserved temporary files are renamed so as to contain the
14687 @code{.gk} additional extension during the second compilation, to avoid
14688 overwriting those generated by the first.
14689
14690 When this option is passed to the compiler driver, it causes the
14691 @emph{first} compilation to be skipped, which makes it useful for little
14692 other than debugging the compiler proper.
14693
14694 @item -gtoggle
14695 @opindex gtoggle
14696 Turn off generation of debug info, if leaving out this option
14697 generates it, or turn it on at level 2 otherwise. The position of this
14698 argument in the command line does not matter; it takes effect after all
14699 other options are processed, and it does so only once, no matter how
14700 many times it is given. This is mainly intended to be used with
14701 @option{-fcompare-debug}.
14702
14703 @item -fvar-tracking-assignments-toggle
14704 @opindex fvar-tracking-assignments-toggle
14705 @opindex fno-var-tracking-assignments-toggle
14706 Toggle @option{-fvar-tracking-assignments}, in the same way that
14707 @option{-gtoggle} toggles @option{-g}.
14708
14709 @item -Q
14710 @opindex Q
14711 Makes the compiler print out each function name as it is compiled, and
14712 print some statistics about each pass when it finishes.
14713
14714 @item -ftime-report
14715 @opindex ftime-report
14716 Makes the compiler print some statistics about the time consumed by each
14717 pass when it finishes.
14718
14719 @item -ftime-report-details
14720 @opindex ftime-report-details
14721 Record the time consumed by infrastructure parts separately for each pass.
14722
14723 @item -fira-verbose=@var{n}
14724 @opindex fira-verbose
14725 Control the verbosity of the dump file for the integrated register allocator.
14726 The default value is 5. If the value @var{n} is greater or equal to 10,
14727 the dump output is sent to stderr using the same format as @var{n} minus 10.
14728
14729 @item -flto-report
14730 @opindex flto-report
14731 Prints a report with internal details on the workings of the link-time
14732 optimizer. The contents of this report vary from version to version.
14733 It is meant to be useful to GCC developers when processing object
14734 files in LTO mode (via @option{-flto}).
14735
14736 Disabled by default.
14737
14738 @item -flto-report-wpa
14739 @opindex flto-report-wpa
14740 Like @option{-flto-report}, but only print for the WPA phase of Link
14741 Time Optimization.
14742
14743 @item -fmem-report
14744 @opindex fmem-report
14745 Makes the compiler print some statistics about permanent memory
14746 allocation when it finishes.
14747
14748 @item -fmem-report-wpa
14749 @opindex fmem-report-wpa
14750 Makes the compiler print some statistics about permanent memory
14751 allocation for the WPA phase only.
14752
14753 @item -fpre-ipa-mem-report
14754 @opindex fpre-ipa-mem-report
14755 @item -fpost-ipa-mem-report
14756 @opindex fpost-ipa-mem-report
14757 Makes the compiler print some statistics about permanent memory
14758 allocation before or after interprocedural optimization.
14759
14760 @item -fprofile-report
14761 @opindex fprofile-report
14762 Makes the compiler print some statistics about consistency of the
14763 (estimated) profile and effect of individual passes.
14764
14765 @item -fstack-usage
14766 @opindex fstack-usage
14767 Makes the compiler output stack usage information for the program, on a
14768 per-function basis. The filename for the dump is made by appending
14769 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14770 the output file, if explicitly specified and it is not an executable,
14771 otherwise it is the basename of the source file. An entry is made up
14772 of three fields:
14773
14774 @itemize
14775 @item
14776 The name of the function.
14777 @item
14778 A number of bytes.
14779 @item
14780 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14781 @end itemize
14782
14783 The qualifier @code{static} means that the function manipulates the stack
14784 statically: a fixed number of bytes are allocated for the frame on function
14785 entry and released on function exit; no stack adjustments are otherwise made
14786 in the function. The second field is this fixed number of bytes.
14787
14788 The qualifier @code{dynamic} means that the function manipulates the stack
14789 dynamically: in addition to the static allocation described above, stack
14790 adjustments are made in the body of the function, for example to push/pop
14791 arguments around function calls. If the qualifier @code{bounded} is also
14792 present, the amount of these adjustments is bounded at compile time and
14793 the second field is an upper bound of the total amount of stack used by
14794 the function. If it is not present, the amount of these adjustments is
14795 not bounded at compile time and the second field only represents the
14796 bounded part.
14797
14798 @item -fstats
14799 @opindex fstats
14800 Emit statistics about front-end processing at the end of the compilation.
14801 This option is supported only by the C++ front end, and
14802 the information is generally only useful to the G++ development team.
14803
14804 @item -fdbg-cnt-list
14805 @opindex fdbg-cnt-list
14806 Print the name and the counter upper bound for all debug counters.
14807
14808
14809 @item -fdbg-cnt=@var{counter-value-list}
14810 @opindex fdbg-cnt
14811 Set the internal debug counter lower and upper bound. @var{counter-value-list}
14812 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
14813 tuples which sets the lower and the upper bound of each debug
14814 counter @var{name}. The @var{lower_bound} is optional and is zero
14815 initialized if not set.
14816 All debug counters have the initial upper bound of @code{UINT_MAX};
14817 thus @code{dbg_cnt} returns true always unless the upper bound
14818 is set by this option.
14819 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
14820 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
14821 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
14822
14823 @item -print-file-name=@var{library}
14824 @opindex print-file-name
14825 Print the full absolute name of the library file @var{library} that
14826 would be used when linking---and don't do anything else. With this
14827 option, GCC does not compile or link anything; it just prints the
14828 file name.
14829
14830 @item -print-multi-directory
14831 @opindex print-multi-directory
14832 Print the directory name corresponding to the multilib selected by any
14833 other switches present in the command line. This directory is supposed
14834 to exist in @env{GCC_EXEC_PREFIX}.
14835
14836 @item -print-multi-lib
14837 @opindex print-multi-lib
14838 Print the mapping from multilib directory names to compiler switches
14839 that enable them. The directory name is separated from the switches by
14840 @samp{;}, and each switch starts with an @samp{@@} instead of the
14841 @samp{-}, without spaces between multiple switches. This is supposed to
14842 ease shell processing.
14843
14844 @item -print-multi-os-directory
14845 @opindex print-multi-os-directory
14846 Print the path to OS libraries for the selected
14847 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14848 present in the @file{lib} subdirectory and no multilibs are used, this is
14849 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14850 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14851 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14852 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14853
14854 @item -print-multiarch
14855 @opindex print-multiarch
14856 Print the path to OS libraries for the selected multiarch,
14857 relative to some @file{lib} subdirectory.
14858
14859 @item -print-prog-name=@var{program}
14860 @opindex print-prog-name
14861 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14862
14863 @item -print-libgcc-file-name
14864 @opindex print-libgcc-file-name
14865 Same as @option{-print-file-name=libgcc.a}.
14866
14867 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14868 but you do want to link with @file{libgcc.a}. You can do:
14869
14870 @smallexample
14871 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14872 @end smallexample
14873
14874 @item -print-search-dirs
14875 @opindex print-search-dirs
14876 Print the name of the configured installation directory and a list of
14877 program and library directories @command{gcc} searches---and don't do anything else.
14878
14879 This is useful when @command{gcc} prints the error message
14880 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14881 To resolve this you either need to put @file{cpp0} and the other compiler
14882 components where @command{gcc} expects to find them, or you can set the environment
14883 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14884 Don't forget the trailing @samp{/}.
14885 @xref{Environment Variables}.
14886
14887 @item -print-sysroot
14888 @opindex print-sysroot
14889 Print the target sysroot directory that is used during
14890 compilation. This is the target sysroot specified either at configure
14891 time or using the @option{--sysroot} option, possibly with an extra
14892 suffix that depends on compilation options. If no target sysroot is
14893 specified, the option prints nothing.
14894
14895 @item -print-sysroot-headers-suffix
14896 @opindex print-sysroot-headers-suffix
14897 Print the suffix added to the target sysroot when searching for
14898 headers, or give an error if the compiler is not configured with such
14899 a suffix---and don't do anything else.
14900
14901 @item -dumpmachine
14902 @opindex dumpmachine
14903 Print the compiler's target machine (for example,
14904 @samp{i686-pc-linux-gnu})---and don't do anything else.
14905
14906 @item -dumpversion
14907 @opindex dumpversion
14908 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
14909 anything else. This is the compiler version used in filesystem paths and
14910 specs. Depending on how the compiler has been configured it can be just
14911 a single number (major version), two numbers separated by a dot (major and
14912 minor version) or three numbers separated by dots (major, minor and patchlevel
14913 version).
14914
14915 @item -dumpfullversion
14916 @opindex dumpfullversion
14917 Print the full compiler version---and don't do anything else. The output is
14918 always three numbers separated by dots, major, minor and patchlevel version.
14919
14920 @item -dumpspecs
14921 @opindex dumpspecs
14922 Print the compiler's built-in specs---and don't do anything else. (This
14923 is used when GCC itself is being built.) @xref{Spec Files}.
14924 @end table
14925
14926 @node Submodel Options
14927 @section Machine-Dependent Options
14928 @cindex submodel options
14929 @cindex specifying hardware config
14930 @cindex hardware models and configurations, specifying
14931 @cindex target-dependent options
14932 @cindex machine-dependent options
14933
14934 Each target machine supported by GCC can have its own options---for
14935 example, to allow you to compile for a particular processor variant or
14936 ABI, or to control optimizations specific to that machine. By
14937 convention, the names of machine-specific options start with
14938 @samp{-m}.
14939
14940 Some configurations of the compiler also support additional target-specific
14941 options, usually for compatibility with other compilers on the same
14942 platform.
14943
14944 @c This list is ordered alphanumerically by subsection name.
14945 @c It should be the same order and spelling as these options are listed
14946 @c in Machine Dependent Options
14947
14948 @menu
14949 * AArch64 Options::
14950 * Adapteva Epiphany Options::
14951 * ARC Options::
14952 * ARM Options::
14953 * AVR Options::
14954 * Blackfin Options::
14955 * C6X Options::
14956 * CRIS Options::
14957 * CR16 Options::
14958 * C-SKY Options::
14959 * Darwin Options::
14960 * DEC Alpha Options::
14961 * FR30 Options::
14962 * FT32 Options::
14963 * FRV Options::
14964 * GNU/Linux Options::
14965 * H8/300 Options::
14966 * HPPA Options::
14967 * IA-64 Options::
14968 * LM32 Options::
14969 * M32C Options::
14970 * M32R/D Options::
14971 * M680x0 Options::
14972 * MCore Options::
14973 * MeP Options::
14974 * MicroBlaze Options::
14975 * MIPS Options::
14976 * MMIX Options::
14977 * MN10300 Options::
14978 * Moxie Options::
14979 * MSP430 Options::
14980 * NDS32 Options::
14981 * Nios II Options::
14982 * Nvidia PTX Options::
14983 * PDP-11 Options::
14984 * picoChip Options::
14985 * PowerPC Options::
14986 * PowerPC SPE Options::
14987 * RISC-V Options::
14988 * RL78 Options::
14989 * RS/6000 and PowerPC Options::
14990 * RX Options::
14991 * S/390 and zSeries Options::
14992 * Score Options::
14993 * SH Options::
14994 * Solaris 2 Options::
14995 * SPARC Options::
14996 * SPU Options::
14997 * System V Options::
14998 * TILE-Gx Options::
14999 * TILEPro Options::
15000 * V850 Options::
15001 * VAX Options::
15002 * Visium Options::
15003 * VMS Options::
15004 * VxWorks Options::
15005 * x86 Options::
15006 * x86 Windows Options::
15007 * Xstormy16 Options::
15008 * Xtensa Options::
15009 * zSeries Options::
15010 @end menu
15011
15012 @node AArch64 Options
15013 @subsection AArch64 Options
15014 @cindex AArch64 Options
15015
15016 These options are defined for AArch64 implementations:
15017
15018 @table @gcctabopt
15019
15020 @item -mabi=@var{name}
15021 @opindex mabi
15022 Generate code for the specified data model. Permissible values
15023 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15024 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15025 but long int and pointers are 64 bits.
15026
15027 The default depends on the specific target configuration. Note that
15028 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15029 entire program with the same ABI, and link with a compatible set of libraries.
15030
15031 @item -mbig-endian
15032 @opindex mbig-endian
15033 Generate big-endian code. This is the default when GCC is configured for an
15034 @samp{aarch64_be-*-*} target.
15035
15036 @item -mgeneral-regs-only
15037 @opindex mgeneral-regs-only
15038 Generate code which uses only the general-purpose registers. This will prevent
15039 the compiler from using floating-point and Advanced SIMD registers but will not
15040 impose any restrictions on the assembler.
15041
15042 @item -mlittle-endian
15043 @opindex mlittle-endian
15044 Generate little-endian code. This is the default when GCC is configured for an
15045 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15046
15047 @item -mcmodel=tiny
15048 @opindex mcmodel=tiny
15049 Generate code for the tiny code model. The program and its statically defined
15050 symbols must be within 1MB of each other. Programs can be statically or
15051 dynamically linked.
15052
15053 @item -mcmodel=small
15054 @opindex mcmodel=small
15055 Generate code for the small code model. The program and its statically defined
15056 symbols must be within 4GB of each other. Programs can be statically or
15057 dynamically linked. This is the default code model.
15058
15059 @item -mcmodel=large
15060 @opindex mcmodel=large
15061 Generate code for the large code model. This makes no assumptions about
15062 addresses and sizes of sections. Programs can be statically linked only.
15063
15064 @item -mstrict-align
15065 @itemx -mno-strict-align
15066 @opindex mstrict-align
15067 @opindex mno-strict-align
15068 Avoid or allow generating memory accesses that may not be aligned on a natural
15069 object boundary as described in the architecture specification.
15070
15071 @item -momit-leaf-frame-pointer
15072 @itemx -mno-omit-leaf-frame-pointer
15073 @opindex momit-leaf-frame-pointer
15074 @opindex mno-omit-leaf-frame-pointer
15075 Omit or keep the frame pointer in leaf functions. The former behavior is the
15076 default.
15077
15078 @item -mtls-dialect=desc
15079 @opindex mtls-dialect=desc
15080 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15081 of TLS variables. This is the default.
15082
15083 @item -mtls-dialect=traditional
15084 @opindex mtls-dialect=traditional
15085 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15086 of TLS variables.
15087
15088 @item -mtls-size=@var{size}
15089 @opindex mtls-size
15090 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15091 This option requires binutils 2.26 or newer.
15092
15093 @item -mfix-cortex-a53-835769
15094 @itemx -mno-fix-cortex-a53-835769
15095 @opindex mfix-cortex-a53-835769
15096 @opindex mno-fix-cortex-a53-835769
15097 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15098 This involves inserting a NOP instruction between memory instructions and
15099 64-bit integer multiply-accumulate instructions.
15100
15101 @item -mfix-cortex-a53-843419
15102 @itemx -mno-fix-cortex-a53-843419
15103 @opindex mfix-cortex-a53-843419
15104 @opindex mno-fix-cortex-a53-843419
15105 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15106 This erratum workaround is made at link time and this will only pass the
15107 corresponding flag to the linker.
15108
15109 @item -mlow-precision-recip-sqrt
15110 @itemx -mno-low-precision-recip-sqrt
15111 @opindex mlow-precision-recip-sqrt
15112 @opindex mno-low-precision-recip-sqrt
15113 Enable or disable the reciprocal square root approximation.
15114 This option only has an effect if @option{-ffast-math} or
15115 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15116 precision of reciprocal square root results to about 16 bits for
15117 single precision and to 32 bits for double precision.
15118
15119 @item -mlow-precision-sqrt
15120 @itemx -mno-low-precision-sqrt
15121 @opindex mlow-precision-sqrt
15122 @opindex mno-low-precision-sqrt
15123 Enable or disable the square root approximation.
15124 This option only has an effect if @option{-ffast-math} or
15125 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15126 precision of square root results to about 16 bits for
15127 single precision and to 32 bits for double precision.
15128 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15129
15130 @item -mlow-precision-div
15131 @itemx -mno-low-precision-div
15132 @opindex mlow-precision-div
15133 @opindex mno-low-precision-div
15134 Enable or disable the division approximation.
15135 This option only has an effect if @option{-ffast-math} or
15136 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15137 precision of division results to about 16 bits for
15138 single precision and to 32 bits for double precision.
15139
15140 @item -mtrack-speculation
15141 @itemx -mno-track-speculation
15142 Enable or disable generation of additional code to track speculative
15143 execution through conditional branches. The tracking state can then
15144 be used by the compiler when expanding calls to
15145 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15146 sequence to be generated.
15147
15148 @item -march=@var{name}
15149 @opindex march
15150 Specify the name of the target architecture and, optionally, one or
15151 more feature modifiers. This option has the form
15152 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15153
15154 The permissible values for @var{arch} are @samp{armv8-a},
15155 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
15156 or @var{native}.
15157
15158 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15159 support for the ARMv8.4-A architecture extensions.
15160
15161 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15162 support for the ARMv8.3-A architecture extensions.
15163
15164 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15165 support for the ARMv8.2-A architecture extensions.
15166
15167 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15168 support for the ARMv8.1-A architecture extension. In particular, it
15169 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15170
15171 The value @samp{native} is available on native AArch64 GNU/Linux and
15172 causes the compiler to pick the architecture of the host system. This
15173 option has no effect if the compiler is unable to recognize the
15174 architecture of the host system,
15175
15176 The permissible values for @var{feature} are listed in the sub-section
15177 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15178 Feature Modifiers}. Where conflicting feature modifiers are
15179 specified, the right-most feature is used.
15180
15181 GCC uses @var{name} to determine what kind of instructions it can emit
15182 when generating assembly code. If @option{-march} is specified
15183 without either of @option{-mtune} or @option{-mcpu} also being
15184 specified, the code is tuned to perform well across a range of target
15185 processors implementing the target architecture.
15186
15187 @item -mtune=@var{name}
15188 @opindex mtune
15189 Specify the name of the target processor for which GCC should tune the
15190 performance of the code. Permissible values for this option are:
15191 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15192 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15193 @samp{cortex-a76}, @samp{ares}, @samp{exynos-m1}, @samp{falkor},
15194 @samp{qdf24xx}, @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan},
15195 @samp{thunderx}, @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
15196 @samp{tsv110}, @samp{thunderxt83}, @samp{thunderx2t99},
15197 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15198 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15199 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15200 @samp{native}.
15201
15202 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15203 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15204 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15205 should tune for a big.LITTLE system.
15206
15207 Additionally on native AArch64 GNU/Linux systems the value
15208 @samp{native} tunes performance to the host system. This option has no effect
15209 if the compiler is unable to recognize the processor of the host system.
15210
15211 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15212 are specified, the code is tuned to perform well across a range
15213 of target processors.
15214
15215 This option cannot be suffixed by feature modifiers.
15216
15217 @item -mcpu=@var{name}
15218 @opindex mcpu
15219 Specify the name of the target processor, optionally suffixed by one
15220 or more feature modifiers. This option has the form
15221 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15222 the permissible values for @var{cpu} are the same as those available
15223 for @option{-mtune}. The permissible values for @var{feature} are
15224 documented in the sub-section on
15225 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15226 Feature Modifiers}. Where conflicting feature modifiers are
15227 specified, the right-most feature is used.
15228
15229 GCC uses @var{name} to determine what kind of instructions it can emit when
15230 generating assembly code (as if by @option{-march}) and to determine
15231 the target processor for which to tune for performance (as if
15232 by @option{-mtune}). Where this option is used in conjunction
15233 with @option{-march} or @option{-mtune}, those options take precedence
15234 over the appropriate part of this option.
15235
15236 @item -moverride=@var{string}
15237 @opindex moverride
15238 Override tuning decisions made by the back-end in response to a
15239 @option{-mtune=} switch. The syntax, semantics, and accepted values
15240 for @var{string} in this option are not guaranteed to be consistent
15241 across releases.
15242
15243 This option is only intended to be useful when developing GCC.
15244
15245 @item -mverbose-cost-dump
15246 @opindex mverbose-cost-dump
15247 Enable verbose cost model dumping in the debug dump files. This option is
15248 provided for use in debugging the compiler.
15249
15250 @item -mpc-relative-literal-loads
15251 @itemx -mno-pc-relative-literal-loads
15252 @opindex mpc-relative-literal-loads
15253 @opindex mno-pc-relative-literal-loads
15254 Enable or disable PC-relative literal loads. With this option literal pools are
15255 accessed using a single instruction and emitted after each function. This
15256 limits the maximum size of functions to 1MB. This is enabled by default for
15257 @option{-mcmodel=tiny}.
15258
15259 @item -msign-return-address=@var{scope}
15260 @opindex msign-return-address
15261 Select the function scope on which return address signing will be applied.
15262 Permissible values are @samp{none}, which disables return address signing,
15263 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15264 functions, and @samp{all}, which enables pointer signing for all functions. The
15265 default value is @samp{none}.
15266
15267 @item -msve-vector-bits=@var{bits}
15268 @opindex msve-vector-bits
15269 Specify the number of bits in an SVE vector register. This option only has
15270 an effect when SVE is enabled.
15271
15272 GCC supports two forms of SVE code generation: ``vector-length
15273 agnostic'' output that works with any size of vector register and
15274 ``vector-length specific'' output that only works when the vector
15275 registers are a particular size. Replacing @var{bits} with
15276 @samp{scalable} selects vector-length agnostic output while
15277 replacing it with a number selects vector-length specific output.
15278 The possible lengths in the latter case are: 128, 256, 512, 1024
15279 and 2048. @samp{scalable} is the default.
15280
15281 At present, @samp{-msve-vector-bits=128} produces the same output
15282 as @samp{-msve-vector-bits=scalable}.
15283
15284 @end table
15285
15286 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15287 @anchor{aarch64-feature-modifiers}
15288 @cindex @option{-march} feature modifiers
15289 @cindex @option{-mcpu} feature modifiers
15290 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15291 the following and their inverses @option{no@var{feature}}:
15292
15293 @table @samp
15294 @item crc
15295 Enable CRC extension. This is on by default for
15296 @option{-march=armv8.1-a}.
15297 @item crypto
15298 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15299 instructions.
15300 @item fp
15301 Enable floating-point instructions. This is on by default for all possible
15302 values for options @option{-march} and @option{-mcpu}.
15303 @item simd
15304 Enable Advanced SIMD instructions. This also enables floating-point
15305 instructions. This is on by default for all possible values for options
15306 @option{-march} and @option{-mcpu}.
15307 @item sve
15308 Enable Scalable Vector Extension instructions. This also enables Advanced
15309 SIMD and floating-point instructions.
15310 @item lse
15311 Enable Large System Extension instructions. This is on by default for
15312 @option{-march=armv8.1-a}.
15313 @item rdma
15314 Enable Round Double Multiply Accumulate instructions. This is on by default
15315 for @option{-march=armv8.1-a}.
15316 @item fp16
15317 Enable FP16 extension. This also enables floating-point instructions.
15318 @item fp16fml
15319 Enable FP16 fmla extension. This also enables FP16 extensions and
15320 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.
15321
15322 @item rcpc
15323 Enable the RcPc extension. This does not change code generation from GCC,
15324 but is passed on to the assembler, enabling inline asm statements to use
15325 instructions from the RcPc extension.
15326 @item dotprod
15327 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15328 @item aes
15329 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15330 SIMD instructions.
15331 @item sha2
15332 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15333 @item sha3
15334 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15335 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15336 @item sm4
15337 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15338 Use of this option with architectures prior to Armv8.2-A is not supported.
15339 @item profile
15340 Enable the Statistical Profiling extension. This option is only to enable the
15341 extension at the assembler level and does not affect code generation.
15342
15343 @end table
15344
15345 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15346 which implies @option{fp}.
15347 Conversely, @option{nofp} implies @option{nosimd}, which implies
15348 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15349
15350 @node Adapteva Epiphany Options
15351 @subsection Adapteva Epiphany Options
15352
15353 These @samp{-m} options are defined for Adapteva Epiphany:
15354
15355 @table @gcctabopt
15356 @item -mhalf-reg-file
15357 @opindex mhalf-reg-file
15358 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15359 That allows code to run on hardware variants that lack these registers.
15360
15361 @item -mprefer-short-insn-regs
15362 @opindex mprefer-short-insn-regs
15363 Preferentially allocate registers that allow short instruction generation.
15364 This can result in increased instruction count, so this may either reduce or
15365 increase overall code size.
15366
15367 @item -mbranch-cost=@var{num}
15368 @opindex mbranch-cost
15369 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15370 This cost is only a heuristic and is not guaranteed to produce
15371 consistent results across releases.
15372
15373 @item -mcmove
15374 @opindex mcmove
15375 Enable the generation of conditional moves.
15376
15377 @item -mnops=@var{num}
15378 @opindex mnops
15379 Emit @var{num} NOPs before every other generated instruction.
15380
15381 @item -mno-soft-cmpsf
15382 @opindex mno-soft-cmpsf
15383 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15384 and test the flags. This is faster than a software comparison, but can
15385 get incorrect results in the presence of NaNs, or when two different small
15386 numbers are compared such that their difference is calculated as zero.
15387 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15388 software comparisons.
15389
15390 @item -mstack-offset=@var{num}
15391 @opindex mstack-offset
15392 Set the offset between the top of the stack and the stack pointer.
15393 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15394 can be used by leaf functions without stack allocation.
15395 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15396 Note also that this option changes the ABI; compiling a program with a
15397 different stack offset than the libraries have been compiled with
15398 generally does not work.
15399 This option can be useful if you want to evaluate if a different stack
15400 offset would give you better code, but to actually use a different stack
15401 offset to build working programs, it is recommended to configure the
15402 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15403
15404 @item -mno-round-nearest
15405 @opindex mno-round-nearest
15406 Make the scheduler assume that the rounding mode has been set to
15407 truncating. The default is @option{-mround-nearest}.
15408
15409 @item -mlong-calls
15410 @opindex mlong-calls
15411 If not otherwise specified by an attribute, assume all calls might be beyond
15412 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15413 function address into a register before performing a (otherwise direct) call.
15414 This is the default.
15415
15416 @item -mshort-calls
15417 @opindex short-calls
15418 If not otherwise specified by an attribute, assume all direct calls are
15419 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15420 for direct calls. The default is @option{-mlong-calls}.
15421
15422 @item -msmall16
15423 @opindex msmall16
15424 Assume addresses can be loaded as 16-bit unsigned values. This does not
15425 apply to function addresses for which @option{-mlong-calls} semantics
15426 are in effect.
15427
15428 @item -mfp-mode=@var{mode}
15429 @opindex mfp-mode
15430 Set the prevailing mode of the floating-point unit.
15431 This determines the floating-point mode that is provided and expected
15432 at function call and return time. Making this mode match the mode you
15433 predominantly need at function start can make your programs smaller and
15434 faster by avoiding unnecessary mode switches.
15435
15436 @var{mode} can be set to one the following values:
15437
15438 @table @samp
15439 @item caller
15440 Any mode at function entry is valid, and retained or restored when
15441 the function returns, and when it calls other functions.
15442 This mode is useful for compiling libraries or other compilation units
15443 you might want to incorporate into different programs with different
15444 prevailing FPU modes, and the convenience of being able to use a single
15445 object file outweighs the size and speed overhead for any extra
15446 mode switching that might be needed, compared with what would be needed
15447 with a more specific choice of prevailing FPU mode.
15448
15449 @item truncate
15450 This is the mode used for floating-point calculations with
15451 truncating (i.e.@: round towards zero) rounding mode. That includes
15452 conversion from floating point to integer.
15453
15454 @item round-nearest
15455 This is the mode used for floating-point calculations with
15456 round-to-nearest-or-even rounding mode.
15457
15458 @item int
15459 This is the mode used to perform integer calculations in the FPU, e.g.@:
15460 integer multiply, or integer multiply-and-accumulate.
15461 @end table
15462
15463 The default is @option{-mfp-mode=caller}
15464
15465 @item -mnosplit-lohi
15466 @itemx -mno-postinc
15467 @itemx -mno-postmodify
15468 @opindex mnosplit-lohi
15469 @opindex mno-postinc
15470 @opindex mno-postmodify
15471 Code generation tweaks that disable, respectively, splitting of 32-bit
15472 loads, generation of post-increment addresses, and generation of
15473 post-modify addresses. The defaults are @option{msplit-lohi},
15474 @option{-mpost-inc}, and @option{-mpost-modify}.
15475
15476 @item -mnovect-double
15477 @opindex mno-vect-double
15478 Change the preferred SIMD mode to SImode. The default is
15479 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15480
15481 @item -max-vect-align=@var{num}
15482 @opindex max-vect-align
15483 The maximum alignment for SIMD vector mode types.
15484 @var{num} may be 4 or 8. The default is 8.
15485 Note that this is an ABI change, even though many library function
15486 interfaces are unaffected if they don't use SIMD vector modes
15487 in places that affect size and/or alignment of relevant types.
15488
15489 @item -msplit-vecmove-early
15490 @opindex msplit-vecmove-early
15491 Split vector moves into single word moves before reload. In theory this
15492 can give better register allocation, but so far the reverse seems to be
15493 generally the case.
15494
15495 @item -m1reg-@var{reg}
15496 @opindex m1reg-
15497 Specify a register to hold the constant @minus{}1, which makes loading small negative
15498 constants and certain bitmasks faster.
15499 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15500 which specify use of that register as a fixed register,
15501 and @samp{none}, which means that no register is used for this
15502 purpose. The default is @option{-m1reg-none}.
15503
15504 @end table
15505
15506 @node ARC Options
15507 @subsection ARC Options
15508 @cindex ARC options
15509
15510 The following options control the architecture variant for which code
15511 is being compiled:
15512
15513 @c architecture variants
15514 @table @gcctabopt
15515
15516 @item -mbarrel-shifter
15517 @opindex mbarrel-shifter
15518 Generate instructions supported by barrel shifter. This is the default
15519 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15520
15521 @item -mjli-always
15522 @opindex mjli-alawys
15523 Force to call a function using jli_s instruction. This option is
15524 valid only for ARCv2 architecture.
15525
15526 @item -mcpu=@var{cpu}
15527 @opindex mcpu
15528 Set architecture type, register usage, and instruction scheduling
15529 parameters for @var{cpu}. There are also shortcut alias options
15530 available for backward compatibility and convenience. Supported
15531 values for @var{cpu} are
15532
15533 @table @samp
15534 @opindex mA6
15535 @opindex mARC600
15536 @item arc600
15537 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15538
15539 @item arc601
15540 @opindex mARC601
15541 Compile for ARC601. Alias: @option{-mARC601}.
15542
15543 @item arc700
15544 @opindex mA7
15545 @opindex mARC700
15546 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15547 This is the default when configured with @option{--with-cpu=arc700}@.
15548
15549 @item arcem
15550 Compile for ARC EM.
15551
15552 @item archs
15553 Compile for ARC HS.
15554
15555 @item em
15556 Compile for ARC EM CPU with no hardware extensions.
15557
15558 @item em4
15559 Compile for ARC EM4 CPU.
15560
15561 @item em4_dmips
15562 Compile for ARC EM4 DMIPS CPU.
15563
15564 @item em4_fpus
15565 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15566 extension.
15567
15568 @item em4_fpuda
15569 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15570 double assist instructions.
15571
15572 @item hs
15573 Compile for ARC HS CPU with no hardware extensions except the atomic
15574 instructions.
15575
15576 @item hs34
15577 Compile for ARC HS34 CPU.
15578
15579 @item hs38
15580 Compile for ARC HS38 CPU.
15581
15582 @item hs38_linux
15583 Compile for ARC HS38 CPU with all hardware extensions on.
15584
15585 @item arc600_norm
15586 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15587
15588 @item arc600_mul32x16
15589 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15590 instructions enabled.
15591
15592 @item arc600_mul64
15593 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15594 instructions enabled.
15595
15596 @item arc601_norm
15597 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15598
15599 @item arc601_mul32x16
15600 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15601 instructions enabled.
15602
15603 @item arc601_mul64
15604 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15605 instructions enabled.
15606
15607 @item nps400
15608 Compile for ARC 700 on NPS400 chip.
15609
15610 @item em_mini
15611 Compile for ARC EM minimalist configuration featuring reduced register
15612 set.
15613
15614 @end table
15615
15616 @item -mdpfp
15617 @opindex mdpfp
15618 @itemx -mdpfp-compact
15619 @opindex mdpfp-compact
15620 Generate double-precision FPX instructions, tuned for the compact
15621 implementation.
15622
15623 @item -mdpfp-fast
15624 @opindex mdpfp-fast
15625 Generate double-precision FPX instructions, tuned for the fast
15626 implementation.
15627
15628 @item -mno-dpfp-lrsr
15629 @opindex mno-dpfp-lrsr
15630 Disable @code{lr} and @code{sr} instructions from using FPX extension
15631 aux registers.
15632
15633 @item -mea
15634 @opindex mea
15635 Generate extended arithmetic instructions. Currently only
15636 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15637 supported. This is always enabled for @option{-mcpu=ARC700}.
15638
15639 @item -mno-mpy
15640 @opindex mno-mpy
15641 Do not generate @code{mpy}-family instructions for ARC700. This option is
15642 deprecated.
15643
15644 @item -mmul32x16
15645 @opindex mmul32x16
15646 Generate 32x16-bit multiply and multiply-accumulate instructions.
15647
15648 @item -mmul64
15649 @opindex mmul64
15650 Generate @code{mul64} and @code{mulu64} instructions.
15651 Only valid for @option{-mcpu=ARC600}.
15652
15653 @item -mnorm
15654 @opindex mnorm
15655 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15656 is in effect.
15657
15658 @item -mspfp
15659 @opindex mspfp
15660 @itemx -mspfp-compact
15661 @opindex mspfp-compact
15662 Generate single-precision FPX instructions, tuned for the compact
15663 implementation.
15664
15665 @item -mspfp-fast
15666 @opindex mspfp-fast
15667 Generate single-precision FPX instructions, tuned for the fast
15668 implementation.
15669
15670 @item -msimd
15671 @opindex msimd
15672 Enable generation of ARC SIMD instructions via target-specific
15673 builtins. Only valid for @option{-mcpu=ARC700}.
15674
15675 @item -msoft-float
15676 @opindex msoft-float
15677 This option ignored; it is provided for compatibility purposes only.
15678 Software floating-point code is emitted by default, and this default
15679 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15680 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15681 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15682
15683 @item -mswap
15684 @opindex mswap
15685 Generate @code{swap} instructions.
15686
15687 @item -matomic
15688 @opindex matomic
15689 This enables use of the locked load/store conditional extension to implement
15690 atomic memory built-in functions. Not available for ARC 6xx or ARC
15691 EM cores.
15692
15693 @item -mdiv-rem
15694 @opindex mdiv-rem
15695 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15696
15697 @item -mcode-density
15698 @opindex mcode-density
15699 Enable code density instructions for ARC EM.
15700 This option is on by default for ARC HS.
15701
15702 @item -mll64
15703 @opindex mll64
15704 Enable double load/store operations for ARC HS cores.
15705
15706 @item -mtp-regno=@var{regno}
15707 @opindex mtp-regno
15708 Specify thread pointer register number.
15709
15710 @item -mmpy-option=@var{multo}
15711 @opindex mmpy-option
15712 Compile ARCv2 code with a multiplier design option. You can specify
15713 the option using either a string or numeric value for @var{multo}.
15714 @samp{wlh1} is the default value. The recognized values are:
15715
15716 @table @samp
15717 @item 0
15718 @itemx none
15719 No multiplier available.
15720
15721 @item 1
15722 @itemx w
15723 16x16 multiplier, fully pipelined.
15724 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15725
15726 @item 2
15727 @itemx wlh1
15728 32x32 multiplier, fully
15729 pipelined (1 stage). The following instructions are additionally
15730 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15731
15732 @item 3
15733 @itemx wlh2
15734 32x32 multiplier, fully pipelined
15735 (2 stages). The following instructions are additionally enabled: @code{mpy},
15736 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15737
15738 @item 4
15739 @itemx wlh3
15740 Two 16x16 multipliers, blocking,
15741 sequential. The following instructions are additionally enabled: @code{mpy},
15742 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15743
15744 @item 5
15745 @itemx wlh4
15746 One 16x16 multiplier, blocking,
15747 sequential. The following instructions are additionally enabled: @code{mpy},
15748 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15749
15750 @item 6
15751 @itemx wlh5
15752 One 32x4 multiplier, blocking,
15753 sequential. The following instructions are additionally enabled: @code{mpy},
15754 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15755
15756 @item 7
15757 @itemx plus_dmpy
15758 ARC HS SIMD support.
15759
15760 @item 8
15761 @itemx plus_macd
15762 ARC HS SIMD support.
15763
15764 @item 9
15765 @itemx plus_qmacw
15766 ARC HS SIMD support.
15767
15768 @end table
15769
15770 This option is only available for ARCv2 cores@.
15771
15772 @item -mfpu=@var{fpu}
15773 @opindex mfpu
15774 Enables support for specific floating-point hardware extensions for ARCv2
15775 cores. Supported values for @var{fpu} are:
15776
15777 @table @samp
15778
15779 @item fpus
15780 Enables support for single-precision floating-point hardware
15781 extensions@.
15782
15783 @item fpud
15784 Enables support for double-precision floating-point hardware
15785 extensions. The single-precision floating-point extension is also
15786 enabled. Not available for ARC EM@.
15787
15788 @item fpuda
15789 Enables support for double-precision floating-point hardware
15790 extensions using double-precision assist instructions. The single-precision
15791 floating-point extension is also enabled. This option is
15792 only available for ARC EM@.
15793
15794 @item fpuda_div
15795 Enables support for double-precision floating-point hardware
15796 extensions using double-precision assist instructions.
15797 The single-precision floating-point, square-root, and divide
15798 extensions are also enabled. This option is
15799 only available for ARC EM@.
15800
15801 @item fpuda_fma
15802 Enables support for double-precision floating-point hardware
15803 extensions using double-precision assist instructions.
15804 The single-precision floating-point and fused multiply and add
15805 hardware extensions are also enabled. This option is
15806 only available for ARC EM@.
15807
15808 @item fpuda_all
15809 Enables support for double-precision floating-point hardware
15810 extensions using double-precision assist instructions.
15811 All single-precision floating-point hardware extensions are also
15812 enabled. This option is only available for ARC EM@.
15813
15814 @item fpus_div
15815 Enables support for single-precision floating-point, square-root and divide
15816 hardware extensions@.
15817
15818 @item fpud_div
15819 Enables support for double-precision floating-point, square-root and divide
15820 hardware extensions. This option
15821 includes option @samp{fpus_div}. Not available for ARC EM@.
15822
15823 @item fpus_fma
15824 Enables support for single-precision floating-point and
15825 fused multiply and add hardware extensions@.
15826
15827 @item fpud_fma
15828 Enables support for double-precision floating-point and
15829 fused multiply and add hardware extensions. This option
15830 includes option @samp{fpus_fma}. Not available for ARC EM@.
15831
15832 @item fpus_all
15833 Enables support for all single-precision floating-point hardware
15834 extensions@.
15835
15836 @item fpud_all
15837 Enables support for all single- and double-precision floating-point
15838 hardware extensions. Not available for ARC EM@.
15839
15840 @end table
15841
15842 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15843 @opindex mirq-ctrl-saved
15844 Specifies general-purposes registers that the processor automatically
15845 saves/restores on interrupt entry and exit. @var{register-range} is
15846 specified as two registers separated by a dash. The register range
15847 always starts with @code{r0}, the upper limit is @code{fp} register.
15848 @var{blink} and @var{lp_count} are optional. This option is only
15849 valid for ARC EM and ARC HS cores.
15850
15851 @item -mrgf-banked-regs=@var{number}
15852 @opindex mrgf-banked-regs
15853 Specifies the number of registers replicated in second register bank
15854 on entry to fast interrupt. Fast interrupts are interrupts with the
15855 highest priority level P0. These interrupts save only PC and STATUS32
15856 registers to avoid memory transactions during interrupt entry and exit
15857 sequences. Use this option when you are using fast interrupts in an
15858 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15859
15860 @item -mlpc-width=@var{width}
15861 @opindex mlpc-width
15862 Specify the width of the @code{lp_count} register. Valid values for
15863 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15864 fixed to 32 bits. If the width is less than 32, the compiler does not
15865 attempt to transform loops in your program to use the zero-delay loop
15866 mechanism unless it is known that the @code{lp_count} register can
15867 hold the required loop-counter value. Depending on the width
15868 specified, the compiler and run-time library might continue to use the
15869 loop mechanism for various needs. This option defines macro
15870 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15871
15872 @item -mrf16
15873 @opindex mrf16
15874 This option instructs the compiler to generate code for a 16-entry
15875 register file. This option defines the @code{__ARC_RF16__}
15876 preprocessor macro.
15877
15878 @item -mbranch-index
15879 @opindex mbranch-index
15880 Enable use of @code{bi} or @code{bih} instructions to implement jump
15881 tables.
15882
15883 @end table
15884
15885 The following options are passed through to the assembler, and also
15886 define preprocessor macro symbols.
15887
15888 @c Flags used by the assembler, but for which we define preprocessor
15889 @c macro symbols as well.
15890 @table @gcctabopt
15891 @item -mdsp-packa
15892 @opindex mdsp-packa
15893 Passed down to the assembler to enable the DSP Pack A extensions.
15894 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
15895 deprecated.
15896
15897 @item -mdvbf
15898 @opindex mdvbf
15899 Passed down to the assembler to enable the dual Viterbi butterfly
15900 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
15901 option is deprecated.
15902
15903 @c ARC700 4.10 extension instruction
15904 @item -mlock
15905 @opindex mlock
15906 Passed down to the assembler to enable the locked load/store
15907 conditional extension. Also sets the preprocessor symbol
15908 @code{__Xlock}.
15909
15910 @item -mmac-d16
15911 @opindex mmac-d16
15912 Passed down to the assembler. Also sets the preprocessor symbol
15913 @code{__Xxmac_d16}. This option is deprecated.
15914
15915 @item -mmac-24
15916 @opindex mmac-24
15917 Passed down to the assembler. Also sets the preprocessor symbol
15918 @code{__Xxmac_24}. This option is deprecated.
15919
15920 @c ARC700 4.10 extension instruction
15921 @item -mrtsc
15922 @opindex mrtsc
15923 Passed down to the assembler to enable the 64-bit time-stamp counter
15924 extension instruction. Also sets the preprocessor symbol
15925 @code{__Xrtsc}. This option is deprecated.
15926
15927 @c ARC700 4.10 extension instruction
15928 @item -mswape
15929 @opindex mswape
15930 Passed down to the assembler to enable the swap byte ordering
15931 extension instruction. Also sets the preprocessor symbol
15932 @code{__Xswape}.
15933
15934 @item -mtelephony
15935 @opindex mtelephony
15936 Passed down to the assembler to enable dual- and single-operand
15937 instructions for telephony. Also sets the preprocessor symbol
15938 @code{__Xtelephony}. This option is deprecated.
15939
15940 @item -mxy
15941 @opindex mxy
15942 Passed down to the assembler to enable the XY memory extension. Also
15943 sets the preprocessor symbol @code{__Xxy}.
15944
15945 @end table
15946
15947 The following options control how the assembly code is annotated:
15948
15949 @c Assembly annotation options
15950 @table @gcctabopt
15951 @item -misize
15952 @opindex misize
15953 Annotate assembler instructions with estimated addresses.
15954
15955 @item -mannotate-align
15956 @opindex mannotate-align
15957 Explain what alignment considerations lead to the decision to make an
15958 instruction short or long.
15959
15960 @end table
15961
15962 The following options are passed through to the linker:
15963
15964 @c options passed through to the linker
15965 @table @gcctabopt
15966 @item -marclinux
15967 @opindex marclinux
15968 Passed through to the linker, to specify use of the @code{arclinux} emulation.
15969 This option is enabled by default in tool chains built for
15970 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
15971 when profiling is not requested.
15972
15973 @item -marclinux_prof
15974 @opindex marclinux_prof
15975 Passed through to the linker, to specify use of the
15976 @code{arclinux_prof} emulation. This option is enabled by default in
15977 tool chains built for @w{@code{arc-linux-uclibc}} and
15978 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
15979
15980 @end table
15981
15982 The following options control the semantics of generated code:
15983
15984 @c semantically relevant code generation options
15985 @table @gcctabopt
15986 @item -mlong-calls
15987 @opindex mlong-calls
15988 Generate calls as register indirect calls, thus providing access
15989 to the full 32-bit address range.
15990
15991 @item -mmedium-calls
15992 @opindex mmedium-calls
15993 Don't use less than 25-bit addressing range for calls, which is the
15994 offset available for an unconditional branch-and-link
15995 instruction. Conditional execution of function calls is suppressed, to
15996 allow use of the 25-bit range, rather than the 21-bit range with
15997 conditional branch-and-link. This is the default for tool chains built
15998 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
15999
16000 @item -G @var{num}
16001 @opindex G
16002 Put definitions of externally-visible data in a small data section if
16003 that data is no bigger than @var{num} bytes. The default value of
16004 @var{num} is 4 for any ARC configuration, or 8 when we have double
16005 load/store operations.
16006
16007 @item -mno-sdata
16008 @opindex mno-sdata
16009 Do not generate sdata references. This is the default for tool chains
16010 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16011 targets.
16012
16013 @item -mvolatile-cache
16014 @opindex mvolatile-cache
16015 Use ordinarily cached memory accesses for volatile references. This is the
16016 default.
16017
16018 @item -mno-volatile-cache
16019 @opindex mno-volatile-cache
16020 Enable cache bypass for volatile references.
16021
16022 @end table
16023
16024 The following options fine tune code generation:
16025 @c code generation tuning options
16026 @table @gcctabopt
16027 @item -malign-call
16028 @opindex malign-call
16029 Do alignment optimizations for call instructions.
16030
16031 @item -mauto-modify-reg
16032 @opindex mauto-modify-reg
16033 Enable the use of pre/post modify with register displacement.
16034
16035 @item -mbbit-peephole
16036 @opindex mbbit-peephole
16037 Enable bbit peephole2.
16038
16039 @item -mno-brcc
16040 @opindex mno-brcc
16041 This option disables a target-specific pass in @file{arc_reorg} to
16042 generate compare-and-branch (@code{br@var{cc}}) instructions.
16043 It has no effect on
16044 generation of these instructions driven by the combiner pass.
16045
16046 @item -mcase-vector-pcrel
16047 @opindex mcase-vector-pcrel
16048 Use PC-relative switch case tables to enable case table shortening.
16049 This is the default for @option{-Os}.
16050
16051 @item -mcompact-casesi
16052 @opindex mcompact-casesi
16053 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16054 and only available for ARCv1 cores. This option is deprecated.
16055
16056 @item -mno-cond-exec
16057 @opindex mno-cond-exec
16058 Disable the ARCompact-specific pass to generate conditional
16059 execution instructions.
16060
16061 Due to delay slot scheduling and interactions between operand numbers,
16062 literal sizes, instruction lengths, and the support for conditional execution,
16063 the target-independent pass to generate conditional execution is often lacking,
16064 so the ARC port has kept a special pass around that tries to find more
16065 conditional execution generation opportunities after register allocation,
16066 branch shortening, and delay slot scheduling have been done. This pass
16067 generally, but not always, improves performance and code size, at the cost of
16068 extra compilation time, which is why there is an option to switch it off.
16069 If you have a problem with call instructions exceeding their allowable
16070 offset range because they are conditionalized, you should consider using
16071 @option{-mmedium-calls} instead.
16072
16073 @item -mearly-cbranchsi
16074 @opindex mearly-cbranchsi
16075 Enable pre-reload use of the @code{cbranchsi} pattern.
16076
16077 @item -mexpand-adddi
16078 @opindex mexpand-adddi
16079 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16080 @code{add.f}, @code{adc} etc. This option is deprecated.
16081
16082 @item -mindexed-loads
16083 @opindex mindexed-loads
16084 Enable the use of indexed loads. This can be problematic because some
16085 optimizers then assume that indexed stores exist, which is not
16086 the case.
16087
16088 @item -mlra
16089 @opindex mlra
16090 Enable Local Register Allocation. This is still experimental for ARC,
16091 so by default the compiler uses standard reload
16092 (i.e.@: @option{-mno-lra}).
16093
16094 @item -mlra-priority-none
16095 @opindex mlra-priority-none
16096 Don't indicate any priority for target registers.
16097
16098 @item -mlra-priority-compact
16099 @opindex mlra-priority-compact
16100 Indicate target register priority for r0..r3 / r12..r15.
16101
16102 @item -mlra-priority-noncompact
16103 @opindex mlra-priority-noncompact
16104 Reduce target register priority for r0..r3 / r12..r15.
16105
16106 @item -mno-millicode
16107 @opindex mno-millicode
16108 When optimizing for size (using @option{-Os}), prologues and epilogues
16109 that have to save or restore a large number of registers are often
16110 shortened by using call to a special function in libgcc; this is
16111 referred to as a @emph{millicode} call. As these calls can pose
16112 performance issues, and/or cause linking issues when linking in a
16113 nonstandard way, this option is provided to turn off millicode call
16114 generation.
16115
16116 @item -mmixed-code
16117 @opindex mmixed-code
16118 Tweak register allocation to help 16-bit instruction generation.
16119 This generally has the effect of decreasing the average instruction size
16120 while increasing the instruction count.
16121
16122 @item -mq-class
16123 @opindex mq-class
16124 Enable @samp{q} instruction alternatives.
16125 This is the default for @option{-Os}.
16126
16127 @item -mRcq
16128 @opindex mRcq
16129 Enable @samp{Rcq} constraint handling.
16130 Most short code generation depends on this.
16131 This is the default.
16132
16133 @item -mRcw
16134 @opindex mRcw
16135 Enable @samp{Rcw} constraint handling.
16136 Most ccfsm condexec mostly depends on this.
16137 This is the default.
16138
16139 @item -msize-level=@var{level}
16140 @opindex msize-level
16141 Fine-tune size optimization with regards to instruction lengths and alignment.
16142 The recognized values for @var{level} are:
16143 @table @samp
16144 @item 0
16145 No size optimization. This level is deprecated and treated like @samp{1}.
16146
16147 @item 1
16148 Short instructions are used opportunistically.
16149
16150 @item 2
16151 In addition, alignment of loops and of code after barriers are dropped.
16152
16153 @item 3
16154 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
16155
16156 @end table
16157
16158 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
16159 the behavior when this is not set is equivalent to level @samp{1}.
16160
16161 @item -mtune=@var{cpu}
16162 @opindex mtune
16163 Set instruction scheduling parameters for @var{cpu}, overriding any implied
16164 by @option{-mcpu=}.
16165
16166 Supported values for @var{cpu} are
16167
16168 @table @samp
16169 @item ARC600
16170 Tune for ARC600 CPU.
16171
16172 @item ARC601
16173 Tune for ARC601 CPU.
16174
16175 @item ARC700
16176 Tune for ARC700 CPU with standard multiplier block.
16177
16178 @item ARC700-xmac
16179 Tune for ARC700 CPU with XMAC block.
16180
16181 @item ARC725D
16182 Tune for ARC725D CPU.
16183
16184 @item ARC750D
16185 Tune for ARC750D CPU.
16186
16187 @end table
16188
16189 @item -mmultcost=@var{num}
16190 @opindex mmultcost
16191 Cost to assume for a multiply instruction, with @samp{4} being equal to a
16192 normal instruction.
16193
16194 @item -munalign-prob-threshold=@var{probability}
16195 @opindex munalign-prob-threshold
16196 Set probability threshold for unaligning branches.
16197 When tuning for @samp{ARC700} and optimizing for speed, branches without
16198 filled delay slot are preferably emitted unaligned and long, unless
16199 profiling indicates that the probability for the branch to be taken
16200 is below @var{probability}. @xref{Cross-profiling}.
16201 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16202
16203 @end table
16204
16205 The following options are maintained for backward compatibility, but
16206 are now deprecated and will be removed in a future release:
16207
16208 @c Deprecated options
16209 @table @gcctabopt
16210
16211 @item -margonaut
16212 @opindex margonaut
16213 Obsolete FPX.
16214
16215 @item -mbig-endian
16216 @opindex mbig-endian
16217 @itemx -EB
16218 @opindex EB
16219 Compile code for big-endian targets. Use of these options is now
16220 deprecated. Big-endian code is supported by configuring GCC to build
16221 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16222 for which big endian is the default.
16223
16224 @item -mlittle-endian
16225 @opindex mlittle-endian
16226 @itemx -EL
16227 @opindex EL
16228 Compile code for little-endian targets. Use of these options is now
16229 deprecated. Little-endian code is supported by configuring GCC to build
16230 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16231 for which little endian is the default.
16232
16233 @item -mbarrel_shifter
16234 @opindex mbarrel_shifter
16235 Replaced by @option{-mbarrel-shifter}.
16236
16237 @item -mdpfp_compact
16238 @opindex mdpfp_compact
16239 Replaced by @option{-mdpfp-compact}.
16240
16241 @item -mdpfp_fast
16242 @opindex mdpfp_fast
16243 Replaced by @option{-mdpfp-fast}.
16244
16245 @item -mdsp_packa
16246 @opindex mdsp_packa
16247 Replaced by @option{-mdsp-packa}.
16248
16249 @item -mEA
16250 @opindex mEA
16251 Replaced by @option{-mea}.
16252
16253 @item -mmac_24
16254 @opindex mmac_24
16255 Replaced by @option{-mmac-24}.
16256
16257 @item -mmac_d16
16258 @opindex mmac_d16
16259 Replaced by @option{-mmac-d16}.
16260
16261 @item -mspfp_compact
16262 @opindex mspfp_compact
16263 Replaced by @option{-mspfp-compact}.
16264
16265 @item -mspfp_fast
16266 @opindex mspfp_fast
16267 Replaced by @option{-mspfp-fast}.
16268
16269 @item -mtune=@var{cpu}
16270 @opindex mtune
16271 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16272 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16273 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16274
16275 @item -multcost=@var{num}
16276 @opindex multcost
16277 Replaced by @option{-mmultcost}.
16278
16279 @end table
16280
16281 @node ARM Options
16282 @subsection ARM Options
16283 @cindex ARM options
16284
16285 These @samp{-m} options are defined for the ARM port:
16286
16287 @table @gcctabopt
16288 @item -mabi=@var{name}
16289 @opindex mabi
16290 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16291 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16292
16293 @item -mapcs-frame
16294 @opindex mapcs-frame
16295 Generate a stack frame that is compliant with the ARM Procedure Call
16296 Standard for all functions, even if this is not strictly necessary for
16297 correct execution of the code. Specifying @option{-fomit-frame-pointer}
16298 with this option causes the stack frames not to be generated for
16299 leaf functions. The default is @option{-mno-apcs-frame}.
16300 This option is deprecated.
16301
16302 @item -mapcs
16303 @opindex mapcs
16304 This is a synonym for @option{-mapcs-frame} and is deprecated.
16305
16306 @ignore
16307 @c not currently implemented
16308 @item -mapcs-stack-check
16309 @opindex mapcs-stack-check
16310 Generate code to check the amount of stack space available upon entry to
16311 every function (that actually uses some stack space). If there is
16312 insufficient space available then either the function
16313 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
16314 called, depending upon the amount of stack space required. The runtime
16315 system is required to provide these functions. The default is
16316 @option{-mno-apcs-stack-check}, since this produces smaller code.
16317
16318 @c not currently implemented
16319 @item -mapcs-reentrant
16320 @opindex mapcs-reentrant
16321 Generate reentrant, position-independent code. The default is
16322 @option{-mno-apcs-reentrant}.
16323 @end ignore
16324
16325 @item -mthumb-interwork
16326 @opindex mthumb-interwork
16327 Generate code that supports calling between the ARM and Thumb
16328 instruction sets. Without this option, on pre-v5 architectures, the
16329 two instruction sets cannot be reliably used inside one program. The
16330 default is @option{-mno-thumb-interwork}, since slightly larger code
16331 is generated when @option{-mthumb-interwork} is specified. In AAPCS
16332 configurations this option is meaningless.
16333
16334 @item -mno-sched-prolog
16335 @opindex mno-sched-prolog
16336 Prevent the reordering of instructions in the function prologue, or the
16337 merging of those instruction with the instructions in the function's
16338 body. This means that all functions start with a recognizable set
16339 of instructions (or in fact one of a choice from a small set of
16340 different function prologues), and this information can be used to
16341 locate the start of functions inside an executable piece of code. The
16342 default is @option{-msched-prolog}.
16343
16344 @item -mfloat-abi=@var{name}
16345 @opindex mfloat-abi
16346 Specifies which floating-point ABI to use. Permissible values
16347 are: @samp{soft}, @samp{softfp} and @samp{hard}.
16348
16349 Specifying @samp{soft} causes GCC to generate output containing
16350 library calls for floating-point operations.
16351 @samp{softfp} allows the generation of code using hardware floating-point
16352 instructions, but still uses the soft-float calling conventions.
16353 @samp{hard} allows generation of floating-point instructions
16354 and uses FPU-specific calling conventions.
16355
16356 The default depends on the specific target configuration. Note that
16357 the hard-float and soft-float ABIs are not link-compatible; you must
16358 compile your entire program with the same ABI, and link with a
16359 compatible set of libraries.
16360
16361 @item -mlittle-endian
16362 @opindex mlittle-endian
16363 Generate code for a processor running in little-endian mode. This is
16364 the default for all standard configurations.
16365
16366 @item -mbig-endian
16367 @opindex mbig-endian
16368 Generate code for a processor running in big-endian mode; the default is
16369 to compile code for a little-endian processor.
16370
16371 @item -mbe8
16372 @itemx -mbe32
16373 @opindex mbe8
16374 When linking a big-endian image select between BE8 and BE32 formats.
16375 The option has no effect for little-endian images and is ignored. The
16376 default is dependent on the selected target architecture. For ARMv6
16377 and later architectures the default is BE8, for older architectures
16378 the default is BE32. BE32 format has been deprecated by ARM.
16379
16380 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16381 @opindex march
16382 This specifies the name of the target ARM architecture. GCC uses this
16383 name to determine what kind of instructions it can emit when generating
16384 assembly code. This option can be used in conjunction with or instead
16385 of the @option{-mcpu=} option.
16386
16387 Permissible names are:
16388 @samp{armv4t},
16389 @samp{armv5t}, @samp{armv5te},
16390 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16391 @samp{armv6z}, @samp{armv6zk},
16392 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16393 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16394 @samp{armv8.4-a},
16395 @samp{armv7-r},
16396 @samp{armv8-r},
16397 @samp{armv6-m}, @samp{armv6s-m},
16398 @samp{armv7-m}, @samp{armv7e-m},
16399 @samp{armv8-m.base}, @samp{armv8-m.main},
16400 @samp{iwmmxt} and @samp{iwmmxt2}.
16401
16402 Additionally, the following architectures, which lack support for the
16403 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16404
16405 Many of the architectures support extensions. These can be added by
16406 appending @samp{+@var{extension}} to the architecture name. Extension
16407 options are processed in order and capabilities accumulate. An extension
16408 will also enable any necessary base extensions
16409 upon which it depends. For example, the @samp{+crypto} extension
16410 will always enable the @samp{+simd} extension. The exception to the
16411 additive construction is for extensions that are prefixed with
16412 @samp{+no@dots{}}: these extensions disable the specified option and
16413 any other extensions that may depend on the presence of that
16414 extension.
16415
16416 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16417 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16418 entirely disabled by the @samp{+nofp} option that follows it.
16419
16420 Most extension names are generically named, but have an effect that is
16421 dependent upon the architecture to which it is applied. For example,
16422 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16423 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16424 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16425 variant for @samp{armv8-a}.
16426
16427 The table below lists the supported extensions for each architecture.
16428 Architectures not mentioned do not support any extensions.
16429
16430 @table @samp
16431 @item armv5te
16432 @itemx armv6
16433 @itemx armv6j
16434 @itemx armv6k
16435 @itemx armv6kz
16436 @itemx armv6t2
16437 @itemx armv6z
16438 @itemx armv6zk
16439 @table @samp
16440 @item +fp
16441 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16442 used as an alias for this extension.
16443
16444 @item +nofp
16445 Disable the floating-point instructions.
16446 @end table
16447
16448 @item armv7
16449 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16450 @table @samp
16451 @item +fp
16452 The VFPv3 floating-point instructions, with 16 double-precision
16453 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16454 for this extension. Note that floating-point is not supported by the
16455 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16456 ARMv7-R architectures.
16457
16458 @item +nofp
16459 Disable the floating-point instructions.
16460 @end table
16461
16462 @item armv7-a
16463 @table @samp
16464 @item +fp
16465 The VFPv3 floating-point instructions, with 16 double-precision
16466 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16467 for this extension.
16468
16469 @item +simd
16470 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16471 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16472 for this extension.
16473
16474 @item +vfpv3
16475 The VFPv3 floating-point instructions, with 32 double-precision
16476 registers.
16477
16478 @item +vfpv3-d16-fp16
16479 The VFPv3 floating-point instructions, with 16 double-precision
16480 registers and the half-precision floating-point conversion operations.
16481
16482 @item +vfpv3-fp16
16483 The VFPv3 floating-point instructions, with 32 double-precision
16484 registers and the half-precision floating-point conversion operations.
16485
16486 @item +vfpv4-d16
16487 The VFPv4 floating-point instructions, with 16 double-precision
16488 registers.
16489
16490 @item +vfpv4
16491 The VFPv4 floating-point instructions, with 32 double-precision
16492 registers.
16493
16494 @item +neon-fp16
16495 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16496 the half-precision floating-point conversion operations.
16497
16498 @item +neon-vfpv4
16499 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16500
16501 @item +nosimd
16502 Disable the Advanced SIMD instructions (does not disable floating point).
16503
16504 @item +nofp
16505 Disable the floating-point and Advanced SIMD instructions.
16506 @end table
16507
16508 @item armv7ve
16509 The extended version of the ARMv7-A architecture with support for
16510 virtualization.
16511 @table @samp
16512 @item +fp
16513 The VFPv4 floating-point instructions, with 16 double-precision registers.
16514 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16515
16516 @item +simd
16517 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16518 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16519
16520 @item +vfpv3-d16
16521 The VFPv3 floating-point instructions, with 16 double-precision
16522 registers.
16523
16524 @item +vfpv3
16525 The VFPv3 floating-point instructions, with 32 double-precision
16526 registers.
16527
16528 @item +vfpv3-d16-fp16
16529 The VFPv3 floating-point instructions, with 16 double-precision
16530 registers and the half-precision floating-point conversion operations.
16531
16532 @item +vfpv3-fp16
16533 The VFPv3 floating-point instructions, with 32 double-precision
16534 registers and the half-precision floating-point conversion operations.
16535
16536 @item +vfpv4-d16
16537 The VFPv4 floating-point instructions, with 16 double-precision
16538 registers.
16539
16540 @item +vfpv4
16541 The VFPv4 floating-point instructions, with 32 double-precision
16542 registers.
16543
16544 @item +neon
16545 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16546 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16547
16548 @item +neon-fp16
16549 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16550 the half-precision floating-point conversion operations.
16551
16552 @item +nosimd
16553 Disable the Advanced SIMD instructions (does not disable floating point).
16554
16555 @item +nofp
16556 Disable the floating-point and Advanced SIMD instructions.
16557 @end table
16558
16559 @item armv8-a
16560 @table @samp
16561 @item +crc
16562 The Cyclic Redundancy Check (CRC) instructions.
16563 @item +simd
16564 The ARMv8-A Advanced SIMD and floating-point instructions.
16565 @item +crypto
16566 The cryptographic instructions.
16567 @item +nocrypto
16568 Disable the cryptographic instructions.
16569 @item +nofp
16570 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16571 @end table
16572
16573 @item armv8.1-a
16574 @table @samp
16575 @item +simd
16576 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16577
16578 @item +crypto
16579 The cryptographic instructions. This also enables the Advanced SIMD and
16580 floating-point instructions.
16581
16582 @item +nocrypto
16583 Disable the cryptographic instructions.
16584
16585 @item +nofp
16586 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16587 @end table
16588
16589 @item armv8.2-a
16590 @itemx armv8.3-a
16591 @table @samp
16592 @item +fp16
16593 The half-precision floating-point data processing instructions.
16594 This also enables the Advanced SIMD and floating-point instructions.
16595
16596 @item +fp16fml
16597 The half-precision floating-point fmla extension. This also enables
16598 the half-precision floating-point extension and Advanced SIMD and
16599 floating-point instructions.
16600
16601 @item +simd
16602 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16603
16604 @item +crypto
16605 The cryptographic instructions. This also enables the Advanced SIMD and
16606 floating-point instructions.
16607
16608 @item +dotprod
16609 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16610
16611 @item +nocrypto
16612 Disable the cryptographic extension.
16613
16614 @item +nofp
16615 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16616 @end table
16617
16618 @item armv8.4-a
16619 @table @samp
16620 @item +fp16
16621 The half-precision floating-point data processing instructions.
16622 This also enables the Advanced SIMD and floating-point instructions as well
16623 as the Dot Product extension and the half-precision floating-point fmla
16624 extension.
16625
16626 @item +simd
16627 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16628 Dot Product extension.
16629
16630 @item +crypto
16631 The cryptographic instructions. This also enables the Advanced SIMD and
16632 floating-point instructions as well as the Dot Product extension.
16633
16634 @item +nocrypto
16635 Disable the cryptographic extension.
16636
16637 @item +nofp
16638 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16639 @end table
16640
16641 @item armv7-r
16642 @table @samp
16643 @item +fp.sp
16644 The single-precision VFPv3 floating-point instructions. The extension
16645 @samp{+vfpv3xd} can be used as an alias for this extension.
16646
16647 @item +fp
16648 The VFPv3 floating-point instructions with 16 double-precision registers.
16649 The extension +vfpv3-d16 can be used as an alias for this extension.
16650
16651 @item +nofp
16652 Disable the floating-point extension.
16653
16654 @item +idiv
16655 The ARM-state integer division instructions.
16656
16657 @item +noidiv
16658 Disable the ARM-state integer division extension.
16659 @end table
16660
16661 @item armv7e-m
16662 @table @samp
16663 @item +fp
16664 The single-precision VFPv4 floating-point instructions.
16665
16666 @item +fpv5
16667 The single-precision FPv5 floating-point instructions.
16668
16669 @item +fp.dp
16670 The single- and double-precision FPv5 floating-point instructions.
16671
16672 @item +nofp
16673 Disable the floating-point extensions.
16674 @end table
16675
16676 @item armv8-m.main
16677 @table @samp
16678 @item +dsp
16679 The DSP instructions.
16680
16681 @item +nodsp
16682 Disable the DSP extension.
16683
16684 @item +fp
16685 The single-precision floating-point instructions.
16686
16687 @item +fp.dp
16688 The single- and double-precision floating-point instructions.
16689
16690 @item +nofp
16691 Disable the floating-point extension.
16692 @end table
16693
16694 @item armv8-r
16695 @table @samp
16696 @item +crc
16697 The Cyclic Redundancy Check (CRC) instructions.
16698 @item +fp.sp
16699 The single-precision FPv5 floating-point instructions.
16700 @item +simd
16701 The ARMv8-A Advanced SIMD and floating-point instructions.
16702 @item +crypto
16703 The cryptographic instructions.
16704 @item +nocrypto
16705 Disable the cryptographic instructions.
16706 @item +nofp
16707 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16708 @end table
16709
16710 @end table
16711
16712 @option{-march=native} causes the compiler to auto-detect the architecture
16713 of the build computer. At present, this feature is only supported on
16714 GNU/Linux, and not all architectures are recognized. If the auto-detect
16715 is unsuccessful the option has no effect.
16716
16717 @item -mtune=@var{name}
16718 @opindex mtune
16719 This option specifies the name of the target ARM processor for
16720 which GCC should tune the performance of the code.
16721 For some ARM implementations better performance can be obtained by using
16722 this option.
16723 Permissible names are: @samp{arm2}, @samp{arm250},
16724 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16725 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16726 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16727 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16728 @samp{arm720},
16729 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16730 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16731 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16732 @samp{strongarm1110},
16733 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16734 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16735 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16736 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16737 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16738 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16739 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16740 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16741 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16742 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16743 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16744 @samp{cortex-a76}, @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
16745 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
16746 @samp{cortex-m33},
16747 @samp{cortex-m23},
16748 @samp{cortex-m7},
16749 @samp{cortex-m4},
16750 @samp{cortex-m3},
16751 @samp{cortex-m1},
16752 @samp{cortex-m0},
16753 @samp{cortex-m0plus},
16754 @samp{cortex-m1.small-multiply},
16755 @samp{cortex-m0.small-multiply},
16756 @samp{cortex-m0plus.small-multiply},
16757 @samp{exynos-m1},
16758 @samp{marvell-pj4},
16759 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16760 @samp{fa526}, @samp{fa626},
16761 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16762 @samp{xgene1}.
16763
16764 Additionally, this option can specify that GCC should tune the performance
16765 of the code for a big.LITTLE system. Permissible names are:
16766 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16767 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16768 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16769 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
16770
16771 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16772 performance for a blend of processors within architecture @var{arch}.
16773 The aim is to generate code that run well on the current most popular
16774 processors, balancing between optimizations that benefit some CPUs in the
16775 range, and avoiding performance pitfalls of other CPUs. The effects of
16776 this option may change in future GCC versions as CPU models come and go.
16777
16778 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16779 the extension options do not affect the tuning of the generated code.
16780
16781 @option{-mtune=native} causes the compiler to auto-detect the CPU
16782 of the build computer. At present, this feature is only supported on
16783 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16784 unsuccessful the option has no effect.
16785
16786 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16787 @opindex mcpu
16788 This specifies the name of the target ARM processor. GCC uses this name
16789 to derive the name of the target ARM architecture (as if specified
16790 by @option{-march}) and the ARM processor type for which to tune for
16791 performance (as if specified by @option{-mtune}). Where this option
16792 is used in conjunction with @option{-march} or @option{-mtune},
16793 those options take precedence over the appropriate part of this option.
16794
16795 Many of the supported CPUs implement optional architectural
16796 extensions. Where this is so the architectural extensions are
16797 normally enabled by default. If implementations that lack the
16798 extension exist, then the extension syntax can be used to disable
16799 those extensions that have been omitted. For floating-point and
16800 Advanced SIMD (Neon) instructions, the settings of the options
16801 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16802 floating-point and Advanced SIMD instructions will only be used if
16803 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16804 @option{-mfpu} other than @samp{auto} will override the available
16805 floating-point and SIMD extension instructions.
16806
16807 For example, @samp{cortex-a9} can be found in three major
16808 configurations: integer only, with just a floating-point unit or with
16809 floating-point and Advanced SIMD. The default is to enable all the
16810 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16811 be used to disable just the SIMD or both the SIMD and floating-point
16812 instructions respectively.
16813
16814 Permissible names for this option are the same as those for
16815 @option{-mtune}.
16816
16817 The following extension options are common to the listed CPUs:
16818
16819 @table @samp
16820 @item +nodsp
16821 Disable the DSP instructions on @samp{cortex-m33}.
16822
16823 @item +nofp
16824 Disables the floating-point instructions on @samp{arm9e},
16825 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16826 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16827 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16828 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16829 Disables the floating-point and SIMD instructions on
16830 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16831 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16832 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16833 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16834 @samp{cortex-a53} and @samp{cortex-a55}.
16835
16836 @item +nofp.dp
16837 Disables the double-precision component of the floating-point instructions
16838 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16839
16840 @item +nosimd
16841 Disables the SIMD (but not floating-point) instructions on
16842 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16843 and @samp{cortex-a9}.
16844
16845 @item +crypto
16846 Enables the cryptographic instructions on @samp{cortex-a32},
16847 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16848 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16849 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16850 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16851 @samp{cortex-a75.cortex-a55}.
16852 @end table
16853
16854 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16855 VFPv3 with 16 double-precision registers. It supports the following
16856 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16857 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16858 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16859 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16860 @option{-march=armv7-a}.
16861
16862 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16863 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16864 See @option{-mtune} for more information.
16865
16866 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16867 of the build computer. At present, this feature is only supported on
16868 GNU/Linux, and not all architectures are recognized. If the auto-detect
16869 is unsuccessful the option has no effect.
16870
16871 @item -mfpu=@var{name}
16872 @opindex mfpu
16873 This specifies what floating-point hardware (or hardware emulation) is
16874 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16875 @samp{vfpv3},
16876 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16877 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16878 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16879 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16880 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16881 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16882 is an alias for @samp{vfpv2}.
16883
16884 The setting @samp{auto} is the default and is special. It causes the
16885 compiler to select the floating-point and Advanced SIMD instructions
16886 based on the settings of @option{-mcpu} and @option{-march}.
16887
16888 If the selected floating-point hardware includes the NEON extension
16889 (e.g.@: @option{-mfpu=neon}), note that floating-point
16890 operations are not generated by GCC's auto-vectorization pass unless
16891 @option{-funsafe-math-optimizations} is also specified. This is
16892 because NEON hardware does not fully implement the IEEE 754 standard for
16893 floating-point arithmetic (in particular denormal values are treated as
16894 zero), so the use of NEON instructions may lead to a loss of precision.
16895
16896 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}).
16897
16898 @item -mfp16-format=@var{name}
16899 @opindex mfp16-format
16900 Specify the format of the @code{__fp16} half-precision floating-point type.
16901 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
16902 the default is @samp{none}, in which case the @code{__fp16} type is not
16903 defined. @xref{Half-Precision}, for more information.
16904
16905 @item -mstructure-size-boundary=@var{n}
16906 @opindex mstructure-size-boundary
16907 The sizes of all structures and unions are rounded up to a multiple
16908 of the number of bits set by this option. Permissible values are 8, 32
16909 and 64. The default value varies for different toolchains. For the COFF
16910 targeted toolchain the default value is 8. A value of 64 is only allowed
16911 if the underlying ABI supports it.
16912
16913 Specifying a larger number can produce faster, more efficient code, but
16914 can also increase the size of the program. Different values are potentially
16915 incompatible. Code compiled with one value cannot necessarily expect to
16916 work with code or libraries compiled with another value, if they exchange
16917 information using structures or unions.
16918
16919 This option is deprecated.
16920
16921 @item -mabort-on-noreturn
16922 @opindex mabort-on-noreturn
16923 Generate a call to the function @code{abort} at the end of a
16924 @code{noreturn} function. It is executed if the function tries to
16925 return.
16926
16927 @item -mlong-calls
16928 @itemx -mno-long-calls
16929 @opindex mlong-calls
16930 @opindex mno-long-calls
16931 Tells the compiler to perform function calls by first loading the
16932 address of the function into a register and then performing a subroutine
16933 call on this register. This switch is needed if the target function
16934 lies outside of the 64-megabyte addressing range of the offset-based
16935 version of subroutine call instruction.
16936
16937 Even if this switch is enabled, not all function calls are turned
16938 into long calls. The heuristic is that static functions, functions
16939 that have the @code{short_call} attribute, functions that are inside
16940 the scope of a @code{#pragma no_long_calls} directive, and functions whose
16941 definitions have already been compiled within the current compilation
16942 unit are not turned into long calls. The exceptions to this rule are
16943 that weak function definitions, functions with the @code{long_call}
16944 attribute or the @code{section} attribute, and functions that are within
16945 the scope of a @code{#pragma long_calls} directive are always
16946 turned into long calls.
16947
16948 This feature is not enabled by default. Specifying
16949 @option{-mno-long-calls} restores the default behavior, as does
16950 placing the function calls within the scope of a @code{#pragma
16951 long_calls_off} directive. Note these switches have no effect on how
16952 the compiler generates code to handle function calls via function
16953 pointers.
16954
16955 @item -msingle-pic-base
16956 @opindex msingle-pic-base
16957 Treat the register used for PIC addressing as read-only, rather than
16958 loading it in the prologue for each function. The runtime system is
16959 responsible for initializing this register with an appropriate value
16960 before execution begins.
16961
16962 @item -mpic-register=@var{reg}
16963 @opindex mpic-register
16964 Specify the register to be used for PIC addressing.
16965 For standard PIC base case, the default is any suitable register
16966 determined by compiler. For single PIC base case, the default is
16967 @samp{R9} if target is EABI based or stack-checking is enabled,
16968 otherwise the default is @samp{R10}.
16969
16970 @item -mpic-data-is-text-relative
16971 @opindex mpic-data-is-text-relative
16972 Assume that the displacement between the text and data segments is fixed
16973 at static link time. This permits using PC-relative addressing
16974 operations to access data known to be in the data segment. For
16975 non-VxWorks RTP targets, this option is enabled by default. When
16976 disabled on such targets, it will enable @option{-msingle-pic-base} by
16977 default.
16978
16979 @item -mpoke-function-name
16980 @opindex mpoke-function-name
16981 Write the name of each function into the text section, directly
16982 preceding the function prologue. The generated code is similar to this:
16983
16984 @smallexample
16985 t0
16986 .ascii "arm_poke_function_name", 0
16987 .align
16988 t1
16989 .word 0xff000000 + (t1 - t0)
16990 arm_poke_function_name
16991 mov ip, sp
16992 stmfd sp!, @{fp, ip, lr, pc@}
16993 sub fp, ip, #4
16994 @end smallexample
16995
16996 When performing a stack backtrace, code can inspect the value of
16997 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
16998 location @code{pc - 12} and the top 8 bits are set, then we know that
16999 there is a function name embedded immediately preceding this location
17000 and has length @code{((pc[-3]) & 0xff000000)}.
17001
17002 @item -mthumb
17003 @itemx -marm
17004 @opindex marm
17005 @opindex mthumb
17006
17007 Select between generating code that executes in ARM and Thumb
17008 states. The default for most configurations is to generate code
17009 that executes in ARM state, but the default can be changed by
17010 configuring GCC with the @option{--with-mode=}@var{state}
17011 configure option.
17012
17013 You can also override the ARM and Thumb mode for each function
17014 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17015 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17016
17017 @item -mflip-thumb
17018 @opindex mflip-thumb
17019 Switch ARM/Thumb modes on alternating functions.
17020 This option is provided for regression testing of mixed Thumb/ARM code
17021 generation, and is not intended for ordinary use in compiling code.
17022
17023 @item -mtpcs-frame
17024 @opindex mtpcs-frame
17025 Generate a stack frame that is compliant with the Thumb Procedure Call
17026 Standard for all non-leaf functions. (A leaf function is one that does
17027 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17028
17029 @item -mtpcs-leaf-frame
17030 @opindex mtpcs-leaf-frame
17031 Generate a stack frame that is compliant with the Thumb Procedure Call
17032 Standard for all leaf functions. (A leaf function is one that does
17033 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17034
17035 @item -mcallee-super-interworking
17036 @opindex mcallee-super-interworking
17037 Gives all externally visible functions in the file being compiled an ARM
17038 instruction set header which switches to Thumb mode before executing the
17039 rest of the function. This allows these functions to be called from
17040 non-interworking code. This option is not valid in AAPCS configurations
17041 because interworking is enabled by default.
17042
17043 @item -mcaller-super-interworking
17044 @opindex mcaller-super-interworking
17045 Allows calls via function pointers (including virtual functions) to
17046 execute correctly regardless of whether the target code has been
17047 compiled for interworking or not. There is a small overhead in the cost
17048 of executing a function pointer if this option is enabled. This option
17049 is not valid in AAPCS configurations because interworking is enabled
17050 by default.
17051
17052 @item -mtp=@var{name}
17053 @opindex mtp
17054 Specify the access model for the thread local storage pointer. The valid
17055 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17056 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17057 (supported in the arm6k architecture), and @samp{auto}, which uses the
17058 best available method for the selected processor. The default setting is
17059 @samp{auto}.
17060
17061 @item -mtls-dialect=@var{dialect}
17062 @opindex mtls-dialect
17063 Specify the dialect to use for accessing thread local storage. Two
17064 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17065 @samp{gnu} dialect selects the original GNU scheme for supporting
17066 local and global dynamic TLS models. The @samp{gnu2} dialect
17067 selects the GNU descriptor scheme, which provides better performance
17068 for shared libraries. The GNU descriptor scheme is compatible with
17069 the original scheme, but does require new assembler, linker and
17070 library support. Initial and local exec TLS models are unaffected by
17071 this option and always use the original scheme.
17072
17073 @item -mword-relocations
17074 @opindex mword-relocations
17075 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
17076 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
17077 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
17078 is specified. This option conflicts with @option{-mslow-flash-data}.
17079
17080 @item -mfix-cortex-m3-ldrd
17081 @opindex mfix-cortex-m3-ldrd
17082 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
17083 with overlapping destination and base registers are used. This option avoids
17084 generating these instructions. This option is enabled by default when
17085 @option{-mcpu=cortex-m3} is specified.
17086
17087 @item -munaligned-access
17088 @itemx -mno-unaligned-access
17089 @opindex munaligned-access
17090 @opindex mno-unaligned-access
17091 Enables (or disables) reading and writing of 16- and 32- bit values
17092 from addresses that are not 16- or 32- bit aligned. By default
17093 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
17094 ARMv8-M Baseline architectures, and enabled for all other
17095 architectures. If unaligned access is not enabled then words in packed
17096 data structures are accessed a byte at a time.
17097
17098 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
17099 generated object file to either true or false, depending upon the
17100 setting of this option. If unaligned access is enabled then the
17101 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
17102 defined.
17103
17104 @item -mneon-for-64bits
17105 @opindex mneon-for-64bits
17106 Enables using Neon to handle scalar 64-bits operations. This is
17107 disabled by default since the cost of moving data from core registers
17108 to Neon is high.
17109
17110 @item -mslow-flash-data
17111 @opindex mslow-flash-data
17112 Assume loading data from flash is slower than fetching instruction.
17113 Therefore literal load is minimized for better performance.
17114 This option is only supported when compiling for ARMv7 M-profile and
17115 off by default. It conflicts with @option{-mword-relocations}.
17116
17117 @item -masm-syntax-unified
17118 @opindex masm-syntax-unified
17119 Assume inline assembler is using unified asm syntax. The default is
17120 currently off which implies divided syntax. This option has no impact
17121 on Thumb2. However, this may change in future releases of GCC.
17122 Divided syntax should be considered deprecated.
17123
17124 @item -mrestrict-it
17125 @opindex mrestrict-it
17126 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
17127 IT blocks can only contain a single 16-bit instruction from a select
17128 set of instructions. This option is on by default for ARMv8-A Thumb mode.
17129
17130 @item -mprint-tune-info
17131 @opindex mprint-tune-info
17132 Print CPU tuning information as comment in assembler file. This is
17133 an option used only for regression testing of the compiler and not
17134 intended for ordinary use in compiling code. This option is disabled
17135 by default.
17136
17137 @item -mverbose-cost-dump
17138 @opindex mverbose-cost-dump
17139 Enable verbose cost model dumping in the debug dump files. This option is
17140 provided for use in debugging the compiler.
17141
17142 @item -mpure-code
17143 @opindex mpure-code
17144 Do not allow constant data to be placed in code sections.
17145 Additionally, when compiling for ELF object format give all text sections the
17146 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
17147 is only available when generating non-pic code for M-profile targets with the
17148 MOVT instruction.
17149
17150 @item -mcmse
17151 @opindex mcmse
17152 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
17153 Development Tools Engineering Specification", which can be found on
17154 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
17155 @end table
17156
17157 @node AVR Options
17158 @subsection AVR Options
17159 @cindex AVR Options
17160
17161 These options are defined for AVR implementations:
17162
17163 @table @gcctabopt
17164 @item -mmcu=@var{mcu}
17165 @opindex mmcu
17166 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
17167
17168 The default for this option is@tie{}@samp{avr2}.
17169
17170 GCC supports the following AVR devices and ISAs:
17171
17172 @include avr-mmcu.texi
17173
17174 @item -mabsdata
17175 @opindex mabsdata
17176
17177 Assume that all data in static storage can be accessed by LDS / STS
17178 instructions. This option has only an effect on reduced Tiny devices like
17179 ATtiny40. See also the @code{absdata}
17180 @ref{AVR Variable Attributes,variable attribute}.
17181
17182 @item -maccumulate-args
17183 @opindex maccumulate-args
17184 Accumulate outgoing function arguments and acquire/release the needed
17185 stack space for outgoing function arguments once in function
17186 prologue/epilogue. Without this option, outgoing arguments are pushed
17187 before calling a function and popped afterwards.
17188
17189 Popping the arguments after the function call can be expensive on
17190 AVR so that accumulating the stack space might lead to smaller
17191 executables because arguments need not be removed from the
17192 stack after such a function call.
17193
17194 This option can lead to reduced code size for functions that perform
17195 several calls to functions that get their arguments on the stack like
17196 calls to printf-like functions.
17197
17198 @item -mbranch-cost=@var{cost}
17199 @opindex mbranch-cost
17200 Set the branch costs for conditional branch instructions to
17201 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17202 integers. The default branch cost is 0.
17203
17204 @item -mcall-prologues
17205 @opindex mcall-prologues
17206 Functions prologues/epilogues are expanded as calls to appropriate
17207 subroutines. Code size is smaller.
17208
17209 @item -mgas-isr-prologues
17210 @opindex mgas-isr-prologues
17211 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17212 instruction supported by GNU Binutils.
17213 If this option is on, the feature can still be disabled for individual
17214 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17215 function attribute. This feature is activated per default
17216 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17217 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17218
17219 @item -mint8
17220 @opindex mint8
17221 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17222 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17223 and @code{long long} is 4 bytes. Please note that this option does not
17224 conform to the C standards, but it results in smaller code
17225 size.
17226
17227 @item -mmain-is-OS_task
17228 @opindex mmain-is-OS_task
17229 Do not save registers in @code{main}. The effect is the same like
17230 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17231 to @code{main}. It is activated per default if optimization is on.
17232
17233 @item -mn-flash=@var{num}
17234 @opindex mn-flash
17235 Assume that the flash memory has a size of
17236 @var{num} times 64@tie{}KiB.
17237
17238 @item -mno-interrupts
17239 @opindex mno-interrupts
17240 Generated code is not compatible with hardware interrupts.
17241 Code size is smaller.
17242
17243 @item -mrelax
17244 @opindex mrelax
17245 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17246 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17247 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17248 the assembler's command line and the @option{--relax} option to the
17249 linker's command line.
17250
17251 Jump relaxing is performed by the linker because jump offsets are not
17252 known before code is located. Therefore, the assembler code generated by the
17253 compiler is the same, but the instructions in the executable may
17254 differ from instructions in the assembler code.
17255
17256 Relaxing must be turned on if linker stubs are needed, see the
17257 section on @code{EIND} and linker stubs below.
17258
17259 @item -mrmw
17260 @opindex mrmw
17261 Assume that the device supports the Read-Modify-Write
17262 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
17263
17264 @item -mshort-calls
17265 @opindex mshort-calls
17266
17267 Assume that @code{RJMP} and @code{RCALL} can target the whole
17268 program memory.
17269
17270 This option is used internally for multilib selection. It is
17271 not an optimization option, and you don't need to set it by hand.
17272
17273 @item -msp8
17274 @opindex msp8
17275 Treat the stack pointer register as an 8-bit register,
17276 i.e.@: assume the high byte of the stack pointer is zero.
17277 In general, you don't need to set this option by hand.
17278
17279 This option is used internally by the compiler to select and
17280 build multilibs for architectures @code{avr2} and @code{avr25}.
17281 These architectures mix devices with and without @code{SPH}.
17282 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
17283 the compiler driver adds or removes this option from the compiler
17284 proper's command line, because the compiler then knows if the device
17285 or architecture has an 8-bit stack pointer and thus no @code{SPH}
17286 register or not.
17287
17288 @item -mstrict-X
17289 @opindex mstrict-X
17290 Use address register @code{X} in a way proposed by the hardware. This means
17291 that @code{X} is only used in indirect, post-increment or
17292 pre-decrement addressing.
17293
17294 Without this option, the @code{X} register may be used in the same way
17295 as @code{Y} or @code{Z} which then is emulated by additional
17296 instructions.
17297 For example, loading a value with @code{X+const} addressing with a
17298 small non-negative @code{const < 64} to a register @var{Rn} is
17299 performed as
17300
17301 @example
17302 adiw r26, const ; X += const
17303 ld @var{Rn}, X ; @var{Rn} = *X
17304 sbiw r26, const ; X -= const
17305 @end example
17306
17307 @item -mtiny-stack
17308 @opindex mtiny-stack
17309 Only change the lower 8@tie{}bits of the stack pointer.
17310
17311 @item -mfract-convert-truncate
17312 @opindex mfract-convert-truncate
17313 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
17314
17315 @item -nodevicelib
17316 @opindex nodevicelib
17317 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
17318
17319 @item -Waddr-space-convert
17320 @opindex Waddr-space-convert
17321 @opindex Wno-addr-space-convert
17322 Warn about conversions between address spaces in the case where the
17323 resulting address space is not contained in the incoming address space.
17324
17325 @item -Wmisspelled-isr
17326 @opindex Wmisspelled-isr
17327 @opindex Wno-misspelled-isr
17328 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
17329 Enabled by default.
17330 @end table
17331
17332 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
17333 @cindex @code{EIND}
17334 Pointers in the implementation are 16@tie{}bits wide.
17335 The address of a function or label is represented as word address so
17336 that indirect jumps and calls can target any code address in the
17337 range of 64@tie{}Ki words.
17338
17339 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
17340 bytes of program memory space, there is a special function register called
17341 @code{EIND} that serves as most significant part of the target address
17342 when @code{EICALL} or @code{EIJMP} instructions are used.
17343
17344 Indirect jumps and calls on these devices are handled as follows by
17345 the compiler and are subject to some limitations:
17346
17347 @itemize @bullet
17348
17349 @item
17350 The compiler never sets @code{EIND}.
17351
17352 @item
17353 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
17354 instructions or might read @code{EIND} directly in order to emulate an
17355 indirect call/jump by means of a @code{RET} instruction.
17356
17357 @item
17358 The compiler assumes that @code{EIND} never changes during the startup
17359 code or during the application. In particular, @code{EIND} is not
17360 saved/restored in function or interrupt service routine
17361 prologue/epilogue.
17362
17363 @item
17364 For indirect calls to functions and computed goto, the linker
17365 generates @emph{stubs}. Stubs are jump pads sometimes also called
17366 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
17367 The stub contains a direct jump to the desired address.
17368
17369 @item
17370 Linker relaxation must be turned on so that the linker generates
17371 the stubs correctly in all situations. See the compiler option
17372 @option{-mrelax} and the linker option @option{--relax}.
17373 There are corner cases where the linker is supposed to generate stubs
17374 but aborts without relaxation and without a helpful error message.
17375
17376 @item
17377 The default linker script is arranged for code with @code{EIND = 0}.
17378 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17379 linker script has to be used in order to place the sections whose
17380 name start with @code{.trampolines} into the segment where @code{EIND}
17381 points to.
17382
17383 @item
17384 The startup code from libgcc never sets @code{EIND}.
17385 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17386 For the impact of AVR-LibC on @code{EIND}, see the
17387 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17388
17389 @item
17390 It is legitimate for user-specific startup code to set up @code{EIND}
17391 early, for example by means of initialization code located in
17392 section @code{.init3}. Such code runs prior to general startup code
17393 that initializes RAM and calls constructors, but after the bit
17394 of startup code from AVR-LibC that sets @code{EIND} to the segment
17395 where the vector table is located.
17396 @example
17397 #include <avr/io.h>
17398
17399 static void
17400 __attribute__((section(".init3"),naked,used,no_instrument_function))
17401 init3_set_eind (void)
17402 @{
17403 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17404 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17405 @}
17406 @end example
17407
17408 @noindent
17409 The @code{__trampolines_start} symbol is defined in the linker script.
17410
17411 @item
17412 Stubs are generated automatically by the linker if
17413 the following two conditions are met:
17414 @itemize @minus
17415
17416 @item The address of a label is taken by means of the @code{gs} modifier
17417 (short for @emph{generate stubs}) like so:
17418 @example
17419 LDI r24, lo8(gs(@var{func}))
17420 LDI r25, hi8(gs(@var{func}))
17421 @end example
17422 @item The final location of that label is in a code segment
17423 @emph{outside} the segment where the stubs are located.
17424 @end itemize
17425
17426 @item
17427 The compiler emits such @code{gs} modifiers for code labels in the
17428 following situations:
17429 @itemize @minus
17430 @item Taking address of a function or code label.
17431 @item Computed goto.
17432 @item If prologue-save function is used, see @option{-mcall-prologues}
17433 command-line option.
17434 @item Switch/case dispatch tables. If you do not want such dispatch
17435 tables you can specify the @option{-fno-jump-tables} command-line option.
17436 @item C and C++ constructors/destructors called during startup/shutdown.
17437 @item If the tools hit a @code{gs()} modifier explained above.
17438 @end itemize
17439
17440 @item
17441 Jumping to non-symbolic addresses like so is @emph{not} supported:
17442
17443 @example
17444 int main (void)
17445 @{
17446 /* Call function at word address 0x2 */
17447 return ((int(*)(void)) 0x2)();
17448 @}
17449 @end example
17450
17451 Instead, a stub has to be set up, i.e.@: the function has to be called
17452 through a symbol (@code{func_4} in the example):
17453
17454 @example
17455 int main (void)
17456 @{
17457 extern int func_4 (void);
17458
17459 /* Call function at byte address 0x4 */
17460 return func_4();
17461 @}
17462 @end example
17463
17464 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17465 Alternatively, @code{func_4} can be defined in the linker script.
17466 @end itemize
17467
17468 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17469 @cindex @code{RAMPD}
17470 @cindex @code{RAMPX}
17471 @cindex @code{RAMPY}
17472 @cindex @code{RAMPZ}
17473 Some AVR devices support memories larger than the 64@tie{}KiB range
17474 that can be accessed with 16-bit pointers. To access memory locations
17475 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17476 register is used as high part of the address:
17477 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17478 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17479 register, respectively, to get a wide address. Similarly,
17480 @code{RAMPD} is used together with direct addressing.
17481
17482 @itemize
17483 @item
17484 The startup code initializes the @code{RAMP} special function
17485 registers with zero.
17486
17487 @item
17488 If a @ref{AVR Named Address Spaces,named address space} other than
17489 generic or @code{__flash} is used, then @code{RAMPZ} is set
17490 as needed before the operation.
17491
17492 @item
17493 If the device supports RAM larger than 64@tie{}KiB and the compiler
17494 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17495 is reset to zero after the operation.
17496
17497 @item
17498 If the device comes with a specific @code{RAMP} register, the ISR
17499 prologue/epilogue saves/restores that SFR and initializes it with
17500 zero in case the ISR code might (implicitly) use it.
17501
17502 @item
17503 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17504 If you use inline assembler to read from locations outside the
17505 16-bit address range and change one of the @code{RAMP} registers,
17506 you must reset it to zero after the access.
17507
17508 @end itemize
17509
17510 @subsubsection AVR Built-in Macros
17511
17512 GCC defines several built-in macros so that the user code can test
17513 for the presence or absence of features. Almost any of the following
17514 built-in macros are deduced from device capabilities and thus
17515 triggered by the @option{-mmcu=} command-line option.
17516
17517 For even more AVR-specific built-in macros see
17518 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17519
17520 @table @code
17521
17522 @item __AVR_ARCH__
17523 Build-in macro that resolves to a decimal number that identifies the
17524 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17525 Possible values are:
17526
17527 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17528 @code{4}, @code{5}, @code{51}, @code{6}
17529
17530 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17531 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17532
17533 respectively and
17534
17535 @code{100},
17536 @code{102}, @code{103}, @code{104},
17537 @code{105}, @code{106}, @code{107}
17538
17539 for @var{mcu}=@code{avrtiny},
17540 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17541 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17542 If @var{mcu} specifies a device, this built-in macro is set
17543 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17544 defined to @code{4}.
17545
17546 @item __AVR_@var{Device}__
17547 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17548 the device's name. For example, @option{-mmcu=atmega8} defines the
17549 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17550 @code{__AVR_ATtiny261A__}, etc.
17551
17552 The built-in macros' names follow
17553 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17554 the device name as from the AVR user manual. The difference between
17555 @var{Device} in the built-in macro and @var{device} in
17556 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17557
17558 If @var{device} is not a device but only a core architecture like
17559 @samp{avr51}, this macro is not defined.
17560
17561 @item __AVR_DEVICE_NAME__
17562 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17563 the device's name. For example, with @option{-mmcu=atmega8} the macro
17564 is defined to @code{atmega8}.
17565
17566 If @var{device} is not a device but only a core architecture like
17567 @samp{avr51}, this macro is not defined.
17568
17569 @item __AVR_XMEGA__
17570 The device / architecture belongs to the XMEGA family of devices.
17571
17572 @item __AVR_HAVE_ELPM__
17573 The device has the @code{ELPM} instruction.
17574
17575 @item __AVR_HAVE_ELPMX__
17576 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
17577 R@var{n},Z+} instructions.
17578
17579 @item __AVR_HAVE_MOVW__
17580 The device has the @code{MOVW} instruction to perform 16-bit
17581 register-register moves.
17582
17583 @item __AVR_HAVE_LPMX__
17584 The device has the @code{LPM R@var{n},Z} and
17585 @code{LPM R@var{n},Z+} instructions.
17586
17587 @item __AVR_HAVE_MUL__
17588 The device has a hardware multiplier.
17589
17590 @item __AVR_HAVE_JMP_CALL__
17591 The device has the @code{JMP} and @code{CALL} instructions.
17592 This is the case for devices with more than 8@tie{}KiB of program
17593 memory.
17594
17595 @item __AVR_HAVE_EIJMP_EICALL__
17596 @itemx __AVR_3_BYTE_PC__
17597 The device has the @code{EIJMP} and @code{EICALL} instructions.
17598 This is the case for devices with more than 128@tie{}KiB of program memory.
17599 This also means that the program counter
17600 (PC) is 3@tie{}bytes wide.
17601
17602 @item __AVR_2_BYTE_PC__
17603 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
17604 with up to 128@tie{}KiB of program memory.
17605
17606 @item __AVR_HAVE_8BIT_SP__
17607 @itemx __AVR_HAVE_16BIT_SP__
17608 The stack pointer (SP) register is treated as 8-bit respectively
17609 16-bit register by the compiler.
17610 The definition of these macros is affected by @option{-mtiny-stack}.
17611
17612 @item __AVR_HAVE_SPH__
17613 @itemx __AVR_SP8__
17614 The device has the SPH (high part of stack pointer) special function
17615 register or has an 8-bit stack pointer, respectively.
17616 The definition of these macros is affected by @option{-mmcu=} and
17617 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17618 by @option{-msp8}.
17619
17620 @item __AVR_HAVE_RAMPD__
17621 @itemx __AVR_HAVE_RAMPX__
17622 @itemx __AVR_HAVE_RAMPY__
17623 @itemx __AVR_HAVE_RAMPZ__
17624 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17625 @code{RAMPZ} special function register, respectively.
17626
17627 @item __NO_INTERRUPTS__
17628 This macro reflects the @option{-mno-interrupts} command-line option.
17629
17630 @item __AVR_ERRATA_SKIP__
17631 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17632 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17633 instructions because of a hardware erratum. Skip instructions are
17634 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17635 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17636 set.
17637
17638 @item __AVR_ISA_RMW__
17639 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17640
17641 @item __AVR_SFR_OFFSET__=@var{offset}
17642 Instructions that can address I/O special function registers directly
17643 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17644 address as if addressed by an instruction to access RAM like @code{LD}
17645 or @code{STS}. This offset depends on the device architecture and has
17646 to be subtracted from the RAM address in order to get the
17647 respective I/O@tie{}address.
17648
17649 @item __AVR_SHORT_CALLS__
17650 The @option{-mshort-calls} command line option is set.
17651
17652 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17653 Some devices support reading from flash memory by means of @code{LD*}
17654 instructions. The flash memory is seen in the data address space
17655 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17656 is not defined, this feature is not available. If defined,
17657 the address space is linear and there is no need to put
17658 @code{.rodata} into RAM. This is handled by the default linker
17659 description file, and is currently available for
17660 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17661 there is no need to use address spaces like @code{__flash} or
17662 features like attribute @code{progmem} and @code{pgm_read_*}.
17663
17664 @item __WITH_AVRLIBC__
17665 The compiler is configured to be used together with AVR-Libc.
17666 See the @option{--with-avrlibc} configure option.
17667
17668 @end table
17669
17670 @node Blackfin Options
17671 @subsection Blackfin Options
17672 @cindex Blackfin Options
17673
17674 @table @gcctabopt
17675 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17676 @opindex mcpu=
17677 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17678 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17679 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17680 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17681 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17682 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17683 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17684 @samp{bf561}, @samp{bf592}.
17685
17686 The optional @var{sirevision} specifies the silicon revision of the target
17687 Blackfin processor. Any workarounds available for the targeted silicon revision
17688 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17689 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17690 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17691 hexadecimal digits representing the major and minor numbers in the silicon
17692 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17693 is not defined. If @var{sirevision} is @samp{any}, the
17694 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17695 If this optional @var{sirevision} is not used, GCC assumes the latest known
17696 silicon revision of the targeted Blackfin processor.
17697
17698 GCC defines a preprocessor macro for the specified @var{cpu}.
17699 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17700 provided by libgloss to be linked in if @option{-msim} is not given.
17701
17702 Without this option, @samp{bf532} is used as the processor by default.
17703
17704 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17705 only the preprocessor macro is defined.
17706
17707 @item -msim
17708 @opindex msim
17709 Specifies that the program will be run on the simulator. This causes
17710 the simulator BSP provided by libgloss to be linked in. This option
17711 has effect only for @samp{bfin-elf} toolchain.
17712 Certain other options, such as @option{-mid-shared-library} and
17713 @option{-mfdpic}, imply @option{-msim}.
17714
17715 @item -momit-leaf-frame-pointer
17716 @opindex momit-leaf-frame-pointer
17717 Don't keep the frame pointer in a register for leaf functions. This
17718 avoids the instructions to save, set up and restore frame pointers and
17719 makes an extra register available in leaf functions.
17720
17721 @item -mspecld-anomaly
17722 @opindex mspecld-anomaly
17723 When enabled, the compiler ensures that the generated code does not
17724 contain speculative loads after jump instructions. If this option is used,
17725 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17726
17727 @item -mno-specld-anomaly
17728 @opindex mno-specld-anomaly
17729 Don't generate extra code to prevent speculative loads from occurring.
17730
17731 @item -mcsync-anomaly
17732 @opindex mcsync-anomaly
17733 When enabled, the compiler ensures that the generated code does not
17734 contain CSYNC or SSYNC instructions too soon after conditional branches.
17735 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17736
17737 @item -mno-csync-anomaly
17738 @opindex mno-csync-anomaly
17739 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17740 occurring too soon after a conditional branch.
17741
17742 @item -mlow-64k
17743 @opindex mlow-64k
17744 When enabled, the compiler is free to take advantage of the knowledge that
17745 the entire program fits into the low 64k of memory.
17746
17747 @item -mno-low-64k
17748 @opindex mno-low-64k
17749 Assume that the program is arbitrarily large. This is the default.
17750
17751 @item -mstack-check-l1
17752 @opindex mstack-check-l1
17753 Do stack checking using information placed into L1 scratchpad memory by the
17754 uClinux kernel.
17755
17756 @item -mid-shared-library
17757 @opindex mid-shared-library
17758 Generate code that supports shared libraries via the library ID method.
17759 This allows for execute in place and shared libraries in an environment
17760 without virtual memory management. This option implies @option{-fPIC}.
17761 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17762
17763 @item -mno-id-shared-library
17764 @opindex mno-id-shared-library
17765 Generate code that doesn't assume ID-based shared libraries are being used.
17766 This is the default.
17767
17768 @item -mleaf-id-shared-library
17769 @opindex mleaf-id-shared-library
17770 Generate code that supports shared libraries via the library ID method,
17771 but assumes that this library or executable won't link against any other
17772 ID shared libraries. That allows the compiler to use faster code for jumps
17773 and calls.
17774
17775 @item -mno-leaf-id-shared-library
17776 @opindex mno-leaf-id-shared-library
17777 Do not assume that the code being compiled won't link against any ID shared
17778 libraries. Slower code is generated for jump and call insns.
17779
17780 @item -mshared-library-id=n
17781 @opindex mshared-library-id
17782 Specifies the identification number of the ID-based shared library being
17783 compiled. Specifying a value of 0 generates more compact code; specifying
17784 other values forces the allocation of that number to the current
17785 library but is no more space- or time-efficient than omitting this option.
17786
17787 @item -msep-data
17788 @opindex msep-data
17789 Generate code that allows the data segment to be located in a different
17790 area of memory from the text segment. This allows for execute in place in
17791 an environment without virtual memory management by eliminating relocations
17792 against the text section.
17793
17794 @item -mno-sep-data
17795 @opindex mno-sep-data
17796 Generate code that assumes that the data segment follows the text segment.
17797 This is the default.
17798
17799 @item -mlong-calls
17800 @itemx -mno-long-calls
17801 @opindex mlong-calls
17802 @opindex mno-long-calls
17803 Tells the compiler to perform function calls by first loading the
17804 address of the function into a register and then performing a subroutine
17805 call on this register. This switch is needed if the target function
17806 lies outside of the 24-bit addressing range of the offset-based
17807 version of subroutine call instruction.
17808
17809 This feature is not enabled by default. Specifying
17810 @option{-mno-long-calls} restores the default behavior. Note these
17811 switches have no effect on how the compiler generates code to handle
17812 function calls via function pointers.
17813
17814 @item -mfast-fp
17815 @opindex mfast-fp
17816 Link with the fast floating-point library. This library relaxes some of
17817 the IEEE floating-point standard's rules for checking inputs against
17818 Not-a-Number (NAN), in the interest of performance.
17819
17820 @item -minline-plt
17821 @opindex minline-plt
17822 Enable inlining of PLT entries in function calls to functions that are
17823 not known to bind locally. It has no effect without @option{-mfdpic}.
17824
17825 @item -mmulticore
17826 @opindex mmulticore
17827 Build a standalone application for multicore Blackfin processors.
17828 This option causes proper start files and link scripts supporting
17829 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17830 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17831
17832 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17833 selects the one-application-per-core programming model. Without
17834 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17835 programming model is used. In this model, the main function of Core B
17836 should be named as @code{coreb_main}.
17837
17838 If this option is not used, the single-core application programming
17839 model is used.
17840
17841 @item -mcorea
17842 @opindex mcorea
17843 Build a standalone application for Core A of BF561 when using
17844 the one-application-per-core programming model. Proper start files
17845 and link scripts are used to support Core A, and the macro
17846 @code{__BFIN_COREA} is defined.
17847 This option can only be used in conjunction with @option{-mmulticore}.
17848
17849 @item -mcoreb
17850 @opindex mcoreb
17851 Build a standalone application for Core B of BF561 when using
17852 the one-application-per-core programming model. Proper start files
17853 and link scripts are used to support Core B, and the macro
17854 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17855 should be used instead of @code{main}.
17856 This option can only be used in conjunction with @option{-mmulticore}.
17857
17858 @item -msdram
17859 @opindex msdram
17860 Build a standalone application for SDRAM. Proper start files and
17861 link scripts are used to put the application into SDRAM, and the macro
17862 @code{__BFIN_SDRAM} is defined.
17863 The loader should initialize SDRAM before loading the application.
17864
17865 @item -micplb
17866 @opindex micplb
17867 Assume that ICPLBs are enabled at run time. This has an effect on certain
17868 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17869 are enabled; for standalone applications the default is off.
17870 @end table
17871
17872 @node C6X Options
17873 @subsection C6X Options
17874 @cindex C6X Options
17875
17876 @table @gcctabopt
17877 @item -march=@var{name}
17878 @opindex march
17879 This specifies the name of the target architecture. GCC uses this
17880 name to determine what kind of instructions it can emit when generating
17881 assembly code. Permissible names are: @samp{c62x},
17882 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17883
17884 @item -mbig-endian
17885 @opindex mbig-endian
17886 Generate code for a big-endian target.
17887
17888 @item -mlittle-endian
17889 @opindex mlittle-endian
17890 Generate code for a little-endian target. This is the default.
17891
17892 @item -msim
17893 @opindex msim
17894 Choose startup files and linker script suitable for the simulator.
17895
17896 @item -msdata=default
17897 @opindex msdata=default
17898 Put small global and static data in the @code{.neardata} section,
17899 which is pointed to by register @code{B14}. Put small uninitialized
17900 global and static data in the @code{.bss} section, which is adjacent
17901 to the @code{.neardata} section. Put small read-only data into the
17902 @code{.rodata} section. The corresponding sections used for large
17903 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
17904
17905 @item -msdata=all
17906 @opindex msdata=all
17907 Put all data, not just small objects, into the sections reserved for
17908 small data, and use addressing relative to the @code{B14} register to
17909 access them.
17910
17911 @item -msdata=none
17912 @opindex msdata=none
17913 Make no use of the sections reserved for small data, and use absolute
17914 addresses to access all data. Put all initialized global and static
17915 data in the @code{.fardata} section, and all uninitialized data in the
17916 @code{.far} section. Put all constant data into the @code{.const}
17917 section.
17918 @end table
17919
17920 @node CRIS Options
17921 @subsection CRIS Options
17922 @cindex CRIS Options
17923
17924 These options are defined specifically for the CRIS ports.
17925
17926 @table @gcctabopt
17927 @item -march=@var{architecture-type}
17928 @itemx -mcpu=@var{architecture-type}
17929 @opindex march
17930 @opindex mcpu
17931 Generate code for the specified architecture. The choices for
17932 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
17933 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
17934 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
17935 @samp{v10}.
17936
17937 @item -mtune=@var{architecture-type}
17938 @opindex mtune
17939 Tune to @var{architecture-type} everything applicable about the generated
17940 code, except for the ABI and the set of available instructions. The
17941 choices for @var{architecture-type} are the same as for
17942 @option{-march=@var{architecture-type}}.
17943
17944 @item -mmax-stack-frame=@var{n}
17945 @opindex mmax-stack-frame
17946 Warn when the stack frame of a function exceeds @var{n} bytes.
17947
17948 @item -metrax4
17949 @itemx -metrax100
17950 @opindex metrax4
17951 @opindex metrax100
17952 The options @option{-metrax4} and @option{-metrax100} are synonyms for
17953 @option{-march=v3} and @option{-march=v8} respectively.
17954
17955 @item -mmul-bug-workaround
17956 @itemx -mno-mul-bug-workaround
17957 @opindex mmul-bug-workaround
17958 @opindex mno-mul-bug-workaround
17959 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
17960 models where it applies. This option is active by default.
17961
17962 @item -mpdebug
17963 @opindex mpdebug
17964 Enable CRIS-specific verbose debug-related information in the assembly
17965 code. This option also has the effect of turning off the @samp{#NO_APP}
17966 formatted-code indicator to the assembler at the beginning of the
17967 assembly file.
17968
17969 @item -mcc-init
17970 @opindex mcc-init
17971 Do not use condition-code results from previous instruction; always emit
17972 compare and test instructions before use of condition codes.
17973
17974 @item -mno-side-effects
17975 @opindex mno-side-effects
17976 Do not emit instructions with side effects in addressing modes other than
17977 post-increment.
17978
17979 @item -mstack-align
17980 @itemx -mno-stack-align
17981 @itemx -mdata-align
17982 @itemx -mno-data-align
17983 @itemx -mconst-align
17984 @itemx -mno-const-align
17985 @opindex mstack-align
17986 @opindex mno-stack-align
17987 @opindex mdata-align
17988 @opindex mno-data-align
17989 @opindex mconst-align
17990 @opindex mno-const-align
17991 These options (@samp{no-} options) arrange (eliminate arrangements) for the
17992 stack frame, individual data and constants to be aligned for the maximum
17993 single data access size for the chosen CPU model. The default is to
17994 arrange for 32-bit alignment. ABI details such as structure layout are
17995 not affected by these options.
17996
17997 @item -m32-bit
17998 @itemx -m16-bit
17999 @itemx -m8-bit
18000 @opindex m32-bit
18001 @opindex m16-bit
18002 @opindex m8-bit
18003 Similar to the stack- data- and const-align options above, these options
18004 arrange for stack frame, writable data and constants to all be 32-bit,
18005 16-bit or 8-bit aligned. The default is 32-bit alignment.
18006
18007 @item -mno-prologue-epilogue
18008 @itemx -mprologue-epilogue
18009 @opindex mno-prologue-epilogue
18010 @opindex mprologue-epilogue
18011 With @option{-mno-prologue-epilogue}, the normal function prologue and
18012 epilogue which set up the stack frame are omitted and no return
18013 instructions or return sequences are generated in the code. Use this
18014 option only together with visual inspection of the compiled code: no
18015 warnings or errors are generated when call-saved registers must be saved,
18016 or storage for local variables needs to be allocated.
18017
18018 @item -mno-gotplt
18019 @itemx -mgotplt
18020 @opindex mno-gotplt
18021 @opindex mgotplt
18022 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18023 instruction sequences that load addresses for functions from the PLT part
18024 of the GOT rather than (traditional on other architectures) calls to the
18025 PLT@. The default is @option{-mgotplt}.
18026
18027 @item -melf
18028 @opindex melf
18029 Legacy no-op option only recognized with the cris-axis-elf and
18030 cris-axis-linux-gnu targets.
18031
18032 @item -mlinux
18033 @opindex mlinux
18034 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18035
18036 @item -sim
18037 @opindex sim
18038 This option, recognized for the cris-axis-elf, arranges
18039 to link with input-output functions from a simulator library. Code,
18040 initialized data and zero-initialized data are allocated consecutively.
18041
18042 @item -sim2
18043 @opindex sim2
18044 Like @option{-sim}, but pass linker options to locate initialized data at
18045 0x40000000 and zero-initialized data at 0x80000000.
18046 @end table
18047
18048 @node CR16 Options
18049 @subsection CR16 Options
18050 @cindex CR16 Options
18051
18052 These options are defined specifically for the CR16 ports.
18053
18054 @table @gcctabopt
18055
18056 @item -mmac
18057 @opindex mmac
18058 Enable the use of multiply-accumulate instructions. Disabled by default.
18059
18060 @item -mcr16cplus
18061 @itemx -mcr16c
18062 @opindex mcr16cplus
18063 @opindex mcr16c
18064 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
18065 is default.
18066
18067 @item -msim
18068 @opindex msim
18069 Links the library libsim.a which is in compatible with simulator. Applicable
18070 to ELF compiler only.
18071
18072 @item -mint32
18073 @opindex mint32
18074 Choose integer type as 32-bit wide.
18075
18076 @item -mbit-ops
18077 @opindex mbit-ops
18078 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
18079
18080 @item -mdata-model=@var{model}
18081 @opindex mdata-model
18082 Choose a data model. The choices for @var{model} are @samp{near},
18083 @samp{far} or @samp{medium}. @samp{medium} is default.
18084 However, @samp{far} is not valid with @option{-mcr16c}, as the
18085 CR16C architecture does not support the far data model.
18086 @end table
18087
18088 @node C-SKY Options
18089 @subsection C-SKY Options
18090 @cindex C-SKY Options
18091
18092 GCC supports these options when compiling for C-SKY V2 processors.
18093
18094 @table @gcctabopt
18095
18096 @item -march=@var{arch}
18097 @opindex march=
18098 Specify the C-SKY target architecture. Valid values for @var{arch} are:
18099 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
18100 The default is @samp{ck810}.
18101
18102 @item -mcpu=@var{cpu}
18103 @opindex mcpu=
18104 Specify the C-SKY target processor. Valid values for @var{cpu} are:
18105 @samp{ck801}, @samp{ck801t},
18106 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
18107 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
18108 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
18109 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
18110 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
18111 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
18112 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
18113 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
18114 @samp{ck803eftr1}, @samp{ck803efhtr1},
18115 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
18116 @samp{ck803sef}, @samp{ck803seft},
18117 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
18118 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
18119 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
18120 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
18121
18122 @item -mbig-endian
18123 @opindex mbig-endian
18124 @itemx -EB
18125 @opindex EB
18126 @itemx -mlittle-endian
18127 @opindex mlittle-endian
18128 @itemx -EL
18129 @opindex EL
18130
18131 Select big- or little-endian code. The default is little-endian.
18132
18133 @item -mhard-float
18134 @opindex mhard-float
18135 @itemx -msoft-float
18136 @opindex msoft-float
18137
18138 Select hardware or software floating-point implementations.
18139 The default is soft float.
18140
18141 @item -mdouble-float
18142 @itemx -mno-double-float
18143 @opindex mdouble-float
18144 When @option{-mhard-float} is in effect, enable generation of
18145 double-precision float instructions. This is the default except
18146 when compiling for CK803.
18147
18148 @item -mfdivdu
18149 @itemx -mno-fdivdu
18150 @opindex mfdivdu
18151 When @option{-mhard-float} is in effect, enable generation of
18152 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
18153 This is the default except when compiling for CK803.
18154
18155 @item -mfpu=@var{fpu}
18156 @opindex mfpu=
18157 Select the floating-point processor. This option can only be used with
18158 @option{-mhard-float}.
18159 Values for @var{fpu} are
18160 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
18161 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
18162 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
18163
18164 @item -melrw
18165 @itemx -mno-elrw
18166 @opindex melrw
18167 Enable the extended @code{lrw} instruction. This option defaults to on
18168 for CK801 and off otherwise.
18169
18170 @item -mistack
18171 @itemx -mno-istack
18172 @opindex mistack
18173 Enable interrupt stack instructions; the default is off.
18174
18175 The @option{-mistack} option is required to handle the
18176 @code{interrupt} and @code{isr} function attributes
18177 (@pxref{C-SKY Function Attributes}).
18178
18179 @item -mmp
18180 @opindex mmp
18181 Enable multiprocessor instructions; the default is off.
18182
18183 @item -mcp
18184 @opindex mcp
18185 Enable coprocessor instructions; the default is off.
18186
18187 @item -mcache
18188 @opindex mcache
18189 Enable coprocessor instructions; the default is off.
18190
18191 @item -msecurity
18192 @opindex msecurity
18193 Enable C-SKY security instructions; the default is off.
18194
18195 @item -mtrust
18196 @opindex mtrust
18197 Enable C-SKY trust instructions; the default is off.
18198
18199 @item -mdsp
18200 @opindex mdsp
18201 @itemx -medsp
18202 @opindex medsp
18203 @itemx -mvdsp
18204 @opindex mvdsp
18205 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18206 All of these options default to off.
18207
18208 @item -mdiv
18209 @itemx -mno-div
18210 @opindex mdiv
18211 Generate divide instructions. Default is off.
18212
18213 @item -msmart
18214 @itemx -mno-smart
18215 @opindex msmart
18216 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18217 use of 16-bit instructions. This option is ignored for CK801 where this
18218 is the required behavior, and it defaults to on for CK802.
18219 For other targets, the default is off.
18220
18221 @item -mhigh-registers
18222 @itemx -mno-high-registers
18223 @opindex mhigh-registers
18224 Generate code using the high registers numbered 16-31. This option
18225 is not supported on CK801, CK802, or CK803, and is enabled by default
18226 for other processors.
18227
18228 @item -manchor
18229 @itemx -mno-anchor
18230 @opindex manchor
18231 Generate code using global anchor symbol addresses.
18232
18233 @item -mpushpop
18234 @itemx -mno-pushpop
18235 @opindex mpushpop
18236 Generate code using @code{push} and @code{pop} instructions. This option
18237 defaults to on.
18238
18239 @item -mmultiple-stld
18240 @itemx -mstm
18241 @itemx -mno-multiple-stld
18242 @itemx -mno-stm
18243 @opindex mmultiple-stld
18244 Generate code using @code{stm} and @code{ldm} instructions. This option
18245 isn't supported on CK801 but is enabled by default on other processors.
18246
18247 @item -mconstpool
18248 @itemx -mno-constpool
18249 @opindex mconstpool
18250 Create constant pools in the compiler instead of deferring it to the
18251 assembler. This option is the default and required for correct code
18252 generation on CK801 and CK802, and is optional on other processors.
18253
18254 @item -mstack-size
18255 @item -mno-stack-size
18256 @opindex mstack-size
18257 Emit @code{.stack_size} directives for each function in the assembly
18258 output. This option defaults to off.
18259
18260 @item -mccrt
18261 @itemx -mno-ccrt
18262 @opindex mccrt
18263 Generate code for the C-SKY compiler runtime instead of libgcc. This
18264 option defaults to off.
18265
18266 @item -mbranch-cost=@var{n}
18267 @opindex mbranch-cost=
18268 Set the branch costs to roughly @code{n} instructions. The default is 1.
18269
18270 @item -msched-prolog
18271 @itemx -mno-sched-prolog
18272 @opindex msched-prolog
18273 Permit scheduling of function prologue and epilogue sequences. Using
18274 this option can result in code that is not compliant with the C-SKY V2 ABI
18275 prologue requirements and that cannot be debugged or backtraced.
18276 It is disabled by default.
18277
18278 @end table
18279
18280 @node Darwin Options
18281 @subsection Darwin Options
18282 @cindex Darwin options
18283
18284 These options are defined for all architectures running the Darwin operating
18285 system.
18286
18287 FSF GCC on Darwin does not create ``fat'' object files; it creates
18288 an object file for the single architecture that GCC was built to
18289 target. Apple's GCC on Darwin does create ``fat'' files if multiple
18290 @option{-arch} options are used; it does so by running the compiler or
18291 linker multiple times and joining the results together with
18292 @file{lipo}.
18293
18294 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
18295 @samp{i686}) is determined by the flags that specify the ISA
18296 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
18297 @option{-force_cpusubtype_ALL} option can be used to override this.
18298
18299 The Darwin tools vary in their behavior when presented with an ISA
18300 mismatch. The assembler, @file{as}, only permits instructions to
18301 be used that are valid for the subtype of the file it is generating,
18302 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
18303 The linker for shared libraries, @file{/usr/bin/libtool}, fails
18304 and prints an error if asked to create a shared library with a less
18305 restrictive subtype than its input files (for instance, trying to put
18306 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
18307 for executables, @command{ld}, quietly gives the executable the most
18308 restrictive subtype of any of its input files.
18309
18310 @table @gcctabopt
18311 @item -F@var{dir}
18312 @opindex F
18313 Add the framework directory @var{dir} to the head of the list of
18314 directories to be searched for header files. These directories are
18315 interleaved with those specified by @option{-I} options and are
18316 scanned in a left-to-right order.
18317
18318 A framework directory is a directory with frameworks in it. A
18319 framework is a directory with a @file{Headers} and/or
18320 @file{PrivateHeaders} directory contained directly in it that ends
18321 in @file{.framework}. The name of a framework is the name of this
18322 directory excluding the @file{.framework}. Headers associated with
18323 the framework are found in one of those two directories, with
18324 @file{Headers} being searched first. A subframework is a framework
18325 directory that is in a framework's @file{Frameworks} directory.
18326 Includes of subframework headers can only appear in a header of a
18327 framework that contains the subframework, or in a sibling subframework
18328 header. Two subframeworks are siblings if they occur in the same
18329 framework. A subframework should not have the same name as a
18330 framework; a warning is issued if this is violated. Currently a
18331 subframework cannot have subframeworks; in the future, the mechanism
18332 may be extended to support this. The standard frameworks can be found
18333 in @file{/System/Library/Frameworks} and
18334 @file{/Library/Frameworks}. An example include looks like
18335 @code{#include <Framework/header.h>}, where @file{Framework} denotes
18336 the name of the framework and @file{header.h} is found in the
18337 @file{PrivateHeaders} or @file{Headers} directory.
18338
18339 @item -iframework@var{dir}
18340 @opindex iframework
18341 Like @option{-F} except the directory is a treated as a system
18342 directory. The main difference between this @option{-iframework} and
18343 @option{-F} is that with @option{-iframework} the compiler does not
18344 warn about constructs contained within header files found via
18345 @var{dir}. This option is valid only for the C family of languages.
18346
18347 @item -gused
18348 @opindex gused
18349 Emit debugging information for symbols that are used. For stabs
18350 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
18351 This is by default ON@.
18352
18353 @item -gfull
18354 @opindex gfull
18355 Emit debugging information for all symbols and types.
18356
18357 @item -mmacosx-version-min=@var{version}
18358 The earliest version of MacOS X that this executable will run on
18359 is @var{version}. Typical values of @var{version} include @code{10.1},
18360 @code{10.2}, and @code{10.3.9}.
18361
18362 If the compiler was built to use the system's headers by default,
18363 then the default for this option is the system version on which the
18364 compiler is running, otherwise the default is to make choices that
18365 are compatible with as many systems and code bases as possible.
18366
18367 @item -mkernel
18368 @opindex mkernel
18369 Enable kernel development mode. The @option{-mkernel} option sets
18370 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
18371 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
18372 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
18373 applicable. This mode also sets @option{-mno-altivec},
18374 @option{-msoft-float}, @option{-fno-builtin} and
18375 @option{-mlong-branch} for PowerPC targets.
18376
18377 @item -mone-byte-bool
18378 @opindex mone-byte-bool
18379 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
18380 By default @code{sizeof(bool)} is @code{4} when compiling for
18381 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
18382 option has no effect on x86.
18383
18384 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
18385 to generate code that is not binary compatible with code generated
18386 without that switch. Using this switch may require recompiling all
18387 other modules in a program, including system libraries. Use this
18388 switch to conform to a non-default data model.
18389
18390 @item -mfix-and-continue
18391 @itemx -ffix-and-continue
18392 @itemx -findirect-data
18393 @opindex mfix-and-continue
18394 @opindex ffix-and-continue
18395 @opindex findirect-data
18396 Generate code suitable for fast turnaround development, such as to
18397 allow GDB to dynamically load @file{.o} files into already-running
18398 programs. @option{-findirect-data} and @option{-ffix-and-continue}
18399 are provided for backwards compatibility.
18400
18401 @item -all_load
18402 @opindex all_load
18403 Loads all members of static archive libraries.
18404 See man ld(1) for more information.
18405
18406 @item -arch_errors_fatal
18407 @opindex arch_errors_fatal
18408 Cause the errors having to do with files that have the wrong architecture
18409 to be fatal.
18410
18411 @item -bind_at_load
18412 @opindex bind_at_load
18413 Causes the output file to be marked such that the dynamic linker will
18414 bind all undefined references when the file is loaded or launched.
18415
18416 @item -bundle
18417 @opindex bundle
18418 Produce a Mach-o bundle format file.
18419 See man ld(1) for more information.
18420
18421 @item -bundle_loader @var{executable}
18422 @opindex bundle_loader
18423 This option specifies the @var{executable} that will load the build
18424 output file being linked. See man ld(1) for more information.
18425
18426 @item -dynamiclib
18427 @opindex dynamiclib
18428 When passed this option, GCC produces a dynamic library instead of
18429 an executable when linking, using the Darwin @file{libtool} command.
18430
18431 @item -force_cpusubtype_ALL
18432 @opindex force_cpusubtype_ALL
18433 This causes GCC's output file to have the @samp{ALL} subtype, instead of
18434 one controlled by the @option{-mcpu} or @option{-march} option.
18435
18436 @item -allowable_client @var{client_name}
18437 @itemx -client_name
18438 @itemx -compatibility_version
18439 @itemx -current_version
18440 @itemx -dead_strip
18441 @itemx -dependency-file
18442 @itemx -dylib_file
18443 @itemx -dylinker_install_name
18444 @itemx -dynamic
18445 @itemx -exported_symbols_list
18446 @itemx -filelist
18447 @need 800
18448 @itemx -flat_namespace
18449 @itemx -force_flat_namespace
18450 @itemx -headerpad_max_install_names
18451 @itemx -image_base
18452 @itemx -init
18453 @itemx -install_name
18454 @itemx -keep_private_externs
18455 @itemx -multi_module
18456 @itemx -multiply_defined
18457 @itemx -multiply_defined_unused
18458 @need 800
18459 @itemx -noall_load
18460 @itemx -no_dead_strip_inits_and_terms
18461 @itemx -nofixprebinding
18462 @itemx -nomultidefs
18463 @itemx -noprebind
18464 @itemx -noseglinkedit
18465 @itemx -pagezero_size
18466 @itemx -prebind
18467 @itemx -prebind_all_twolevel_modules
18468 @itemx -private_bundle
18469 @need 800
18470 @itemx -read_only_relocs
18471 @itemx -sectalign
18472 @itemx -sectobjectsymbols
18473 @itemx -whyload
18474 @itemx -seg1addr
18475 @itemx -sectcreate
18476 @itemx -sectobjectsymbols
18477 @itemx -sectorder
18478 @itemx -segaddr
18479 @itemx -segs_read_only_addr
18480 @need 800
18481 @itemx -segs_read_write_addr
18482 @itemx -seg_addr_table
18483 @itemx -seg_addr_table_filename
18484 @itemx -seglinkedit
18485 @itemx -segprot
18486 @itemx -segs_read_only_addr
18487 @itemx -segs_read_write_addr
18488 @itemx -single_module
18489 @itemx -static
18490 @itemx -sub_library
18491 @need 800
18492 @itemx -sub_umbrella
18493 @itemx -twolevel_namespace
18494 @itemx -umbrella
18495 @itemx -undefined
18496 @itemx -unexported_symbols_list
18497 @itemx -weak_reference_mismatches
18498 @itemx -whatsloaded
18499 @opindex allowable_client
18500 @opindex client_name
18501 @opindex compatibility_version
18502 @opindex current_version
18503 @opindex dead_strip
18504 @opindex dependency-file
18505 @opindex dylib_file
18506 @opindex dylinker_install_name
18507 @opindex dynamic
18508 @opindex exported_symbols_list
18509 @opindex filelist
18510 @opindex flat_namespace
18511 @opindex force_flat_namespace
18512 @opindex headerpad_max_install_names
18513 @opindex image_base
18514 @opindex init
18515 @opindex install_name
18516 @opindex keep_private_externs
18517 @opindex multi_module
18518 @opindex multiply_defined
18519 @opindex multiply_defined_unused
18520 @opindex noall_load
18521 @opindex no_dead_strip_inits_and_terms
18522 @opindex nofixprebinding
18523 @opindex nomultidefs
18524 @opindex noprebind
18525 @opindex noseglinkedit
18526 @opindex pagezero_size
18527 @opindex prebind
18528 @opindex prebind_all_twolevel_modules
18529 @opindex private_bundle
18530 @opindex read_only_relocs
18531 @opindex sectalign
18532 @opindex sectobjectsymbols
18533 @opindex whyload
18534 @opindex seg1addr
18535 @opindex sectcreate
18536 @opindex sectobjectsymbols
18537 @opindex sectorder
18538 @opindex segaddr
18539 @opindex segs_read_only_addr
18540 @opindex segs_read_write_addr
18541 @opindex seg_addr_table
18542 @opindex seg_addr_table_filename
18543 @opindex seglinkedit
18544 @opindex segprot
18545 @opindex segs_read_only_addr
18546 @opindex segs_read_write_addr
18547 @opindex single_module
18548 @opindex static
18549 @opindex sub_library
18550 @opindex sub_umbrella
18551 @opindex twolevel_namespace
18552 @opindex umbrella
18553 @opindex undefined
18554 @opindex unexported_symbols_list
18555 @opindex weak_reference_mismatches
18556 @opindex whatsloaded
18557 These options are passed to the Darwin linker. The Darwin linker man page
18558 describes them in detail.
18559 @end table
18560
18561 @node DEC Alpha Options
18562 @subsection DEC Alpha Options
18563
18564 These @samp{-m} options are defined for the DEC Alpha implementations:
18565
18566 @table @gcctabopt
18567 @item -mno-soft-float
18568 @itemx -msoft-float
18569 @opindex mno-soft-float
18570 @opindex msoft-float
18571 Use (do not use) the hardware floating-point instructions for
18572 floating-point operations. When @option{-msoft-float} is specified,
18573 functions in @file{libgcc.a} are used to perform floating-point
18574 operations. Unless they are replaced by routines that emulate the
18575 floating-point operations, or compiled in such a way as to call such
18576 emulations routines, these routines issue floating-point
18577 operations. If you are compiling for an Alpha without floating-point
18578 operations, you must ensure that the library is built so as not to call
18579 them.
18580
18581 Note that Alpha implementations without floating-point operations are
18582 required to have floating-point registers.
18583
18584 @item -mfp-reg
18585 @itemx -mno-fp-regs
18586 @opindex mfp-reg
18587 @opindex mno-fp-regs
18588 Generate code that uses (does not use) the floating-point register set.
18589 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
18590 register set is not used, floating-point operands are passed in integer
18591 registers as if they were integers and floating-point results are passed
18592 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
18593 so any function with a floating-point argument or return value called by code
18594 compiled with @option{-mno-fp-regs} must also be compiled with that
18595 option.
18596
18597 A typical use of this option is building a kernel that does not use,
18598 and hence need not save and restore, any floating-point registers.
18599
18600 @item -mieee
18601 @opindex mieee
18602 The Alpha architecture implements floating-point hardware optimized for
18603 maximum performance. It is mostly compliant with the IEEE floating-point
18604 standard. However, for full compliance, software assistance is
18605 required. This option generates code fully IEEE-compliant code
18606 @emph{except} that the @var{inexact-flag} is not maintained (see below).
18607 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
18608 defined during compilation. The resulting code is less efficient but is
18609 able to correctly support denormalized numbers and exceptional IEEE
18610 values such as not-a-number and plus/minus infinity. Other Alpha
18611 compilers call this option @option{-ieee_with_no_inexact}.
18612
18613 @item -mieee-with-inexact
18614 @opindex mieee-with-inexact
18615 This is like @option{-mieee} except the generated code also maintains
18616 the IEEE @var{inexact-flag}. Turning on this option causes the
18617 generated code to implement fully-compliant IEEE math. In addition to
18618 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
18619 macro. On some Alpha implementations the resulting code may execute
18620 significantly slower than the code generated by default. Since there is
18621 very little code that depends on the @var{inexact-flag}, you should
18622 normally not specify this option. Other Alpha compilers call this
18623 option @option{-ieee_with_inexact}.
18624
18625 @item -mfp-trap-mode=@var{trap-mode}
18626 @opindex mfp-trap-mode
18627 This option controls what floating-point related traps are enabled.
18628 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
18629 The trap mode can be set to one of four values:
18630
18631 @table @samp
18632 @item n
18633 This is the default (normal) setting. The only traps that are enabled
18634 are the ones that cannot be disabled in software (e.g., division by zero
18635 trap).
18636
18637 @item u
18638 In addition to the traps enabled by @samp{n}, underflow traps are enabled
18639 as well.
18640
18641 @item su
18642 Like @samp{u}, but the instructions are marked to be safe for software
18643 completion (see Alpha architecture manual for details).
18644
18645 @item sui
18646 Like @samp{su}, but inexact traps are enabled as well.
18647 @end table
18648
18649 @item -mfp-rounding-mode=@var{rounding-mode}
18650 @opindex mfp-rounding-mode
18651 Selects the IEEE rounding mode. Other Alpha compilers call this option
18652 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
18653 of:
18654
18655 @table @samp
18656 @item n
18657 Normal IEEE rounding mode. Floating-point numbers are rounded towards
18658 the nearest machine number or towards the even machine number in case
18659 of a tie.
18660
18661 @item m
18662 Round towards minus infinity.
18663
18664 @item c
18665 Chopped rounding mode. Floating-point numbers are rounded towards zero.
18666
18667 @item d
18668 Dynamic rounding mode. A field in the floating-point control register
18669 (@var{fpcr}, see Alpha architecture reference manual) controls the
18670 rounding mode in effect. The C library initializes this register for
18671 rounding towards plus infinity. Thus, unless your program modifies the
18672 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
18673 @end table
18674
18675 @item -mtrap-precision=@var{trap-precision}
18676 @opindex mtrap-precision
18677 In the Alpha architecture, floating-point traps are imprecise. This
18678 means without software assistance it is impossible to recover from a
18679 floating trap and program execution normally needs to be terminated.
18680 GCC can generate code that can assist operating system trap handlers
18681 in determining the exact location that caused a floating-point trap.
18682 Depending on the requirements of an application, different levels of
18683 precisions can be selected:
18684
18685 @table @samp
18686 @item p
18687 Program precision. This option is the default and means a trap handler
18688 can only identify which program caused a floating-point exception.
18689
18690 @item f
18691 Function precision. The trap handler can determine the function that
18692 caused a floating-point exception.
18693
18694 @item i
18695 Instruction precision. The trap handler can determine the exact
18696 instruction that caused a floating-point exception.
18697 @end table
18698
18699 Other Alpha compilers provide the equivalent options called
18700 @option{-scope_safe} and @option{-resumption_safe}.
18701
18702 @item -mieee-conformant
18703 @opindex mieee-conformant
18704 This option marks the generated code as IEEE conformant. You must not
18705 use this option unless you also specify @option{-mtrap-precision=i} and either
18706 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
18707 is to emit the line @samp{.eflag 48} in the function prologue of the
18708 generated assembly file.
18709
18710 @item -mbuild-constants
18711 @opindex mbuild-constants
18712 Normally GCC examines a 32- or 64-bit integer constant to
18713 see if it can construct it from smaller constants in two or three
18714 instructions. If it cannot, it outputs the constant as a literal and
18715 generates code to load it from the data segment at run time.
18716
18717 Use this option to require GCC to construct @emph{all} integer constants
18718 using code, even if it takes more instructions (the maximum is six).
18719
18720 You typically use this option to build a shared library dynamic
18721 loader. Itself a shared library, it must relocate itself in memory
18722 before it can find the variables and constants in its own data segment.
18723
18724 @item -mbwx
18725 @itemx -mno-bwx
18726 @itemx -mcix
18727 @itemx -mno-cix
18728 @itemx -mfix
18729 @itemx -mno-fix
18730 @itemx -mmax
18731 @itemx -mno-max
18732 @opindex mbwx
18733 @opindex mno-bwx
18734 @opindex mcix
18735 @opindex mno-cix
18736 @opindex mfix
18737 @opindex mno-fix
18738 @opindex mmax
18739 @opindex mno-max
18740 Indicate whether GCC should generate code to use the optional BWX,
18741 CIX, FIX and MAX instruction sets. The default is to use the instruction
18742 sets supported by the CPU type specified via @option{-mcpu=} option or that
18743 of the CPU on which GCC was built if none is specified.
18744
18745 @item -mfloat-vax
18746 @itemx -mfloat-ieee
18747 @opindex mfloat-vax
18748 @opindex mfloat-ieee
18749 Generate code that uses (does not use) VAX F and G floating-point
18750 arithmetic instead of IEEE single and double precision.
18751
18752 @item -mexplicit-relocs
18753 @itemx -mno-explicit-relocs
18754 @opindex mexplicit-relocs
18755 @opindex mno-explicit-relocs
18756 Older Alpha assemblers provided no way to generate symbol relocations
18757 except via assembler macros. Use of these macros does not allow
18758 optimal instruction scheduling. GNU binutils as of version 2.12
18759 supports a new syntax that allows the compiler to explicitly mark
18760 which relocations should apply to which instructions. This option
18761 is mostly useful for debugging, as GCC detects the capabilities of
18762 the assembler when it is built and sets the default accordingly.
18763
18764 @item -msmall-data
18765 @itemx -mlarge-data
18766 @opindex msmall-data
18767 @opindex mlarge-data
18768 When @option{-mexplicit-relocs} is in effect, static data is
18769 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
18770 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
18771 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
18772 16-bit relocations off of the @code{$gp} register. This limits the
18773 size of the small data area to 64KB, but allows the variables to be
18774 directly accessed via a single instruction.
18775
18776 The default is @option{-mlarge-data}. With this option the data area
18777 is limited to just below 2GB@. Programs that require more than 2GB of
18778 data must use @code{malloc} or @code{mmap} to allocate the data in the
18779 heap instead of in the program's data segment.
18780
18781 When generating code for shared libraries, @option{-fpic} implies
18782 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
18783
18784 @item -msmall-text
18785 @itemx -mlarge-text
18786 @opindex msmall-text
18787 @opindex mlarge-text
18788 When @option{-msmall-text} is used, the compiler assumes that the
18789 code of the entire program (or shared library) fits in 4MB, and is
18790 thus reachable with a branch instruction. When @option{-msmall-data}
18791 is used, the compiler can assume that all local symbols share the
18792 same @code{$gp} value, and thus reduce the number of instructions
18793 required for a function call from 4 to 1.
18794
18795 The default is @option{-mlarge-text}.
18796
18797 @item -mcpu=@var{cpu_type}
18798 @opindex mcpu
18799 Set the instruction set and instruction scheduling parameters for
18800 machine type @var{cpu_type}. You can specify either the @samp{EV}
18801 style name or the corresponding chip number. GCC supports scheduling
18802 parameters for the EV4, EV5 and EV6 family of processors and
18803 chooses the default values for the instruction set from the processor
18804 you specify. If you do not specify a processor type, GCC defaults
18805 to the processor on which the compiler was built.
18806
18807 Supported values for @var{cpu_type} are
18808
18809 @table @samp
18810 @item ev4
18811 @itemx ev45
18812 @itemx 21064
18813 Schedules as an EV4 and has no instruction set extensions.
18814
18815 @item ev5
18816 @itemx 21164
18817 Schedules as an EV5 and has no instruction set extensions.
18818
18819 @item ev56
18820 @itemx 21164a
18821 Schedules as an EV5 and supports the BWX extension.
18822
18823 @item pca56
18824 @itemx 21164pc
18825 @itemx 21164PC
18826 Schedules as an EV5 and supports the BWX and MAX extensions.
18827
18828 @item ev6
18829 @itemx 21264
18830 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
18831
18832 @item ev67
18833 @itemx 21264a
18834 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
18835 @end table
18836
18837 Native toolchains also support the value @samp{native},
18838 which selects the best architecture option for the host processor.
18839 @option{-mcpu=native} has no effect if GCC does not recognize
18840 the processor.
18841
18842 @item -mtune=@var{cpu_type}
18843 @opindex mtune
18844 Set only the instruction scheduling parameters for machine type
18845 @var{cpu_type}. The instruction set is not changed.
18846
18847 Native toolchains also support the value @samp{native},
18848 which selects the best architecture option for the host processor.
18849 @option{-mtune=native} has no effect if GCC does not recognize
18850 the processor.
18851
18852 @item -mmemory-latency=@var{time}
18853 @opindex mmemory-latency
18854 Sets the latency the scheduler should assume for typical memory
18855 references as seen by the application. This number is highly
18856 dependent on the memory access patterns used by the application
18857 and the size of the external cache on the machine.
18858
18859 Valid options for @var{time} are
18860
18861 @table @samp
18862 @item @var{number}
18863 A decimal number representing clock cycles.
18864
18865 @item L1
18866 @itemx L2
18867 @itemx L3
18868 @itemx main
18869 The compiler contains estimates of the number of clock cycles for
18870 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18871 (also called Dcache, Scache, and Bcache), as well as to main memory.
18872 Note that L3 is only valid for EV5.
18873
18874 @end table
18875 @end table
18876
18877 @node FR30 Options
18878 @subsection FR30 Options
18879 @cindex FR30 Options
18880
18881 These options are defined specifically for the FR30 port.
18882
18883 @table @gcctabopt
18884
18885 @item -msmall-model
18886 @opindex msmall-model
18887 Use the small address space model. This can produce smaller code, but
18888 it does assume that all symbolic values and addresses fit into a
18889 20-bit range.
18890
18891 @item -mno-lsim
18892 @opindex mno-lsim
18893 Assume that runtime support has been provided and so there is no need
18894 to include the simulator library (@file{libsim.a}) on the linker
18895 command line.
18896
18897 @end table
18898
18899 @node FT32 Options
18900 @subsection FT32 Options
18901 @cindex FT32 Options
18902
18903 These options are defined specifically for the FT32 port.
18904
18905 @table @gcctabopt
18906
18907 @item -msim
18908 @opindex msim
18909 Specifies that the program will be run on the simulator. This causes
18910 an alternate runtime startup and library to be linked.
18911 You must not use this option when generating programs that will run on
18912 real hardware; you must provide your own runtime library for whatever
18913 I/O functions are needed.
18914
18915 @item -mlra
18916 @opindex mlra
18917 Enable Local Register Allocation. This is still experimental for FT32,
18918 so by default the compiler uses standard reload.
18919
18920 @item -mnodiv
18921 @opindex mnodiv
18922 Do not use div and mod instructions.
18923
18924 @item -mft32b
18925 @opindex mft32b
18926 Enable use of the extended instructions of the FT32B processor.
18927
18928 @item -mcompress
18929 @opindex mcompress
18930 Compress all code using the Ft32B code compression scheme.
18931
18932 @item -mnopm
18933 @opindex mnopm
18934 Do not generate code that reads program memory.
18935
18936 @end table
18937
18938 @node FRV Options
18939 @subsection FRV Options
18940 @cindex FRV Options
18941
18942 @table @gcctabopt
18943 @item -mgpr-32
18944 @opindex mgpr-32
18945
18946 Only use the first 32 general-purpose registers.
18947
18948 @item -mgpr-64
18949 @opindex mgpr-64
18950
18951 Use all 64 general-purpose registers.
18952
18953 @item -mfpr-32
18954 @opindex mfpr-32
18955
18956 Use only the first 32 floating-point registers.
18957
18958 @item -mfpr-64
18959 @opindex mfpr-64
18960
18961 Use all 64 floating-point registers.
18962
18963 @item -mhard-float
18964 @opindex mhard-float
18965
18966 Use hardware instructions for floating-point operations.
18967
18968 @item -msoft-float
18969 @opindex msoft-float
18970
18971 Use library routines for floating-point operations.
18972
18973 @item -malloc-cc
18974 @opindex malloc-cc
18975
18976 Dynamically allocate condition code registers.
18977
18978 @item -mfixed-cc
18979 @opindex mfixed-cc
18980
18981 Do not try to dynamically allocate condition code registers, only
18982 use @code{icc0} and @code{fcc0}.
18983
18984 @item -mdword
18985 @opindex mdword
18986
18987 Change ABI to use double word insns.
18988
18989 @item -mno-dword
18990 @opindex mno-dword
18991
18992 Do not use double word instructions.
18993
18994 @item -mdouble
18995 @opindex mdouble
18996
18997 Use floating-point double instructions.
18998
18999 @item -mno-double
19000 @opindex mno-double
19001
19002 Do not use floating-point double instructions.
19003
19004 @item -mmedia
19005 @opindex mmedia
19006
19007 Use media instructions.
19008
19009 @item -mno-media
19010 @opindex mno-media
19011
19012 Do not use media instructions.
19013
19014 @item -mmuladd
19015 @opindex mmuladd
19016
19017 Use multiply and add/subtract instructions.
19018
19019 @item -mno-muladd
19020 @opindex mno-muladd
19021
19022 Do not use multiply and add/subtract instructions.
19023
19024 @item -mfdpic
19025 @opindex mfdpic
19026
19027 Select the FDPIC ABI, which uses function descriptors to represent
19028 pointers to functions. Without any PIC/PIE-related options, it
19029 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
19030 assumes GOT entries and small data are within a 12-bit range from the
19031 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
19032 are computed with 32 bits.
19033 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19034
19035 @item -minline-plt
19036 @opindex minline-plt
19037
19038 Enable inlining of PLT entries in function calls to functions that are
19039 not known to bind locally. It has no effect without @option{-mfdpic}.
19040 It's enabled by default if optimizing for speed and compiling for
19041 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
19042 optimization option such as @option{-O3} or above is present in the
19043 command line.
19044
19045 @item -mTLS
19046 @opindex mTLS
19047
19048 Assume a large TLS segment when generating thread-local code.
19049
19050 @item -mtls
19051 @opindex mtls
19052
19053 Do not assume a large TLS segment when generating thread-local code.
19054
19055 @item -mgprel-ro
19056 @opindex mgprel-ro
19057
19058 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
19059 that is known to be in read-only sections. It's enabled by default,
19060 except for @option{-fpic} or @option{-fpie}: even though it may help
19061 make the global offset table smaller, it trades 1 instruction for 4.
19062 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
19063 one of which may be shared by multiple symbols, and it avoids the need
19064 for a GOT entry for the referenced symbol, so it's more likely to be a
19065 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
19066
19067 @item -multilib-library-pic
19068 @opindex multilib-library-pic
19069
19070 Link with the (library, not FD) pic libraries. It's implied by
19071 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
19072 @option{-fpic} without @option{-mfdpic}. You should never have to use
19073 it explicitly.
19074
19075 @item -mlinked-fp
19076 @opindex mlinked-fp
19077
19078 Follow the EABI requirement of always creating a frame pointer whenever
19079 a stack frame is allocated. This option is enabled by default and can
19080 be disabled with @option{-mno-linked-fp}.
19081
19082 @item -mlong-calls
19083 @opindex mlong-calls
19084
19085 Use indirect addressing to call functions outside the current
19086 compilation unit. This allows the functions to be placed anywhere
19087 within the 32-bit address space.
19088
19089 @item -malign-labels
19090 @opindex malign-labels
19091
19092 Try to align labels to an 8-byte boundary by inserting NOPs into the
19093 previous packet. This option only has an effect when VLIW packing
19094 is enabled. It doesn't create new packets; it merely adds NOPs to
19095 existing ones.
19096
19097 @item -mlibrary-pic
19098 @opindex mlibrary-pic
19099
19100 Generate position-independent EABI code.
19101
19102 @item -macc-4
19103 @opindex macc-4
19104
19105 Use only the first four media accumulator registers.
19106
19107 @item -macc-8
19108 @opindex macc-8
19109
19110 Use all eight media accumulator registers.
19111
19112 @item -mpack
19113 @opindex mpack
19114
19115 Pack VLIW instructions.
19116
19117 @item -mno-pack
19118 @opindex mno-pack
19119
19120 Do not pack VLIW instructions.
19121
19122 @item -mno-eflags
19123 @opindex mno-eflags
19124
19125 Do not mark ABI switches in e_flags.
19126
19127 @item -mcond-move
19128 @opindex mcond-move
19129
19130 Enable the use of conditional-move instructions (default).
19131
19132 This switch is mainly for debugging the compiler and will likely be removed
19133 in a future version.
19134
19135 @item -mno-cond-move
19136 @opindex mno-cond-move
19137
19138 Disable the use of conditional-move instructions.
19139
19140 This switch is mainly for debugging the compiler and will likely be removed
19141 in a future version.
19142
19143 @item -mscc
19144 @opindex mscc
19145
19146 Enable the use of conditional set instructions (default).
19147
19148 This switch is mainly for debugging the compiler and will likely be removed
19149 in a future version.
19150
19151 @item -mno-scc
19152 @opindex mno-scc
19153
19154 Disable the use of conditional set instructions.
19155
19156 This switch is mainly for debugging the compiler and will likely be removed
19157 in a future version.
19158
19159 @item -mcond-exec
19160 @opindex mcond-exec
19161
19162 Enable the use of conditional execution (default).
19163
19164 This switch is mainly for debugging the compiler and will likely be removed
19165 in a future version.
19166
19167 @item -mno-cond-exec
19168 @opindex mno-cond-exec
19169
19170 Disable the use of conditional execution.
19171
19172 This switch is mainly for debugging the compiler and will likely be removed
19173 in a future version.
19174
19175 @item -mvliw-branch
19176 @opindex mvliw-branch
19177
19178 Run a pass to pack branches into VLIW instructions (default).
19179
19180 This switch is mainly for debugging the compiler and will likely be removed
19181 in a future version.
19182
19183 @item -mno-vliw-branch
19184 @opindex mno-vliw-branch
19185
19186 Do not run a pass to pack branches into VLIW instructions.
19187
19188 This switch is mainly for debugging the compiler and will likely be removed
19189 in a future version.
19190
19191 @item -mmulti-cond-exec
19192 @opindex mmulti-cond-exec
19193
19194 Enable optimization of @code{&&} and @code{||} in conditional execution
19195 (default).
19196
19197 This switch is mainly for debugging the compiler and will likely be removed
19198 in a future version.
19199
19200 @item -mno-multi-cond-exec
19201 @opindex mno-multi-cond-exec
19202
19203 Disable optimization of @code{&&} and @code{||} in conditional execution.
19204
19205 This switch is mainly for debugging the compiler and will likely be removed
19206 in a future version.
19207
19208 @item -mnested-cond-exec
19209 @opindex mnested-cond-exec
19210
19211 Enable nested conditional execution optimizations (default).
19212
19213 This switch is mainly for debugging the compiler and will likely be removed
19214 in a future version.
19215
19216 @item -mno-nested-cond-exec
19217 @opindex mno-nested-cond-exec
19218
19219 Disable nested conditional execution optimizations.
19220
19221 This switch is mainly for debugging the compiler and will likely be removed
19222 in a future version.
19223
19224 @item -moptimize-membar
19225 @opindex moptimize-membar
19226
19227 This switch removes redundant @code{membar} instructions from the
19228 compiler-generated code. It is enabled by default.
19229
19230 @item -mno-optimize-membar
19231 @opindex mno-optimize-membar
19232
19233 This switch disables the automatic removal of redundant @code{membar}
19234 instructions from the generated code.
19235
19236 @item -mtomcat-stats
19237 @opindex mtomcat-stats
19238
19239 Cause gas to print out tomcat statistics.
19240
19241 @item -mcpu=@var{cpu}
19242 @opindex mcpu
19243
19244 Select the processor type for which to generate code. Possible values are
19245 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
19246 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
19247
19248 @end table
19249
19250 @node GNU/Linux Options
19251 @subsection GNU/Linux Options
19252
19253 These @samp{-m} options are defined for GNU/Linux targets:
19254
19255 @table @gcctabopt
19256 @item -mglibc
19257 @opindex mglibc
19258 Use the GNU C library. This is the default except
19259 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
19260 @samp{*-*-linux-*android*} targets.
19261
19262 @item -muclibc
19263 @opindex muclibc
19264 Use uClibc C library. This is the default on
19265 @samp{*-*-linux-*uclibc*} targets.
19266
19267 @item -mmusl
19268 @opindex mmusl
19269 Use the musl C library. This is the default on
19270 @samp{*-*-linux-*musl*} targets.
19271
19272 @item -mbionic
19273 @opindex mbionic
19274 Use Bionic C library. This is the default on
19275 @samp{*-*-linux-*android*} targets.
19276
19277 @item -mandroid
19278 @opindex mandroid
19279 Compile code compatible with Android platform. This is the default on
19280 @samp{*-*-linux-*android*} targets.
19281
19282 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
19283 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
19284 this option makes the GCC driver pass Android-specific options to the linker.
19285 Finally, this option causes the preprocessor macro @code{__ANDROID__}
19286 to be defined.
19287
19288 @item -tno-android-cc
19289 @opindex tno-android-cc
19290 Disable compilation effects of @option{-mandroid}, i.e., do not enable
19291 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
19292 @option{-fno-rtti} by default.
19293
19294 @item -tno-android-ld
19295 @opindex tno-android-ld
19296 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
19297 linking options to the linker.
19298
19299 @end table
19300
19301 @node H8/300 Options
19302 @subsection H8/300 Options
19303
19304 These @samp{-m} options are defined for the H8/300 implementations:
19305
19306 @table @gcctabopt
19307 @item -mrelax
19308 @opindex mrelax
19309 Shorten some address references at link time, when possible; uses the
19310 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
19311 ld, Using ld}, for a fuller description.
19312
19313 @item -mh
19314 @opindex mh
19315 Generate code for the H8/300H@.
19316
19317 @item -ms
19318 @opindex ms
19319 Generate code for the H8S@.
19320
19321 @item -mn
19322 @opindex mn
19323 Generate code for the H8S and H8/300H in the normal mode. This switch
19324 must be used either with @option{-mh} or @option{-ms}.
19325
19326 @item -ms2600
19327 @opindex ms2600
19328 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
19329
19330 @item -mexr
19331 @opindex mexr
19332 Extended registers are stored on stack before execution of function
19333 with monitor attribute. Default option is @option{-mexr}.
19334 This option is valid only for H8S targets.
19335
19336 @item -mno-exr
19337 @opindex mno-exr
19338 Extended registers are not stored on stack before execution of function
19339 with monitor attribute. Default option is @option{-mno-exr}.
19340 This option is valid only for H8S targets.
19341
19342 @item -mint32
19343 @opindex mint32
19344 Make @code{int} data 32 bits by default.
19345
19346 @item -malign-300
19347 @opindex malign-300
19348 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
19349 The default for the H8/300H and H8S is to align longs and floats on
19350 4-byte boundaries.
19351 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
19352 This option has no effect on the H8/300.
19353 @end table
19354
19355 @node HPPA Options
19356 @subsection HPPA Options
19357 @cindex HPPA Options
19358
19359 These @samp{-m} options are defined for the HPPA family of computers:
19360
19361 @table @gcctabopt
19362 @item -march=@var{architecture-type}
19363 @opindex march
19364 Generate code for the specified architecture. The choices for
19365 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
19366 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
19367 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
19368 architecture option for your machine. Code compiled for lower numbered
19369 architectures runs on higher numbered architectures, but not the
19370 other way around.
19371
19372 @item -mpa-risc-1-0
19373 @itemx -mpa-risc-1-1
19374 @itemx -mpa-risc-2-0
19375 @opindex mpa-risc-1-0
19376 @opindex mpa-risc-1-1
19377 @opindex mpa-risc-2-0
19378 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
19379
19380 @item -mcaller-copies
19381 @opindex mcaller-copies
19382 The caller copies function arguments passed by hidden reference. This
19383 option should be used with care as it is not compatible with the default
19384 32-bit runtime. However, only aggregates larger than eight bytes are
19385 passed by hidden reference and the option provides better compatibility
19386 with OpenMP.
19387
19388 @item -mjump-in-delay
19389 @opindex mjump-in-delay
19390 This option is ignored and provided for compatibility purposes only.
19391
19392 @item -mdisable-fpregs
19393 @opindex mdisable-fpregs
19394 Prevent floating-point registers from being used in any manner. This is
19395 necessary for compiling kernels that perform lazy context switching of
19396 floating-point registers. If you use this option and attempt to perform
19397 floating-point operations, the compiler aborts.
19398
19399 @item -mdisable-indexing
19400 @opindex mdisable-indexing
19401 Prevent the compiler from using indexing address modes. This avoids some
19402 rather obscure problems when compiling MIG generated code under MACH@.
19403
19404 @item -mno-space-regs
19405 @opindex mno-space-regs
19406 Generate code that assumes the target has no space registers. This allows
19407 GCC to generate faster indirect calls and use unscaled index address modes.
19408
19409 Such code is suitable for level 0 PA systems and kernels.
19410
19411 @item -mfast-indirect-calls
19412 @opindex mfast-indirect-calls
19413 Generate code that assumes calls never cross space boundaries. This
19414 allows GCC to emit code that performs faster indirect calls.
19415
19416 This option does not work in the presence of shared libraries or nested
19417 functions.
19418
19419 @item -mfixed-range=@var{register-range}
19420 @opindex mfixed-range
19421 Generate code treating the given register range as fixed registers.
19422 A fixed register is one that the register allocator cannot use. This is
19423 useful when compiling kernel code. A register range is specified as
19424 two registers separated by a dash. Multiple register ranges can be
19425 specified separated by a comma.
19426
19427 @item -mlong-load-store
19428 @opindex mlong-load-store
19429 Generate 3-instruction load and store sequences as sometimes required by
19430 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
19431 the HP compilers.
19432
19433 @item -mportable-runtime
19434 @opindex mportable-runtime
19435 Use the portable calling conventions proposed by HP for ELF systems.
19436
19437 @item -mgas
19438 @opindex mgas
19439 Enable the use of assembler directives only GAS understands.
19440
19441 @item -mschedule=@var{cpu-type}
19442 @opindex mschedule
19443 Schedule code according to the constraints for the machine type
19444 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
19445 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
19446 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
19447 proper scheduling option for your machine. The default scheduling is
19448 @samp{8000}.
19449
19450 @item -mlinker-opt
19451 @opindex mlinker-opt
19452 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
19453 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
19454 linkers in which they give bogus error messages when linking some programs.
19455
19456 @item -msoft-float
19457 @opindex msoft-float
19458 Generate output containing library calls for floating point.
19459 @strong{Warning:} the requisite libraries are not available for all HPPA
19460 targets. Normally the facilities of the machine's usual C compiler are
19461 used, but this cannot be done directly in cross-compilation. You must make
19462 your own arrangements to provide suitable library functions for
19463 cross-compilation.
19464
19465 @option{-msoft-float} changes the calling convention in the output file;
19466 therefore, it is only useful if you compile @emph{all} of a program with
19467 this option. In particular, you need to compile @file{libgcc.a}, the
19468 library that comes with GCC, with @option{-msoft-float} in order for
19469 this to work.
19470
19471 @item -msio
19472 @opindex msio
19473 Generate the predefine, @code{_SIO}, for server IO@. The default is
19474 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
19475 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
19476 options are available under HP-UX and HI-UX@.
19477
19478 @item -mgnu-ld
19479 @opindex mgnu-ld
19480 Use options specific to GNU @command{ld}.
19481 This passes @option{-shared} to @command{ld} when
19482 building a shared library. It is the default when GCC is configured,
19483 explicitly or implicitly, with the GNU linker. This option does not
19484 affect which @command{ld} is called; it only changes what parameters
19485 are passed to that @command{ld}.
19486 The @command{ld} that is called is determined by the
19487 @option{--with-ld} configure option, GCC's program search path, and
19488 finally by the user's @env{PATH}. The linker used by GCC can be printed
19489 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
19490 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19491
19492 @item -mhp-ld
19493 @opindex mhp-ld
19494 Use options specific to HP @command{ld}.
19495 This passes @option{-b} to @command{ld} when building
19496 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
19497 links. It is the default when GCC is configured, explicitly or
19498 implicitly, with the HP linker. This option does not affect
19499 which @command{ld} is called; it only changes what parameters are passed to that
19500 @command{ld}.
19501 The @command{ld} that is called is determined by the @option{--with-ld}
19502 configure option, GCC's program search path, and finally by the user's
19503 @env{PATH}. The linker used by GCC can be printed using @samp{which
19504 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
19505 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19506
19507 @item -mlong-calls
19508 @opindex mno-long-calls
19509 Generate code that uses long call sequences. This ensures that a call
19510 is always able to reach linker generated stubs. The default is to generate
19511 long calls only when the distance from the call site to the beginning
19512 of the function or translation unit, as the case may be, exceeds a
19513 predefined limit set by the branch type being used. The limits for
19514 normal calls are 7,600,000 and 240,000 bytes, respectively for the
19515 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
19516 240,000 bytes.
19517
19518 Distances are measured from the beginning of functions when using the
19519 @option{-ffunction-sections} option, or when using the @option{-mgas}
19520 and @option{-mno-portable-runtime} options together under HP-UX with
19521 the SOM linker.
19522
19523 It is normally not desirable to use this option as it degrades
19524 performance. However, it may be useful in large applications,
19525 particularly when partial linking is used to build the application.
19526
19527 The types of long calls used depends on the capabilities of the
19528 assembler and linker, and the type of code being generated. The
19529 impact on systems that support long absolute calls, and long pic
19530 symbol-difference or pc-relative calls should be relatively small.
19531 However, an indirect call is used on 32-bit ELF systems in pic code
19532 and it is quite long.
19533
19534 @item -munix=@var{unix-std}
19535 @opindex march
19536 Generate compiler predefines and select a startfile for the specified
19537 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
19538 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
19539 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
19540 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
19541 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
19542 and later.
19543
19544 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
19545 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
19546 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
19547 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
19548 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
19549 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
19550
19551 It is @emph{important} to note that this option changes the interfaces
19552 for various library routines. It also affects the operational behavior
19553 of the C library. Thus, @emph{extreme} care is needed in using this
19554 option.
19555
19556 Library code that is intended to operate with more than one UNIX
19557 standard must test, set and restore the variable @code{__xpg4_extended_mask}
19558 as appropriate. Most GNU software doesn't provide this capability.
19559
19560 @item -nolibdld
19561 @opindex nolibdld
19562 Suppress the generation of link options to search libdld.sl when the
19563 @option{-static} option is specified on HP-UX 10 and later.
19564
19565 @item -static
19566 @opindex static
19567 The HP-UX implementation of setlocale in libc has a dependency on
19568 libdld.sl. There isn't an archive version of libdld.sl. Thus,
19569 when the @option{-static} option is specified, special link options
19570 are needed to resolve this dependency.
19571
19572 On HP-UX 10 and later, the GCC driver adds the necessary options to
19573 link with libdld.sl when the @option{-static} option is specified.
19574 This causes the resulting binary to be dynamic. On the 64-bit port,
19575 the linkers generate dynamic binaries by default in any case. The
19576 @option{-nolibdld} option can be used to prevent the GCC driver from
19577 adding these link options.
19578
19579 @item -threads
19580 @opindex threads
19581 Add support for multithreading with the @dfn{dce thread} library
19582 under HP-UX@. This option sets flags for both the preprocessor and
19583 linker.
19584 @end table
19585
19586 @node IA-64 Options
19587 @subsection IA-64 Options
19588 @cindex IA-64 Options
19589
19590 These are the @samp{-m} options defined for the Intel IA-64 architecture.
19591
19592 @table @gcctabopt
19593 @item -mbig-endian
19594 @opindex mbig-endian
19595 Generate code for a big-endian target. This is the default for HP-UX@.
19596
19597 @item -mlittle-endian
19598 @opindex mlittle-endian
19599 Generate code for a little-endian target. This is the default for AIX5
19600 and GNU/Linux.
19601
19602 @item -mgnu-as
19603 @itemx -mno-gnu-as
19604 @opindex mgnu-as
19605 @opindex mno-gnu-as
19606 Generate (or don't) code for the GNU assembler. This is the default.
19607 @c Also, this is the default if the configure option @option{--with-gnu-as}
19608 @c is used.
19609
19610 @item -mgnu-ld
19611 @itemx -mno-gnu-ld
19612 @opindex mgnu-ld
19613 @opindex mno-gnu-ld
19614 Generate (or don't) code for the GNU linker. This is the default.
19615 @c Also, this is the default if the configure option @option{--with-gnu-ld}
19616 @c is used.
19617
19618 @item -mno-pic
19619 @opindex mno-pic
19620 Generate code that does not use a global pointer register. The result
19621 is not position independent code, and violates the IA-64 ABI@.
19622
19623 @item -mvolatile-asm-stop
19624 @itemx -mno-volatile-asm-stop
19625 @opindex mvolatile-asm-stop
19626 @opindex mno-volatile-asm-stop
19627 Generate (or don't) a stop bit immediately before and after volatile asm
19628 statements.
19629
19630 @item -mregister-names
19631 @itemx -mno-register-names
19632 @opindex mregister-names
19633 @opindex mno-register-names
19634 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
19635 the stacked registers. This may make assembler output more readable.
19636
19637 @item -mno-sdata
19638 @itemx -msdata
19639 @opindex mno-sdata
19640 @opindex msdata
19641 Disable (or enable) optimizations that use the small data section. This may
19642 be useful for working around optimizer bugs.
19643
19644 @item -mconstant-gp
19645 @opindex mconstant-gp
19646 Generate code that uses a single constant global pointer value. This is
19647 useful when compiling kernel code.
19648
19649 @item -mauto-pic
19650 @opindex mauto-pic
19651 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
19652 This is useful when compiling firmware code.
19653
19654 @item -minline-float-divide-min-latency
19655 @opindex minline-float-divide-min-latency
19656 Generate code for inline divides of floating-point values
19657 using the minimum latency algorithm.
19658
19659 @item -minline-float-divide-max-throughput
19660 @opindex minline-float-divide-max-throughput
19661 Generate code for inline divides of floating-point values
19662 using the maximum throughput algorithm.
19663
19664 @item -mno-inline-float-divide
19665 @opindex mno-inline-float-divide
19666 Do not generate inline code for divides of floating-point values.
19667
19668 @item -minline-int-divide-min-latency
19669 @opindex minline-int-divide-min-latency
19670 Generate code for inline divides of integer values
19671 using the minimum latency algorithm.
19672
19673 @item -minline-int-divide-max-throughput
19674 @opindex minline-int-divide-max-throughput
19675 Generate code for inline divides of integer values
19676 using the maximum throughput algorithm.
19677
19678 @item -mno-inline-int-divide
19679 @opindex mno-inline-int-divide
19680 Do not generate inline code for divides of integer values.
19681
19682 @item -minline-sqrt-min-latency
19683 @opindex minline-sqrt-min-latency
19684 Generate code for inline square roots
19685 using the minimum latency algorithm.
19686
19687 @item -minline-sqrt-max-throughput
19688 @opindex minline-sqrt-max-throughput
19689 Generate code for inline square roots
19690 using the maximum throughput algorithm.
19691
19692 @item -mno-inline-sqrt
19693 @opindex mno-inline-sqrt
19694 Do not generate inline code for @code{sqrt}.
19695
19696 @item -mfused-madd
19697 @itemx -mno-fused-madd
19698 @opindex mfused-madd
19699 @opindex mno-fused-madd
19700 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
19701 instructions. The default is to use these instructions.
19702
19703 @item -mno-dwarf2-asm
19704 @itemx -mdwarf2-asm
19705 @opindex mno-dwarf2-asm
19706 @opindex mdwarf2-asm
19707 Don't (or do) generate assembler code for the DWARF line number debugging
19708 info. This may be useful when not using the GNU assembler.
19709
19710 @item -mearly-stop-bits
19711 @itemx -mno-early-stop-bits
19712 @opindex mearly-stop-bits
19713 @opindex mno-early-stop-bits
19714 Allow stop bits to be placed earlier than immediately preceding the
19715 instruction that triggered the stop bit. This can improve instruction
19716 scheduling, but does not always do so.
19717
19718 @item -mfixed-range=@var{register-range}
19719 @opindex mfixed-range
19720 Generate code treating the given register range as fixed registers.
19721 A fixed register is one that the register allocator cannot use. This is
19722 useful when compiling kernel code. A register range is specified as
19723 two registers separated by a dash. Multiple register ranges can be
19724 specified separated by a comma.
19725
19726 @item -mtls-size=@var{tls-size}
19727 @opindex mtls-size
19728 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
19729 64.
19730
19731 @item -mtune=@var{cpu-type}
19732 @opindex mtune
19733 Tune the instruction scheduling for a particular CPU, Valid values are
19734 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
19735 and @samp{mckinley}.
19736
19737 @item -milp32
19738 @itemx -mlp64
19739 @opindex milp32
19740 @opindex mlp64
19741 Generate code for a 32-bit or 64-bit environment.
19742 The 32-bit environment sets int, long and pointer to 32 bits.
19743 The 64-bit environment sets int to 32 bits and long and pointer
19744 to 64 bits. These are HP-UX specific flags.
19745
19746 @item -mno-sched-br-data-spec
19747 @itemx -msched-br-data-spec
19748 @opindex mno-sched-br-data-spec
19749 @opindex msched-br-data-spec
19750 (Dis/En)able data speculative scheduling before reload.
19751 This results in generation of @code{ld.a} instructions and
19752 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19753 The default setting is disabled.
19754
19755 @item -msched-ar-data-spec
19756 @itemx -mno-sched-ar-data-spec
19757 @opindex msched-ar-data-spec
19758 @opindex mno-sched-ar-data-spec
19759 (En/Dis)able data speculative scheduling after reload.
19760 This results in generation of @code{ld.a} instructions and
19761 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19762 The default setting is enabled.
19763
19764 @item -mno-sched-control-spec
19765 @itemx -msched-control-spec
19766 @opindex mno-sched-control-spec
19767 @opindex msched-control-spec
19768 (Dis/En)able control speculative scheduling. This feature is
19769 available only during region scheduling (i.e.@: before reload).
19770 This results in generation of the @code{ld.s} instructions and
19771 the corresponding check instructions @code{chk.s}.
19772 The default setting is disabled.
19773
19774 @item -msched-br-in-data-spec
19775 @itemx -mno-sched-br-in-data-spec
19776 @opindex msched-br-in-data-spec
19777 @opindex mno-sched-br-in-data-spec
19778 (En/Dis)able speculative scheduling of the instructions that
19779 are dependent on the data speculative loads before reload.
19780 This is effective only with @option{-msched-br-data-spec} enabled.
19781 The default setting is enabled.
19782
19783 @item -msched-ar-in-data-spec
19784 @itemx -mno-sched-ar-in-data-spec
19785 @opindex msched-ar-in-data-spec
19786 @opindex mno-sched-ar-in-data-spec
19787 (En/Dis)able speculative scheduling of the instructions that
19788 are dependent on the data speculative loads after reload.
19789 This is effective only with @option{-msched-ar-data-spec} enabled.
19790 The default setting is enabled.
19791
19792 @item -msched-in-control-spec
19793 @itemx -mno-sched-in-control-spec
19794 @opindex msched-in-control-spec
19795 @opindex mno-sched-in-control-spec
19796 (En/Dis)able speculative scheduling of the instructions that
19797 are dependent on the control speculative loads.
19798 This is effective only with @option{-msched-control-spec} enabled.
19799 The default setting is enabled.
19800
19801 @item -mno-sched-prefer-non-data-spec-insns
19802 @itemx -msched-prefer-non-data-spec-insns
19803 @opindex mno-sched-prefer-non-data-spec-insns
19804 @opindex msched-prefer-non-data-spec-insns
19805 If enabled, data-speculative instructions are chosen for schedule
19806 only if there are no other choices at the moment. This makes
19807 the use of the data speculation much more conservative.
19808 The default setting is disabled.
19809
19810 @item -mno-sched-prefer-non-control-spec-insns
19811 @itemx -msched-prefer-non-control-spec-insns
19812 @opindex mno-sched-prefer-non-control-spec-insns
19813 @opindex msched-prefer-non-control-spec-insns
19814 If enabled, control-speculative instructions are chosen for schedule
19815 only if there are no other choices at the moment. This makes
19816 the use of the control speculation much more conservative.
19817 The default setting is disabled.
19818
19819 @item -mno-sched-count-spec-in-critical-path
19820 @itemx -msched-count-spec-in-critical-path
19821 @opindex mno-sched-count-spec-in-critical-path
19822 @opindex msched-count-spec-in-critical-path
19823 If enabled, speculative dependencies are considered during
19824 computation of the instructions priorities. This makes the use of the
19825 speculation a bit more conservative.
19826 The default setting is disabled.
19827
19828 @item -msched-spec-ldc
19829 @opindex msched-spec-ldc
19830 Use a simple data speculation check. This option is on by default.
19831
19832 @item -msched-control-spec-ldc
19833 @opindex msched-spec-ldc
19834 Use a simple check for control speculation. This option is on by default.
19835
19836 @item -msched-stop-bits-after-every-cycle
19837 @opindex msched-stop-bits-after-every-cycle
19838 Place a stop bit after every cycle when scheduling. This option is on
19839 by default.
19840
19841 @item -msched-fp-mem-deps-zero-cost
19842 @opindex msched-fp-mem-deps-zero-cost
19843 Assume that floating-point stores and loads are not likely to cause a conflict
19844 when placed into the same instruction group. This option is disabled by
19845 default.
19846
19847 @item -msel-sched-dont-check-control-spec
19848 @opindex msel-sched-dont-check-control-spec
19849 Generate checks for control speculation in selective scheduling.
19850 This flag is disabled by default.
19851
19852 @item -msched-max-memory-insns=@var{max-insns}
19853 @opindex msched-max-memory-insns
19854 Limit on the number of memory insns per instruction group, giving lower
19855 priority to subsequent memory insns attempting to schedule in the same
19856 instruction group. Frequently useful to prevent cache bank conflicts.
19857 The default value is 1.
19858
19859 @item -msched-max-memory-insns-hard-limit
19860 @opindex msched-max-memory-insns-hard-limit
19861 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
19862 disallowing more than that number in an instruction group.
19863 Otherwise, the limit is ``soft'', meaning that non-memory operations
19864 are preferred when the limit is reached, but memory operations may still
19865 be scheduled.
19866
19867 @end table
19868
19869 @node LM32 Options
19870 @subsection LM32 Options
19871 @cindex LM32 options
19872
19873 These @option{-m} options are defined for the LatticeMico32 architecture:
19874
19875 @table @gcctabopt
19876 @item -mbarrel-shift-enabled
19877 @opindex mbarrel-shift-enabled
19878 Enable barrel-shift instructions.
19879
19880 @item -mdivide-enabled
19881 @opindex mdivide-enabled
19882 Enable divide and modulus instructions.
19883
19884 @item -mmultiply-enabled
19885 @opindex multiply-enabled
19886 Enable multiply instructions.
19887
19888 @item -msign-extend-enabled
19889 @opindex msign-extend-enabled
19890 Enable sign extend instructions.
19891
19892 @item -muser-enabled
19893 @opindex muser-enabled
19894 Enable user-defined instructions.
19895
19896 @end table
19897
19898 @node M32C Options
19899 @subsection M32C Options
19900 @cindex M32C options
19901
19902 @table @gcctabopt
19903 @item -mcpu=@var{name}
19904 @opindex mcpu=
19905 Select the CPU for which code is generated. @var{name} may be one of
19906 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
19907 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
19908 the M32C/80 series.
19909
19910 @item -msim
19911 @opindex msim
19912 Specifies that the program will be run on the simulator. This causes
19913 an alternate runtime library to be linked in which supports, for
19914 example, file I/O@. You must not use this option when generating
19915 programs that will run on real hardware; you must provide your own
19916 runtime library for whatever I/O functions are needed.
19917
19918 @item -memregs=@var{number}
19919 @opindex memregs=
19920 Specifies the number of memory-based pseudo-registers GCC uses
19921 during code generation. These pseudo-registers are used like real
19922 registers, so there is a tradeoff between GCC's ability to fit the
19923 code into available registers, and the performance penalty of using
19924 memory instead of registers. Note that all modules in a program must
19925 be compiled with the same value for this option. Because of that, you
19926 must not use this option with GCC's default runtime libraries.
19927
19928 @end table
19929
19930 @node M32R/D Options
19931 @subsection M32R/D Options
19932 @cindex M32R/D options
19933
19934 These @option{-m} options are defined for Renesas M32R/D architectures:
19935
19936 @table @gcctabopt
19937 @item -m32r2
19938 @opindex m32r2
19939 Generate code for the M32R/2@.
19940
19941 @item -m32rx
19942 @opindex m32rx
19943 Generate code for the M32R/X@.
19944
19945 @item -m32r
19946 @opindex m32r
19947 Generate code for the M32R@. This is the default.
19948
19949 @item -mmodel=small
19950 @opindex mmodel=small
19951 Assume all objects live in the lower 16MB of memory (so that their addresses
19952 can be loaded with the @code{ld24} instruction), and assume all subroutines
19953 are reachable with the @code{bl} instruction.
19954 This is the default.
19955
19956 The addressability of a particular object can be set with the
19957 @code{model} attribute.
19958
19959 @item -mmodel=medium
19960 @opindex mmodel=medium
19961 Assume objects may be anywhere in the 32-bit address space (the compiler
19962 generates @code{seth/add3} instructions to load their addresses), and
19963 assume all subroutines are reachable with the @code{bl} instruction.
19964
19965 @item -mmodel=large
19966 @opindex mmodel=large
19967 Assume objects may be anywhere in the 32-bit address space (the compiler
19968 generates @code{seth/add3} instructions to load their addresses), and
19969 assume subroutines may not be reachable with the @code{bl} instruction
19970 (the compiler generates the much slower @code{seth/add3/jl}
19971 instruction sequence).
19972
19973 @item -msdata=none
19974 @opindex msdata=none
19975 Disable use of the small data area. Variables are put into
19976 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
19977 @code{section} attribute has been specified).
19978 This is the default.
19979
19980 The small data area consists of sections @code{.sdata} and @code{.sbss}.
19981 Objects may be explicitly put in the small data area with the
19982 @code{section} attribute using one of these sections.
19983
19984 @item -msdata=sdata
19985 @opindex msdata=sdata
19986 Put small global and static data in the small data area, but do not
19987 generate special code to reference them.
19988
19989 @item -msdata=use
19990 @opindex msdata=use
19991 Put small global and static data in the small data area, and generate
19992 special instructions to reference them.
19993
19994 @item -G @var{num}
19995 @opindex G
19996 @cindex smaller data references
19997 Put global and static objects less than or equal to @var{num} bytes
19998 into the small data or BSS sections instead of the normal data or BSS
19999 sections. The default value of @var{num} is 8.
20000 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20001 for this option to have any effect.
20002
20003 All modules should be compiled with the same @option{-G @var{num}} value.
20004 Compiling with different values of @var{num} may or may not work; if it
20005 doesn't the linker gives an error message---incorrect code is not
20006 generated.
20007
20008 @item -mdebug
20009 @opindex mdebug
20010 Makes the M32R-specific code in the compiler display some statistics
20011 that might help in debugging programs.
20012
20013 @item -malign-loops
20014 @opindex malign-loops
20015 Align all loops to a 32-byte boundary.
20016
20017 @item -mno-align-loops
20018 @opindex mno-align-loops
20019 Do not enforce a 32-byte alignment for loops. This is the default.
20020
20021 @item -missue-rate=@var{number}
20022 @opindex missue-rate=@var{number}
20023 Issue @var{number} instructions per cycle. @var{number} can only be 1
20024 or 2.
20025
20026 @item -mbranch-cost=@var{number}
20027 @opindex mbranch-cost=@var{number}
20028 @var{number} can only be 1 or 2. If it is 1 then branches are
20029 preferred over conditional code, if it is 2, then the opposite applies.
20030
20031 @item -mflush-trap=@var{number}
20032 @opindex mflush-trap=@var{number}
20033 Specifies the trap number to use to flush the cache. The default is
20034 12. Valid numbers are between 0 and 15 inclusive.
20035
20036 @item -mno-flush-trap
20037 @opindex mno-flush-trap
20038 Specifies that the cache cannot be flushed by using a trap.
20039
20040 @item -mflush-func=@var{name}
20041 @opindex mflush-func=@var{name}
20042 Specifies the name of the operating system function to call to flush
20043 the cache. The default is @samp{_flush_cache}, but a function call
20044 is only used if a trap is not available.
20045
20046 @item -mno-flush-func
20047 @opindex mno-flush-func
20048 Indicates that there is no OS function for flushing the cache.
20049
20050 @end table
20051
20052 @node M680x0 Options
20053 @subsection M680x0 Options
20054 @cindex M680x0 options
20055
20056 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
20057 The default settings depend on which architecture was selected when
20058 the compiler was configured; the defaults for the most common choices
20059 are given below.
20060
20061 @table @gcctabopt
20062 @item -march=@var{arch}
20063 @opindex march
20064 Generate code for a specific M680x0 or ColdFire instruction set
20065 architecture. Permissible values of @var{arch} for M680x0
20066 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
20067 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
20068 architectures are selected according to Freescale's ISA classification
20069 and the permissible values are: @samp{isaa}, @samp{isaaplus},
20070 @samp{isab} and @samp{isac}.
20071
20072 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
20073 code for a ColdFire target. The @var{arch} in this macro is one of the
20074 @option{-march} arguments given above.
20075
20076 When used together, @option{-march} and @option{-mtune} select code
20077 that runs on a family of similar processors but that is optimized
20078 for a particular microarchitecture.
20079
20080 @item -mcpu=@var{cpu}
20081 @opindex mcpu
20082 Generate code for a specific M680x0 or ColdFire processor.
20083 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
20084 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
20085 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
20086 below, which also classifies the CPUs into families:
20087
20088 @multitable @columnfractions 0.20 0.80
20089 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
20090 @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}
20091 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
20092 @item @samp{5206e} @tab @samp{5206e}
20093 @item @samp{5208} @tab @samp{5207} @samp{5208}
20094 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
20095 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
20096 @item @samp{5216} @tab @samp{5214} @samp{5216}
20097 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
20098 @item @samp{5225} @tab @samp{5224} @samp{5225}
20099 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
20100 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
20101 @item @samp{5249} @tab @samp{5249}
20102 @item @samp{5250} @tab @samp{5250}
20103 @item @samp{5271} @tab @samp{5270} @samp{5271}
20104 @item @samp{5272} @tab @samp{5272}
20105 @item @samp{5275} @tab @samp{5274} @samp{5275}
20106 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
20107 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
20108 @item @samp{5307} @tab @samp{5307}
20109 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
20110 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
20111 @item @samp{5407} @tab @samp{5407}
20112 @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}
20113 @end multitable
20114
20115 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
20116 @var{arch} is compatible with @var{cpu}. Other combinations of
20117 @option{-mcpu} and @option{-march} are rejected.
20118
20119 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
20120 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
20121 where the value of @var{family} is given by the table above.
20122
20123 @item -mtune=@var{tune}
20124 @opindex mtune
20125 Tune the code for a particular microarchitecture within the
20126 constraints set by @option{-march} and @option{-mcpu}.
20127 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
20128 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
20129 and @samp{cpu32}. The ColdFire microarchitectures
20130 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
20131
20132 You can also use @option{-mtune=68020-40} for code that needs
20133 to run relatively well on 68020, 68030 and 68040 targets.
20134 @option{-mtune=68020-60} is similar but includes 68060 targets
20135 as well. These two options select the same tuning decisions as
20136 @option{-m68020-40} and @option{-m68020-60} respectively.
20137
20138 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
20139 when tuning for 680x0 architecture @var{arch}. It also defines
20140 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
20141 option is used. If GCC is tuning for a range of architectures,
20142 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
20143 it defines the macros for every architecture in the range.
20144
20145 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
20146 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
20147 of the arguments given above.
20148
20149 @item -m68000
20150 @itemx -mc68000
20151 @opindex m68000
20152 @opindex mc68000
20153 Generate output for a 68000. This is the default
20154 when the compiler is configured for 68000-based systems.
20155 It is equivalent to @option{-march=68000}.
20156
20157 Use this option for microcontrollers with a 68000 or EC000 core,
20158 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
20159
20160 @item -m68010
20161 @opindex m68010
20162 Generate output for a 68010. This is the default
20163 when the compiler is configured for 68010-based systems.
20164 It is equivalent to @option{-march=68010}.
20165
20166 @item -m68020
20167 @itemx -mc68020
20168 @opindex m68020
20169 @opindex mc68020
20170 Generate output for a 68020. This is the default
20171 when the compiler is configured for 68020-based systems.
20172 It is equivalent to @option{-march=68020}.
20173
20174 @item -m68030
20175 @opindex m68030
20176 Generate output for a 68030. This is the default when the compiler is
20177 configured for 68030-based systems. It is equivalent to
20178 @option{-march=68030}.
20179
20180 @item -m68040
20181 @opindex m68040
20182 Generate output for a 68040. This is the default when the compiler is
20183 configured for 68040-based systems. It is equivalent to
20184 @option{-march=68040}.
20185
20186 This option inhibits the use of 68881/68882 instructions that have to be
20187 emulated by software on the 68040. Use this option if your 68040 does not
20188 have code to emulate those instructions.
20189
20190 @item -m68060
20191 @opindex m68060
20192 Generate output for a 68060. This is the default when the compiler is
20193 configured for 68060-based systems. It is equivalent to
20194 @option{-march=68060}.
20195
20196 This option inhibits the use of 68020 and 68881/68882 instructions that
20197 have to be emulated by software on the 68060. Use this option if your 68060
20198 does not have code to emulate those instructions.
20199
20200 @item -mcpu32
20201 @opindex mcpu32
20202 Generate output for a CPU32. This is the default
20203 when the compiler is configured for CPU32-based systems.
20204 It is equivalent to @option{-march=cpu32}.
20205
20206 Use this option for microcontrollers with a
20207 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20208 68336, 68340, 68341, 68349 and 68360.
20209
20210 @item -m5200
20211 @opindex m5200
20212 Generate output for a 520X ColdFire CPU@. This is the default
20213 when the compiler is configured for 520X-based systems.
20214 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20215 in favor of that option.
20216
20217 Use this option for microcontroller with a 5200 core, including
20218 the MCF5202, MCF5203, MCF5204 and MCF5206.
20219
20220 @item -m5206e
20221 @opindex m5206e
20222 Generate output for a 5206e ColdFire CPU@. The option is now
20223 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20224
20225 @item -m528x
20226 @opindex m528x
20227 Generate output for a member of the ColdFire 528X family.
20228 The option is now deprecated in favor of the equivalent
20229 @option{-mcpu=528x}.
20230
20231 @item -m5307
20232 @opindex m5307
20233 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20234 in favor of the equivalent @option{-mcpu=5307}.
20235
20236 @item -m5407
20237 @opindex m5407
20238 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
20239 in favor of the equivalent @option{-mcpu=5407}.
20240
20241 @item -mcfv4e
20242 @opindex mcfv4e
20243 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
20244 This includes use of hardware floating-point instructions.
20245 The option is equivalent to @option{-mcpu=547x}, and is now
20246 deprecated in favor of that option.
20247
20248 @item -m68020-40
20249 @opindex m68020-40
20250 Generate output for a 68040, without using any of the new instructions.
20251 This results in code that can run relatively efficiently on either a
20252 68020/68881 or a 68030 or a 68040. The generated code does use the
20253 68881 instructions that are emulated on the 68040.
20254
20255 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
20256
20257 @item -m68020-60
20258 @opindex m68020-60
20259 Generate output for a 68060, without using any of the new instructions.
20260 This results in code that can run relatively efficiently on either a
20261 68020/68881 or a 68030 or a 68040. The generated code does use the
20262 68881 instructions that are emulated on the 68060.
20263
20264 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
20265
20266 @item -mhard-float
20267 @itemx -m68881
20268 @opindex mhard-float
20269 @opindex m68881
20270 Generate floating-point instructions. This is the default for 68020
20271 and above, and for ColdFire devices that have an FPU@. It defines the
20272 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
20273 on ColdFire targets.
20274
20275 @item -msoft-float
20276 @opindex msoft-float
20277 Do not generate floating-point instructions; use library calls instead.
20278 This is the default for 68000, 68010, and 68832 targets. It is also
20279 the default for ColdFire devices that have no FPU.
20280
20281 @item -mdiv
20282 @itemx -mno-div
20283 @opindex mdiv
20284 @opindex mno-div
20285 Generate (do not generate) ColdFire hardware divide and remainder
20286 instructions. If @option{-march} is used without @option{-mcpu},
20287 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
20288 architectures. Otherwise, the default is taken from the target CPU
20289 (either the default CPU, or the one specified by @option{-mcpu}). For
20290 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
20291 @option{-mcpu=5206e}.
20292
20293 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
20294
20295 @item -mshort
20296 @opindex mshort
20297 Consider type @code{int} to be 16 bits wide, like @code{short int}.
20298 Additionally, parameters passed on the stack are also aligned to a
20299 16-bit boundary even on targets whose API mandates promotion to 32-bit.
20300
20301 @item -mno-short
20302 @opindex mno-short
20303 Do not consider type @code{int} to be 16 bits wide. This is the default.
20304
20305 @item -mnobitfield
20306 @itemx -mno-bitfield
20307 @opindex mnobitfield
20308 @opindex mno-bitfield
20309 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
20310 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
20311
20312 @item -mbitfield
20313 @opindex mbitfield
20314 Do use the bit-field instructions. The @option{-m68020} option implies
20315 @option{-mbitfield}. This is the default if you use a configuration
20316 designed for a 68020.
20317
20318 @item -mrtd
20319 @opindex mrtd
20320 Use a different function-calling convention, in which functions
20321 that take a fixed number of arguments return with the @code{rtd}
20322 instruction, which pops their arguments while returning. This
20323 saves one instruction in the caller since there is no need to pop
20324 the arguments there.
20325
20326 This calling convention is incompatible with the one normally
20327 used on Unix, so you cannot use it if you need to call libraries
20328 compiled with the Unix compiler.
20329
20330 Also, you must provide function prototypes for all functions that
20331 take variable numbers of arguments (including @code{printf});
20332 otherwise incorrect code is generated for calls to those
20333 functions.
20334
20335 In addition, seriously incorrect code results if you call a
20336 function with too many arguments. (Normally, extra arguments are
20337 harmlessly ignored.)
20338
20339 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
20340 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20341
20342 @item -mno-rtd
20343 @opindex mno-rtd
20344 Do not use the calling conventions selected by @option{-mrtd}.
20345 This is the default.
20346
20347 @item -malign-int
20348 @itemx -mno-align-int
20349 @opindex malign-int
20350 @opindex mno-align-int
20351 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
20352 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
20353 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
20354 Aligning variables on 32-bit boundaries produces code that runs somewhat
20355 faster on processors with 32-bit busses at the expense of more memory.
20356
20357 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
20358 aligns structures containing the above types differently than
20359 most published application binary interface specifications for the m68k.
20360
20361 @item -mpcrel
20362 @opindex mpcrel
20363 Use the pc-relative addressing mode of the 68000 directly, instead of
20364 using a global offset table. At present, this option implies @option{-fpic},
20365 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
20366 not presently supported with @option{-mpcrel}, though this could be supported for
20367 68020 and higher processors.
20368
20369 @item -mno-strict-align
20370 @itemx -mstrict-align
20371 @opindex mno-strict-align
20372 @opindex mstrict-align
20373 Do not (do) assume that unaligned memory references are handled by
20374 the system.
20375
20376 @item -msep-data
20377 Generate code that allows the data segment to be located in a different
20378 area of memory from the text segment. This allows for execute-in-place in
20379 an environment without virtual memory management. This option implies
20380 @option{-fPIC}.
20381
20382 @item -mno-sep-data
20383 Generate code that assumes that the data segment follows the text segment.
20384 This is the default.
20385
20386 @item -mid-shared-library
20387 Generate code that supports shared libraries via the library ID method.
20388 This allows for execute-in-place and shared libraries in an environment
20389 without virtual memory management. This option implies @option{-fPIC}.
20390
20391 @item -mno-id-shared-library
20392 Generate code that doesn't assume ID-based shared libraries are being used.
20393 This is the default.
20394
20395 @item -mshared-library-id=n
20396 Specifies the identification number of the ID-based shared library being
20397 compiled. Specifying a value of 0 generates more compact code; specifying
20398 other values forces the allocation of that number to the current
20399 library, but is no more space- or time-efficient than omitting this option.
20400
20401 @item -mxgot
20402 @itemx -mno-xgot
20403 @opindex mxgot
20404 @opindex mno-xgot
20405 When generating position-independent code for ColdFire, generate code
20406 that works if the GOT has more than 8192 entries. This code is
20407 larger and slower than code generated without this option. On M680x0
20408 processors, this option is not needed; @option{-fPIC} suffices.
20409
20410 GCC normally uses a single instruction to load values from the GOT@.
20411 While this is relatively efficient, it only works if the GOT
20412 is smaller than about 64k. Anything larger causes the linker
20413 to report an error such as:
20414
20415 @cindex relocation truncated to fit (ColdFire)
20416 @smallexample
20417 relocation truncated to fit: R_68K_GOT16O foobar
20418 @end smallexample
20419
20420 If this happens, you should recompile your code with @option{-mxgot}.
20421 It should then work with very large GOTs. However, code generated with
20422 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
20423 the value of a global symbol.
20424
20425 Note that some linkers, including newer versions of the GNU linker,
20426 can create multiple GOTs and sort GOT entries. If you have such a linker,
20427 you should only need to use @option{-mxgot} when compiling a single
20428 object file that accesses more than 8192 GOT entries. Very few do.
20429
20430 These options have no effect unless GCC is generating
20431 position-independent code.
20432
20433 @item -mlong-jump-table-offsets
20434 @opindex mlong-jump-table-offsets
20435 Use 32-bit offsets in @code{switch} tables. The default is to use
20436 16-bit offsets.
20437
20438 @end table
20439
20440 @node MCore Options
20441 @subsection MCore Options
20442 @cindex MCore options
20443
20444 These are the @samp{-m} options defined for the Motorola M*Core
20445 processors.
20446
20447 @table @gcctabopt
20448
20449 @item -mhardlit
20450 @itemx -mno-hardlit
20451 @opindex mhardlit
20452 @opindex mno-hardlit
20453 Inline constants into the code stream if it can be done in two
20454 instructions or less.
20455
20456 @item -mdiv
20457 @itemx -mno-div
20458 @opindex mdiv
20459 @opindex mno-div
20460 Use the divide instruction. (Enabled by default).
20461
20462 @item -mrelax-immediate
20463 @itemx -mno-relax-immediate
20464 @opindex mrelax-immediate
20465 @opindex mno-relax-immediate
20466 Allow arbitrary-sized immediates in bit operations.
20467
20468 @item -mwide-bitfields
20469 @itemx -mno-wide-bitfields
20470 @opindex mwide-bitfields
20471 @opindex mno-wide-bitfields
20472 Always treat bit-fields as @code{int}-sized.
20473
20474 @item -m4byte-functions
20475 @itemx -mno-4byte-functions
20476 @opindex m4byte-functions
20477 @opindex mno-4byte-functions
20478 Force all functions to be aligned to a 4-byte boundary.
20479
20480 @item -mcallgraph-data
20481 @itemx -mno-callgraph-data
20482 @opindex mcallgraph-data
20483 @opindex mno-callgraph-data
20484 Emit callgraph information.
20485
20486 @item -mslow-bytes
20487 @itemx -mno-slow-bytes
20488 @opindex mslow-bytes
20489 @opindex mno-slow-bytes
20490 Prefer word access when reading byte quantities.
20491
20492 @item -mlittle-endian
20493 @itemx -mbig-endian
20494 @opindex mlittle-endian
20495 @opindex mbig-endian
20496 Generate code for a little-endian target.
20497
20498 @item -m210
20499 @itemx -m340
20500 @opindex m210
20501 @opindex m340
20502 Generate code for the 210 processor.
20503
20504 @item -mno-lsim
20505 @opindex mno-lsim
20506 Assume that runtime support has been provided and so omit the
20507 simulator library (@file{libsim.a)} from the linker command line.
20508
20509 @item -mstack-increment=@var{size}
20510 @opindex mstack-increment
20511 Set the maximum amount for a single stack increment operation. Large
20512 values can increase the speed of programs that contain functions
20513 that need a large amount of stack space, but they can also trigger a
20514 segmentation fault if the stack is extended too much. The default
20515 value is 0x1000.
20516
20517 @end table
20518
20519 @node MeP Options
20520 @subsection MeP Options
20521 @cindex MeP options
20522
20523 @table @gcctabopt
20524
20525 @item -mabsdiff
20526 @opindex mabsdiff
20527 Enables the @code{abs} instruction, which is the absolute difference
20528 between two registers.
20529
20530 @item -mall-opts
20531 @opindex mall-opts
20532 Enables all the optional instructions---average, multiply, divide, bit
20533 operations, leading zero, absolute difference, min/max, clip, and
20534 saturation.
20535
20536
20537 @item -maverage
20538 @opindex maverage
20539 Enables the @code{ave} instruction, which computes the average of two
20540 registers.
20541
20542 @item -mbased=@var{n}
20543 @opindex mbased=
20544 Variables of size @var{n} bytes or smaller are placed in the
20545 @code{.based} section by default. Based variables use the @code{$tp}
20546 register as a base register, and there is a 128-byte limit to the
20547 @code{.based} section.
20548
20549 @item -mbitops
20550 @opindex mbitops
20551 Enables the bit operation instructions---bit test (@code{btstm}), set
20552 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
20553 test-and-set (@code{tas}).
20554
20555 @item -mc=@var{name}
20556 @opindex mc=
20557 Selects which section constant data is placed in. @var{name} may
20558 be @samp{tiny}, @samp{near}, or @samp{far}.
20559
20560 @item -mclip
20561 @opindex mclip
20562 Enables the @code{clip} instruction. Note that @option{-mclip} is not
20563 useful unless you also provide @option{-mminmax}.
20564
20565 @item -mconfig=@var{name}
20566 @opindex mconfig=
20567 Selects one of the built-in core configurations. Each MeP chip has
20568 one or more modules in it; each module has a core CPU and a variety of
20569 coprocessors, optional instructions, and peripherals. The
20570 @code{MeP-Integrator} tool, not part of GCC, provides these
20571 configurations through this option; using this option is the same as
20572 using all the corresponding command-line options. The default
20573 configuration is @samp{default}.
20574
20575 @item -mcop
20576 @opindex mcop
20577 Enables the coprocessor instructions. By default, this is a 32-bit
20578 coprocessor. Note that the coprocessor is normally enabled via the
20579 @option{-mconfig=} option.
20580
20581 @item -mcop32
20582 @opindex mcop32
20583 Enables the 32-bit coprocessor's instructions.
20584
20585 @item -mcop64
20586 @opindex mcop64
20587 Enables the 64-bit coprocessor's instructions.
20588
20589 @item -mivc2
20590 @opindex mivc2
20591 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20592
20593 @item -mdc
20594 @opindex mdc
20595 Causes constant variables to be placed in the @code{.near} section.
20596
20597 @item -mdiv
20598 @opindex mdiv
20599 Enables the @code{div} and @code{divu} instructions.
20600
20601 @item -meb
20602 @opindex meb
20603 Generate big-endian code.
20604
20605 @item -mel
20606 @opindex mel
20607 Generate little-endian code.
20608
20609 @item -mio-volatile
20610 @opindex mio-volatile
20611 Tells the compiler that any variable marked with the @code{io}
20612 attribute is to be considered volatile.
20613
20614 @item -ml
20615 @opindex ml
20616 Causes variables to be assigned to the @code{.far} section by default.
20617
20618 @item -mleadz
20619 @opindex mleadz
20620 Enables the @code{leadz} (leading zero) instruction.
20621
20622 @item -mm
20623 @opindex mm
20624 Causes variables to be assigned to the @code{.near} section by default.
20625
20626 @item -mminmax
20627 @opindex mminmax
20628 Enables the @code{min} and @code{max} instructions.
20629
20630 @item -mmult
20631 @opindex mmult
20632 Enables the multiplication and multiply-accumulate instructions.
20633
20634 @item -mno-opts
20635 @opindex mno-opts
20636 Disables all the optional instructions enabled by @option{-mall-opts}.
20637
20638 @item -mrepeat
20639 @opindex mrepeat
20640 Enables the @code{repeat} and @code{erepeat} instructions, used for
20641 low-overhead looping.
20642
20643 @item -ms
20644 @opindex ms
20645 Causes all variables to default to the @code{.tiny} section. Note
20646 that there is a 65536-byte limit to this section. Accesses to these
20647 variables use the @code{%gp} base register.
20648
20649 @item -msatur
20650 @opindex msatur
20651 Enables the saturation instructions. Note that the compiler does not
20652 currently generate these itself, but this option is included for
20653 compatibility with other tools, like @code{as}.
20654
20655 @item -msdram
20656 @opindex msdram
20657 Link the SDRAM-based runtime instead of the default ROM-based runtime.
20658
20659 @item -msim
20660 @opindex msim
20661 Link the simulator run-time libraries.
20662
20663 @item -msimnovec
20664 @opindex msimnovec
20665 Link the simulator runtime libraries, excluding built-in support
20666 for reset and exception vectors and tables.
20667
20668 @item -mtf
20669 @opindex mtf
20670 Causes all functions to default to the @code{.far} section. Without
20671 this option, functions default to the @code{.near} section.
20672
20673 @item -mtiny=@var{n}
20674 @opindex mtiny=
20675 Variables that are @var{n} bytes or smaller are allocated to the
20676 @code{.tiny} section. These variables use the @code{$gp} base
20677 register. The default for this option is 4, but note that there's a
20678 65536-byte limit to the @code{.tiny} section.
20679
20680 @end table
20681
20682 @node MicroBlaze Options
20683 @subsection MicroBlaze Options
20684 @cindex MicroBlaze Options
20685
20686 @table @gcctabopt
20687
20688 @item -msoft-float
20689 @opindex msoft-float
20690 Use software emulation for floating point (default).
20691
20692 @item -mhard-float
20693 @opindex mhard-float
20694 Use hardware floating-point instructions.
20695
20696 @item -mmemcpy
20697 @opindex mmemcpy
20698 Do not optimize block moves, use @code{memcpy}.
20699
20700 @item -mno-clearbss
20701 @opindex mno-clearbss
20702 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
20703
20704 @item -mcpu=@var{cpu-type}
20705 @opindex mcpu=
20706 Use features of, and schedule code for, the given CPU.
20707 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
20708 where @var{X} is a major version, @var{YY} is the minor version, and
20709 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
20710 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
20711
20712 @item -mxl-soft-mul
20713 @opindex mxl-soft-mul
20714 Use software multiply emulation (default).
20715
20716 @item -mxl-soft-div
20717 @opindex mxl-soft-div
20718 Use software emulation for divides (default).
20719
20720 @item -mxl-barrel-shift
20721 @opindex mxl-barrel-shift
20722 Use the hardware barrel shifter.
20723
20724 @item -mxl-pattern-compare
20725 @opindex mxl-pattern-compare
20726 Use pattern compare instructions.
20727
20728 @item -msmall-divides
20729 @opindex msmall-divides
20730 Use table lookup optimization for small signed integer divisions.
20731
20732 @item -mxl-stack-check
20733 @opindex mxl-stack-check
20734 This option is deprecated. Use @option{-fstack-check} instead.
20735
20736 @item -mxl-gp-opt
20737 @opindex mxl-gp-opt
20738 Use GP-relative @code{.sdata}/@code{.sbss} sections.
20739
20740 @item -mxl-multiply-high
20741 @opindex mxl-multiply-high
20742 Use multiply high instructions for high part of 32x32 multiply.
20743
20744 @item -mxl-float-convert
20745 @opindex mxl-float-convert
20746 Use hardware floating-point conversion instructions.
20747
20748 @item -mxl-float-sqrt
20749 @opindex mxl-float-sqrt
20750 Use hardware floating-point square root instruction.
20751
20752 @item -mbig-endian
20753 @opindex mbig-endian
20754 Generate code for a big-endian target.
20755
20756 @item -mlittle-endian
20757 @opindex mlittle-endian
20758 Generate code for a little-endian target.
20759
20760 @item -mxl-reorder
20761 @opindex mxl-reorder
20762 Use reorder instructions (swap and byte reversed load/store).
20763
20764 @item -mxl-mode-@var{app-model}
20765 Select application model @var{app-model}. Valid models are
20766 @table @samp
20767 @item executable
20768 normal executable (default), uses startup code @file{crt0.o}.
20769
20770 @item -mpic-data-is-text-relative
20771 @opindex mpic-data-is-text-relative
20772 Assume that the displacement between the text and data segments is fixed
20773 at static link time. This allows data to be referenced by offset from start of
20774 text address instead of GOT since PC-relative addressing is not supported.
20775
20776 @item xmdstub
20777 for use with Xilinx Microprocessor Debugger (XMD) based
20778 software intrusive debug agent called xmdstub. This uses startup file
20779 @file{crt1.o} and sets the start address of the program to 0x800.
20780
20781 @item bootstrap
20782 for applications that are loaded using a bootloader.
20783 This model uses startup file @file{crt2.o} which does not contain a processor
20784 reset vector handler. This is suitable for transferring control on a
20785 processor reset to the bootloader rather than the application.
20786
20787 @item novectors
20788 for applications that do not require any of the
20789 MicroBlaze vectors. This option may be useful for applications running
20790 within a monitoring application. This model uses @file{crt3.o} as a startup file.
20791 @end table
20792
20793 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
20794 @option{-mxl-mode-@var{app-model}}.
20795
20796 @end table
20797
20798 @node MIPS Options
20799 @subsection MIPS Options
20800 @cindex MIPS options
20801
20802 @table @gcctabopt
20803
20804 @item -EB
20805 @opindex EB
20806 Generate big-endian code.
20807
20808 @item -EL
20809 @opindex EL
20810 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20811 configurations.
20812
20813 @item -march=@var{arch}
20814 @opindex march
20815 Generate code that runs on @var{arch}, which can be the name of a
20816 generic MIPS ISA, or the name of a particular processor.
20817 The ISA names are:
20818 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
20819 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
20820 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
20821 @samp{mips64r5} and @samp{mips64r6}.
20822 The processor names are:
20823 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
20824 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
20825 @samp{5kc}, @samp{5kf},
20826 @samp{20kc},
20827 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
20828 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
20829 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
20830 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
20831 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
20832 @samp{i6400}, @samp{i6500},
20833 @samp{interaptiv},
20834 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
20835 @samp{gs464e}, @samp{gs264e},
20836 @samp{m4k},
20837 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
20838 @samp{m5100}, @samp{m5101},
20839 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
20840 @samp{orion},
20841 @samp{p5600}, @samp{p6600},
20842 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
20843 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
20844 @samp{rm7000}, @samp{rm9000},
20845 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
20846 @samp{sb1},
20847 @samp{sr71000},
20848 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
20849 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
20850 @samp{xlr} and @samp{xlp}.
20851 The special value @samp{from-abi} selects the
20852 most compatible architecture for the selected ABI (that is,
20853 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
20854
20855 The native Linux/GNU toolchain also supports the value @samp{native},
20856 which selects the best architecture option for the host processor.
20857 @option{-march=native} has no effect if GCC does not recognize
20858 the processor.
20859
20860 In processor names, a final @samp{000} can be abbreviated as @samp{k}
20861 (for example, @option{-march=r2k}). Prefixes are optional, and
20862 @samp{vr} may be written @samp{r}.
20863
20864 Names of the form @samp{@var{n}f2_1} refer to processors with
20865 FPUs clocked at half the rate of the core, names of the form
20866 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
20867 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
20868 processors with FPUs clocked a ratio of 3:2 with respect to the core.
20869 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
20870 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
20871 accepted as synonyms for @samp{@var{n}f1_1}.
20872
20873 GCC defines two macros based on the value of this option. The first
20874 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
20875 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
20876 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
20877 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
20878 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
20879
20880 Note that the @code{_MIPS_ARCH} macro uses the processor names given
20881 above. In other words, it has the full prefix and does not
20882 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
20883 the macro names the resolved architecture (either @code{"mips1"} or
20884 @code{"mips3"}). It names the default architecture when no
20885 @option{-march} option is given.
20886
20887 @item -mtune=@var{arch}
20888 @opindex mtune
20889 Optimize for @var{arch}. Among other things, this option controls
20890 the way instructions are scheduled, and the perceived cost of arithmetic
20891 operations. The list of @var{arch} values is the same as for
20892 @option{-march}.
20893
20894 When this option is not used, GCC optimizes for the processor
20895 specified by @option{-march}. By using @option{-march} and
20896 @option{-mtune} together, it is possible to generate code that
20897 runs on a family of processors, but optimize the code for one
20898 particular member of that family.
20899
20900 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
20901 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
20902 @option{-march} ones described above.
20903
20904 @item -mips1
20905 @opindex mips1
20906 Equivalent to @option{-march=mips1}.
20907
20908 @item -mips2
20909 @opindex mips2
20910 Equivalent to @option{-march=mips2}.
20911
20912 @item -mips3
20913 @opindex mips3
20914 Equivalent to @option{-march=mips3}.
20915
20916 @item -mips4
20917 @opindex mips4
20918 Equivalent to @option{-march=mips4}.
20919
20920 @item -mips32
20921 @opindex mips32
20922 Equivalent to @option{-march=mips32}.
20923
20924 @item -mips32r3
20925 @opindex mips32r3
20926 Equivalent to @option{-march=mips32r3}.
20927
20928 @item -mips32r5
20929 @opindex mips32r5
20930 Equivalent to @option{-march=mips32r5}.
20931
20932 @item -mips32r6
20933 @opindex mips32r6
20934 Equivalent to @option{-march=mips32r6}.
20935
20936 @item -mips64
20937 @opindex mips64
20938 Equivalent to @option{-march=mips64}.
20939
20940 @item -mips64r2
20941 @opindex mips64r2
20942 Equivalent to @option{-march=mips64r2}.
20943
20944 @item -mips64r3
20945 @opindex mips64r3
20946 Equivalent to @option{-march=mips64r3}.
20947
20948 @item -mips64r5
20949 @opindex mips64r5
20950 Equivalent to @option{-march=mips64r5}.
20951
20952 @item -mips64r6
20953 @opindex mips64r6
20954 Equivalent to @option{-march=mips64r6}.
20955
20956 @item -mips16
20957 @itemx -mno-mips16
20958 @opindex mips16
20959 @opindex mno-mips16
20960 Generate (do not generate) MIPS16 code. If GCC is targeting a
20961 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
20962
20963 MIPS16 code generation can also be controlled on a per-function basis
20964 by means of @code{mips16} and @code{nomips16} attributes.
20965 @xref{Function Attributes}, for more information.
20966
20967 @item -mflip-mips16
20968 @opindex mflip-mips16
20969 Generate MIPS16 code on alternating functions. This option is provided
20970 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
20971 not intended for ordinary use in compiling user code.
20972
20973 @item -minterlink-compressed
20974 @itemx -mno-interlink-compressed
20975 @opindex minterlink-compressed
20976 @opindex mno-interlink-compressed
20977 Require (do not require) that code using the standard (uncompressed) MIPS ISA
20978 be link-compatible with MIPS16 and microMIPS code, and vice versa.
20979
20980 For example, code using the standard ISA encoding cannot jump directly
20981 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
20982 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
20983 knows that the target of the jump is not compressed.
20984
20985 @item -minterlink-mips16
20986 @itemx -mno-interlink-mips16
20987 @opindex minterlink-mips16
20988 @opindex mno-interlink-mips16
20989 Aliases of @option{-minterlink-compressed} and
20990 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
20991 and are retained for backwards compatibility.
20992
20993 @item -mabi=32
20994 @itemx -mabi=o64
20995 @itemx -mabi=n32
20996 @itemx -mabi=64
20997 @itemx -mabi=eabi
20998 @opindex mabi=32
20999 @opindex mabi=o64
21000 @opindex mabi=n32
21001 @opindex mabi=64
21002 @opindex mabi=eabi
21003 Generate code for the given ABI@.
21004
21005 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
21006 generates 64-bit code when you select a 64-bit architecture, but you
21007 can use @option{-mgp32} to get 32-bit code instead.
21008
21009 For information about the O64 ABI, see
21010 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
21011
21012 GCC supports a variant of the o32 ABI in which floating-point registers
21013 are 64 rather than 32 bits wide. You can select this combination with
21014 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
21015 and @code{mfhc1} instructions and is therefore only supported for
21016 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
21017
21018 The register assignments for arguments and return values remain the
21019 same, but each scalar value is passed in a single 64-bit register
21020 rather than a pair of 32-bit registers. For example, scalar
21021 floating-point values are returned in @samp{$f0} only, not a
21022 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
21023 remains the same in that the even-numbered double-precision registers
21024 are saved.
21025
21026 Two additional variants of the o32 ABI are supported to enable
21027 a transition from 32-bit to 64-bit registers. These are FPXX
21028 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
21029 The FPXX extension mandates that all code must execute correctly
21030 when run using 32-bit or 64-bit registers. The code can be interlinked
21031 with either FP32 or FP64, but not both.
21032 The FP64A extension is similar to the FP64 extension but forbids the
21033 use of odd-numbered single-precision registers. This can be used
21034 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
21035 processors and allows both FP32 and FP64A code to interlink and
21036 run in the same process without changing FPU modes.
21037
21038 @item -mabicalls
21039 @itemx -mno-abicalls
21040 @opindex mabicalls
21041 @opindex mno-abicalls
21042 Generate (do not generate) code that is suitable for SVR4-style
21043 dynamic objects. @option{-mabicalls} is the default for SVR4-based
21044 systems.
21045
21046 @item -mshared
21047 @itemx -mno-shared
21048 Generate (do not generate) code that is fully position-independent,
21049 and that can therefore be linked into shared libraries. This option
21050 only affects @option{-mabicalls}.
21051
21052 All @option{-mabicalls} code has traditionally been position-independent,
21053 regardless of options like @option{-fPIC} and @option{-fpic}. However,
21054 as an extension, the GNU toolchain allows executables to use absolute
21055 accesses for locally-binding symbols. It can also use shorter GP
21056 initialization sequences and generate direct calls to locally-defined
21057 functions. This mode is selected by @option{-mno-shared}.
21058
21059 @option{-mno-shared} depends on binutils 2.16 or higher and generates
21060 objects that can only be linked by the GNU linker. However, the option
21061 does not affect the ABI of the final executable; it only affects the ABI
21062 of relocatable objects. Using @option{-mno-shared} generally makes
21063 executables both smaller and quicker.
21064
21065 @option{-mshared} is the default.
21066
21067 @item -mplt
21068 @itemx -mno-plt
21069 @opindex mplt
21070 @opindex mno-plt
21071 Assume (do not assume) that the static and dynamic linkers
21072 support PLTs and copy relocations. This option only affects
21073 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
21074 has no effect without @option{-msym32}.
21075
21076 You can make @option{-mplt} the default by configuring
21077 GCC with @option{--with-mips-plt}. The default is
21078 @option{-mno-plt} otherwise.
21079
21080 @item -mxgot
21081 @itemx -mno-xgot
21082 @opindex mxgot
21083 @opindex mno-xgot
21084 Lift (do not lift) the usual restrictions on the size of the global
21085 offset table.
21086
21087 GCC normally uses a single instruction to load values from the GOT@.
21088 While this is relatively efficient, it only works if the GOT
21089 is smaller than about 64k. Anything larger causes the linker
21090 to report an error such as:
21091
21092 @cindex relocation truncated to fit (MIPS)
21093 @smallexample
21094 relocation truncated to fit: R_MIPS_GOT16 foobar
21095 @end smallexample
21096
21097 If this happens, you should recompile your code with @option{-mxgot}.
21098 This works with very large GOTs, although the code is also
21099 less efficient, since it takes three instructions to fetch the
21100 value of a global symbol.
21101
21102 Note that some linkers can create multiple GOTs. If you have such a
21103 linker, you should only need to use @option{-mxgot} when a single object
21104 file accesses more than 64k's worth of GOT entries. Very few do.
21105
21106 These options have no effect unless GCC is generating position
21107 independent code.
21108
21109 @item -mgp32
21110 @opindex mgp32
21111 Assume that general-purpose registers are 32 bits wide.
21112
21113 @item -mgp64
21114 @opindex mgp64
21115 Assume that general-purpose registers are 64 bits wide.
21116
21117 @item -mfp32
21118 @opindex mfp32
21119 Assume that floating-point registers are 32 bits wide.
21120
21121 @item -mfp64
21122 @opindex mfp64
21123 Assume that floating-point registers are 64 bits wide.
21124
21125 @item -mfpxx
21126 @opindex mfpxx
21127 Do not assume the width of floating-point registers.
21128
21129 @item -mhard-float
21130 @opindex mhard-float
21131 Use floating-point coprocessor instructions.
21132
21133 @item -msoft-float
21134 @opindex msoft-float
21135 Do not use floating-point coprocessor instructions. Implement
21136 floating-point calculations using library calls instead.
21137
21138 @item -mno-float
21139 @opindex mno-float
21140 Equivalent to @option{-msoft-float}, but additionally asserts that the
21141 program being compiled does not perform any floating-point operations.
21142 This option is presently supported only by some bare-metal MIPS
21143 configurations, where it may select a special set of libraries
21144 that lack all floating-point support (including, for example, the
21145 floating-point @code{printf} formats).
21146 If code compiled with @option{-mno-float} accidentally contains
21147 floating-point operations, it is likely to suffer a link-time
21148 or run-time failure.
21149
21150 @item -msingle-float
21151 @opindex msingle-float
21152 Assume that the floating-point coprocessor only supports single-precision
21153 operations.
21154
21155 @item -mdouble-float
21156 @opindex mdouble-float
21157 Assume that the floating-point coprocessor supports double-precision
21158 operations. This is the default.
21159
21160 @item -modd-spreg
21161 @itemx -mno-odd-spreg
21162 @opindex modd-spreg
21163 @opindex mno-odd-spreg
21164 Enable the use of odd-numbered single-precision floating-point registers
21165 for the o32 ABI. This is the default for processors that are known to
21166 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
21167 is set by default.
21168
21169 @item -mabs=2008
21170 @itemx -mabs=legacy
21171 @opindex mabs=2008
21172 @opindex mabs=legacy
21173 These options control the treatment of the special not-a-number (NaN)
21174 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
21175 @code{neg.@i{fmt}} machine instructions.
21176
21177 By default or when @option{-mabs=legacy} is used the legacy
21178 treatment is selected. In this case these instructions are considered
21179 arithmetic and avoided where correct operation is required and the
21180 input operand might be a NaN. A longer sequence of instructions that
21181 manipulate the sign bit of floating-point datum manually is used
21182 instead unless the @option{-ffinite-math-only} option has also been
21183 specified.
21184
21185 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
21186 this case these instructions are considered non-arithmetic and therefore
21187 operating correctly in all cases, including in particular where the
21188 input operand is a NaN. These instructions are therefore always used
21189 for the respective operations.
21190
21191 @item -mnan=2008
21192 @itemx -mnan=legacy
21193 @opindex mnan=2008
21194 @opindex mnan=legacy
21195 These options control the encoding of the special not-a-number (NaN)
21196 IEEE 754 floating-point data.
21197
21198 The @option{-mnan=legacy} option selects the legacy encoding. In this
21199 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21200 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21201 by the first bit of their trailing significand field being 1.
21202
21203 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21204 this case qNaNs are denoted by the first bit of their trailing
21205 significand field being 1, whereas sNaNs are denoted by the first bit of
21206 their trailing significand field being 0.
21207
21208 The default is @option{-mnan=legacy} unless GCC has been configured with
21209 @option{--with-nan=2008}.
21210
21211 @item -mllsc
21212 @itemx -mno-llsc
21213 @opindex mllsc
21214 @opindex mno-llsc
21215 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21216 implement atomic memory built-in functions. When neither option is
21217 specified, GCC uses the instructions if the target architecture
21218 supports them.
21219
21220 @option{-mllsc} is useful if the runtime environment can emulate the
21221 instructions and @option{-mno-llsc} can be useful when compiling for
21222 nonstandard ISAs. You can make either option the default by
21223 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21224 respectively. @option{--with-llsc} is the default for some
21225 configurations; see the installation documentation for details.
21226
21227 @item -mdsp
21228 @itemx -mno-dsp
21229 @opindex mdsp
21230 @opindex mno-dsp
21231 Use (do not use) revision 1 of the MIPS DSP ASE@.
21232 @xref{MIPS DSP Built-in Functions}. This option defines the
21233 preprocessor macro @code{__mips_dsp}. It also defines
21234 @code{__mips_dsp_rev} to 1.
21235
21236 @item -mdspr2
21237 @itemx -mno-dspr2
21238 @opindex mdspr2
21239 @opindex mno-dspr2
21240 Use (do not use) revision 2 of the MIPS DSP ASE@.
21241 @xref{MIPS DSP Built-in Functions}. This option defines the
21242 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
21243 It also defines @code{__mips_dsp_rev} to 2.
21244
21245 @item -msmartmips
21246 @itemx -mno-smartmips
21247 @opindex msmartmips
21248 @opindex mno-smartmips
21249 Use (do not use) the MIPS SmartMIPS ASE.
21250
21251 @item -mpaired-single
21252 @itemx -mno-paired-single
21253 @opindex mpaired-single
21254 @opindex mno-paired-single
21255 Use (do not use) paired-single floating-point instructions.
21256 @xref{MIPS Paired-Single Support}. This option requires
21257 hardware floating-point support to be enabled.
21258
21259 @item -mdmx
21260 @itemx -mno-mdmx
21261 @opindex mdmx
21262 @opindex mno-mdmx
21263 Use (do not use) MIPS Digital Media Extension instructions.
21264 This option can only be used when generating 64-bit code and requires
21265 hardware floating-point support to be enabled.
21266
21267 @item -mips3d
21268 @itemx -mno-mips3d
21269 @opindex mips3d
21270 @opindex mno-mips3d
21271 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
21272 The option @option{-mips3d} implies @option{-mpaired-single}.
21273
21274 @item -mmicromips
21275 @itemx -mno-micromips
21276 @opindex mmicromips
21277 @opindex mno-mmicromips
21278 Generate (do not generate) microMIPS code.
21279
21280 MicroMIPS code generation can also be controlled on a per-function basis
21281 by means of @code{micromips} and @code{nomicromips} attributes.
21282 @xref{Function Attributes}, for more information.
21283
21284 @item -mmt
21285 @itemx -mno-mt
21286 @opindex mmt
21287 @opindex mno-mt
21288 Use (do not use) MT Multithreading instructions.
21289
21290 @item -mmcu
21291 @itemx -mno-mcu
21292 @opindex mmcu
21293 @opindex mno-mcu
21294 Use (do not use) the MIPS MCU ASE instructions.
21295
21296 @item -meva
21297 @itemx -mno-eva
21298 @opindex meva
21299 @opindex mno-eva
21300 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21301
21302 @item -mvirt
21303 @itemx -mno-virt
21304 @opindex mvirt
21305 @opindex mno-virt
21306 Use (do not use) the MIPS Virtualization (VZ) instructions.
21307
21308 @item -mxpa
21309 @itemx -mno-xpa
21310 @opindex mxpa
21311 @opindex mno-xpa
21312 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
21313
21314 @item -mcrc
21315 @itemx -mno-crc
21316 @opindex mcrc
21317 @opindex mno-crc
21318 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
21319
21320 @item -mginv
21321 @itemx -mno-ginv
21322 @opindex mginv
21323 @opindex mno-ginv
21324 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21325
21326 @item -mloongson-mmi
21327 @itemx -mno-loongson-mmi
21328 @opindex mloongson-mmi
21329 @opindex mno-loongson-mmi
21330 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
21331
21332 @item -mloongson-ext
21333 @itemx -mno-loongson-ext
21334 @opindex mloongson-ext
21335 @opindex mno-loongson-ext
21336 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
21337
21338 @item -mloongson-ext2
21339 @itemx -mno-loongson-ext2
21340 @opindex mloongson-ext2
21341 @opindex mno-loongson-ext2
21342 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
21343
21344 @item -mlong64
21345 @opindex mlong64
21346 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
21347 an explanation of the default and the way that the pointer size is
21348 determined.
21349
21350 @item -mlong32
21351 @opindex mlong32
21352 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
21353
21354 The default size of @code{int}s, @code{long}s and pointers depends on
21355 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
21356 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
21357 32-bit @code{long}s. Pointers are the same size as @code{long}s,
21358 or the same size as integer registers, whichever is smaller.
21359
21360 @item -msym32
21361 @itemx -mno-sym32
21362 @opindex msym32
21363 @opindex mno-sym32
21364 Assume (do not assume) that all symbols have 32-bit values, regardless
21365 of the selected ABI@. This option is useful in combination with
21366 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
21367 to generate shorter and faster references to symbolic addresses.
21368
21369 @item -G @var{num}
21370 @opindex G
21371 Put definitions of externally-visible data in a small data section
21372 if that data is no bigger than @var{num} bytes. GCC can then generate
21373 more efficient accesses to the data; see @option{-mgpopt} for details.
21374
21375 The default @option{-G} option depends on the configuration.
21376
21377 @item -mlocal-sdata
21378 @itemx -mno-local-sdata
21379 @opindex mlocal-sdata
21380 @opindex mno-local-sdata
21381 Extend (do not extend) the @option{-G} behavior to local data too,
21382 such as to static variables in C@. @option{-mlocal-sdata} is the
21383 default for all configurations.
21384
21385 If the linker complains that an application is using too much small data,
21386 you might want to try rebuilding the less performance-critical parts with
21387 @option{-mno-local-sdata}. You might also want to build large
21388 libraries with @option{-mno-local-sdata}, so that the libraries leave
21389 more room for the main program.
21390
21391 @item -mextern-sdata
21392 @itemx -mno-extern-sdata
21393 @opindex mextern-sdata
21394 @opindex mno-extern-sdata
21395 Assume (do not assume) that externally-defined data is in
21396 a small data section if the size of that data is within the @option{-G} limit.
21397 @option{-mextern-sdata} is the default for all configurations.
21398
21399 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
21400 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
21401 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
21402 is placed in a small data section. If @var{Var} is defined by another
21403 module, you must either compile that module with a high-enough
21404 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
21405 definition. If @var{Var} is common, you must link the application
21406 with a high-enough @option{-G} setting.
21407
21408 The easiest way of satisfying these restrictions is to compile
21409 and link every module with the same @option{-G} option. However,
21410 you may wish to build a library that supports several different
21411 small data limits. You can do this by compiling the library with
21412 the highest supported @option{-G} setting and additionally using
21413 @option{-mno-extern-sdata} to stop the library from making assumptions
21414 about externally-defined data.
21415
21416 @item -mgpopt
21417 @itemx -mno-gpopt
21418 @opindex mgpopt
21419 @opindex mno-gpopt
21420 Use (do not use) GP-relative accesses for symbols that are known to be
21421 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
21422 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
21423 configurations.
21424
21425 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
21426 might not hold the value of @code{_gp}. For example, if the code is
21427 part of a library that might be used in a boot monitor, programs that
21428 call boot monitor routines pass an unknown value in @code{$gp}.
21429 (In such situations, the boot monitor itself is usually compiled
21430 with @option{-G0}.)
21431
21432 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
21433 @option{-mno-extern-sdata}.
21434
21435 @item -membedded-data
21436 @itemx -mno-embedded-data
21437 @opindex membedded-data
21438 @opindex mno-embedded-data
21439 Allocate variables to the read-only data section first if possible, then
21440 next in the small data section if possible, otherwise in data. This gives
21441 slightly slower code than the default, but reduces the amount of RAM required
21442 when executing, and thus may be preferred for some embedded systems.
21443
21444 @item -muninit-const-in-rodata
21445 @itemx -mno-uninit-const-in-rodata
21446 @opindex muninit-const-in-rodata
21447 @opindex mno-uninit-const-in-rodata
21448 Put uninitialized @code{const} variables in the read-only data section.
21449 This option is only meaningful in conjunction with @option{-membedded-data}.
21450
21451 @item -mcode-readable=@var{setting}
21452 @opindex mcode-readable
21453 Specify whether GCC may generate code that reads from executable sections.
21454 There are three possible settings:
21455
21456 @table @gcctabopt
21457 @item -mcode-readable=yes
21458 Instructions may freely access executable sections. This is the
21459 default setting.
21460
21461 @item -mcode-readable=pcrel
21462 MIPS16 PC-relative load instructions can access executable sections,
21463 but other instructions must not do so. This option is useful on 4KSc
21464 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
21465 It is also useful on processors that can be configured to have a dual
21466 instruction/data SRAM interface and that, like the M4K, automatically
21467 redirect PC-relative loads to the instruction RAM.
21468
21469 @item -mcode-readable=no
21470 Instructions must not access executable sections. This option can be
21471 useful on targets that are configured to have a dual instruction/data
21472 SRAM interface but that (unlike the M4K) do not automatically redirect
21473 PC-relative loads to the instruction RAM.
21474 @end table
21475
21476 @item -msplit-addresses
21477 @itemx -mno-split-addresses
21478 @opindex msplit-addresses
21479 @opindex mno-split-addresses
21480 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
21481 relocation operators. This option has been superseded by
21482 @option{-mexplicit-relocs} but is retained for backwards compatibility.
21483
21484 @item -mexplicit-relocs
21485 @itemx -mno-explicit-relocs
21486 @opindex mexplicit-relocs
21487 @opindex mno-explicit-relocs
21488 Use (do not use) assembler relocation operators when dealing with symbolic
21489 addresses. The alternative, selected by @option{-mno-explicit-relocs},
21490 is to use assembler macros instead.
21491
21492 @option{-mexplicit-relocs} is the default if GCC was configured
21493 to use an assembler that supports relocation operators.
21494
21495 @item -mcheck-zero-division
21496 @itemx -mno-check-zero-division
21497 @opindex mcheck-zero-division
21498 @opindex mno-check-zero-division
21499 Trap (do not trap) on integer division by zero.
21500
21501 The default is @option{-mcheck-zero-division}.
21502
21503 @item -mdivide-traps
21504 @itemx -mdivide-breaks
21505 @opindex mdivide-traps
21506 @opindex mdivide-breaks
21507 MIPS systems check for division by zero by generating either a
21508 conditional trap or a break instruction. Using traps results in
21509 smaller code, but is only supported on MIPS II and later. Also, some
21510 versions of the Linux kernel have a bug that prevents trap from
21511 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
21512 allow conditional traps on architectures that support them and
21513 @option{-mdivide-breaks} to force the use of breaks.
21514
21515 The default is usually @option{-mdivide-traps}, but this can be
21516 overridden at configure time using @option{--with-divide=breaks}.
21517 Divide-by-zero checks can be completely disabled using
21518 @option{-mno-check-zero-division}.
21519
21520 @item -mload-store-pairs
21521 @itemx -mno-load-store-pairs
21522 @opindex mload-store-pairs
21523 @opindex mno-load-store-pairs
21524 Enable (disable) an optimization that pairs consecutive load or store
21525 instructions to enable load/store bonding. This option is enabled by
21526 default but only takes effect when the selected architecture is known
21527 to support bonding.
21528
21529 @item -mmemcpy
21530 @itemx -mno-memcpy
21531 @opindex mmemcpy
21532 @opindex mno-memcpy
21533 Force (do not force) the use of @code{memcpy} for non-trivial block
21534 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
21535 most constant-sized copies.
21536
21537 @item -mlong-calls
21538 @itemx -mno-long-calls
21539 @opindex mlong-calls
21540 @opindex mno-long-calls
21541 Disable (do not disable) use of the @code{jal} instruction. Calling
21542 functions using @code{jal} is more efficient but requires the caller
21543 and callee to be in the same 256 megabyte segment.
21544
21545 This option has no effect on abicalls code. The default is
21546 @option{-mno-long-calls}.
21547
21548 @item -mmad
21549 @itemx -mno-mad
21550 @opindex mmad
21551 @opindex mno-mad
21552 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
21553 instructions, as provided by the R4650 ISA@.
21554
21555 @item -mimadd
21556 @itemx -mno-imadd
21557 @opindex mimadd
21558 @opindex mno-imadd
21559 Enable (disable) use of the @code{madd} and @code{msub} integer
21560 instructions. The default is @option{-mimadd} on architectures
21561 that support @code{madd} and @code{msub} except for the 74k
21562 architecture where it was found to generate slower code.
21563
21564 @item -mfused-madd
21565 @itemx -mno-fused-madd
21566 @opindex mfused-madd
21567 @opindex mno-fused-madd
21568 Enable (disable) use of the floating-point multiply-accumulate
21569 instructions, when they are available. The default is
21570 @option{-mfused-madd}.
21571
21572 On the R8000 CPU when multiply-accumulate instructions are used,
21573 the intermediate product is calculated to infinite precision
21574 and is not subject to the FCSR Flush to Zero bit. This may be
21575 undesirable in some circumstances. On other processors the result
21576 is numerically identical to the equivalent computation using
21577 separate multiply, add, subtract and negate instructions.
21578
21579 @item -nocpp
21580 @opindex nocpp
21581 Tell the MIPS assembler to not run its preprocessor over user
21582 assembler files (with a @samp{.s} suffix) when assembling them.
21583
21584 @item -mfix-24k
21585 @itemx -mno-fix-24k
21586 @opindex mfix-24k
21587 @opindex mno-fix-24k
21588 Work around the 24K E48 (lost data on stores during refill) errata.
21589 The workarounds are implemented by the assembler rather than by GCC@.
21590
21591 @item -mfix-r4000
21592 @itemx -mno-fix-r4000
21593 @opindex mfix-r4000
21594 @opindex mno-fix-r4000
21595 Work around certain R4000 CPU errata:
21596 @itemize @minus
21597 @item
21598 A double-word or a variable shift may give an incorrect result if executed
21599 immediately after starting an integer division.
21600 @item
21601 A double-word or a variable shift may give an incorrect result if executed
21602 while an integer multiplication is in progress.
21603 @item
21604 An integer division may give an incorrect result if started in a delay slot
21605 of a taken branch or a jump.
21606 @end itemize
21607
21608 @item -mfix-r4400
21609 @itemx -mno-fix-r4400
21610 @opindex mfix-r4400
21611 @opindex mno-fix-r4400
21612 Work around certain R4400 CPU errata:
21613 @itemize @minus
21614 @item
21615 A double-word or a variable shift may give an incorrect result if executed
21616 immediately after starting an integer division.
21617 @end itemize
21618
21619 @item -mfix-r10000
21620 @itemx -mno-fix-r10000
21621 @opindex mfix-r10000
21622 @opindex mno-fix-r10000
21623 Work around certain R10000 errata:
21624 @itemize @minus
21625 @item
21626 @code{ll}/@code{sc} sequences may not behave atomically on revisions
21627 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21628 @end itemize
21629
21630 This option can only be used if the target architecture supports
21631 branch-likely instructions. @option{-mfix-r10000} is the default when
21632 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
21633 otherwise.
21634
21635 @item -mfix-rm7000
21636 @itemx -mno-fix-rm7000
21637 @opindex mfix-rm7000
21638 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
21639 workarounds are implemented by the assembler rather than by GCC@.
21640
21641 @item -mfix-vr4120
21642 @itemx -mno-fix-vr4120
21643 @opindex mfix-vr4120
21644 Work around certain VR4120 errata:
21645 @itemize @minus
21646 @item
21647 @code{dmultu} does not always produce the correct result.
21648 @item
21649 @code{div} and @code{ddiv} do not always produce the correct result if one
21650 of the operands is negative.
21651 @end itemize
21652 The workarounds for the division errata rely on special functions in
21653 @file{libgcc.a}. At present, these functions are only provided by
21654 the @code{mips64vr*-elf} configurations.
21655
21656 Other VR4120 errata require a NOP to be inserted between certain pairs of
21657 instructions. These errata are handled by the assembler, not by GCC itself.
21658
21659 @item -mfix-vr4130
21660 @opindex mfix-vr4130
21661 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
21662 workarounds are implemented by the assembler rather than by GCC,
21663 although GCC avoids using @code{mflo} and @code{mfhi} if the
21664 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
21665 instructions are available instead.
21666
21667 @item -mfix-sb1
21668 @itemx -mno-fix-sb1
21669 @opindex mfix-sb1
21670 Work around certain SB-1 CPU core errata.
21671 (This flag currently works around the SB-1 revision 2
21672 ``F1'' and ``F2'' floating-point errata.)
21673
21674 @item -mr10k-cache-barrier=@var{setting}
21675 @opindex mr10k-cache-barrier
21676 Specify whether GCC should insert cache barriers to avoid the
21677 side effects of speculation on R10K processors.
21678
21679 In common with many processors, the R10K tries to predict the outcome
21680 of a conditional branch and speculatively executes instructions from
21681 the ``taken'' branch. It later aborts these instructions if the
21682 predicted outcome is wrong. However, on the R10K, even aborted
21683 instructions can have side effects.
21684
21685 This problem only affects kernel stores and, depending on the system,
21686 kernel loads. As an example, a speculatively-executed store may load
21687 the target memory into cache and mark the cache line as dirty, even if
21688 the store itself is later aborted. If a DMA operation writes to the
21689 same area of memory before the ``dirty'' line is flushed, the cached
21690 data overwrites the DMA-ed data. See the R10K processor manual
21691 for a full description, including other potential problems.
21692
21693 One workaround is to insert cache barrier instructions before every memory
21694 access that might be speculatively executed and that might have side
21695 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
21696 controls GCC's implementation of this workaround. It assumes that
21697 aborted accesses to any byte in the following regions does not have
21698 side effects:
21699
21700 @enumerate
21701 @item
21702 the memory occupied by the current function's stack frame;
21703
21704 @item
21705 the memory occupied by an incoming stack argument;
21706
21707 @item
21708 the memory occupied by an object with a link-time-constant address.
21709 @end enumerate
21710
21711 It is the kernel's responsibility to ensure that speculative
21712 accesses to these regions are indeed safe.
21713
21714 If the input program contains a function declaration such as:
21715
21716 @smallexample
21717 void foo (void);
21718 @end smallexample
21719
21720 then the implementation of @code{foo} must allow @code{j foo} and
21721 @code{jal foo} to be executed speculatively. GCC honors this
21722 restriction for functions it compiles itself. It expects non-GCC
21723 functions (such as hand-written assembly code) to do the same.
21724
21725 The option has three forms:
21726
21727 @table @gcctabopt
21728 @item -mr10k-cache-barrier=load-store
21729 Insert a cache barrier before a load or store that might be
21730 speculatively executed and that might have side effects even
21731 if aborted.
21732
21733 @item -mr10k-cache-barrier=store
21734 Insert a cache barrier before a store that might be speculatively
21735 executed and that might have side effects even if aborted.
21736
21737 @item -mr10k-cache-barrier=none
21738 Disable the insertion of cache barriers. This is the default setting.
21739 @end table
21740
21741 @item -mflush-func=@var{func}
21742 @itemx -mno-flush-func
21743 @opindex mflush-func
21744 Specifies the function to call to flush the I and D caches, or to not
21745 call any such function. If called, the function must take the same
21746 arguments as the common @code{_flush_func}, that is, the address of the
21747 memory range for which the cache is being flushed, the size of the
21748 memory range, and the number 3 (to flush both caches). The default
21749 depends on the target GCC was configured for, but commonly is either
21750 @code{_flush_func} or @code{__cpu_flush}.
21751
21752 @item mbranch-cost=@var{num}
21753 @opindex mbranch-cost
21754 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21755 This cost is only a heuristic and is not guaranteed to produce
21756 consistent results across releases. A zero cost redundantly selects
21757 the default, which is based on the @option{-mtune} setting.
21758
21759 @item -mbranch-likely
21760 @itemx -mno-branch-likely
21761 @opindex mbranch-likely
21762 @opindex mno-branch-likely
21763 Enable or disable use of Branch Likely instructions, regardless of the
21764 default for the selected architecture. By default, Branch Likely
21765 instructions may be generated if they are supported by the selected
21766 architecture. An exception is for the MIPS32 and MIPS64 architectures
21767 and processors that implement those architectures; for those, Branch
21768 Likely instructions are not be generated by default because the MIPS32
21769 and MIPS64 architectures specifically deprecate their use.
21770
21771 @item -mcompact-branches=never
21772 @itemx -mcompact-branches=optimal
21773 @itemx -mcompact-branches=always
21774 @opindex mcompact-branches=never
21775 @opindex mcompact-branches=optimal
21776 @opindex mcompact-branches=always
21777 These options control which form of branches will be generated. The
21778 default is @option{-mcompact-branches=optimal}.
21779
21780 The @option{-mcompact-branches=never} option ensures that compact branch
21781 instructions will never be generated.
21782
21783 The @option{-mcompact-branches=always} option ensures that a compact
21784 branch instruction will be generated if available. If a compact branch
21785 instruction is not available, a delay slot form of the branch will be
21786 used instead.
21787
21788 This option is supported from MIPS Release 6 onwards.
21789
21790 The @option{-mcompact-branches=optimal} option will cause a delay slot
21791 branch to be used if one is available in the current ISA and the delay
21792 slot is successfully filled. If the delay slot is not filled, a compact
21793 branch will be chosen if one is available.
21794
21795 @item -mfp-exceptions
21796 @itemx -mno-fp-exceptions
21797 @opindex mfp-exceptions
21798 Specifies whether FP exceptions are enabled. This affects how
21799 FP instructions are scheduled for some processors.
21800 The default is that FP exceptions are
21801 enabled.
21802
21803 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
21804 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
21805 FP pipe.
21806
21807 @item -mvr4130-align
21808 @itemx -mno-vr4130-align
21809 @opindex mvr4130-align
21810 The VR4130 pipeline is two-way superscalar, but can only issue two
21811 instructions together if the first one is 8-byte aligned. When this
21812 option is enabled, GCC aligns pairs of instructions that it
21813 thinks should execute in parallel.
21814
21815 This option only has an effect when optimizing for the VR4130.
21816 It normally makes code faster, but at the expense of making it bigger.
21817 It is enabled by default at optimization level @option{-O3}.
21818
21819 @item -msynci
21820 @itemx -mno-synci
21821 @opindex msynci
21822 Enable (disable) generation of @code{synci} instructions on
21823 architectures that support it. The @code{synci} instructions (if
21824 enabled) are generated when @code{__builtin___clear_cache} is
21825 compiled.
21826
21827 This option defaults to @option{-mno-synci}, but the default can be
21828 overridden by configuring GCC with @option{--with-synci}.
21829
21830 When compiling code for single processor systems, it is generally safe
21831 to use @code{synci}. However, on many multi-core (SMP) systems, it
21832 does not invalidate the instruction caches on all cores and may lead
21833 to undefined behavior.
21834
21835 @item -mrelax-pic-calls
21836 @itemx -mno-relax-pic-calls
21837 @opindex mrelax-pic-calls
21838 Try to turn PIC calls that are normally dispatched via register
21839 @code{$25} into direct calls. This is only possible if the linker can
21840 resolve the destination at link time and if the destination is within
21841 range for a direct call.
21842
21843 @option{-mrelax-pic-calls} is the default if GCC was configured to use
21844 an assembler and a linker that support the @code{.reloc} assembly
21845 directive and @option{-mexplicit-relocs} is in effect. With
21846 @option{-mno-explicit-relocs}, this optimization can be performed by the
21847 assembler and the linker alone without help from the compiler.
21848
21849 @item -mmcount-ra-address
21850 @itemx -mno-mcount-ra-address
21851 @opindex mmcount-ra-address
21852 @opindex mno-mcount-ra-address
21853 Emit (do not emit) code that allows @code{_mcount} to modify the
21854 calling function's return address. When enabled, this option extends
21855 the usual @code{_mcount} interface with a new @var{ra-address}
21856 parameter, which has type @code{intptr_t *} and is passed in register
21857 @code{$12}. @code{_mcount} can then modify the return address by
21858 doing both of the following:
21859 @itemize
21860 @item
21861 Returning the new address in register @code{$31}.
21862 @item
21863 Storing the new address in @code{*@var{ra-address}},
21864 if @var{ra-address} is nonnull.
21865 @end itemize
21866
21867 The default is @option{-mno-mcount-ra-address}.
21868
21869 @item -mframe-header-opt
21870 @itemx -mno-frame-header-opt
21871 @opindex mframe-header-opt
21872 Enable (disable) frame header optimization in the o32 ABI. When using the
21873 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
21874 function to write out register arguments. When enabled, this optimization
21875 will suppress the allocation of the frame header if it can be determined that
21876 it is unused.
21877
21878 This optimization is off by default at all optimization levels.
21879
21880 @item -mlxc1-sxc1
21881 @itemx -mno-lxc1-sxc1
21882 @opindex mlxc1-sxc1
21883 When applicable, enable (disable) the generation of @code{lwxc1},
21884 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
21885
21886 @item -mmadd4
21887 @itemx -mno-madd4
21888 @opindex mmadd4
21889 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
21890 @code{madd.d} and related instructions. Enabled by default.
21891
21892 @end table
21893
21894 @node MMIX Options
21895 @subsection MMIX Options
21896 @cindex MMIX Options
21897
21898 These options are defined for the MMIX:
21899
21900 @table @gcctabopt
21901 @item -mlibfuncs
21902 @itemx -mno-libfuncs
21903 @opindex mlibfuncs
21904 @opindex mno-libfuncs
21905 Specify that intrinsic library functions are being compiled, passing all
21906 values in registers, no matter the size.
21907
21908 @item -mepsilon
21909 @itemx -mno-epsilon
21910 @opindex mepsilon
21911 @opindex mno-epsilon
21912 Generate floating-point comparison instructions that compare with respect
21913 to the @code{rE} epsilon register.
21914
21915 @item -mabi=mmixware
21916 @itemx -mabi=gnu
21917 @opindex mabi=mmixware
21918 @opindex mabi=gnu
21919 Generate code that passes function parameters and return values that (in
21920 the called function) are seen as registers @code{$0} and up, as opposed to
21921 the GNU ABI which uses global registers @code{$231} and up.
21922
21923 @item -mzero-extend
21924 @itemx -mno-zero-extend
21925 @opindex mzero-extend
21926 @opindex mno-zero-extend
21927 When reading data from memory in sizes shorter than 64 bits, use (do not
21928 use) zero-extending load instructions by default, rather than
21929 sign-extending ones.
21930
21931 @item -mknuthdiv
21932 @itemx -mno-knuthdiv
21933 @opindex mknuthdiv
21934 @opindex mno-knuthdiv
21935 Make the result of a division yielding a remainder have the same sign as
21936 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
21937 remainder follows the sign of the dividend. Both methods are
21938 arithmetically valid, the latter being almost exclusively used.
21939
21940 @item -mtoplevel-symbols
21941 @itemx -mno-toplevel-symbols
21942 @opindex mtoplevel-symbols
21943 @opindex mno-toplevel-symbols
21944 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
21945 code can be used with the @code{PREFIX} assembly directive.
21946
21947 @item -melf
21948 @opindex melf
21949 Generate an executable in the ELF format, rather than the default
21950 @samp{mmo} format used by the @command{mmix} simulator.
21951
21952 @item -mbranch-predict
21953 @itemx -mno-branch-predict
21954 @opindex mbranch-predict
21955 @opindex mno-branch-predict
21956 Use (do not use) the probable-branch instructions, when static branch
21957 prediction indicates a probable branch.
21958
21959 @item -mbase-addresses
21960 @itemx -mno-base-addresses
21961 @opindex mbase-addresses
21962 @opindex mno-base-addresses
21963 Generate (do not generate) code that uses @emph{base addresses}. Using a
21964 base address automatically generates a request (handled by the assembler
21965 and the linker) for a constant to be set up in a global register. The
21966 register is used for one or more base address requests within the range 0
21967 to 255 from the value held in the register. The generally leads to short
21968 and fast code, but the number of different data items that can be
21969 addressed is limited. This means that a program that uses lots of static
21970 data may require @option{-mno-base-addresses}.
21971
21972 @item -msingle-exit
21973 @itemx -mno-single-exit
21974 @opindex msingle-exit
21975 @opindex mno-single-exit
21976 Force (do not force) generated code to have a single exit point in each
21977 function.
21978 @end table
21979
21980 @node MN10300 Options
21981 @subsection MN10300 Options
21982 @cindex MN10300 options
21983
21984 These @option{-m} options are defined for Matsushita MN10300 architectures:
21985
21986 @table @gcctabopt
21987 @item -mmult-bug
21988 @opindex mmult-bug
21989 Generate code to avoid bugs in the multiply instructions for the MN10300
21990 processors. This is the default.
21991
21992 @item -mno-mult-bug
21993 @opindex mno-mult-bug
21994 Do not generate code to avoid bugs in the multiply instructions for the
21995 MN10300 processors.
21996
21997 @item -mam33
21998 @opindex mam33
21999 Generate code using features specific to the AM33 processor.
22000
22001 @item -mno-am33
22002 @opindex mno-am33
22003 Do not generate code using features specific to the AM33 processor. This
22004 is the default.
22005
22006 @item -mam33-2
22007 @opindex mam33-2
22008 Generate code using features specific to the AM33/2.0 processor.
22009
22010 @item -mam34
22011 @opindex mam34
22012 Generate code using features specific to the AM34 processor.
22013
22014 @item -mtune=@var{cpu-type}
22015 @opindex mtune
22016 Use the timing characteristics of the indicated CPU type when
22017 scheduling instructions. This does not change the targeted processor
22018 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
22019 @samp{am33-2} or @samp{am34}.
22020
22021 @item -mreturn-pointer-on-d0
22022 @opindex mreturn-pointer-on-d0
22023 When generating a function that returns a pointer, return the pointer
22024 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
22025 only in @code{a0}, and attempts to call such functions without a prototype
22026 result in errors. Note that this option is on by default; use
22027 @option{-mno-return-pointer-on-d0} to disable it.
22028
22029 @item -mno-crt0
22030 @opindex mno-crt0
22031 Do not link in the C run-time initialization object file.
22032
22033 @item -mrelax
22034 @opindex mrelax
22035 Indicate to the linker that it should perform a relaxation optimization pass
22036 to shorten branches, calls and absolute memory addresses. This option only
22037 has an effect when used on the command line for the final link step.
22038
22039 This option makes symbolic debugging impossible.
22040
22041 @item -mliw
22042 @opindex mliw
22043 Allow the compiler to generate @emph{Long Instruction Word}
22044 instructions if the target is the @samp{AM33} or later. This is the
22045 default. This option defines the preprocessor macro @code{__LIW__}.
22046
22047 @item -mnoliw
22048 @opindex mnoliw
22049 Do not allow the compiler to generate @emph{Long Instruction Word}
22050 instructions. This option defines the preprocessor macro
22051 @code{__NO_LIW__}.
22052
22053 @item -msetlb
22054 @opindex msetlb
22055 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
22056 instructions if the target is the @samp{AM33} or later. This is the
22057 default. This option defines the preprocessor macro @code{__SETLB__}.
22058
22059 @item -mnosetlb
22060 @opindex mnosetlb
22061 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
22062 instructions. This option defines the preprocessor macro
22063 @code{__NO_SETLB__}.
22064
22065 @end table
22066
22067 @node Moxie Options
22068 @subsection Moxie Options
22069 @cindex Moxie Options
22070
22071 @table @gcctabopt
22072
22073 @item -meb
22074 @opindex meb
22075 Generate big-endian code. This is the default for @samp{moxie-*-*}
22076 configurations.
22077
22078 @item -mel
22079 @opindex mel
22080 Generate little-endian code.
22081
22082 @item -mmul.x
22083 @opindex mmul.x
22084 Generate mul.x and umul.x instructions. This is the default for
22085 @samp{moxiebox-*-*} configurations.
22086
22087 @item -mno-crt0
22088 @opindex mno-crt0
22089 Do not link in the C run-time initialization object file.
22090
22091 @end table
22092
22093 @node MSP430 Options
22094 @subsection MSP430 Options
22095 @cindex MSP430 Options
22096
22097 These options are defined for the MSP430:
22098
22099 @table @gcctabopt
22100
22101 @item -masm-hex
22102 @opindex masm-hex
22103 Force assembly output to always use hex constants. Normally such
22104 constants are signed decimals, but this option is available for
22105 testsuite and/or aesthetic purposes.
22106
22107 @item -mmcu=
22108 @opindex mmcu=
22109 Select the MCU to target. This is used to create a C preprocessor
22110 symbol based upon the MCU name, converted to upper case and pre- and
22111 post-fixed with @samp{__}. This in turn is used by the
22112 @file{msp430.h} header file to select an MCU-specific supplementary
22113 header file.
22114
22115 The option also sets the ISA to use. If the MCU name is one that is
22116 known to only support the 430 ISA then that is selected, otherwise the
22117 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
22118 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
22119 name selects the 430X ISA.
22120
22121 In addition an MCU-specific linker script is added to the linker
22122 command line. The script's name is the name of the MCU with
22123 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
22124 command line defines the C preprocessor symbol @code{__XXX__} and
22125 cause the linker to search for a script called @file{xxx.ld}.
22126
22127 This option is also passed on to the assembler.
22128
22129 @item -mwarn-mcu
22130 @itemx -mno-warn-mcu
22131 @opindex mwarn-mcu
22132 @opindex mno-warn-mcu
22133 This option enables or disables warnings about conflicts between the
22134 MCU name specified by the @option{-mmcu} option and the ISA set by the
22135 @option{-mcpu} option and/or the hardware multiply support set by the
22136 @option{-mhwmult} option. It also toggles warnings about unrecognized
22137 MCU names. This option is on by default.
22138
22139 @item -mcpu=
22140 @opindex mcpu=
22141 Specifies the ISA to use. Accepted values are @samp{msp430},
22142 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
22143 @option{-mmcu=} option should be used to select the ISA.
22144
22145 @item -msim
22146 @opindex msim
22147 Link to the simulator runtime libraries and linker script. Overrides
22148 any scripts that would be selected by the @option{-mmcu=} option.
22149
22150 @item -mlarge
22151 @opindex mlarge
22152 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
22153
22154 @item -msmall
22155 @opindex msmall
22156 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
22157
22158 @item -mrelax
22159 @opindex mrelax
22160 This option is passed to the assembler and linker, and allows the
22161 linker to perform certain optimizations that cannot be done until
22162 the final link.
22163
22164 @item mhwmult=
22165 @opindex mhwmult=
22166 Describes the type of hardware multiply supported by the target.
22167 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
22168 for the original 16-bit-only multiply supported by early MCUs.
22169 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
22170 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
22171 A value of @samp{auto} can also be given. This tells GCC to deduce
22172 the hardware multiply support based upon the MCU name provided by the
22173 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
22174 the MCU name is not recognized then no hardware multiply support is
22175 assumed. @code{auto} is the default setting.
22176
22177 Hardware multiplies are normally performed by calling a library
22178 routine. This saves space in the generated code. When compiling at
22179 @option{-O3} or higher however the hardware multiplier is invoked
22180 inline. This makes for bigger, but faster code.
22181
22182 The hardware multiply routines disable interrupts whilst running and
22183 restore the previous interrupt state when they finish. This makes
22184 them safe to use inside interrupt handlers as well as in normal code.
22185
22186 @item -minrt
22187 @opindex minrt
22188 Enable the use of a minimum runtime environment - no static
22189 initializers or constructors. This is intended for memory-constrained
22190 devices. The compiler includes special symbols in some objects
22191 that tell the linker and runtime which code fragments are required.
22192
22193 @item -mcode-region=
22194 @itemx -mdata-region=
22195 @opindex mcode-region
22196 @opindex mdata-region
22197 These options tell the compiler where to place functions and data that
22198 do not have one of the @code{lower}, @code{upper}, @code{either} or
22199 @code{section} attributes. Possible values are @code{lower},
22200 @code{upper}, @code{either} or @code{any}. The first three behave
22201 like the corresponding attribute. The fourth possible value -
22202 @code{any} - is the default. It leaves placement entirely up to the
22203 linker script and how it assigns the standard sections
22204 (@code{.text}, @code{.data}, etc) to the memory regions.
22205
22206 @item -msilicon-errata=
22207 @opindex msilicon-errata
22208 This option passes on a request to assembler to enable the fixes for
22209 the named silicon errata.
22210
22211 @item -msilicon-errata-warn=
22212 @opindex msilicon-errata-warn
22213 This option passes on a request to the assembler to enable warning
22214 messages when a silicon errata might need to be applied.
22215
22216 @end table
22217
22218 @node NDS32 Options
22219 @subsection NDS32 Options
22220 @cindex NDS32 Options
22221
22222 These options are defined for NDS32 implementations:
22223
22224 @table @gcctabopt
22225
22226 @item -mbig-endian
22227 @opindex mbig-endian
22228 Generate code in big-endian mode.
22229
22230 @item -mlittle-endian
22231 @opindex mlittle-endian
22232 Generate code in little-endian mode.
22233
22234 @item -mreduced-regs
22235 @opindex mreduced-regs
22236 Use reduced-set registers for register allocation.
22237
22238 @item -mfull-regs
22239 @opindex mfull-regs
22240 Use full-set registers for register allocation.
22241
22242 @item -mcmov
22243 @opindex mcmov
22244 Generate conditional move instructions.
22245
22246 @item -mno-cmov
22247 @opindex mno-cmov
22248 Do not generate conditional move instructions.
22249
22250 @item -mext-perf
22251 @opindex mperf-ext
22252 Generate performance extension instructions.
22253
22254 @item -mno-ext-perf
22255 @opindex mno-perf-ext
22256 Do not generate performance extension instructions.
22257
22258 @item -mext-perf2
22259 @opindex mperf-ext
22260 Generate performance extension 2 instructions.
22261
22262 @item -mno-ext-perf2
22263 @opindex mno-perf-ext
22264 Do not generate performance extension 2 instructions.
22265
22266 @item -mext-string
22267 @opindex mperf-ext
22268 Generate string extension instructions.
22269
22270 @item -mno-ext-string
22271 @opindex mno-perf-ext
22272 Do not generate string extension instructions.
22273
22274 @item -mv3push
22275 @opindex mv3push
22276 Generate v3 push25/pop25 instructions.
22277
22278 @item -mno-v3push
22279 @opindex mno-v3push
22280 Do not generate v3 push25/pop25 instructions.
22281
22282 @item -m16-bit
22283 @opindex m16-bit
22284 Generate 16-bit instructions.
22285
22286 @item -mno-16-bit
22287 @opindex mno-16-bit
22288 Do not generate 16-bit instructions.
22289
22290 @item -misr-vector-size=@var{num}
22291 @opindex misr-vector-size
22292 Specify the size of each interrupt vector, which must be 4 or 16.
22293
22294 @item -mcache-block-size=@var{num}
22295 @opindex mcache-block-size
22296 Specify the size of each cache block,
22297 which must be a power of 2 between 4 and 512.
22298
22299 @item -march=@var{arch}
22300 @opindex march
22301 Specify the name of the target architecture.
22302
22303 @item -mcmodel=@var{code-model}
22304 @opindex mcmodel
22305 Set the code model to one of
22306 @table @asis
22307 @item @samp{small}
22308 All the data and read-only data segments must be within 512KB addressing space.
22309 The text segment must be within 16MB addressing space.
22310 @item @samp{medium}
22311 The data segment must be within 512KB while the read-only data segment can be
22312 within 4GB addressing space. The text segment should be still within 16MB
22313 addressing space.
22314 @item @samp{large}
22315 All the text and data segments can be within 4GB addressing space.
22316 @end table
22317
22318 @item -mctor-dtor
22319 @opindex mctor-dtor
22320 Enable constructor/destructor feature.
22321
22322 @item -mrelax
22323 @opindex mrelax
22324 Guide linker to relax instructions.
22325
22326 @end table
22327
22328 @node Nios II Options
22329 @subsection Nios II Options
22330 @cindex Nios II options
22331 @cindex Altera Nios II options
22332
22333 These are the options defined for the Altera Nios II processor.
22334
22335 @table @gcctabopt
22336
22337 @item -G @var{num}
22338 @opindex G
22339 @cindex smaller data references
22340 Put global and static objects less than or equal to @var{num} bytes
22341 into the small data or BSS sections instead of the normal data or BSS
22342 sections. The default value of @var{num} is 8.
22343
22344 @item -mgpopt=@var{option}
22345 @itemx -mgpopt
22346 @itemx -mno-gpopt
22347 @opindex mgpopt
22348 @opindex mno-gpopt
22349 Generate (do not generate) GP-relative accesses. The following
22350 @var{option} names are recognized:
22351
22352 @table @samp
22353
22354 @item none
22355 Do not generate GP-relative accesses.
22356
22357 @item local
22358 Generate GP-relative accesses for small data objects that are not
22359 external, weak, or uninitialized common symbols.
22360 Also use GP-relative addressing for objects that
22361 have been explicitly placed in a small data section via a @code{section}
22362 attribute.
22363
22364 @item global
22365 As for @samp{local}, but also generate GP-relative accesses for
22366 small data objects that are external, weak, or common. If you use this option,
22367 you must ensure that all parts of your program (including libraries) are
22368 compiled with the same @option{-G} setting.
22369
22370 @item data
22371 Generate GP-relative accesses for all data objects in the program. If you
22372 use this option, the entire data and BSS segments
22373 of your program must fit in 64K of memory and you must use an appropriate
22374 linker script to allocate them within the addressable range of the
22375 global pointer.
22376
22377 @item all
22378 Generate GP-relative addresses for function pointers as well as data
22379 pointers. If you use this option, the entire text, data, and BSS segments
22380 of your program must fit in 64K of memory and you must use an appropriate
22381 linker script to allocate them within the addressable range of the
22382 global pointer.
22383
22384 @end table
22385
22386 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
22387 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
22388
22389 The default is @option{-mgpopt} except when @option{-fpic} or
22390 @option{-fPIC} is specified to generate position-independent code.
22391 Note that the Nios II ABI does not permit GP-relative accesses from
22392 shared libraries.
22393
22394 You may need to specify @option{-mno-gpopt} explicitly when building
22395 programs that include large amounts of small data, including large
22396 GOT data sections. In this case, the 16-bit offset for GP-relative
22397 addressing may not be large enough to allow access to the entire
22398 small data section.
22399
22400 @item -mgprel-sec=@var{regexp}
22401 @opindex mgprel-sec
22402 This option specifies additional section names that can be accessed via
22403 GP-relative addressing. It is most useful in conjunction with
22404 @code{section} attributes on variable declarations
22405 (@pxref{Common Variable Attributes}) and a custom linker script.
22406 The @var{regexp} is a POSIX Extended Regular Expression.
22407
22408 This option does not affect the behavior of the @option{-G} option, and
22409 the specified sections are in addition to the standard @code{.sdata}
22410 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
22411
22412 @item -mr0rel-sec=@var{regexp}
22413 @opindex mr0rel-sec
22414 This option specifies names of sections that can be accessed via a
22415 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
22416 of the 32-bit address space. It is most useful in conjunction with
22417 @code{section} attributes on variable declarations
22418 (@pxref{Common Variable Attributes}) and a custom linker script.
22419 The @var{regexp} is a POSIX Extended Regular Expression.
22420
22421 In contrast to the use of GP-relative addressing for small data,
22422 zero-based addressing is never generated by default and there are no
22423 conventional section names used in standard linker scripts for sections
22424 in the low or high areas of memory.
22425
22426 @item -mel
22427 @itemx -meb
22428 @opindex mel
22429 @opindex meb
22430 Generate little-endian (default) or big-endian (experimental) code,
22431 respectively.
22432
22433 @item -march=@var{arch}
22434 @opindex march
22435 This specifies the name of the target Nios II architecture. GCC uses this
22436 name to determine what kind of instructions it can emit when generating
22437 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
22438
22439 The preprocessor macro @code{__nios2_arch__} is available to programs,
22440 with value 1 or 2, indicating the targeted ISA level.
22441
22442 @item -mbypass-cache
22443 @itemx -mno-bypass-cache
22444 @opindex mno-bypass-cache
22445 @opindex mbypass-cache
22446 Force all load and store instructions to always bypass cache by
22447 using I/O variants of the instructions. The default is not to
22448 bypass the cache.
22449
22450 @item -mno-cache-volatile
22451 @itemx -mcache-volatile
22452 @opindex mcache-volatile
22453 @opindex mno-cache-volatile
22454 Volatile memory access bypass the cache using the I/O variants of
22455 the load and store instructions. The default is not to bypass the cache.
22456
22457 @item -mno-fast-sw-div
22458 @itemx -mfast-sw-div
22459 @opindex mno-fast-sw-div
22460 @opindex mfast-sw-div
22461 Do not use table-based fast divide for small numbers. The default
22462 is to use the fast divide at @option{-O3} and above.
22463
22464 @item -mno-hw-mul
22465 @itemx -mhw-mul
22466 @itemx -mno-hw-mulx
22467 @itemx -mhw-mulx
22468 @itemx -mno-hw-div
22469 @itemx -mhw-div
22470 @opindex mno-hw-mul
22471 @opindex mhw-mul
22472 @opindex mno-hw-mulx
22473 @opindex mhw-mulx
22474 @opindex mno-hw-div
22475 @opindex mhw-div
22476 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
22477 instructions by the compiler. The default is to emit @code{mul}
22478 and not emit @code{div} and @code{mulx}.
22479
22480 @item -mbmx
22481 @itemx -mno-bmx
22482 @itemx -mcdx
22483 @itemx -mno-cdx
22484 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
22485 CDX (code density) instructions. Enabling these instructions also
22486 requires @option{-march=r2}. Since these instructions are optional
22487 extensions to the R2 architecture, the default is not to emit them.
22488
22489 @item -mcustom-@var{insn}=@var{N}
22490 @itemx -mno-custom-@var{insn}
22491 @opindex mcustom-@var{insn}
22492 @opindex mno-custom-@var{insn}
22493 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
22494 custom instruction with encoding @var{N} when generating code that uses
22495 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
22496 instruction 253 for single-precision floating-point add operations instead
22497 of the default behavior of using a library call.
22498
22499 The following values of @var{insn} are supported. Except as otherwise
22500 noted, floating-point operations are expected to be implemented with
22501 normal IEEE 754 semantics and correspond directly to the C operators or the
22502 equivalent GCC built-in functions (@pxref{Other Builtins}).
22503
22504 Single-precision floating point:
22505 @table @asis
22506
22507 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
22508 Binary arithmetic operations.
22509
22510 @item @samp{fnegs}
22511 Unary negation.
22512
22513 @item @samp{fabss}
22514 Unary absolute value.
22515
22516 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
22517 Comparison operations.
22518
22519 @item @samp{fmins}, @samp{fmaxs}
22520 Floating-point minimum and maximum. These instructions are only
22521 generated if @option{-ffinite-math-only} is specified.
22522
22523 @item @samp{fsqrts}
22524 Unary square root operation.
22525
22526 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
22527 Floating-point trigonometric and exponential functions. These instructions
22528 are only generated if @option{-funsafe-math-optimizations} is also specified.
22529
22530 @end table
22531
22532 Double-precision floating point:
22533 @table @asis
22534
22535 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
22536 Binary arithmetic operations.
22537
22538 @item @samp{fnegd}
22539 Unary negation.
22540
22541 @item @samp{fabsd}
22542 Unary absolute value.
22543
22544 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
22545 Comparison operations.
22546
22547 @item @samp{fmind}, @samp{fmaxd}
22548 Double-precision minimum and maximum. These instructions are only
22549 generated if @option{-ffinite-math-only} is specified.
22550
22551 @item @samp{fsqrtd}
22552 Unary square root operation.
22553
22554 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
22555 Double-precision trigonometric and exponential functions. These instructions
22556 are only generated if @option{-funsafe-math-optimizations} is also specified.
22557
22558 @end table
22559
22560 Conversions:
22561 @table @asis
22562 @item @samp{fextsd}
22563 Conversion from single precision to double precision.
22564
22565 @item @samp{ftruncds}
22566 Conversion from double precision to single precision.
22567
22568 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
22569 Conversion from floating point to signed or unsigned integer types, with
22570 truncation towards zero.
22571
22572 @item @samp{round}
22573 Conversion from single-precision floating point to signed integer,
22574 rounding to the nearest integer and ties away from zero.
22575 This corresponds to the @code{__builtin_lroundf} function when
22576 @option{-fno-math-errno} is used.
22577
22578 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
22579 Conversion from signed or unsigned integer types to floating-point types.
22580
22581 @end table
22582
22583 In addition, all of the following transfer instructions for internal
22584 registers X and Y must be provided to use any of the double-precision
22585 floating-point instructions. Custom instructions taking two
22586 double-precision source operands expect the first operand in the
22587 64-bit register X. The other operand (or only operand of a unary
22588 operation) is given to the custom arithmetic instruction with the
22589 least significant half in source register @var{src1} and the most
22590 significant half in @var{src2}. A custom instruction that returns a
22591 double-precision result returns the most significant 32 bits in the
22592 destination register and the other half in 32-bit register Y.
22593 GCC automatically generates the necessary code sequences to write
22594 register X and/or read register Y when double-precision floating-point
22595 instructions are used.
22596
22597 @table @asis
22598
22599 @item @samp{fwrx}
22600 Write @var{src1} into the least significant half of X and @var{src2} into
22601 the most significant half of X.
22602
22603 @item @samp{fwry}
22604 Write @var{src1} into Y.
22605
22606 @item @samp{frdxhi}, @samp{frdxlo}
22607 Read the most or least (respectively) significant half of X and store it in
22608 @var{dest}.
22609
22610 @item @samp{frdy}
22611 Read the value of Y and store it into @var{dest}.
22612 @end table
22613
22614 Note that you can gain more local control over generation of Nios II custom
22615 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
22616 and @code{target("no-custom-@var{insn}")} function attributes
22617 (@pxref{Function Attributes})
22618 or pragmas (@pxref{Function Specific Option Pragmas}).
22619
22620 @item -mcustom-fpu-cfg=@var{name}
22621 @opindex mcustom-fpu-cfg
22622
22623 This option enables a predefined, named set of custom instruction encodings
22624 (see @option{-mcustom-@var{insn}} above).
22625 Currently, the following sets are defined:
22626
22627 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
22628 @gccoptlist{-mcustom-fmuls=252 @gol
22629 -mcustom-fadds=253 @gol
22630 -mcustom-fsubs=254 @gol
22631 -fsingle-precision-constant}
22632
22633 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
22634 @gccoptlist{-mcustom-fmuls=252 @gol
22635 -mcustom-fadds=253 @gol
22636 -mcustom-fsubs=254 @gol
22637 -mcustom-fdivs=255 @gol
22638 -fsingle-precision-constant}
22639
22640 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
22641 @gccoptlist{-mcustom-floatus=243 @gol
22642 -mcustom-fixsi=244 @gol
22643 -mcustom-floatis=245 @gol
22644 -mcustom-fcmpgts=246 @gol
22645 -mcustom-fcmples=249 @gol
22646 -mcustom-fcmpeqs=250 @gol
22647 -mcustom-fcmpnes=251 @gol
22648 -mcustom-fmuls=252 @gol
22649 -mcustom-fadds=253 @gol
22650 -mcustom-fsubs=254 @gol
22651 -mcustom-fdivs=255 @gol
22652 -fsingle-precision-constant}
22653
22654 Custom instruction assignments given by individual
22655 @option{-mcustom-@var{insn}=} options override those given by
22656 @option{-mcustom-fpu-cfg=}, regardless of the
22657 order of the options on the command line.
22658
22659 Note that you can gain more local control over selection of a FPU
22660 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
22661 function attribute (@pxref{Function Attributes})
22662 or pragma (@pxref{Function Specific Option Pragmas}).
22663
22664 @end table
22665
22666 These additional @samp{-m} options are available for the Altera Nios II
22667 ELF (bare-metal) target:
22668
22669 @table @gcctabopt
22670
22671 @item -mhal
22672 @opindex mhal
22673 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
22674 startup and termination code, and is typically used in conjunction with
22675 @option{-msys-crt0=} to specify the location of the alternate startup code
22676 provided by the HAL BSP.
22677
22678 @item -msmallc
22679 @opindex msmallc
22680 Link with a limited version of the C library, @option{-lsmallc}, rather than
22681 Newlib.
22682
22683 @item -msys-crt0=@var{startfile}
22684 @opindex msys-crt0
22685 @var{startfile} is the file name of the startfile (crt0) to use
22686 when linking. This option is only useful in conjunction with @option{-mhal}.
22687
22688 @item -msys-lib=@var{systemlib}
22689 @opindex msys-lib
22690 @var{systemlib} is the library name of the library that provides
22691 low-level system calls required by the C library,
22692 e.g.@: @code{read} and @code{write}.
22693 This option is typically used to link with a library provided by a HAL BSP.
22694
22695 @end table
22696
22697 @node Nvidia PTX Options
22698 @subsection Nvidia PTX Options
22699 @cindex Nvidia PTX options
22700 @cindex nvptx options
22701
22702 These options are defined for Nvidia PTX:
22703
22704 @table @gcctabopt
22705
22706 @item -m32
22707 @itemx -m64
22708 @opindex m32
22709 @opindex m64
22710 Generate code for 32-bit or 64-bit ABI.
22711
22712 @item -misa=@var{ISA-string}
22713 @opindex march
22714 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
22715 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
22716 @samp{sm_35}. The default ISA is sm_30.
22717
22718 @item -mmainkernel
22719 @opindex mmainkernel
22720 Link in code for a __main kernel. This is for stand-alone instead of
22721 offloading execution.
22722
22723 @item -moptimize
22724 @opindex moptimize
22725 Apply partitioned execution optimizations. This is the default when any
22726 level of optimization is selected.
22727
22728 @item -msoft-stack
22729 @opindex msoft-stack
22730 Generate code that does not use @code{.local} memory
22731 directly for stack storage. Instead, a per-warp stack pointer is
22732 maintained explicitly. This enables variable-length stack allocation (with
22733 variable-length arrays or @code{alloca}), and when global memory is used for
22734 underlying storage, makes it possible to access automatic variables from other
22735 threads, or with atomic instructions. This code generation variant is used
22736 for OpenMP offloading, but the option is exposed on its own for the purpose
22737 of testing the compiler; to generate code suitable for linking into programs
22738 using OpenMP offloading, use option @option{-mgomp}.
22739
22740 @item -muniform-simt
22741 @opindex muniform-simt
22742 Switch to code generation variant that allows to execute all threads in each
22743 warp, while maintaining memory state and side effects as if only one thread
22744 in each warp was active outside of OpenMP SIMD regions. All atomic operations
22745 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
22746 current lane index equals the master lane index), and the register being
22747 assigned is copied via a shuffle instruction from the master lane. Outside of
22748 SIMD regions lane 0 is the master; inside, each thread sees itself as the
22749 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
22750 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
22751 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
22752 with current lane index to compute the master lane index.
22753
22754 @item -mgomp
22755 @opindex mgomp
22756 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
22757 @option{-muniform-simt} options, and selects corresponding multilib variant.
22758
22759 @end table
22760
22761 @node PDP-11 Options
22762 @subsection PDP-11 Options
22763 @cindex PDP-11 Options
22764
22765 These options are defined for the PDP-11:
22766
22767 @table @gcctabopt
22768 @item -mfpu
22769 @opindex mfpu
22770 Use hardware FPP floating point. This is the default. (FIS floating
22771 point on the PDP-11/40 is not supported.) Implies -m45.
22772
22773 @item -msoft-float
22774 @opindex msoft-float
22775 Do not use hardware floating point.
22776
22777 @item -mac0
22778 @opindex mac0
22779 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
22780
22781 @item -mno-ac0
22782 @opindex mno-ac0
22783 Return floating-point results in memory. This is the default.
22784
22785 @item -m40
22786 @opindex m40
22787 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22788
22789 @item -m45
22790 @opindex m45
22791 Generate code for a PDP-11/45. This is the default.
22792
22793 @item -m10
22794 @opindex m10
22795 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22796
22797 @item -mint16
22798 @itemx -mno-int32
22799 @opindex mint16
22800 @opindex mno-int32
22801 Use 16-bit @code{int}. This is the default.
22802
22803 @item -mint32
22804 @itemx -mno-int16
22805 @opindex mint32
22806 @opindex mno-int16
22807 Use 32-bit @code{int}.
22808
22809 @item -msplit
22810 @opindex msplit
22811 Target has split instruction and data space. Implies -m45.
22812
22813 @item -munix-asm
22814 @opindex munix-asm
22815 Use Unix assembler syntax.
22816
22817 @item -mdec-asm
22818 @opindex mdec-asm
22819 Use DEC assembler syntax.
22820
22821 @item -mgnu-asm
22822 @opindex mgnu-asm
22823 Use GNU assembler syntax. This is the default.
22824
22825 @item -mlra
22826 @opindex mlra
22827 Use the new LRA register allocator. By default, the old ``reload''
22828 allocator is used.
22829 @end table
22830
22831 @node picoChip Options
22832 @subsection picoChip Options
22833 @cindex picoChip options
22834
22835 These @samp{-m} options are defined for picoChip implementations:
22836
22837 @table @gcctabopt
22838
22839 @item -mae=@var{ae_type}
22840 @opindex mcpu
22841 Set the instruction set, register set, and instruction scheduling
22842 parameters for array element type @var{ae_type}. Supported values
22843 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
22844
22845 @option{-mae=ANY} selects a completely generic AE type. Code
22846 generated with this option runs on any of the other AE types. The
22847 code is not as efficient as it would be if compiled for a specific
22848 AE type, and some types of operation (e.g., multiplication) do not
22849 work properly on all types of AE.
22850
22851 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
22852 for compiled code, and is the default.
22853
22854 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
22855 option may suffer from poor performance of byte (char) manipulation,
22856 since the DSP AE does not provide hardware support for byte load/stores.
22857
22858 @item -msymbol-as-address
22859 Enable the compiler to directly use a symbol name as an address in a
22860 load/store instruction, without first loading it into a
22861 register. Typically, the use of this option generates larger
22862 programs, which run faster than when the option isn't used. However, the
22863 results vary from program to program, so it is left as a user option,
22864 rather than being permanently enabled.
22865
22866 @item -mno-inefficient-warnings
22867 Disables warnings about the generation of inefficient code. These
22868 warnings can be generated, for example, when compiling code that
22869 performs byte-level memory operations on the MAC AE type. The MAC AE has
22870 no hardware support for byte-level memory operations, so all byte
22871 load/stores must be synthesized from word load/store operations. This is
22872 inefficient and a warning is generated to indicate
22873 that you should rewrite the code to avoid byte operations, or to target
22874 an AE type that has the necessary hardware support. This option disables
22875 these warnings.
22876
22877 @end table
22878
22879 @node PowerPC Options
22880 @subsection PowerPC Options
22881 @cindex PowerPC options
22882
22883 These are listed under @xref{RS/6000 and PowerPC Options}.
22884
22885 @node PowerPC SPE Options
22886 @subsection PowerPC SPE Options
22887 @cindex PowerPC SPE options
22888
22889 These @samp{-m} options are defined for PowerPC SPE:
22890 @table @gcctabopt
22891 @item -mmfcrf
22892 @itemx -mno-mfcrf
22893 @itemx -mpopcntb
22894 @itemx -mno-popcntb
22895 @opindex mmfcrf
22896 @opindex mno-mfcrf
22897 @opindex mpopcntb
22898 @opindex mno-popcntb
22899 You use these options to specify which instructions are available on the
22900 processor you are using. The default value of these options is
22901 determined when configuring GCC@. Specifying the
22902 @option{-mcpu=@var{cpu_type}} overrides the specification of these
22903 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
22904 rather than the options listed above.
22905
22906 The @option{-mmfcrf} option allows GCC to generate the move from
22907 condition register field instruction implemented on the POWER4
22908 processor and other processors that support the PowerPC V2.01
22909 architecture.
22910 The @option{-mpopcntb} option allows GCC to generate the popcount and
22911 double-precision FP reciprocal estimate instruction implemented on the
22912 POWER5 processor and other processors that support the PowerPC V2.02
22913 architecture.
22914
22915 @item -mcpu=@var{cpu_type}
22916 @opindex mcpu
22917 Set architecture type, register usage, and
22918 instruction scheduling parameters for machine type @var{cpu_type}.
22919 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
22920 and @samp{native}.
22921
22922 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
22923 endian), with an appropriate, generic processor model assumed for
22924 scheduling purposes.
22925
22926 Specifying @samp{native} as cpu type detects and selects the
22927 architecture option that corresponds to the host processor of the
22928 system performing the compilation.
22929 @option{-mcpu=native} has no effect if GCC does not recognize the
22930 processor.
22931
22932 The other options specify a specific processor. Code generated under
22933 those options runs best on that processor, and may not run at all on
22934 others.
22935
22936 The @option{-mcpu} options automatically enable or disable the
22937 following options:
22938
22939 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
22940 -mpopcntb -mpopcntd @gol
22941 -msingle-float -mdouble-float @gol
22942 -mfloat128}
22943
22944 The particular options set for any particular CPU varies between
22945 compiler versions, depending on what setting seems to produce optimal
22946 code for that CPU; it doesn't necessarily reflect the actual hardware's
22947 capabilities. If you wish to set an individual option to a particular
22948 value, you may specify it after the @option{-mcpu} option, like
22949 @option{-mcpu=8548}.
22950
22951 @item -mtune=@var{cpu_type}
22952 @opindex mtune
22953 Set the instruction scheduling parameters for machine type
22954 @var{cpu_type}, but do not set the architecture type or register usage,
22955 as @option{-mcpu=@var{cpu_type}} does. The same
22956 values for @var{cpu_type} are used for @option{-mtune} as for
22957 @option{-mcpu}. If both are specified, the code generated uses the
22958 architecture and registers set by @option{-mcpu}, but the
22959 scheduling parameters set by @option{-mtune}.
22960
22961 @item -msecure-plt
22962 @opindex msecure-plt
22963 Generate code that allows @command{ld} and @command{ld.so}
22964 to build executables and shared
22965 libraries with non-executable @code{.plt} and @code{.got} sections.
22966 This is a PowerPC
22967 32-bit SYSV ABI option.
22968
22969 @item -mbss-plt
22970 @opindex mbss-plt
22971 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
22972 fills in, and
22973 requires @code{.plt} and @code{.got}
22974 sections that are both writable and executable.
22975 This is a PowerPC 32-bit SYSV ABI option.
22976
22977 @item -misel
22978 @itemx -mno-isel
22979 @opindex misel
22980 @opindex mno-isel
22981 This switch enables or disables the generation of ISEL instructions.
22982
22983 @item -misel=@var{yes/no}
22984 This switch has been deprecated. Use @option{-misel} and
22985 @option{-mno-isel} instead.
22986
22987 @item -mspe
22988 @itemx -mno-spe
22989 @opindex mspe
22990 @opindex mno-spe
22991 This switch enables or disables the generation of SPE simd
22992 instructions.
22993
22994 @item -mspe=@var{yes/no}
22995 This option has been deprecated. Use @option{-mspe} and
22996 @option{-mno-spe} instead.
22997
22998 @item -mfloat128
22999 @itemx -mno-float128
23000 @opindex mfloat128
23001 @opindex mno-float128
23002 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
23003 and use either software emulation for IEEE 128-bit floating point or
23004 hardware instructions.
23005
23006 @item -mfloat-gprs=@var{yes/single/double/no}
23007 @itemx -mfloat-gprs
23008 @opindex mfloat-gprs
23009 This switch enables or disables the generation of floating-point
23010 operations on the general-purpose registers for architectures that
23011 support it.
23012
23013 The argument @samp{yes} or @samp{single} enables the use of
23014 single-precision floating-point operations.
23015
23016 The argument @samp{double} enables the use of single and
23017 double-precision floating-point operations.
23018
23019 The argument @samp{no} disables floating-point operations on the
23020 general-purpose registers.
23021
23022 This option is currently only available on the MPC854x.
23023
23024 @item -mfull-toc
23025 @itemx -mno-fp-in-toc
23026 @itemx -mno-sum-in-toc
23027 @itemx -mminimal-toc
23028 @opindex mfull-toc
23029 @opindex mno-fp-in-toc
23030 @opindex mno-sum-in-toc
23031 @opindex mminimal-toc
23032 Modify generation of the TOC (Table Of Contents), which is created for
23033 every executable file. The @option{-mfull-toc} option is selected by
23034 default. In that case, GCC allocates at least one TOC entry for
23035 each unique non-automatic variable reference in your program. GCC
23036 also places floating-point constants in the TOC@. However, only
23037 16,384 entries are available in the TOC@.
23038
23039 If you receive a linker error message that saying you have overflowed
23040 the available TOC space, you can reduce the amount of TOC space used
23041 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
23042 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
23043 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
23044 generate code to calculate the sum of an address and a constant at
23045 run time instead of putting that sum into the TOC@. You may specify one
23046 or both of these options. Each causes GCC to produce very slightly
23047 slower and larger code at the expense of conserving TOC space.
23048
23049 If you still run out of space in the TOC even when you specify both of
23050 these options, specify @option{-mminimal-toc} instead. This option causes
23051 GCC to make only one TOC entry for every file. When you specify this
23052 option, GCC produces code that is slower and larger but which
23053 uses extremely little TOC space. You may wish to use this option
23054 only on files that contain less frequently-executed code.
23055
23056 @item -maix32
23057 @opindex maix32
23058 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
23059
23060 @item -mxl-compat
23061 @itemx -mno-xl-compat
23062 @opindex mxl-compat
23063 @opindex mno-xl-compat
23064 Produce code that conforms more closely to IBM XL compiler semantics
23065 when using AIX-compatible ABI@. Pass floating-point arguments to
23066 prototyped functions beyond the register save area (RSA) on the stack
23067 in addition to argument FPRs. Do not assume that most significant
23068 double in 128-bit long double value is properly rounded when comparing
23069 values and converting to double. Use XL symbol names for long double
23070 support routines.
23071
23072 The AIX calling convention was extended but not initially documented to
23073 handle an obscure K&R C case of calling a function that takes the
23074 address of its arguments with fewer arguments than declared. IBM XL
23075 compilers access floating-point arguments that do not fit in the
23076 RSA from the stack when a subroutine is compiled without
23077 optimization. Because always storing floating-point arguments on the
23078 stack is inefficient and rarely needed, this option is not enabled by
23079 default and only is necessary when calling subroutines compiled by IBM
23080 XL compilers without optimization.
23081
23082 @item -malign-natural
23083 @itemx -malign-power
23084 @opindex malign-natural
23085 @opindex malign-power
23086 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
23087 @option{-malign-natural} overrides the ABI-defined alignment of larger
23088 types, such as floating-point doubles, on their natural size-based boundary.
23089 The option @option{-malign-power} instructs GCC to follow the ABI-specified
23090 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
23091
23092 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
23093 is not supported.
23094
23095 @item -msoft-float
23096 @itemx -mhard-float
23097 @opindex msoft-float
23098 @opindex mhard-float
23099 Generate code that does not use (uses) the floating-point register set.
23100 Software floating-point emulation is provided if you use the
23101 @option{-msoft-float} option, and pass the option to GCC when linking.
23102
23103 @item -msingle-float
23104 @itemx -mdouble-float
23105 @opindex msingle-float
23106 @opindex mdouble-float
23107 Generate code for single- or double-precision floating-point operations.
23108 @option{-mdouble-float} implies @option{-msingle-float}.
23109
23110 @item -mmultiple
23111 @itemx -mno-multiple
23112 @opindex mmultiple
23113 @opindex mno-multiple
23114 Generate code that uses (does not use) the load multiple word
23115 instructions and the store multiple word instructions. These
23116 instructions are generated by default on POWER systems, and not
23117 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
23118 PowerPC systems, since those instructions do not work when the
23119 processor is in little-endian mode. The exceptions are PPC740 and
23120 PPC750 which permit these instructions in little-endian mode.
23121
23122 @item -mupdate
23123 @itemx -mno-update
23124 @opindex mupdate
23125 @opindex mno-update
23126 Generate code that uses (does not use) the load or store instructions
23127 that update the base register to the address of the calculated memory
23128 location. These instructions are generated by default. If you use
23129 @option{-mno-update}, there is a small window between the time that the
23130 stack pointer is updated and the address of the previous frame is
23131 stored, which means code that walks the stack frame across interrupts or
23132 signals may get corrupted data.
23133
23134 @item -mavoid-indexed-addresses
23135 @itemx -mno-avoid-indexed-addresses
23136 @opindex mavoid-indexed-addresses
23137 @opindex mno-avoid-indexed-addresses
23138 Generate code that tries to avoid (not avoid) the use of indexed load
23139 or store instructions. These instructions can incur a performance
23140 penalty on Power6 processors in certain situations, such as when
23141 stepping through large arrays that cross a 16M boundary. This option
23142 is enabled by default when targeting Power6 and disabled otherwise.
23143
23144 @item -mfused-madd
23145 @itemx -mno-fused-madd
23146 @opindex mfused-madd
23147 @opindex mno-fused-madd
23148 Generate code that uses (does not use) the floating-point multiply and
23149 accumulate instructions. These instructions are generated by default
23150 if hardware floating point is used. The machine-dependent
23151 @option{-mfused-madd} option is now mapped to the machine-independent
23152 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
23153 mapped to @option{-ffp-contract=off}.
23154
23155 @item -mno-strict-align
23156 @itemx -mstrict-align
23157 @opindex mno-strict-align
23158 @opindex mstrict-align
23159 On System V.4 and embedded PowerPC systems do not (do) assume that
23160 unaligned memory references are handled by the system.
23161
23162 @item -mrelocatable
23163 @itemx -mno-relocatable
23164 @opindex mrelocatable
23165 @opindex mno-relocatable
23166 Generate code that allows (does not allow) a static executable to be
23167 relocated to a different address at run time. A simple embedded
23168 PowerPC system loader should relocate the entire contents of
23169 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
23170 a table of 32-bit addresses generated by this option. For this to
23171 work, all objects linked together must be compiled with
23172 @option{-mrelocatable} or @option{-mrelocatable-lib}.
23173 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
23174
23175 @item -mrelocatable-lib
23176 @itemx -mno-relocatable-lib
23177 @opindex mrelocatable-lib
23178 @opindex mno-relocatable-lib
23179 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
23180 @code{.fixup} section to allow static executables to be relocated at
23181 run time, but @option{-mrelocatable-lib} does not use the smaller stack
23182 alignment of @option{-mrelocatable}. Objects compiled with
23183 @option{-mrelocatable-lib} may be linked with objects compiled with
23184 any combination of the @option{-mrelocatable} options.
23185
23186 @item -mno-toc
23187 @itemx -mtoc
23188 @opindex mno-toc
23189 @opindex mtoc
23190 On System V.4 and embedded PowerPC systems do not (do) assume that
23191 register 2 contains a pointer to a global area pointing to the addresses
23192 used in the program.
23193
23194 @item -mlittle
23195 @itemx -mlittle-endian
23196 @opindex mlittle
23197 @opindex mlittle-endian
23198 On System V.4 and embedded PowerPC systems compile code for the
23199 processor in little-endian mode. The @option{-mlittle-endian} option is
23200 the same as @option{-mlittle}.
23201
23202 @item -mbig
23203 @itemx -mbig-endian
23204 @opindex mbig
23205 @opindex mbig-endian
23206 On System V.4 and embedded PowerPC systems compile code for the
23207 processor in big-endian mode. The @option{-mbig-endian} option is
23208 the same as @option{-mbig}.
23209
23210 @item -mdynamic-no-pic
23211 @opindex mdynamic-no-pic
23212 On Darwin and Mac OS X systems, compile code so that it is not
23213 relocatable, but that its external references are relocatable. The
23214 resulting code is suitable for applications, but not shared
23215 libraries.
23216
23217 @item -msingle-pic-base
23218 @opindex msingle-pic-base
23219 Treat the register used for PIC addressing as read-only, rather than
23220 loading it in the prologue for each function. The runtime system is
23221 responsible for initializing this register with an appropriate value
23222 before execution begins.
23223
23224 @item -mprioritize-restricted-insns=@var{priority}
23225 @opindex mprioritize-restricted-insns
23226 This option controls the priority that is assigned to
23227 dispatch-slot restricted instructions during the second scheduling
23228 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23229 or @samp{2} to assign no, highest, or second-highest (respectively)
23230 priority to dispatch-slot restricted
23231 instructions.
23232
23233 @item -msched-costly-dep=@var{dependence_type}
23234 @opindex msched-costly-dep
23235 This option controls which dependences are considered costly
23236 by the target during instruction scheduling. The argument
23237 @var{dependence_type} takes one of the following values:
23238
23239 @table @asis
23240 @item @samp{no}
23241 No dependence is costly.
23242
23243 @item @samp{all}
23244 All dependences are costly.
23245
23246 @item @samp{true_store_to_load}
23247 A true dependence from store to load is costly.
23248
23249 @item @samp{store_to_load}
23250 Any dependence from store to load is costly.
23251
23252 @item @var{number}
23253 Any dependence for which the latency is greater than or equal to
23254 @var{number} is costly.
23255 @end table
23256
23257 @item -minsert-sched-nops=@var{scheme}
23258 @opindex minsert-sched-nops
23259 This option controls which NOP insertion scheme is used during
23260 the second scheduling pass. The argument @var{scheme} takes one of the
23261 following values:
23262
23263 @table @asis
23264 @item @samp{no}
23265 Don't insert NOPs.
23266
23267 @item @samp{pad}
23268 Pad with NOPs any dispatch group that has vacant issue slots,
23269 according to the scheduler's grouping.
23270
23271 @item @samp{regroup_exact}
23272 Insert NOPs to force costly dependent insns into
23273 separate groups. Insert exactly as many NOPs as needed to force an insn
23274 to a new group, according to the estimated processor grouping.
23275
23276 @item @var{number}
23277 Insert NOPs to force costly dependent insns into
23278 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23279 @end table
23280
23281 @item -mcall-sysv
23282 @opindex mcall-sysv
23283 On System V.4 and embedded PowerPC systems compile code using calling
23284 conventions that adhere to the March 1995 draft of the System V
23285 Application Binary Interface, PowerPC processor supplement. This is the
23286 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23287
23288 @item -mcall-sysv-eabi
23289 @itemx -mcall-eabi
23290 @opindex mcall-sysv-eabi
23291 @opindex mcall-eabi
23292 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23293
23294 @item -mcall-sysv-noeabi
23295 @opindex mcall-sysv-noeabi
23296 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23297
23298 @item -mcall-aixdesc
23299 @opindex m
23300 On System V.4 and embedded PowerPC systems compile code for the AIX
23301 operating system.
23302
23303 @item -mcall-linux
23304 @opindex mcall-linux
23305 On System V.4 and embedded PowerPC systems compile code for the
23306 Linux-based GNU system.
23307
23308 @item -mcall-freebsd
23309 @opindex mcall-freebsd
23310 On System V.4 and embedded PowerPC systems compile code for the
23311 FreeBSD operating system.
23312
23313 @item -mcall-netbsd
23314 @opindex mcall-netbsd
23315 On System V.4 and embedded PowerPC systems compile code for the
23316 NetBSD operating system.
23317
23318 @item -mcall-openbsd
23319 @opindex mcall-netbsd
23320 On System V.4 and embedded PowerPC systems compile code for the
23321 OpenBSD operating system.
23322
23323 @item -maix-struct-return
23324 @opindex maix-struct-return
23325 Return all structures in memory (as specified by the AIX ABI)@.
23326
23327 @item -msvr4-struct-return
23328 @opindex msvr4-struct-return
23329 Return structures smaller than 8 bytes in registers (as specified by the
23330 SVR4 ABI)@.
23331
23332 @item -mabi=@var{abi-type}
23333 @opindex mabi
23334 Extend the current ABI with a particular extension, or remove such extension.
23335 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23336 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23337 @samp{elfv1}, @samp{elfv2}@.
23338
23339 @item -mabi=spe
23340 @opindex mabi=spe
23341 Extend the current ABI with SPE ABI extensions. This does not change
23342 the default ABI, instead it adds the SPE ABI extensions to the current
23343 ABI@.
23344
23345 @item -mabi=no-spe
23346 @opindex mabi=no-spe
23347 Disable Book-E SPE ABI extensions for the current ABI@.
23348
23349 @item -mabi=ibmlongdouble
23350 @opindex mabi=ibmlongdouble
23351 Change the current ABI to use IBM extended-precision long double.
23352 This is not likely to work if your system defaults to using IEEE
23353 extended-precision long double. If you change the long double type
23354 from IEEE extended-precision, the compiler will issue a warning unless
23355 you use the @option{-Wno-psabi} option.
23356
23357 @item -mabi=ieeelongdouble
23358 @opindex mabi=ieeelongdouble
23359 Change the current ABI to use IEEE extended-precision long double.
23360 This is not likely to work if your system defaults to using IBM
23361 extended-precision long double. If you change the long double type
23362 from IBM extended-precision, the compiler will issue a warning unless
23363 you use the @option{-Wno-psabi} option.
23364
23365 @item -mabi=elfv1
23366 @opindex mabi=elfv1
23367 Change the current ABI to use the ELFv1 ABI.
23368 This is the default ABI for big-endian PowerPC 64-bit Linux.
23369 Overriding the default ABI requires special system support and is
23370 likely to fail in spectacular ways.
23371
23372 @item -mabi=elfv2
23373 @opindex mabi=elfv2
23374 Change the current ABI to use the ELFv2 ABI.
23375 This is the default ABI for little-endian PowerPC 64-bit Linux.
23376 Overriding the default ABI requires special system support and is
23377 likely to fail in spectacular ways.
23378
23379 @item -mgnu-attribute
23380 @itemx -mno-gnu-attribute
23381 @opindex mgnu-attribute
23382 @opindex mno-gnu-attribute
23383 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23384 .gnu.attributes section that specify ABI variations in function
23385 parameters or return values.
23386
23387 @item -mprototype
23388 @itemx -mno-prototype
23389 @opindex mprototype
23390 @opindex mno-prototype
23391 On System V.4 and embedded PowerPC systems assume that all calls to
23392 variable argument functions are properly prototyped. Otherwise, the
23393 compiler must insert an instruction before every non-prototyped call to
23394 set or clear bit 6 of the condition code register (@code{CR}) to
23395 indicate whether floating-point values are passed in the floating-point
23396 registers in case the function takes variable arguments. With
23397 @option{-mprototype}, only calls to prototyped variable argument functions
23398 set or clear the bit.
23399
23400 @item -msim
23401 @opindex msim
23402 On embedded PowerPC systems, assume that the startup module is called
23403 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23404 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23405 configurations.
23406
23407 @item -mmvme
23408 @opindex mmvme
23409 On embedded PowerPC systems, assume that the startup module is called
23410 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23411 @file{libc.a}.
23412
23413 @item -mads
23414 @opindex mads
23415 On embedded PowerPC systems, assume that the startup module is called
23416 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23417 @file{libc.a}.
23418
23419 @item -myellowknife
23420 @opindex myellowknife
23421 On embedded PowerPC systems, assume that the startup module is called
23422 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23423 @file{libc.a}.
23424
23425 @item -mvxworks
23426 @opindex mvxworks
23427 On System V.4 and embedded PowerPC systems, specify that you are
23428 compiling for a VxWorks system.
23429
23430 @item -memb
23431 @opindex memb
23432 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
23433 header to indicate that @samp{eabi} extended relocations are used.
23434
23435 @item -meabi
23436 @itemx -mno-eabi
23437 @opindex meabi
23438 @opindex mno-eabi
23439 On System V.4 and embedded PowerPC systems do (do not) adhere to the
23440 Embedded Applications Binary Interface (EABI), which is a set of
23441 modifications to the System V.4 specifications. Selecting @option{-meabi}
23442 means that the stack is aligned to an 8-byte boundary, a function
23443 @code{__eabi} is called from @code{main} to set up the EABI
23444 environment, and the @option{-msdata} option can use both @code{r2} and
23445 @code{r13} to point to two separate small data areas. Selecting
23446 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
23447 no EABI initialization function is called from @code{main}, and the
23448 @option{-msdata} option only uses @code{r13} to point to a single
23449 small data area. The @option{-meabi} option is on by default if you
23450 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
23451
23452 @item -msdata=eabi
23453 @opindex msdata=eabi
23454 On System V.4 and embedded PowerPC systems, put small initialized
23455 @code{const} global and static data in the @code{.sdata2} section, which
23456 is pointed to by register @code{r2}. Put small initialized
23457 non-@code{const} global and static data in the @code{.sdata} section,
23458 which is pointed to by register @code{r13}. Put small uninitialized
23459 global and static data in the @code{.sbss} section, which is adjacent to
23460 the @code{.sdata} section. The @option{-msdata=eabi} option is
23461 incompatible with the @option{-mrelocatable} option. The
23462 @option{-msdata=eabi} option also sets the @option{-memb} option.
23463
23464 @item -msdata=sysv
23465 @opindex msdata=sysv
23466 On System V.4 and embedded PowerPC systems, put small global and static
23467 data in the @code{.sdata} section, which is pointed to by register
23468 @code{r13}. Put small uninitialized global and static data in the
23469 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
23470 The @option{-msdata=sysv} option is incompatible with the
23471 @option{-mrelocatable} option.
23472
23473 @item -msdata=default
23474 @itemx -msdata
23475 @opindex msdata=default
23476 @opindex msdata
23477 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
23478 compile code the same as @option{-msdata=eabi}, otherwise compile code the
23479 same as @option{-msdata=sysv}.
23480
23481 @item -msdata=data
23482 @opindex msdata=data
23483 On System V.4 and embedded PowerPC systems, put small global
23484 data in the @code{.sdata} section. Put small uninitialized global
23485 data in the @code{.sbss} section. Do not use register @code{r13}
23486 to address small data however. This is the default behavior unless
23487 other @option{-msdata} options are used.
23488
23489 @item -msdata=none
23490 @itemx -mno-sdata
23491 @opindex msdata=none
23492 @opindex mno-sdata
23493 On embedded PowerPC systems, put all initialized global and static data
23494 in the @code{.data} section, and all uninitialized data in the
23495 @code{.bss} section.
23496
23497 @item -mblock-move-inline-limit=@var{num}
23498 @opindex mblock-move-inline-limit
23499 Inline all block moves (such as calls to @code{memcpy} or structure
23500 copies) less than or equal to @var{num} bytes. The minimum value for
23501 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
23502 targets. The default value is target-specific.
23503
23504 @item -G @var{num}
23505 @opindex G
23506 @cindex smaller data references (PowerPC)
23507 @cindex .sdata/.sdata2 references (PowerPC)
23508 On embedded PowerPC systems, put global and static items less than or
23509 equal to @var{num} bytes into the small data or BSS sections instead of
23510 the normal data or BSS section. By default, @var{num} is 8. The
23511 @option{-G @var{num}} switch is also passed to the linker.
23512 All modules should be compiled with the same @option{-G @var{num}} value.
23513
23514 @item -mregnames
23515 @itemx -mno-regnames
23516 @opindex mregnames
23517 @opindex mno-regnames
23518 On System V.4 and embedded PowerPC systems do (do not) emit register
23519 names in the assembly language output using symbolic forms.
23520
23521 @item -mlongcall
23522 @itemx -mno-longcall
23523 @opindex mlongcall
23524 @opindex mno-longcall
23525 By default assume that all calls are far away so that a longer and more
23526 expensive calling sequence is required. This is required for calls
23527 farther than 32 megabytes (33,554,432 bytes) from the current location.
23528 A short call is generated if the compiler knows
23529 the call cannot be that far away. This setting can be overridden by
23530 the @code{shortcall} function attribute, or by @code{#pragma
23531 longcall(0)}.
23532
23533 Some linkers are capable of detecting out-of-range calls and generating
23534 glue code on the fly. On these systems, long calls are unnecessary and
23535 generate slower code. As of this writing, the AIX linker can do this,
23536 as can the GNU linker for PowerPC/64. It is planned to add this feature
23537 to the GNU linker for 32-bit PowerPC systems as well.
23538
23539 In the future, GCC may ignore all longcall specifications
23540 when the linker is known to generate glue.
23541
23542 @item -mtls-markers
23543 @itemx -mno-tls-markers
23544 @opindex mtls-markers
23545 @opindex mno-tls-markers
23546 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
23547 specifying the function argument. The relocation allows the linker to
23548 reliably associate function call with argument setup instructions for
23549 TLS optimization, which in turn allows GCC to better schedule the
23550 sequence.
23551
23552 @item -mrecip
23553 @itemx -mno-recip
23554 @opindex mrecip
23555 This option enables use of the reciprocal estimate and
23556 reciprocal square root estimate instructions with additional
23557 Newton-Raphson steps to increase precision instead of doing a divide or
23558 square root and divide for floating-point arguments. You should use
23559 the @option{-ffast-math} option when using @option{-mrecip} (or at
23560 least @option{-funsafe-math-optimizations},
23561 @option{-ffinite-math-only}, @option{-freciprocal-math} and
23562 @option{-fno-trapping-math}). Note that while the throughput of the
23563 sequence is generally higher than the throughput of the non-reciprocal
23564 instruction, the precision of the sequence can be decreased by up to 2
23565 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
23566 roots.
23567
23568 @item -mrecip=@var{opt}
23569 @opindex mrecip=opt
23570 This option controls which reciprocal estimate instructions
23571 may be used. @var{opt} is a comma-separated list of options, which may
23572 be preceded by a @code{!} to invert the option:
23573
23574 @table @samp
23575
23576 @item all
23577 Enable all estimate instructions.
23578
23579 @item default
23580 Enable the default instructions, equivalent to @option{-mrecip}.
23581
23582 @item none
23583 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23584
23585 @item div
23586 Enable the reciprocal approximation instructions for both
23587 single and double precision.
23588
23589 @item divf
23590 Enable the single-precision reciprocal approximation instructions.
23591
23592 @item divd
23593 Enable the double-precision reciprocal approximation instructions.
23594
23595 @item rsqrt
23596 Enable the reciprocal square root approximation instructions for both
23597 single and double precision.
23598
23599 @item rsqrtf
23600 Enable the single-precision reciprocal square root approximation instructions.
23601
23602 @item rsqrtd
23603 Enable the double-precision reciprocal square root approximation instructions.
23604
23605 @end table
23606
23607 So, for example, @option{-mrecip=all,!rsqrtd} enables
23608 all of the reciprocal estimate instructions, except for the
23609 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
23610 which handle the double-precision reciprocal square root calculations.
23611
23612 @item -mrecip-precision
23613 @itemx -mno-recip-precision
23614 @opindex mrecip-precision
23615 Assume (do not assume) that the reciprocal estimate instructions
23616 provide higher-precision estimates than is mandated by the PowerPC
23617 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
23618 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
23619 The double-precision square root estimate instructions are not generated by
23620 default on low-precision machines, since they do not provide an
23621 estimate that converges after three steps.
23622
23623 @item -mpointers-to-nested-functions
23624 @itemx -mno-pointers-to-nested-functions
23625 @opindex mpointers-to-nested-functions
23626 Generate (do not generate) code to load up the static chain register
23627 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
23628 systems where a function pointer points to a 3-word descriptor giving
23629 the function address, TOC value to be loaded in register @code{r2}, and
23630 static chain value to be loaded in register @code{r11}. The
23631 @option{-mpointers-to-nested-functions} is on by default. You cannot
23632 call through pointers to nested functions or pointers
23633 to functions compiled in other languages that use the static chain if
23634 you use @option{-mno-pointers-to-nested-functions}.
23635
23636 @item -msave-toc-indirect
23637 @itemx -mno-save-toc-indirect
23638 @opindex msave-toc-indirect
23639 Generate (do not generate) code to save the TOC value in the reserved
23640 stack location in the function prologue if the function calls through
23641 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
23642 saved in the prologue, it is saved just before the call through the
23643 pointer. The @option{-mno-save-toc-indirect} option is the default.
23644
23645 @item -mcompat-align-parm
23646 @itemx -mno-compat-align-parm
23647 @opindex mcompat-align-parm
23648 Generate (do not generate) code to pass structure parameters with a
23649 maximum alignment of 64 bits, for compatibility with older versions
23650 of GCC.
23651
23652 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23653 structure parameter on a 128-bit boundary when that structure contained
23654 a member requiring 128-bit alignment. This is corrected in more
23655 recent versions of GCC. This option may be used to generate code
23656 that is compatible with functions compiled with older versions of
23657 GCC.
23658
23659 The @option{-mno-compat-align-parm} option is the default.
23660
23661 @item -mstack-protector-guard=@var{guard}
23662 @itemx -mstack-protector-guard-reg=@var{reg}
23663 @itemx -mstack-protector-guard-offset=@var{offset}
23664 @itemx -mstack-protector-guard-symbol=@var{symbol}
23665 @opindex mstack-protector-guard
23666 @opindex mstack-protector-guard-reg
23667 @opindex mstack-protector-guard-offset
23668 @opindex mstack-protector-guard-symbol
23669 Generate stack protection code using canary at @var{guard}. Supported
23670 locations are @samp{global} for global canary or @samp{tls} for per-thread
23671 canary in the TLS block (the default with GNU libc version 2.4 or later).
23672
23673 With the latter choice the options
23674 @option{-mstack-protector-guard-reg=@var{reg}} and
23675 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
23676 which register to use as base register for reading the canary, and from what
23677 offset from that base register. The default for those is as specified in the
23678 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
23679 the offset with a symbol reference to a canary in the TLS block.
23680 @end table
23681
23682
23683 @node RISC-V Options
23684 @subsection RISC-V Options
23685 @cindex RISC-V Options
23686
23687 These command-line options are defined for RISC-V targets:
23688
23689 @table @gcctabopt
23690 @item -mbranch-cost=@var{n}
23691 @opindex mbranch-cost
23692 Set the cost of branches to roughly @var{n} instructions.
23693
23694 @item -mplt
23695 @itemx -mno-plt
23696 @opindex plt
23697 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23698 non-PIC. The default is @option{-mplt}.
23699
23700 @item -mabi=@var{ABI-string}
23701 @opindex mabi
23702 Specify integer and floating-point calling convention. @var{ABI-string}
23703 contains two parts: the size of integer types and the registers used for
23704 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23705 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23706 32-bit), and that floating-point values up to 64 bits wide are passed in F
23707 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23708 allows the compiler to generate code that uses the F and D extensions but only
23709 allows floating-point values up to 32 bits long to be passed in registers; or
23710 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23711 passed in registers.
23712
23713 The default for this argument is system dependent, users who want a specific
23714 calling convention should specify one explicitly. The valid calling
23715 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23716 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23717 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23718 invalid because the ABI requires 64-bit values be passed in F registers, but F
23719 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23720 only be used with the @samp{rv32e} architecture. This ABI is not well
23721 specified at present, and is subject to change.
23722
23723 @item -mfdiv
23724 @itemx -mno-fdiv
23725 @opindex mfdiv
23726 Do or don't use hardware floating-point divide and square root instructions.
23727 This requires the F or D extensions for floating-point registers. The default
23728 is to use them if the specified architecture has these instructions.
23729
23730 @item -mdiv
23731 @itemx -mno-div
23732 @opindex mdiv
23733 Do or don't use hardware instructions for integer division. This requires the
23734 M extension. The default is to use them if the specified architecture has
23735 these instructions.
23736
23737 @item -march=@var{ISA-string}
23738 @opindex march
23739 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
23740 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23741 @samp{rv32imaf}.
23742
23743 @item -mtune=@var{processor-string}
23744 @opindex mtune
23745 Optimize the output for the given processor, specified by microarchitecture
23746 name.
23747
23748 @item -mpreferred-stack-boundary=@var{num}
23749 @opindex mpreferred-stack-boundary
23750 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23751 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23752 the default is 4 (16 bytes or 128-bits).
23753
23754 @strong{Warning:} If you use this switch, then you must build all modules with
23755 the same value, including any libraries. This includes the system libraries
23756 and startup modules.
23757
23758 @item -msmall-data-limit=@var{n}
23759 @opindex msmall-data-limit
23760 Put global and static data smaller than @var{n} bytes into a special section
23761 (on some targets).
23762
23763 @item -msave-restore
23764 @itemx -mno-save-restore
23765 @opindex msave-restore
23766 Do or don't use smaller but slower prologue and epilogue code that uses
23767 library function calls. The default is to use fast inline prologues and
23768 epilogues.
23769
23770 @item -mstrict-align
23771 @itemx -mno-strict-align
23772 @opindex mstrict-align
23773 Do not or do generate unaligned memory accesses. The default is set depending
23774 on whether the processor we are optimizing for supports fast unaligned access
23775 or not.
23776
23777 @item -mcmodel=medlow
23778 @opindex mcmodel=medlow
23779 Generate code for the medium-low code model. The program and its statically
23780 defined symbols must lie within a single 2 GiB address range and must lie
23781 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23782 statically or dynamically linked. This is the default code model.
23783
23784 @item -mcmodel=medany
23785 @opindex mcmodel=medany
23786 Generate code for the medium-any code model. The program and its statically
23787 defined symbols must be within any single 2 GiB address range. Programs can be
23788 statically or dynamically linked.
23789
23790 @item -mexplicit-relocs
23791 @itemx -mno-exlicit-relocs
23792 Use or do not use assembler relocation operators when dealing with symbolic
23793 addresses. The alternative is to use assembler macros instead, which may
23794 limit optimization.
23795
23796 @item -mrelax
23797 @itemx -mno-relax
23798 Take advantage of linker relaxations to reduce the number of instructions
23799 required to materialize symbol addresses. The default is to take advantage of
23800 linker relaxations.
23801
23802 @end table
23803
23804 @node RL78 Options
23805 @subsection RL78 Options
23806 @cindex RL78 Options
23807
23808 @table @gcctabopt
23809
23810 @item -msim
23811 @opindex msim
23812 Links in additional target libraries to support operation within a
23813 simulator.
23814
23815 @item -mmul=none
23816 @itemx -mmul=g10
23817 @itemx -mmul=g13
23818 @itemx -mmul=g14
23819 @itemx -mmul=rl78
23820 @opindex mmul
23821 Specifies the type of hardware multiplication and division support to
23822 be used. The simplest is @code{none}, which uses software for both
23823 multiplication and division. This is the default. The @code{g13}
23824 value is for the hardware multiply/divide peripheral found on the
23825 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23826 the multiplication and division instructions supported by the RL78/G14
23827 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23828 the value @code{mg10} is an alias for @code{none}.
23829
23830 In addition a C preprocessor macro is defined, based upon the setting
23831 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23832 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23833
23834 @item -mcpu=g10
23835 @itemx -mcpu=g13
23836 @itemx -mcpu=g14
23837 @itemx -mcpu=rl78
23838 @opindex mcpu
23839 Specifies the RL78 core to target. The default is the G14 core, also
23840 known as an S3 core or just RL78. The G13 or S2 core does not have
23841 multiply or divide instructions, instead it uses a hardware peripheral
23842 for these operations. The G10 or S1 core does not have register
23843 banks, so it uses a different calling convention.
23844
23845 If this option is set it also selects the type of hardware multiply
23846 support to use, unless this is overridden by an explicit
23847 @option{-mmul=none} option on the command line. Thus specifying
23848 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23849 peripheral and specifying @option{-mcpu=g10} disables the use of
23850 hardware multiplications altogether.
23851
23852 Note, although the RL78/G14 core is the default target, specifying
23853 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23854 change the behavior of the toolchain since it also enables G14
23855 hardware multiply support. If these options are not specified on the
23856 command line then software multiplication routines will be used even
23857 though the code targets the RL78 core. This is for backwards
23858 compatibility with older toolchains which did not have hardware
23859 multiply and divide support.
23860
23861 In addition a C preprocessor macro is defined, based upon the setting
23862 of this option. Possible values are: @code{__RL78_G10__},
23863 @code{__RL78_G13__} or @code{__RL78_G14__}.
23864
23865 @item -mg10
23866 @itemx -mg13
23867 @itemx -mg14
23868 @itemx -mrl78
23869 @opindex mg10
23870 @opindex mg13
23871 @opindex mg14
23872 @opindex mrl78
23873 These are aliases for the corresponding @option{-mcpu=} option. They
23874 are provided for backwards compatibility.
23875
23876 @item -mallregs
23877 @opindex mallregs
23878 Allow the compiler to use all of the available registers. By default
23879 registers @code{r24..r31} are reserved for use in interrupt handlers.
23880 With this option enabled these registers can be used in ordinary
23881 functions as well.
23882
23883 @item -m64bit-doubles
23884 @itemx -m32bit-doubles
23885 @opindex m64bit-doubles
23886 @opindex m32bit-doubles
23887 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23888 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23889 @option{-m32bit-doubles}.
23890
23891 @item -msave-mduc-in-interrupts
23892 @itemx -mno-save-mduc-in-interrupts
23893 @opindex msave-mduc-in-interrupts
23894 @opindex mno-save-mduc-in-interrupts
23895 Specifies that interrupt handler functions should preserve the
23896 MDUC registers. This is only necessary if normal code might use
23897 the MDUC registers, for example because it performs multiplication
23898 and division operations. The default is to ignore the MDUC registers
23899 as this makes the interrupt handlers faster. The target option -mg13
23900 needs to be passed for this to work as this feature is only available
23901 on the G13 target (S2 core). The MDUC registers will only be saved
23902 if the interrupt handler performs a multiplication or division
23903 operation or it calls another function.
23904
23905 @end table
23906
23907 @node RS/6000 and PowerPC Options
23908 @subsection IBM RS/6000 and PowerPC Options
23909 @cindex RS/6000 and PowerPC Options
23910 @cindex IBM RS/6000 and PowerPC Options
23911
23912 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23913 @table @gcctabopt
23914 @item -mpowerpc-gpopt
23915 @itemx -mno-powerpc-gpopt
23916 @itemx -mpowerpc-gfxopt
23917 @itemx -mno-powerpc-gfxopt
23918 @need 800
23919 @itemx -mpowerpc64
23920 @itemx -mno-powerpc64
23921 @itemx -mmfcrf
23922 @itemx -mno-mfcrf
23923 @itemx -mpopcntb
23924 @itemx -mno-popcntb
23925 @itemx -mpopcntd
23926 @itemx -mno-popcntd
23927 @itemx -mfprnd
23928 @itemx -mno-fprnd
23929 @need 800
23930 @itemx -mcmpb
23931 @itemx -mno-cmpb
23932 @itemx -mmfpgpr
23933 @itemx -mno-mfpgpr
23934 @itemx -mhard-dfp
23935 @itemx -mno-hard-dfp
23936 @opindex mpowerpc-gpopt
23937 @opindex mno-powerpc-gpopt
23938 @opindex mpowerpc-gfxopt
23939 @opindex mno-powerpc-gfxopt
23940 @opindex mpowerpc64
23941 @opindex mno-powerpc64
23942 @opindex mmfcrf
23943 @opindex mno-mfcrf
23944 @opindex mpopcntb
23945 @opindex mno-popcntb
23946 @opindex mpopcntd
23947 @opindex mno-popcntd
23948 @opindex mfprnd
23949 @opindex mno-fprnd
23950 @opindex mcmpb
23951 @opindex mno-cmpb
23952 @opindex mmfpgpr
23953 @opindex mno-mfpgpr
23954 @opindex mhard-dfp
23955 @opindex mno-hard-dfp
23956 You use these options to specify which instructions are available on the
23957 processor you are using. The default value of these options is
23958 determined when configuring GCC@. Specifying the
23959 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23960 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23961 rather than the options listed above.
23962
23963 Specifying @option{-mpowerpc-gpopt} allows
23964 GCC to use the optional PowerPC architecture instructions in the
23965 General Purpose group, including floating-point square root. Specifying
23966 @option{-mpowerpc-gfxopt} allows GCC to
23967 use the optional PowerPC architecture instructions in the Graphics
23968 group, including floating-point select.
23969
23970 The @option{-mmfcrf} option allows GCC to generate the move from
23971 condition register field instruction implemented on the POWER4
23972 processor and other processors that support the PowerPC V2.01
23973 architecture.
23974 The @option{-mpopcntb} option allows GCC to generate the popcount and
23975 double-precision FP reciprocal estimate instruction implemented on the
23976 POWER5 processor and other processors that support the PowerPC V2.02
23977 architecture.
23978 The @option{-mpopcntd} option allows GCC to generate the popcount
23979 instruction implemented on the POWER7 processor and other processors
23980 that support the PowerPC V2.06 architecture.
23981 The @option{-mfprnd} option allows GCC to generate the FP round to
23982 integer instructions implemented on the POWER5+ processor and other
23983 processors that support the PowerPC V2.03 architecture.
23984 The @option{-mcmpb} option allows GCC to generate the compare bytes
23985 instruction implemented on the POWER6 processor and other processors
23986 that support the PowerPC V2.05 architecture.
23987 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23988 general-purpose register instructions implemented on the POWER6X
23989 processor and other processors that support the extended PowerPC V2.05
23990 architecture.
23991 The @option{-mhard-dfp} option allows GCC to generate the decimal
23992 floating-point instructions implemented on some POWER processors.
23993
23994 The @option{-mpowerpc64} option allows GCC to generate the additional
23995 64-bit instructions that are found in the full PowerPC64 architecture
23996 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23997 @option{-mno-powerpc64}.
23998
23999 @item -mcpu=@var{cpu_type}
24000 @opindex mcpu
24001 Set architecture type, register usage, and
24002 instruction scheduling parameters for machine type @var{cpu_type}.
24003 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24004 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24005 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24006 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24007 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24008 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24009 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24010 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24011 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24012 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24013 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
24014 @samp{rs64}, and @samp{native}.
24015
24016 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24017 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24018 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24019 architecture machine types, with an appropriate, generic processor
24020 model assumed for scheduling purposes.
24021
24022 Specifying @samp{native} as cpu type detects and selects the
24023 architecture option that corresponds to the host processor of the
24024 system performing the compilation.
24025 @option{-mcpu=native} has no effect if GCC does not recognize the
24026 processor.
24027
24028 The other options specify a specific processor. Code generated under
24029 those options runs best on that processor, and may not run at all on
24030 others.
24031
24032 The @option{-mcpu} options automatically enable or disable the
24033 following options:
24034
24035 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24036 -mpopcntb -mpopcntd -mpowerpc64 @gol
24037 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24038 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24039 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24040 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24041
24042 The particular options set for any particular CPU varies between
24043 compiler versions, depending on what setting seems to produce optimal
24044 code for that CPU; it doesn't necessarily reflect the actual hardware's
24045 capabilities. If you wish to set an individual option to a particular
24046 value, you may specify it after the @option{-mcpu} option, like
24047 @option{-mcpu=970 -mno-altivec}.
24048
24049 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24050 not enabled or disabled by the @option{-mcpu} option at present because
24051 AIX does not have full support for these options. You may still
24052 enable or disable them individually if you're sure it'll work in your
24053 environment.
24054
24055 @item -mtune=@var{cpu_type}
24056 @opindex mtune
24057 Set the instruction scheduling parameters for machine type
24058 @var{cpu_type}, but do not set the architecture type or register usage,
24059 as @option{-mcpu=@var{cpu_type}} does. The same
24060 values for @var{cpu_type} are used for @option{-mtune} as for
24061 @option{-mcpu}. If both are specified, the code generated uses the
24062 architecture and registers set by @option{-mcpu}, but the
24063 scheduling parameters set by @option{-mtune}.
24064
24065 @item -mcmodel=small
24066 @opindex mcmodel=small
24067 Generate PowerPC64 code for the small model: The TOC is limited to
24068 64k.
24069
24070 @item -mcmodel=medium
24071 @opindex mcmodel=medium
24072 Generate PowerPC64 code for the medium model: The TOC and other static
24073 data may be up to a total of 4G in size. This is the default for 64-bit
24074 Linux.
24075
24076 @item -mcmodel=large
24077 @opindex mcmodel=large
24078 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24079 in size. Other data and code is only limited by the 64-bit address
24080 space.
24081
24082 @item -maltivec
24083 @itemx -mno-altivec
24084 @opindex maltivec
24085 @opindex mno-altivec
24086 Generate code that uses (does not use) AltiVec instructions, and also
24087 enable the use of built-in functions that allow more direct access to
24088 the AltiVec instruction set. You may also need to set
24089 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24090 enhancements.
24091
24092 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
24093 @option{-maltivec=be}, the element order for AltiVec intrinsics such
24094 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24095 match array element order corresponding to the endianness of the
24096 target. That is, element zero identifies the leftmost element in a
24097 vector register when targeting a big-endian platform, and identifies
24098 the rightmost element in a vector register when targeting a
24099 little-endian platform.
24100
24101 @item -maltivec=be
24102 @opindex maltivec=be
24103 Generate AltiVec instructions using big-endian element order,
24104 regardless of whether the target is big- or little-endian. This is
24105 the default when targeting a big-endian platform. Using this option
24106 is currently deprecated. Support for this feature will be removed in
24107 GCC 9.
24108
24109 The element order is used to interpret element numbers in AltiVec
24110 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24111 @code{vec_insert}. By default, these match array element order
24112 corresponding to the endianness for the target.
24113
24114 @item -maltivec=le
24115 @opindex maltivec=le
24116 Generate AltiVec instructions using little-endian element order,
24117 regardless of whether the target is big- or little-endian. This is
24118 the default when targeting a little-endian platform. This option is
24119 currently ignored when targeting a big-endian platform.
24120
24121 The element order is used to interpret element numbers in AltiVec
24122 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
24123 @code{vec_insert}. By default, these match array element order
24124 corresponding to the endianness for the target.
24125
24126 @item -mvrsave
24127 @itemx -mno-vrsave
24128 @opindex mvrsave
24129 @opindex mno-vrsave
24130 Generate VRSAVE instructions when generating AltiVec code.
24131
24132 @item -msecure-plt
24133 @opindex msecure-plt
24134 Generate code that allows @command{ld} and @command{ld.so}
24135 to build executables and shared
24136 libraries with non-executable @code{.plt} and @code{.got} sections.
24137 This is a PowerPC
24138 32-bit SYSV ABI option.
24139
24140 @item -mbss-plt
24141 @opindex mbss-plt
24142 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24143 fills in, and
24144 requires @code{.plt} and @code{.got}
24145 sections that are both writable and executable.
24146 This is a PowerPC 32-bit SYSV ABI option.
24147
24148 @item -misel
24149 @itemx -mno-isel
24150 @opindex misel
24151 @opindex mno-isel
24152 This switch enables or disables the generation of ISEL instructions.
24153
24154 @item -mvsx
24155 @itemx -mno-vsx
24156 @opindex mvsx
24157 @opindex mno-vsx
24158 Generate code that uses (does not use) vector/scalar (VSX)
24159 instructions, and also enable the use of built-in functions that allow
24160 more direct access to the VSX instruction set.
24161
24162 @item -mcrypto
24163 @itemx -mno-crypto
24164 @opindex mcrypto
24165 @opindex mno-crypto
24166 Enable the use (disable) of the built-in functions that allow direct
24167 access to the cryptographic instructions that were added in version
24168 2.07 of the PowerPC ISA.
24169
24170 @item -mhtm
24171 @itemx -mno-htm
24172 @opindex mhtm
24173 @opindex mno-htm
24174 Enable (disable) the use of the built-in functions that allow direct
24175 access to the Hardware Transactional Memory (HTM) instructions that
24176 were added in version 2.07 of the PowerPC ISA.
24177
24178 @item -mpower8-fusion
24179 @itemx -mno-power8-fusion
24180 @opindex mpower8-fusion
24181 @opindex mno-power8-fusion
24182 Generate code that keeps (does not keeps) some integer operations
24183 adjacent so that the instructions can be fused together on power8 and
24184 later processors.
24185
24186 @item -mpower8-vector
24187 @itemx -mno-power8-vector
24188 @opindex mpower8-vector
24189 @opindex mno-power8-vector
24190 Generate code that uses (does not use) the vector and scalar
24191 instructions that were added in version 2.07 of the PowerPC ISA. Also
24192 enable the use of built-in functions that allow more direct access to
24193 the vector instructions.
24194
24195 @item -mquad-memory
24196 @itemx -mno-quad-memory
24197 @opindex mquad-memory
24198 @opindex mno-quad-memory
24199 Generate code that uses (does not use) the non-atomic quad word memory
24200 instructions. The @option{-mquad-memory} option requires use of
24201 64-bit mode.
24202
24203 @item -mquad-memory-atomic
24204 @itemx -mno-quad-memory-atomic
24205 @opindex mquad-memory-atomic
24206 @opindex mno-quad-memory-atomic
24207 Generate code that uses (does not use) the atomic quad word memory
24208 instructions. The @option{-mquad-memory-atomic} option requires use of
24209 64-bit mode.
24210
24211 @item -mfloat128
24212 @itemx -mno-float128
24213 @opindex mfloat128
24214 @opindex mno-float128
24215 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24216 and use either software emulation for IEEE 128-bit floating point or
24217 hardware instructions.
24218
24219 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24220 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24221 use the IEEE 128-bit floating point support. The IEEE 128-bit
24222 floating point support only works on PowerPC Linux systems.
24223
24224 The default for @option{-mfloat128} is enabled on PowerPC Linux
24225 systems using the VSX instruction set, and disabled on other systems.
24226
24227 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24228 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24229 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24230 floating point instructions. Otherwise, if you do not specify to
24231 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24232 system, IEEE 128-bit floating point will be done with software
24233 emulation.
24234
24235 @item -mfloat128-hardware
24236 @itemx -mno-float128-hardware
24237 @opindex mfloat128-hardware
24238 @opindex mno-float128-hardware
24239 Enable/disable using ISA 3.0 hardware instructions to support the
24240 @var{__float128} data type.
24241
24242 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24243 Linux systems using the ISA 3.0 instruction set, and disabled on other
24244 systems.
24245
24246 @item -m32
24247 @itemx -m64
24248 @opindex m32
24249 @opindex m64
24250 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24251 targets (including GNU/Linux). The 32-bit environment sets int, long
24252 and pointer to 32 bits and generates code that runs on any PowerPC
24253 variant. The 64-bit environment sets int to 32 bits and long and
24254 pointer to 64 bits, and generates code for PowerPC64, as for
24255 @option{-mpowerpc64}.
24256
24257 @item -mfull-toc
24258 @itemx -mno-fp-in-toc
24259 @itemx -mno-sum-in-toc
24260 @itemx -mminimal-toc
24261 @opindex mfull-toc
24262 @opindex mno-fp-in-toc
24263 @opindex mno-sum-in-toc
24264 @opindex mminimal-toc
24265 Modify generation of the TOC (Table Of Contents), which is created for
24266 every executable file. The @option{-mfull-toc} option is selected by
24267 default. In that case, GCC allocates at least one TOC entry for
24268 each unique non-automatic variable reference in your program. GCC
24269 also places floating-point constants in the TOC@. However, only
24270 16,384 entries are available in the TOC@.
24271
24272 If you receive a linker error message that saying you have overflowed
24273 the available TOC space, you can reduce the amount of TOC space used
24274 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24275 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24276 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24277 generate code to calculate the sum of an address and a constant at
24278 run time instead of putting that sum into the TOC@. You may specify one
24279 or both of these options. Each causes GCC to produce very slightly
24280 slower and larger code at the expense of conserving TOC space.
24281
24282 If you still run out of space in the TOC even when you specify both of
24283 these options, specify @option{-mminimal-toc} instead. This option causes
24284 GCC to make only one TOC entry for every file. When you specify this
24285 option, GCC produces code that is slower and larger but which
24286 uses extremely little TOC space. You may wish to use this option
24287 only on files that contain less frequently-executed code.
24288
24289 @item -maix64
24290 @itemx -maix32
24291 @opindex maix64
24292 @opindex maix32
24293 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24294 @code{long} type, and the infrastructure needed to support them.
24295 Specifying @option{-maix64} implies @option{-mpowerpc64},
24296 while @option{-maix32} disables the 64-bit ABI and
24297 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24298
24299 @item -mxl-compat
24300 @itemx -mno-xl-compat
24301 @opindex mxl-compat
24302 @opindex mno-xl-compat
24303 Produce code that conforms more closely to IBM XL compiler semantics
24304 when using AIX-compatible ABI@. Pass floating-point arguments to
24305 prototyped functions beyond the register save area (RSA) on the stack
24306 in addition to argument FPRs. Do not assume that most significant
24307 double in 128-bit long double value is properly rounded when comparing
24308 values and converting to double. Use XL symbol names for long double
24309 support routines.
24310
24311 The AIX calling convention was extended but not initially documented to
24312 handle an obscure K&R C case of calling a function that takes the
24313 address of its arguments with fewer arguments than declared. IBM XL
24314 compilers access floating-point arguments that do not fit in the
24315 RSA from the stack when a subroutine is compiled without
24316 optimization. Because always storing floating-point arguments on the
24317 stack is inefficient and rarely needed, this option is not enabled by
24318 default and only is necessary when calling subroutines compiled by IBM
24319 XL compilers without optimization.
24320
24321 @item -mpe
24322 @opindex mpe
24323 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24324 application written to use message passing with special startup code to
24325 enable the application to run. The system must have PE installed in the
24326 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24327 must be overridden with the @option{-specs=} option to specify the
24328 appropriate directory location. The Parallel Environment does not
24329 support threads, so the @option{-mpe} option and the @option{-pthread}
24330 option are incompatible.
24331
24332 @item -malign-natural
24333 @itemx -malign-power
24334 @opindex malign-natural
24335 @opindex malign-power
24336 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24337 @option{-malign-natural} overrides the ABI-defined alignment of larger
24338 types, such as floating-point doubles, on their natural size-based boundary.
24339 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24340 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24341
24342 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24343 is not supported.
24344
24345 @item -msoft-float
24346 @itemx -mhard-float
24347 @opindex msoft-float
24348 @opindex mhard-float
24349 Generate code that does not use (uses) the floating-point register set.
24350 Software floating-point emulation is provided if you use the
24351 @option{-msoft-float} option, and pass the option to GCC when linking.
24352
24353 @item -mmultiple
24354 @itemx -mno-multiple
24355 @opindex mmultiple
24356 @opindex mno-multiple
24357 Generate code that uses (does not use) the load multiple word
24358 instructions and the store multiple word instructions. These
24359 instructions are generated by default on POWER systems, and not
24360 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24361 PowerPC systems, since those instructions do not work when the
24362 processor is in little-endian mode. The exceptions are PPC740 and
24363 PPC750 which permit these instructions in little-endian mode.
24364
24365 @item -mupdate
24366 @itemx -mno-update
24367 @opindex mupdate
24368 @opindex mno-update
24369 Generate code that uses (does not use) the load or store instructions
24370 that update the base register to the address of the calculated memory
24371 location. These instructions are generated by default. If you use
24372 @option{-mno-update}, there is a small window between the time that the
24373 stack pointer is updated and the address of the previous frame is
24374 stored, which means code that walks the stack frame across interrupts or
24375 signals may get corrupted data.
24376
24377 @item -mavoid-indexed-addresses
24378 @itemx -mno-avoid-indexed-addresses
24379 @opindex mavoid-indexed-addresses
24380 @opindex mno-avoid-indexed-addresses
24381 Generate code that tries to avoid (not avoid) the use of indexed load
24382 or store instructions. These instructions can incur a performance
24383 penalty on Power6 processors in certain situations, such as when
24384 stepping through large arrays that cross a 16M boundary. This option
24385 is enabled by default when targeting Power6 and disabled otherwise.
24386
24387 @item -mfused-madd
24388 @itemx -mno-fused-madd
24389 @opindex mfused-madd
24390 @opindex mno-fused-madd
24391 Generate code that uses (does not use) the floating-point multiply and
24392 accumulate instructions. These instructions are generated by default
24393 if hardware floating point is used. The machine-dependent
24394 @option{-mfused-madd} option is now mapped to the machine-independent
24395 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24396 mapped to @option{-ffp-contract=off}.
24397
24398 @item -mmulhw
24399 @itemx -mno-mulhw
24400 @opindex mmulhw
24401 @opindex mno-mulhw
24402 Generate code that uses (does not use) the half-word multiply and
24403 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24404 These instructions are generated by default when targeting those
24405 processors.
24406
24407 @item -mdlmzb
24408 @itemx -mno-dlmzb
24409 @opindex mdlmzb
24410 @opindex mno-dlmzb
24411 Generate code that uses (does not use) the string-search @samp{dlmzb}
24412 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24413 generated by default when targeting those processors.
24414
24415 @item -mno-bit-align
24416 @itemx -mbit-align
24417 @opindex mno-bit-align
24418 @opindex mbit-align
24419 On System V.4 and embedded PowerPC systems do not (do) force structures
24420 and unions that contain bit-fields to be aligned to the base type of the
24421 bit-field.
24422
24423 For example, by default a structure containing nothing but 8
24424 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24425 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24426 the structure is aligned to a 1-byte boundary and is 1 byte in
24427 size.
24428
24429 @item -mno-strict-align
24430 @itemx -mstrict-align
24431 @opindex mno-strict-align
24432 @opindex mstrict-align
24433 On System V.4 and embedded PowerPC systems do not (do) assume that
24434 unaligned memory references are handled by the system.
24435
24436 @item -mrelocatable
24437 @itemx -mno-relocatable
24438 @opindex mrelocatable
24439 @opindex mno-relocatable
24440 Generate code that allows (does not allow) a static executable to be
24441 relocated to a different address at run time. A simple embedded
24442 PowerPC system loader should relocate the entire contents of
24443 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24444 a table of 32-bit addresses generated by this option. For this to
24445 work, all objects linked together must be compiled with
24446 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24447 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24448
24449 @item -mrelocatable-lib
24450 @itemx -mno-relocatable-lib
24451 @opindex mrelocatable-lib
24452 @opindex mno-relocatable-lib
24453 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24454 @code{.fixup} section to allow static executables to be relocated at
24455 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24456 alignment of @option{-mrelocatable}. Objects compiled with
24457 @option{-mrelocatable-lib} may be linked with objects compiled with
24458 any combination of the @option{-mrelocatable} options.
24459
24460 @item -mno-toc
24461 @itemx -mtoc
24462 @opindex mno-toc
24463 @opindex mtoc
24464 On System V.4 and embedded PowerPC systems do not (do) assume that
24465 register 2 contains a pointer to a global area pointing to the addresses
24466 used in the program.
24467
24468 @item -mlittle
24469 @itemx -mlittle-endian
24470 @opindex mlittle
24471 @opindex mlittle-endian
24472 On System V.4 and embedded PowerPC systems compile code for the
24473 processor in little-endian mode. The @option{-mlittle-endian} option is
24474 the same as @option{-mlittle}.
24475
24476 @item -mbig
24477 @itemx -mbig-endian
24478 @opindex mbig
24479 @opindex mbig-endian
24480 On System V.4 and embedded PowerPC systems compile code for the
24481 processor in big-endian mode. The @option{-mbig-endian} option is
24482 the same as @option{-mbig}.
24483
24484 @item -mdynamic-no-pic
24485 @opindex mdynamic-no-pic
24486 On Darwin and Mac OS X systems, compile code so that it is not
24487 relocatable, but that its external references are relocatable. The
24488 resulting code is suitable for applications, but not shared
24489 libraries.
24490
24491 @item -msingle-pic-base
24492 @opindex msingle-pic-base
24493 Treat the register used for PIC addressing as read-only, rather than
24494 loading it in the prologue for each function. The runtime system is
24495 responsible for initializing this register with an appropriate value
24496 before execution begins.
24497
24498 @item -mprioritize-restricted-insns=@var{priority}
24499 @opindex mprioritize-restricted-insns
24500 This option controls the priority that is assigned to
24501 dispatch-slot restricted instructions during the second scheduling
24502 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24503 or @samp{2} to assign no, highest, or second-highest (respectively)
24504 priority to dispatch-slot restricted
24505 instructions.
24506
24507 @item -msched-costly-dep=@var{dependence_type}
24508 @opindex msched-costly-dep
24509 This option controls which dependences are considered costly
24510 by the target during instruction scheduling. The argument
24511 @var{dependence_type} takes one of the following values:
24512
24513 @table @asis
24514 @item @samp{no}
24515 No dependence is costly.
24516
24517 @item @samp{all}
24518 All dependences are costly.
24519
24520 @item @samp{true_store_to_load}
24521 A true dependence from store to load is costly.
24522
24523 @item @samp{store_to_load}
24524 Any dependence from store to load is costly.
24525
24526 @item @var{number}
24527 Any dependence for which the latency is greater than or equal to
24528 @var{number} is costly.
24529 @end table
24530
24531 @item -minsert-sched-nops=@var{scheme}
24532 @opindex minsert-sched-nops
24533 This option controls which NOP insertion scheme is used during
24534 the second scheduling pass. The argument @var{scheme} takes one of the
24535 following values:
24536
24537 @table @asis
24538 @item @samp{no}
24539 Don't insert NOPs.
24540
24541 @item @samp{pad}
24542 Pad with NOPs any dispatch group that has vacant issue slots,
24543 according to the scheduler's grouping.
24544
24545 @item @samp{regroup_exact}
24546 Insert NOPs to force costly dependent insns into
24547 separate groups. Insert exactly as many NOPs as needed to force an insn
24548 to a new group, according to the estimated processor grouping.
24549
24550 @item @var{number}
24551 Insert NOPs to force costly dependent insns into
24552 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24553 @end table
24554
24555 @item -mcall-sysv
24556 @opindex mcall-sysv
24557 On System V.4 and embedded PowerPC systems compile code using calling
24558 conventions that adhere to the March 1995 draft of the System V
24559 Application Binary Interface, PowerPC processor supplement. This is the
24560 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24561
24562 @item -mcall-sysv-eabi
24563 @itemx -mcall-eabi
24564 @opindex mcall-sysv-eabi
24565 @opindex mcall-eabi
24566 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24567
24568 @item -mcall-sysv-noeabi
24569 @opindex mcall-sysv-noeabi
24570 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24571
24572 @item -mcall-aixdesc
24573 @opindex m
24574 On System V.4 and embedded PowerPC systems compile code for the AIX
24575 operating system.
24576
24577 @item -mcall-linux
24578 @opindex mcall-linux
24579 On System V.4 and embedded PowerPC systems compile code for the
24580 Linux-based GNU system.
24581
24582 @item -mcall-freebsd
24583 @opindex mcall-freebsd
24584 On System V.4 and embedded PowerPC systems compile code for the
24585 FreeBSD operating system.
24586
24587 @item -mcall-netbsd
24588 @opindex mcall-netbsd
24589 On System V.4 and embedded PowerPC systems compile code for the
24590 NetBSD operating system.
24591
24592 @item -mcall-openbsd
24593 @opindex mcall-netbsd
24594 On System V.4 and embedded PowerPC systems compile code for the
24595 OpenBSD operating system.
24596
24597 @item -mtraceback=@var{traceback_type}
24598 @opindex mtraceback
24599 Select the type of traceback table. Valid values for @var{traceback_type}
24600 are @samp{full}, @samp{part}, and @samp{no}.
24601
24602 @item -maix-struct-return
24603 @opindex maix-struct-return
24604 Return all structures in memory (as specified by the AIX ABI)@.
24605
24606 @item -msvr4-struct-return
24607 @opindex msvr4-struct-return
24608 Return structures smaller than 8 bytes in registers (as specified by the
24609 SVR4 ABI)@.
24610
24611 @item -mabi=@var{abi-type}
24612 @opindex mabi
24613 Extend the current ABI with a particular extension, or remove such extension.
24614 Valid values are @samp{altivec}, @samp{no-altivec},
24615 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24616 @samp{elfv1}, @samp{elfv2}@.
24617
24618 @item -mabi=ibmlongdouble
24619 @opindex mabi=ibmlongdouble
24620 Change the current ABI to use IBM extended-precision long double.
24621 This is not likely to work if your system defaults to using IEEE
24622 extended-precision long double. If you change the long double type
24623 from IEEE extended-precision, the compiler will issue a warning unless
24624 you use the @option{-Wno-psabi} option.
24625
24626 @item -mabi=ieeelongdouble
24627 @opindex mabi=ieeelongdouble
24628 Change the current ABI to use IEEE extended-precision long double.
24629 This is not likely to work if your system defaults to using IBM
24630 extended-precision long double. If you change the long double type
24631 from IBM extended-precision, the compiler will issue a warning unless
24632 you use the @option{-Wno-psabi} option.
24633
24634 @item -mabi=elfv1
24635 @opindex mabi=elfv1
24636 Change the current ABI to use the ELFv1 ABI.
24637 This is the default ABI for big-endian PowerPC 64-bit Linux.
24638 Overriding the default ABI requires special system support and is
24639 likely to fail in spectacular ways.
24640
24641 @item -mabi=elfv2
24642 @opindex mabi=elfv2
24643 Change the current ABI to use the ELFv2 ABI.
24644 This is the default ABI for little-endian PowerPC 64-bit Linux.
24645 Overriding the default ABI requires special system support and is
24646 likely to fail in spectacular ways.
24647
24648 @item -mgnu-attribute
24649 @itemx -mno-gnu-attribute
24650 @opindex mgnu-attribute
24651 @opindex mno-gnu-attribute
24652 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24653 .gnu.attributes section that specify ABI variations in function
24654 parameters or return values.
24655
24656 @item -mprototype
24657 @itemx -mno-prototype
24658 @opindex mprototype
24659 @opindex mno-prototype
24660 On System V.4 and embedded PowerPC systems assume that all calls to
24661 variable argument functions are properly prototyped. Otherwise, the
24662 compiler must insert an instruction before every non-prototyped call to
24663 set or clear bit 6 of the condition code register (@code{CR}) to
24664 indicate whether floating-point values are passed in the floating-point
24665 registers in case the function takes variable arguments. With
24666 @option{-mprototype}, only calls to prototyped variable argument functions
24667 set or clear the bit.
24668
24669 @item -msim
24670 @opindex msim
24671 On embedded PowerPC systems, assume that the startup module is called
24672 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24673 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24674 configurations.
24675
24676 @item -mmvme
24677 @opindex mmvme
24678 On embedded PowerPC systems, assume that the startup module is called
24679 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24680 @file{libc.a}.
24681
24682 @item -mads
24683 @opindex mads
24684 On embedded PowerPC systems, assume that the startup module is called
24685 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24686 @file{libc.a}.
24687
24688 @item -myellowknife
24689 @opindex myellowknife
24690 On embedded PowerPC systems, assume that the startup module is called
24691 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24692 @file{libc.a}.
24693
24694 @item -mvxworks
24695 @opindex mvxworks
24696 On System V.4 and embedded PowerPC systems, specify that you are
24697 compiling for a VxWorks system.
24698
24699 @item -memb
24700 @opindex memb
24701 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24702 header to indicate that @samp{eabi} extended relocations are used.
24703
24704 @item -meabi
24705 @itemx -mno-eabi
24706 @opindex meabi
24707 @opindex mno-eabi
24708 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24709 Embedded Applications Binary Interface (EABI), which is a set of
24710 modifications to the System V.4 specifications. Selecting @option{-meabi}
24711 means that the stack is aligned to an 8-byte boundary, a function
24712 @code{__eabi} is called from @code{main} to set up the EABI
24713 environment, and the @option{-msdata} option can use both @code{r2} and
24714 @code{r13} to point to two separate small data areas. Selecting
24715 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24716 no EABI initialization function is called from @code{main}, and the
24717 @option{-msdata} option only uses @code{r13} to point to a single
24718 small data area. The @option{-meabi} option is on by default if you
24719 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24720
24721 @item -msdata=eabi
24722 @opindex msdata=eabi
24723 On System V.4 and embedded PowerPC systems, put small initialized
24724 @code{const} global and static data in the @code{.sdata2} section, which
24725 is pointed to by register @code{r2}. Put small initialized
24726 non-@code{const} global and static data in the @code{.sdata} section,
24727 which is pointed to by register @code{r13}. Put small uninitialized
24728 global and static data in the @code{.sbss} section, which is adjacent to
24729 the @code{.sdata} section. The @option{-msdata=eabi} option is
24730 incompatible with the @option{-mrelocatable} option. The
24731 @option{-msdata=eabi} option also sets the @option{-memb} option.
24732
24733 @item -msdata=sysv
24734 @opindex msdata=sysv
24735 On System V.4 and embedded PowerPC systems, put small global and static
24736 data in the @code{.sdata} section, which is pointed to by register
24737 @code{r13}. Put small uninitialized global and static data in the
24738 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24739 The @option{-msdata=sysv} option is incompatible with the
24740 @option{-mrelocatable} option.
24741
24742 @item -msdata=default
24743 @itemx -msdata
24744 @opindex msdata=default
24745 @opindex msdata
24746 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24747 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24748 same as @option{-msdata=sysv}.
24749
24750 @item -msdata=data
24751 @opindex msdata=data
24752 On System V.4 and embedded PowerPC systems, put small global
24753 data in the @code{.sdata} section. Put small uninitialized global
24754 data in the @code{.sbss} section. Do not use register @code{r13}
24755 to address small data however. This is the default behavior unless
24756 other @option{-msdata} options are used.
24757
24758 @item -msdata=none
24759 @itemx -mno-sdata
24760 @opindex msdata=none
24761 @opindex mno-sdata
24762 On embedded PowerPC systems, put all initialized global and static data
24763 in the @code{.data} section, and all uninitialized data in the
24764 @code{.bss} section.
24765
24766 @item -mreadonly-in-sdata
24767 @opindex mreadonly-in-sdata
24768 @opindex mno-readonly-in-sdata
24769 Put read-only objects in the @code{.sdata} section as well. This is the
24770 default.
24771
24772 @item -mblock-move-inline-limit=@var{num}
24773 @opindex mblock-move-inline-limit
24774 Inline all block moves (such as calls to @code{memcpy} or structure
24775 copies) less than or equal to @var{num} bytes. The minimum value for
24776 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24777 targets. The default value is target-specific.
24778
24779 @item -mblock-compare-inline-limit=@var{num}
24780 @opindex mblock-compare-inline-limit
24781 Generate non-looping inline code for all block compares (such as calls
24782 to @code{memcmp} or structure compares) less than or equal to @var{num}
24783 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24784 block compare is disabled. The default value is target-specific.
24785
24786 @item -mblock-compare-inline-loop-limit=@var{num}
24787 @opindex mblock-compare-inline-loop-limit
24788 Generate an inline expansion using loop code for all block compares that
24789 are less than or equal to @var{num} bytes, but greater than the limit
24790 for non-loop inline block compare expansion. If the block length is not
24791 constant, at most @var{num} bytes will be compared before @code{memcmp}
24792 is called to compare the remainder of the block. The default value is
24793 target-specific.
24794
24795 @item -mstring-compare-inline-limit=@var{num}
24796 @opindex mstring-compare-inline-limit
24797 Compare at most @var{num} string bytes with inline code.
24798 If the difference or end of string is not found at the
24799 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24800 take care of the rest of the comparison. The default is 64 bytes.
24801
24802 @item -G @var{num}
24803 @opindex G
24804 @cindex smaller data references (PowerPC)
24805 @cindex .sdata/.sdata2 references (PowerPC)
24806 On embedded PowerPC systems, put global and static items less than or
24807 equal to @var{num} bytes into the small data or BSS sections instead of
24808 the normal data or BSS section. By default, @var{num} is 8. The
24809 @option{-G @var{num}} switch is also passed to the linker.
24810 All modules should be compiled with the same @option{-G @var{num}} value.
24811
24812 @item -mregnames
24813 @itemx -mno-regnames
24814 @opindex mregnames
24815 @opindex mno-regnames
24816 On System V.4 and embedded PowerPC systems do (do not) emit register
24817 names in the assembly language output using symbolic forms.
24818
24819 @item -mlongcall
24820 @itemx -mno-longcall
24821 @opindex mlongcall
24822 @opindex mno-longcall
24823 By default assume that all calls are far away so that a longer and more
24824 expensive calling sequence is required. This is required for calls
24825 farther than 32 megabytes (33,554,432 bytes) from the current location.
24826 A short call is generated if the compiler knows
24827 the call cannot be that far away. This setting can be overridden by
24828 the @code{shortcall} function attribute, or by @code{#pragma
24829 longcall(0)}.
24830
24831 Some linkers are capable of detecting out-of-range calls and generating
24832 glue code on the fly. On these systems, long calls are unnecessary and
24833 generate slower code. As of this writing, the AIX linker can do this,
24834 as can the GNU linker for PowerPC/64. It is planned to add this feature
24835 to the GNU linker for 32-bit PowerPC systems as well.
24836
24837 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24838 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24839 addresses represent the callee and the branch island. The
24840 Darwin/PPC linker prefers the first address and generates a @code{bl
24841 callee} if the PPC @code{bl} instruction reaches the callee directly;
24842 otherwise, the linker generates @code{bl L42} to call the branch
24843 island. The branch island is appended to the body of the
24844 calling function; it computes the full 32-bit address of the callee
24845 and jumps to it.
24846
24847 On Mach-O (Darwin) systems, this option directs the compiler emit to
24848 the glue for every direct call, and the Darwin linker decides whether
24849 to use or discard it.
24850
24851 In the future, GCC may ignore all longcall specifications
24852 when the linker is known to generate glue.
24853
24854 @item -mtls-markers
24855 @itemx -mno-tls-markers
24856 @opindex mtls-markers
24857 @opindex mno-tls-markers
24858 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24859 specifying the function argument. The relocation allows the linker to
24860 reliably associate function call with argument setup instructions for
24861 TLS optimization, which in turn allows GCC to better schedule the
24862 sequence.
24863
24864 @item -mrecip
24865 @itemx -mno-recip
24866 @opindex mrecip
24867 This option enables use of the reciprocal estimate and
24868 reciprocal square root estimate instructions with additional
24869 Newton-Raphson steps to increase precision instead of doing a divide or
24870 square root and divide for floating-point arguments. You should use
24871 the @option{-ffast-math} option when using @option{-mrecip} (or at
24872 least @option{-funsafe-math-optimizations},
24873 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24874 @option{-fno-trapping-math}). Note that while the throughput of the
24875 sequence is generally higher than the throughput of the non-reciprocal
24876 instruction, the precision of the sequence can be decreased by up to 2
24877 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24878 roots.
24879
24880 @item -mrecip=@var{opt}
24881 @opindex mrecip=opt
24882 This option controls which reciprocal estimate instructions
24883 may be used. @var{opt} is a comma-separated list of options, which may
24884 be preceded by a @code{!} to invert the option:
24885
24886 @table @samp
24887
24888 @item all
24889 Enable all estimate instructions.
24890
24891 @item default
24892 Enable the default instructions, equivalent to @option{-mrecip}.
24893
24894 @item none
24895 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24896
24897 @item div
24898 Enable the reciprocal approximation instructions for both
24899 single and double precision.
24900
24901 @item divf
24902 Enable the single-precision reciprocal approximation instructions.
24903
24904 @item divd
24905 Enable the double-precision reciprocal approximation instructions.
24906
24907 @item rsqrt
24908 Enable the reciprocal square root approximation instructions for both
24909 single and double precision.
24910
24911 @item rsqrtf
24912 Enable the single-precision reciprocal square root approximation instructions.
24913
24914 @item rsqrtd
24915 Enable the double-precision reciprocal square root approximation instructions.
24916
24917 @end table
24918
24919 So, for example, @option{-mrecip=all,!rsqrtd} enables
24920 all of the reciprocal estimate instructions, except for the
24921 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24922 which handle the double-precision reciprocal square root calculations.
24923
24924 @item -mrecip-precision
24925 @itemx -mno-recip-precision
24926 @opindex mrecip-precision
24927 Assume (do not assume) that the reciprocal estimate instructions
24928 provide higher-precision estimates than is mandated by the PowerPC
24929 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24930 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24931 The double-precision square root estimate instructions are not generated by
24932 default on low-precision machines, since they do not provide an
24933 estimate that converges after three steps.
24934
24935 @item -mveclibabi=@var{type}
24936 @opindex mveclibabi
24937 Specifies the ABI type to use for vectorizing intrinsics using an
24938 external library. The only type supported at present is @samp{mass},
24939 which specifies to use IBM's Mathematical Acceleration Subsystem
24940 (MASS) libraries for vectorizing intrinsics using external libraries.
24941 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24942 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24943 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24944 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24945 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24946 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24947 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24948 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24949 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24950 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24951 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24952 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24953 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24954 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24955 for power7. Both @option{-ftree-vectorize} and
24956 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24957 libraries must be specified at link time.
24958
24959 @item -mfriz
24960 @itemx -mno-friz
24961 @opindex mfriz
24962 Generate (do not generate) the @code{friz} instruction when the
24963 @option{-funsafe-math-optimizations} option is used to optimize
24964 rounding of floating-point values to 64-bit integer and back to floating
24965 point. The @code{friz} instruction does not return the same value if
24966 the floating-point number is too large to fit in an integer.
24967
24968 @item -mpointers-to-nested-functions
24969 @itemx -mno-pointers-to-nested-functions
24970 @opindex mpointers-to-nested-functions
24971 Generate (do not generate) code to load up the static chain register
24972 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24973 systems where a function pointer points to a 3-word descriptor giving
24974 the function address, TOC value to be loaded in register @code{r2}, and
24975 static chain value to be loaded in register @code{r11}. The
24976 @option{-mpointers-to-nested-functions} is on by default. You cannot
24977 call through pointers to nested functions or pointers
24978 to functions compiled in other languages that use the static chain if
24979 you use @option{-mno-pointers-to-nested-functions}.
24980
24981 @item -msave-toc-indirect
24982 @itemx -mno-save-toc-indirect
24983 @opindex msave-toc-indirect
24984 Generate (do not generate) code to save the TOC value in the reserved
24985 stack location in the function prologue if the function calls through
24986 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24987 saved in the prologue, it is saved just before the call through the
24988 pointer. The @option{-mno-save-toc-indirect} option is the default.
24989
24990 @item -mcompat-align-parm
24991 @itemx -mno-compat-align-parm
24992 @opindex mcompat-align-parm
24993 Generate (do not generate) code to pass structure parameters with a
24994 maximum alignment of 64 bits, for compatibility with older versions
24995 of GCC.
24996
24997 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24998 structure parameter on a 128-bit boundary when that structure contained
24999 a member requiring 128-bit alignment. This is corrected in more
25000 recent versions of GCC. This option may be used to generate code
25001 that is compatible with functions compiled with older versions of
25002 GCC.
25003
25004 The @option{-mno-compat-align-parm} option is the default.
25005
25006 @item -mstack-protector-guard=@var{guard}
25007 @itemx -mstack-protector-guard-reg=@var{reg}
25008 @itemx -mstack-protector-guard-offset=@var{offset}
25009 @itemx -mstack-protector-guard-symbol=@var{symbol}
25010 @opindex mstack-protector-guard
25011 @opindex mstack-protector-guard-reg
25012 @opindex mstack-protector-guard-offset
25013 @opindex mstack-protector-guard-symbol
25014 Generate stack protection code using canary at @var{guard}. Supported
25015 locations are @samp{global} for global canary or @samp{tls} for per-thread
25016 canary in the TLS block (the default with GNU libc version 2.4 or later).
25017
25018 With the latter choice the options
25019 @option{-mstack-protector-guard-reg=@var{reg}} and
25020 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25021 which register to use as base register for reading the canary, and from what
25022 offset from that base register. The default for those is as specified in the
25023 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25024 the offset with a symbol reference to a canary in the TLS block.
25025 @end table
25026
25027 @node RX Options
25028 @subsection RX Options
25029 @cindex RX Options
25030
25031 These command-line options are defined for RX targets:
25032
25033 @table @gcctabopt
25034 @item -m64bit-doubles
25035 @itemx -m32bit-doubles
25036 @opindex m64bit-doubles
25037 @opindex m32bit-doubles
25038 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25039 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25040 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25041 works on 32-bit values, which is why the default is
25042 @option{-m32bit-doubles}.
25043
25044 @item -fpu
25045 @itemx -nofpu
25046 @opindex fpu
25047 @opindex nofpu
25048 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25049 floating-point hardware. The default is enabled for the RX600
25050 series and disabled for the RX200 series.
25051
25052 Floating-point instructions are only generated for 32-bit floating-point
25053 values, however, so the FPU hardware is not used for doubles if the
25054 @option{-m64bit-doubles} option is used.
25055
25056 @emph{Note} If the @option{-fpu} option is enabled then
25057 @option{-funsafe-math-optimizations} is also enabled automatically.
25058 This is because the RX FPU instructions are themselves unsafe.
25059
25060 @item -mcpu=@var{name}
25061 @opindex mcpu
25062 Selects the type of RX CPU to be targeted. Currently three types are
25063 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25064 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25065
25066 The only difference between @samp{RX600} and @samp{RX610} is that the
25067 @samp{RX610} does not support the @code{MVTIPL} instruction.
25068
25069 The @samp{RX200} series does not have a hardware floating-point unit
25070 and so @option{-nofpu} is enabled by default when this type is
25071 selected.
25072
25073 @item -mbig-endian-data
25074 @itemx -mlittle-endian-data
25075 @opindex mbig-endian-data
25076 @opindex mlittle-endian-data
25077 Store data (but not code) in the big-endian format. The default is
25078 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25079 format.
25080
25081 @item -msmall-data-limit=@var{N}
25082 @opindex msmall-data-limit
25083 Specifies the maximum size in bytes of global and static variables
25084 which can be placed into the small data area. Using the small data
25085 area can lead to smaller and faster code, but the size of area is
25086 limited and it is up to the programmer to ensure that the area does
25087 not overflow. Also when the small data area is used one of the RX's
25088 registers (usually @code{r13}) is reserved for use pointing to this
25089 area, so it is no longer available for use by the compiler. This
25090 could result in slower and/or larger code if variables are pushed onto
25091 the stack instead of being held in this register.
25092
25093 Note, common variables (variables that have not been initialized) and
25094 constants are not placed into the small data area as they are assigned
25095 to other sections in the output executable.
25096
25097 The default value is zero, which disables this feature. Note, this
25098 feature is not enabled by default with higher optimization levels
25099 (@option{-O2} etc) because of the potentially detrimental effects of
25100 reserving a register. It is up to the programmer to experiment and
25101 discover whether this feature is of benefit to their program. See the
25102 description of the @option{-mpid} option for a description of how the
25103 actual register to hold the small data area pointer is chosen.
25104
25105 @item -msim
25106 @itemx -mno-sim
25107 @opindex msim
25108 @opindex mno-sim
25109 Use the simulator runtime. The default is to use the libgloss
25110 board-specific runtime.
25111
25112 @item -mas100-syntax
25113 @itemx -mno-as100-syntax
25114 @opindex mas100-syntax
25115 @opindex mno-as100-syntax
25116 When generating assembler output use a syntax that is compatible with
25117 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25118 assembler, but it has some restrictions so it is not generated by default.
25119
25120 @item -mmax-constant-size=@var{N}
25121 @opindex mmax-constant-size
25122 Specifies the maximum size, in bytes, of a constant that can be used as
25123 an operand in a RX instruction. Although the RX instruction set does
25124 allow constants of up to 4 bytes in length to be used in instructions,
25125 a longer value equates to a longer instruction. Thus in some
25126 circumstances it can be beneficial to restrict the size of constants
25127 that are used in instructions. Constants that are too big are instead
25128 placed into a constant pool and referenced via register indirection.
25129
25130 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25131 or 4 means that constants of any size are allowed.
25132
25133 @item -mrelax
25134 @opindex mrelax
25135 Enable linker relaxation. Linker relaxation is a process whereby the
25136 linker attempts to reduce the size of a program by finding shorter
25137 versions of various instructions. Disabled by default.
25138
25139 @item -mint-register=@var{N}
25140 @opindex mint-register
25141 Specify the number of registers to reserve for fast interrupt handler
25142 functions. The value @var{N} can be between 0 and 4. A value of 1
25143 means that register @code{r13} is reserved for the exclusive use
25144 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25145 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25146 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25147 A value of 0, the default, does not reserve any registers.
25148
25149 @item -msave-acc-in-interrupts
25150 @opindex msave-acc-in-interrupts
25151 Specifies that interrupt handler functions should preserve the
25152 accumulator register. This is only necessary if normal code might use
25153 the accumulator register, for example because it performs 64-bit
25154 multiplications. The default is to ignore the accumulator as this
25155 makes the interrupt handlers faster.
25156
25157 @item -mpid
25158 @itemx -mno-pid
25159 @opindex mpid
25160 @opindex mno-pid
25161 Enables the generation of position independent data. When enabled any
25162 access to constant data is done via an offset from a base address
25163 held in a register. This allows the location of constant data to be
25164 determined at run time without requiring the executable to be
25165 relocated, which is a benefit to embedded applications with tight
25166 memory constraints. Data that can be modified is not affected by this
25167 option.
25168
25169 Note, using this feature reserves a register, usually @code{r13}, for
25170 the constant data base address. This can result in slower and/or
25171 larger code, especially in complicated functions.
25172
25173 The actual register chosen to hold the constant data base address
25174 depends upon whether the @option{-msmall-data-limit} and/or the
25175 @option{-mint-register} command-line options are enabled. Starting
25176 with register @code{r13} and proceeding downwards, registers are
25177 allocated first to satisfy the requirements of @option{-mint-register},
25178 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25179 is possible for the small data area register to be @code{r8} if both
25180 @option{-mint-register=4} and @option{-mpid} are specified on the
25181 command line.
25182
25183 By default this feature is not enabled. The default can be restored
25184 via the @option{-mno-pid} command-line option.
25185
25186 @item -mno-warn-multiple-fast-interrupts
25187 @itemx -mwarn-multiple-fast-interrupts
25188 @opindex mno-warn-multiple-fast-interrupts
25189 @opindex mwarn-multiple-fast-interrupts
25190 Prevents GCC from issuing a warning message if it finds more than one
25191 fast interrupt handler when it is compiling a file. The default is to
25192 issue a warning for each extra fast interrupt handler found, as the RX
25193 only supports one such interrupt.
25194
25195 @item -mallow-string-insns
25196 @itemx -mno-allow-string-insns
25197 @opindex mallow-string-insns
25198 @opindex mno-allow-string-insns
25199 Enables or disables the use of the string manipulation instructions
25200 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25201 @code{SWHILE} and also the @code{RMPA} instruction. These
25202 instructions may prefetch data, which is not safe to do if accessing
25203 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25204 for more information).
25205
25206 The default is to allow these instructions, but it is not possible for
25207 GCC to reliably detect all circumstances where a string instruction
25208 might be used to access an I/O register, so their use cannot be
25209 disabled automatically. Instead it is reliant upon the programmer to
25210 use the @option{-mno-allow-string-insns} option if their program
25211 accesses I/O space.
25212
25213 When the instructions are enabled GCC defines the C preprocessor
25214 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25215 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25216
25217 @item -mjsr
25218 @itemx -mno-jsr
25219 @opindex mjsr
25220 @opindex mno-jsr
25221 Use only (or not only) @code{JSR} instructions to access functions.
25222 This option can be used when code size exceeds the range of @code{BSR}
25223 instructions. Note that @option{-mno-jsr} does not mean to not use
25224 @code{JSR} but instead means that any type of branch may be used.
25225 @end table
25226
25227 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25228 has special significance to the RX port when used with the
25229 @code{interrupt} function attribute. This attribute indicates a
25230 function intended to process fast interrupts. GCC ensures
25231 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25232 and/or @code{r13} and only provided that the normal use of the
25233 corresponding registers have been restricted via the
25234 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25235 options.
25236
25237 @node S/390 and zSeries Options
25238 @subsection S/390 and zSeries Options
25239 @cindex S/390 and zSeries Options
25240
25241 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25242
25243 @table @gcctabopt
25244 @item -mhard-float
25245 @itemx -msoft-float
25246 @opindex mhard-float
25247 @opindex msoft-float
25248 Use (do not use) the hardware floating-point instructions and registers
25249 for floating-point operations. When @option{-msoft-float} is specified,
25250 functions in @file{libgcc.a} are used to perform floating-point
25251 operations. When @option{-mhard-float} is specified, the compiler
25252 generates IEEE floating-point instructions. This is the default.
25253
25254 @item -mhard-dfp
25255 @itemx -mno-hard-dfp
25256 @opindex mhard-dfp
25257 @opindex mno-hard-dfp
25258 Use (do not use) the hardware decimal-floating-point instructions for
25259 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25260 specified, functions in @file{libgcc.a} are used to perform
25261 decimal-floating-point operations. When @option{-mhard-dfp} is
25262 specified, the compiler generates decimal-floating-point hardware
25263 instructions. This is the default for @option{-march=z9-ec} or higher.
25264
25265 @item -mlong-double-64
25266 @itemx -mlong-double-128
25267 @opindex mlong-double-64
25268 @opindex mlong-double-128
25269 These switches control the size of @code{long double} type. A size
25270 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25271 type. This is the default.
25272
25273 @item -mbackchain
25274 @itemx -mno-backchain
25275 @opindex mbackchain
25276 @opindex mno-backchain
25277 Store (do not store) the address of the caller's frame as backchain pointer
25278 into the callee's stack frame.
25279 A backchain may be needed to allow debugging using tools that do not understand
25280 DWARF call frame information.
25281 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25282 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25283 the backchain is placed into the topmost word of the 96/160 byte register
25284 save area.
25285
25286 In general, code compiled with @option{-mbackchain} is call-compatible with
25287 code compiled with @option{-mmo-backchain}; however, use of the backchain
25288 for debugging purposes usually requires that the whole binary is built with
25289 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25290 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25291 to build a linux kernel use @option{-msoft-float}.
25292
25293 The default is to not maintain the backchain.
25294
25295 @item -mpacked-stack
25296 @itemx -mno-packed-stack
25297 @opindex mpacked-stack
25298 @opindex mno-packed-stack
25299 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25300 specified, the compiler uses the all fields of the 96/160 byte register save
25301 area only for their default purpose; unused fields still take up stack space.
25302 When @option{-mpacked-stack} is specified, register save slots are densely
25303 packed at the top of the register save area; unused space is reused for other
25304 purposes, allowing for more efficient use of the available stack space.
25305 However, when @option{-mbackchain} is also in effect, the topmost word of
25306 the save area is always used to store the backchain, and the return address
25307 register is always saved two words below the backchain.
25308
25309 As long as the stack frame backchain is not used, code generated with
25310 @option{-mpacked-stack} is call-compatible with code generated with
25311 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25312 S/390 or zSeries generated code that uses the stack frame backchain at run
25313 time, not just for debugging purposes. Such code is not call-compatible
25314 with code compiled with @option{-mpacked-stack}. Also, note that the
25315 combination of @option{-mbackchain},
25316 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25317 to build a linux kernel use @option{-msoft-float}.
25318
25319 The default is to not use the packed stack layout.
25320
25321 @item -msmall-exec
25322 @itemx -mno-small-exec
25323 @opindex msmall-exec
25324 @opindex mno-small-exec
25325 Generate (or do not generate) code using the @code{bras} instruction
25326 to do subroutine calls.
25327 This only works reliably if the total executable size does not
25328 exceed 64k. The default is to use the @code{basr} instruction instead,
25329 which does not have this limitation.
25330
25331 @item -m64
25332 @itemx -m31
25333 @opindex m64
25334 @opindex m31
25335 When @option{-m31} is specified, generate code compliant to the
25336 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25337 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25338 particular to generate 64-bit instructions. For the @samp{s390}
25339 targets, the default is @option{-m31}, while the @samp{s390x}
25340 targets default to @option{-m64}.
25341
25342 @item -mzarch
25343 @itemx -mesa
25344 @opindex mzarch
25345 @opindex mesa
25346 When @option{-mzarch} is specified, generate code using the
25347 instructions available on z/Architecture.
25348 When @option{-mesa} is specified, generate code using the
25349 instructions available on ESA/390. Note that @option{-mesa} is
25350 not possible with @option{-m64}.
25351 When generating code compliant to the GNU/Linux for S/390 ABI,
25352 the default is @option{-mesa}. When generating code compliant
25353 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25354
25355 @item -mhtm
25356 @itemx -mno-htm
25357 @opindex mhtm
25358 @opindex mno-htm
25359 The @option{-mhtm} option enables a set of builtins making use of
25360 instructions available with the transactional execution facility
25361 introduced with the IBM zEnterprise EC12 machine generation
25362 @ref{S/390 System z Built-in Functions}.
25363 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25364
25365 @item -mvx
25366 @itemx -mno-vx
25367 @opindex mvx
25368 @opindex mno-vx
25369 When @option{-mvx} is specified, generate code using the instructions
25370 available with the vector extension facility introduced with the IBM
25371 z13 machine generation.
25372 This option changes the ABI for some vector type values with regard to
25373 alignment and calling conventions. In case vector type values are
25374 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25375 command will be added to mark the resulting binary with the ABI used.
25376 @option{-mvx} is enabled by default when using @option{-march=z13}.
25377
25378 @item -mzvector
25379 @itemx -mno-zvector
25380 @opindex mzvector
25381 @opindex mno-zvector
25382 The @option{-mzvector} option enables vector language extensions and
25383 builtins using instructions available with the vector extension
25384 facility introduced with the IBM z13 machine generation.
25385 This option adds support for @samp{vector} to be used as a keyword to
25386 define vector type variables and arguments. @samp{vector} is only
25387 available when GNU extensions are enabled. It will not be expanded
25388 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25389 In addition to the GCC low-level builtins @option{-mzvector} enables
25390 a set of builtins added for compatibility with AltiVec-style
25391 implementations like Power and Cell. In order to make use of these
25392 builtins the header file @file{vecintrin.h} needs to be included.
25393 @option{-mzvector} is disabled by default.
25394
25395 @item -mmvcle
25396 @itemx -mno-mvcle
25397 @opindex mmvcle
25398 @opindex mno-mvcle
25399 Generate (or do not generate) code using the @code{mvcle} instruction
25400 to perform block moves. When @option{-mno-mvcle} is specified,
25401 use a @code{mvc} loop instead. This is the default unless optimizing for
25402 size.
25403
25404 @item -mdebug
25405 @itemx -mno-debug
25406 @opindex mdebug
25407 @opindex mno-debug
25408 Print (or do not print) additional debug information when compiling.
25409 The default is to not print debug information.
25410
25411 @item -march=@var{cpu-type}
25412 @opindex march
25413 Generate code that runs on @var{cpu-type}, which is the name of a
25414 system representing a certain processor type. Possible values for
25415 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25416 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25417 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
25418 @samp{native}.
25419
25420 The default is @option{-march=z900}.
25421
25422 Specifying @samp{native} as cpu type can be used to select the best
25423 architecture option for the host processor.
25424 @option{-march=native} has no effect if GCC does not recognize the
25425 processor.
25426
25427 @item -mtune=@var{cpu-type}
25428 @opindex mtune
25429 Tune to @var{cpu-type} everything applicable about the generated code,
25430 except for the ABI and the set of available instructions.
25431 The list of @var{cpu-type} values is the same as for @option{-march}.
25432 The default is the value used for @option{-march}.
25433
25434 @item -mtpf-trace
25435 @itemx -mno-tpf-trace
25436 @opindex mtpf-trace
25437 @opindex mno-tpf-trace
25438 Generate code that adds (does not add) in TPF OS specific branches to trace
25439 routines in the operating system. This option is off by default, even
25440 when compiling for the TPF OS@.
25441
25442 @item -mfused-madd
25443 @itemx -mno-fused-madd
25444 @opindex mfused-madd
25445 @opindex mno-fused-madd
25446 Generate code that uses (does not use) the floating-point multiply and
25447 accumulate instructions. These instructions are generated by default if
25448 hardware floating point is used.
25449
25450 @item -mwarn-framesize=@var{framesize}
25451 @opindex mwarn-framesize
25452 Emit a warning if the current function exceeds the given frame size. Because
25453 this is a compile-time check it doesn't need to be a real problem when the program
25454 runs. It is intended to identify functions that most probably cause
25455 a stack overflow. It is useful to be used in an environment with limited stack
25456 size e.g.@: the linux kernel.
25457
25458 @item -mwarn-dynamicstack
25459 @opindex mwarn-dynamicstack
25460 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25461 arrays. This is generally a bad idea with a limited stack size.
25462
25463 @item -mstack-guard=@var{stack-guard}
25464 @itemx -mstack-size=@var{stack-size}
25465 @opindex mstack-guard
25466 @opindex mstack-size
25467 If these options are provided the S/390 back end emits additional instructions in
25468 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25469 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25470 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25471 the frame size of the compiled function is chosen.
25472 These options are intended to be used to help debugging stack overflow problems.
25473 The additionally emitted code causes only little overhead and hence can also be
25474 used in production-like systems without greater performance degradation. The given
25475 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25476 @var{stack-guard} without exceeding 64k.
25477 In order to be efficient the extra code makes the assumption that the stack starts
25478 at an address aligned to the value given by @var{stack-size}.
25479 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25480
25481 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25482 @opindex mhotpatch
25483 If the hotpatch option is enabled, a ``hot-patching'' function
25484 prologue is generated for all functions in the compilation unit.
25485 The funtion label is prepended with the given number of two-byte
25486 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25487 the label, 2 * @var{post-halfwords} bytes are appended, using the
25488 largest NOP like instructions the architecture allows (maximum
25489 1000000).
25490
25491 If both arguments are zero, hotpatching is disabled.
25492
25493 This option can be overridden for individual functions with the
25494 @code{hotpatch} attribute.
25495 @end table
25496
25497 @node Score Options
25498 @subsection Score Options
25499 @cindex Score Options
25500
25501 These options are defined for Score implementations:
25502
25503 @table @gcctabopt
25504 @item -meb
25505 @opindex meb
25506 Compile code for big-endian mode. This is the default.
25507
25508 @item -mel
25509 @opindex mel
25510 Compile code for little-endian mode.
25511
25512 @item -mnhwloop
25513 @opindex mnhwloop
25514 Disable generation of @code{bcnz} instructions.
25515
25516 @item -muls
25517 @opindex muls
25518 Enable generation of unaligned load and store instructions.
25519
25520 @item -mmac
25521 @opindex mmac
25522 Enable the use of multiply-accumulate instructions. Disabled by default.
25523
25524 @item -mscore5
25525 @opindex mscore5
25526 Specify the SCORE5 as the target architecture.
25527
25528 @item -mscore5u
25529 @opindex mscore5u
25530 Specify the SCORE5U of the target architecture.
25531
25532 @item -mscore7
25533 @opindex mscore7
25534 Specify the SCORE7 as the target architecture. This is the default.
25535
25536 @item -mscore7d
25537 @opindex mscore7d
25538 Specify the SCORE7D as the target architecture.
25539 @end table
25540
25541 @node SH Options
25542 @subsection SH Options
25543
25544 These @samp{-m} options are defined for the SH implementations:
25545
25546 @table @gcctabopt
25547 @item -m1
25548 @opindex m1
25549 Generate code for the SH1.
25550
25551 @item -m2
25552 @opindex m2
25553 Generate code for the SH2.
25554
25555 @item -m2e
25556 Generate code for the SH2e.
25557
25558 @item -m2a-nofpu
25559 @opindex m2a-nofpu
25560 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25561 that the floating-point unit is not used.
25562
25563 @item -m2a-single-only
25564 @opindex m2a-single-only
25565 Generate code for the SH2a-FPU, in such a way that no double-precision
25566 floating-point operations are used.
25567
25568 @item -m2a-single
25569 @opindex m2a-single
25570 Generate code for the SH2a-FPU assuming the floating-point unit is in
25571 single-precision mode by default.
25572
25573 @item -m2a
25574 @opindex m2a
25575 Generate code for the SH2a-FPU assuming the floating-point unit is in
25576 double-precision mode by default.
25577
25578 @item -m3
25579 @opindex m3
25580 Generate code for the SH3.
25581
25582 @item -m3e
25583 @opindex m3e
25584 Generate code for the SH3e.
25585
25586 @item -m4-nofpu
25587 @opindex m4-nofpu
25588 Generate code for the SH4 without a floating-point unit.
25589
25590 @item -m4-single-only
25591 @opindex m4-single-only
25592 Generate code for the SH4 with a floating-point unit that only
25593 supports single-precision arithmetic.
25594
25595 @item -m4-single
25596 @opindex m4-single
25597 Generate code for the SH4 assuming the floating-point unit is in
25598 single-precision mode by default.
25599
25600 @item -m4
25601 @opindex m4
25602 Generate code for the SH4.
25603
25604 @item -m4-100
25605 @opindex m4-100
25606 Generate code for SH4-100.
25607
25608 @item -m4-100-nofpu
25609 @opindex m4-100-nofpu
25610 Generate code for SH4-100 in such a way that the
25611 floating-point unit is not used.
25612
25613 @item -m4-100-single
25614 @opindex m4-100-single
25615 Generate code for SH4-100 assuming the floating-point unit is in
25616 single-precision mode by default.
25617
25618 @item -m4-100-single-only
25619 @opindex m4-100-single-only
25620 Generate code for SH4-100 in such a way that no double-precision
25621 floating-point operations are used.
25622
25623 @item -m4-200
25624 @opindex m4-200
25625 Generate code for SH4-200.
25626
25627 @item -m4-200-nofpu
25628 @opindex m4-200-nofpu
25629 Generate code for SH4-200 without in such a way that the
25630 floating-point unit is not used.
25631
25632 @item -m4-200-single
25633 @opindex m4-200-single
25634 Generate code for SH4-200 assuming the floating-point unit is in
25635 single-precision mode by default.
25636
25637 @item -m4-200-single-only
25638 @opindex m4-200-single-only
25639 Generate code for SH4-200 in such a way that no double-precision
25640 floating-point operations are used.
25641
25642 @item -m4-300
25643 @opindex m4-300
25644 Generate code for SH4-300.
25645
25646 @item -m4-300-nofpu
25647 @opindex m4-300-nofpu
25648 Generate code for SH4-300 without in such a way that the
25649 floating-point unit is not used.
25650
25651 @item -m4-300-single
25652 @opindex m4-300-single
25653 Generate code for SH4-300 in such a way that no double-precision
25654 floating-point operations are used.
25655
25656 @item -m4-300-single-only
25657 @opindex m4-300-single-only
25658 Generate code for SH4-300 in such a way that no double-precision
25659 floating-point operations are used.
25660
25661 @item -m4-340
25662 @opindex m4-340
25663 Generate code for SH4-340 (no MMU, no FPU).
25664
25665 @item -m4-500
25666 @opindex m4-500
25667 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25668 assembler.
25669
25670 @item -m4a-nofpu
25671 @opindex m4a-nofpu
25672 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25673 floating-point unit is not used.
25674
25675 @item -m4a-single-only
25676 @opindex m4a-single-only
25677 Generate code for the SH4a, in such a way that no double-precision
25678 floating-point operations are used.
25679
25680 @item -m4a-single
25681 @opindex m4a-single
25682 Generate code for the SH4a assuming the floating-point unit is in
25683 single-precision mode by default.
25684
25685 @item -m4a
25686 @opindex m4a
25687 Generate code for the SH4a.
25688
25689 @item -m4al
25690 @opindex m4al
25691 Same as @option{-m4a-nofpu}, except that it implicitly passes
25692 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25693 instructions at the moment.
25694
25695 @item -mb
25696 @opindex mb
25697 Compile code for the processor in big-endian mode.
25698
25699 @item -ml
25700 @opindex ml
25701 Compile code for the processor in little-endian mode.
25702
25703 @item -mdalign
25704 @opindex mdalign
25705 Align doubles at 64-bit boundaries. Note that this changes the calling
25706 conventions, and thus some functions from the standard C library do
25707 not work unless you recompile it first with @option{-mdalign}.
25708
25709 @item -mrelax
25710 @opindex mrelax
25711 Shorten some address references at link time, when possible; uses the
25712 linker option @option{-relax}.
25713
25714 @item -mbigtable
25715 @opindex mbigtable
25716 Use 32-bit offsets in @code{switch} tables. The default is to use
25717 16-bit offsets.
25718
25719 @item -mbitops
25720 @opindex mbitops
25721 Enable the use of bit manipulation instructions on SH2A.
25722
25723 @item -mfmovd
25724 @opindex mfmovd
25725 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25726 alignment constraints.
25727
25728 @item -mrenesas
25729 @opindex mrenesas
25730 Comply with the calling conventions defined by Renesas.
25731
25732 @item -mno-renesas
25733 @opindex mno-renesas
25734 Comply with the calling conventions defined for GCC before the Renesas
25735 conventions were available. This option is the default for all
25736 targets of the SH toolchain.
25737
25738 @item -mnomacsave
25739 @opindex mnomacsave
25740 Mark the @code{MAC} register as call-clobbered, even if
25741 @option{-mrenesas} is given.
25742
25743 @item -mieee
25744 @itemx -mno-ieee
25745 @opindex mieee
25746 @opindex mno-ieee
25747 Control the IEEE compliance of floating-point comparisons, which affects the
25748 handling of cases where the result of a comparison is unordered. By default
25749 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25750 enabled @option{-mno-ieee} is implicitly set, which results in faster
25751 floating-point greater-equal and less-equal comparisons. The implicit settings
25752 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25753
25754 @item -minline-ic_invalidate
25755 @opindex minline-ic_invalidate
25756 Inline code to invalidate instruction cache entries after setting up
25757 nested function trampolines.
25758 This option has no effect if @option{-musermode} is in effect and the selected
25759 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
25760 instruction.
25761 If the selected code generation option does not allow the use of the @code{icbi}
25762 instruction, and @option{-musermode} is not in effect, the inlined code
25763 manipulates the instruction cache address array directly with an associative
25764 write. This not only requires privileged mode at run time, but it also
25765 fails if the cache line had been mapped via the TLB and has become unmapped.
25766
25767 @item -misize
25768 @opindex misize
25769 Dump instruction size and location in the assembly code.
25770
25771 @item -mpadstruct
25772 @opindex mpadstruct
25773 This option is deprecated. It pads structures to multiple of 4 bytes,
25774 which is incompatible with the SH ABI@.
25775
25776 @item -matomic-model=@var{model}
25777 @opindex matomic-model=@var{model}
25778 Sets the model of atomic operations and additional parameters as a comma
25779 separated list. For details on the atomic built-in functions see
25780 @ref{__atomic Builtins}. The following models and parameters are supported:
25781
25782 @table @samp
25783
25784 @item none
25785 Disable compiler generated atomic sequences and emit library calls for atomic
25786 operations. This is the default if the target is not @code{sh*-*-linux*}.
25787
25788 @item soft-gusa
25789 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25790 built-in functions. The generated atomic sequences require additional support
25791 from the interrupt/exception handling code of the system and are only suitable
25792 for SH3* and SH4* single-core systems. This option is enabled by default when
25793 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25794 this option also partially utilizes the hardware atomic instructions
25795 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25796 @samp{strict} is specified.
25797
25798 @item soft-tcb
25799 Generate software atomic sequences that use a variable in the thread control
25800 block. This is a variation of the gUSA sequences which can also be used on
25801 SH1* and SH2* targets. The generated atomic sequences require additional
25802 support from the interrupt/exception handling code of the system and are only
25803 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25804 parameter has to be specified as well.
25805
25806 @item soft-imask
25807 Generate software atomic sequences that temporarily disable interrupts by
25808 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25809 in privileged mode and is only suitable for single-core systems. Additional
25810 support from the interrupt/exception handling code of the system is not
25811 required. This model is enabled by default when the target is
25812 @code{sh*-*-linux*} and SH1* or SH2*.
25813
25814 @item hard-llcs
25815 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25816 instructions only. This is only available on SH4A and is suitable for
25817 multi-core systems. Since the hardware instructions support only 32 bit atomic
25818 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25819 Code compiled with this option is also compatible with other software
25820 atomic model interrupt/exception handling systems if executed on an SH4A
25821 system. Additional support from the interrupt/exception handling code of the
25822 system is not required for this model.
25823
25824 @item gbr-offset=
25825 This parameter specifies the offset in bytes of the variable in the thread
25826 control block structure that should be used by the generated atomic sequences
25827 when the @samp{soft-tcb} model has been selected. For other models this
25828 parameter is ignored. The specified value must be an integer multiple of four
25829 and in the range 0-1020.
25830
25831 @item strict
25832 This parameter prevents mixed usage of multiple atomic models, even if they
25833 are compatible, and makes the compiler generate atomic sequences of the
25834 specified model only.
25835
25836 @end table
25837
25838 @item -mtas
25839 @opindex mtas
25840 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25841 Notice that depending on the particular hardware and software configuration
25842 this can degrade overall performance due to the operand cache line flushes
25843 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25844 processors the @code{tas.b} instruction must be used with caution since it
25845 can result in data corruption for certain cache configurations.
25846
25847 @item -mprefergot
25848 @opindex mprefergot
25849 When generating position-independent code, emit function calls using
25850 the Global Offset Table instead of the Procedure Linkage Table.
25851
25852 @item -musermode
25853 @itemx -mno-usermode
25854 @opindex musermode
25855 @opindex mno-usermode
25856 Don't allow (allow) the compiler generating privileged mode code. Specifying
25857 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25858 inlined code would not work in user mode. @option{-musermode} is the default
25859 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25860 @option{-musermode} has no effect, since there is no user mode.
25861
25862 @item -multcost=@var{number}
25863 @opindex multcost=@var{number}
25864 Set the cost to assume for a multiply insn.
25865
25866 @item -mdiv=@var{strategy}
25867 @opindex mdiv=@var{strategy}
25868 Set the division strategy to be used for integer division operations.
25869 @var{strategy} can be one of:
25870
25871 @table @samp
25872
25873 @item call-div1
25874 Calls a library function that uses the single-step division instruction
25875 @code{div1} to perform the operation. Division by zero calculates an
25876 unspecified result and does not trap. This is the default except for SH4,
25877 SH2A and SHcompact.
25878
25879 @item call-fp
25880 Calls a library function that performs the operation in double precision
25881 floating point. Division by zero causes a floating-point exception. This is
25882 the default for SHcompact with FPU. Specifying this for targets that do not
25883 have a double precision FPU defaults to @code{call-div1}.
25884
25885 @item call-table
25886 Calls a library function that uses a lookup table for small divisors and
25887 the @code{div1} instruction with case distinction for larger divisors. Division
25888 by zero calculates an unspecified result and does not trap. This is the default
25889 for SH4. Specifying this for targets that do not have dynamic shift
25890 instructions defaults to @code{call-div1}.
25891
25892 @end table
25893
25894 When a division strategy has not been specified the default strategy is
25895 selected based on the current target. For SH2A the default strategy is to
25896 use the @code{divs} and @code{divu} instructions instead of library function
25897 calls.
25898
25899 @item -maccumulate-outgoing-args
25900 @opindex maccumulate-outgoing-args
25901 Reserve space once for outgoing arguments in the function prologue rather
25902 than around each call. Generally beneficial for performance and size. Also
25903 needed for unwinding to avoid changing the stack frame around conditional code.
25904
25905 @item -mdivsi3_libfunc=@var{name}
25906 @opindex mdivsi3_libfunc=@var{name}
25907 Set the name of the library function used for 32-bit signed division to
25908 @var{name}.
25909 This only affects the name used in the @samp{call} division strategies, and
25910 the compiler still expects the same sets of input/output/clobbered registers as
25911 if this option were not present.
25912
25913 @item -mfixed-range=@var{register-range}
25914 @opindex mfixed-range
25915 Generate code treating the given register range as fixed registers.
25916 A fixed register is one that the register allocator can not use. This is
25917 useful when compiling kernel code. A register range is specified as
25918 two registers separated by a dash. Multiple register ranges can be
25919 specified separated by a comma.
25920
25921 @item -mbranch-cost=@var{num}
25922 @opindex mbranch-cost=@var{num}
25923 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25924 make the compiler try to generate more branch-free code if possible.
25925 If not specified the value is selected depending on the processor type that
25926 is being compiled for.
25927
25928 @item -mzdcbranch
25929 @itemx -mno-zdcbranch
25930 @opindex mzdcbranch
25931 @opindex mno-zdcbranch
25932 Assume (do not assume) that zero displacement conditional branch instructions
25933 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25934 compiler prefers zero displacement branch code sequences. This is
25935 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25936 disabled by specifying @option{-mno-zdcbranch}.
25937
25938 @item -mcbranch-force-delay-slot
25939 @opindex mcbranch-force-delay-slot
25940 Force the usage of delay slots for conditional branches, which stuffs the delay
25941 slot with a @code{nop} if a suitable instruction cannot be found. By default
25942 this option is disabled. It can be enabled to work around hardware bugs as
25943 found in the original SH7055.
25944
25945 @item -mfused-madd
25946 @itemx -mno-fused-madd
25947 @opindex mfused-madd
25948 @opindex mno-fused-madd
25949 Generate code that uses (does not use) the floating-point multiply and
25950 accumulate instructions. These instructions are generated by default
25951 if hardware floating point is used. The machine-dependent
25952 @option{-mfused-madd} option is now mapped to the machine-independent
25953 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25954 mapped to @option{-ffp-contract=off}.
25955
25956 @item -mfsca
25957 @itemx -mno-fsca
25958 @opindex mfsca
25959 @opindex mno-fsca
25960 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25961 and cosine approximations. The option @option{-mfsca} must be used in
25962 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25963 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25964 approximations even if @option{-funsafe-math-optimizations} is in effect.
25965
25966 @item -mfsrra
25967 @itemx -mno-fsrra
25968 @opindex mfsrra
25969 @opindex mno-fsrra
25970 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25971 reciprocal square root approximations. The option @option{-mfsrra} must be used
25972 in combination with @option{-funsafe-math-optimizations} and
25973 @option{-ffinite-math-only}. It is enabled by default when generating code for
25974 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25975 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25976 in effect.
25977
25978 @item -mpretend-cmove
25979 @opindex mpretend-cmove
25980 Prefer zero-displacement conditional branches for conditional move instruction
25981 patterns. This can result in faster code on the SH4 processor.
25982
25983 @item -mfdpic
25984 @opindex fdpic
25985 Generate code using the FDPIC ABI.
25986
25987 @end table
25988
25989 @node Solaris 2 Options
25990 @subsection Solaris 2 Options
25991 @cindex Solaris 2 options
25992
25993 These @samp{-m} options are supported on Solaris 2:
25994
25995 @table @gcctabopt
25996 @item -mclear-hwcap
25997 @opindex mclear-hwcap
25998 @option{-mclear-hwcap} tells the compiler to remove the hardware
25999 capabilities generated by the Solaris assembler. This is only necessary
26000 when object files use ISA extensions not supported by the current
26001 machine, but check at runtime whether or not to use them.
26002
26003 @item -mimpure-text
26004 @opindex mimpure-text
26005 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26006 the compiler to not pass @option{-z text} to the linker when linking a
26007 shared object. Using this option, you can link position-dependent
26008 code into a shared object.
26009
26010 @option{-mimpure-text} suppresses the ``relocations remain against
26011 allocatable but non-writable sections'' linker error message.
26012 However, the necessary relocations trigger copy-on-write, and the
26013 shared object is not actually shared across processes. Instead of
26014 using @option{-mimpure-text}, you should compile all source code with
26015 @option{-fpic} or @option{-fPIC}.
26016
26017 @end table
26018
26019 These switches are supported in addition to the above on Solaris 2:
26020
26021 @table @gcctabopt
26022 @item -pthreads
26023 @opindex pthreads
26024 This is a synonym for @option{-pthread}.
26025 @end table
26026
26027 @node SPARC Options
26028 @subsection SPARC Options
26029 @cindex SPARC options
26030
26031 These @samp{-m} options are supported on the SPARC:
26032
26033 @table @gcctabopt
26034 @item -mno-app-regs
26035 @itemx -mapp-regs
26036 @opindex mno-app-regs
26037 @opindex mapp-regs
26038 Specify @option{-mapp-regs} to generate output using the global registers
26039 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26040 global register 1, each global register 2 through 4 is then treated as an
26041 allocable register that is clobbered by function calls. This is the default.
26042
26043 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26044 specify @option{-mno-app-regs}. You should compile libraries and system
26045 software with this option.
26046
26047 @item -mflat
26048 @itemx -mno-flat
26049 @opindex mflat
26050 @opindex mno-flat
26051 With @option{-mflat}, the compiler does not generate save/restore instructions
26052 and uses a ``flat'' or single register window model. This model is compatible
26053 with the regular register window model. The local registers and the input
26054 registers (0--5) are still treated as ``call-saved'' registers and are
26055 saved on the stack as needed.
26056
26057 With @option{-mno-flat} (the default), the compiler generates save/restore
26058 instructions (except for leaf functions). This is the normal operating mode.
26059
26060 @item -mfpu
26061 @itemx -mhard-float
26062 @opindex mfpu
26063 @opindex mhard-float
26064 Generate output containing floating-point instructions. This is the
26065 default.
26066
26067 @item -mno-fpu
26068 @itemx -msoft-float
26069 @opindex mno-fpu
26070 @opindex msoft-float
26071 Generate output containing library calls for floating point.
26072 @strong{Warning:} the requisite libraries are not available for all SPARC
26073 targets. Normally the facilities of the machine's usual C compiler are
26074 used, but this cannot be done directly in cross-compilation. You must make
26075 your own arrangements to provide suitable library functions for
26076 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26077 @samp{sparclite-*-*} do provide software floating-point support.
26078
26079 @option{-msoft-float} changes the calling convention in the output file;
26080 therefore, it is only useful if you compile @emph{all} of a program with
26081 this option. In particular, you need to compile @file{libgcc.a}, the
26082 library that comes with GCC, with @option{-msoft-float} in order for
26083 this to work.
26084
26085 @item -mhard-quad-float
26086 @opindex mhard-quad-float
26087 Generate output containing quad-word (long double) floating-point
26088 instructions.
26089
26090 @item -msoft-quad-float
26091 @opindex msoft-quad-float
26092 Generate output containing library calls for quad-word (long double)
26093 floating-point instructions. The functions called are those specified
26094 in the SPARC ABI@. This is the default.
26095
26096 As of this writing, there are no SPARC implementations that have hardware
26097 support for the quad-word floating-point instructions. They all invoke
26098 a trap handler for one of these instructions, and then the trap handler
26099 emulates the effect of the instruction. Because of the trap handler overhead,
26100 this is much slower than calling the ABI library routines. Thus the
26101 @option{-msoft-quad-float} option is the default.
26102
26103 @item -mno-unaligned-doubles
26104 @itemx -munaligned-doubles
26105 @opindex mno-unaligned-doubles
26106 @opindex munaligned-doubles
26107 Assume that doubles have 8-byte alignment. This is the default.
26108
26109 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26110 alignment only if they are contained in another type, or if they have an
26111 absolute address. Otherwise, it assumes they have 4-byte alignment.
26112 Specifying this option avoids some rare compatibility problems with code
26113 generated by other compilers. It is not the default because it results
26114 in a performance loss, especially for floating-point code.
26115
26116 @item -muser-mode
26117 @itemx -mno-user-mode
26118 @opindex muser-mode
26119 @opindex mno-user-mode
26120 Do not generate code that can only run in supervisor mode. This is relevant
26121 only for the @code{casa} instruction emitted for the LEON3 processor. This
26122 is the default.
26123
26124 @item -mfaster-structs
26125 @itemx -mno-faster-structs
26126 @opindex mfaster-structs
26127 @opindex mno-faster-structs
26128 With @option{-mfaster-structs}, the compiler assumes that structures
26129 should have 8-byte alignment. This enables the use of pairs of
26130 @code{ldd} and @code{std} instructions for copies in structure
26131 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26132 However, the use of this changed alignment directly violates the SPARC
26133 ABI@. Thus, it's intended only for use on targets where the developer
26134 acknowledges that their resulting code is not directly in line with
26135 the rules of the ABI@.
26136
26137 @item -mstd-struct-return
26138 @itemx -mno-std-struct-return
26139 @opindex mstd-struct-return
26140 @opindex mno-std-struct-return
26141 With @option{-mstd-struct-return}, the compiler generates checking code
26142 in functions returning structures or unions to detect size mismatches
26143 between the two sides of function calls, as per the 32-bit ABI@.
26144
26145 The default is @option{-mno-std-struct-return}. This option has no effect
26146 in 64-bit mode.
26147
26148 @item -mlra
26149 @itemx -mno-lra
26150 @opindex mlra
26151 @opindex mno-lra
26152 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26153 so @option{-mno-lra} needs to be passed to get old Reload.
26154
26155 @item -mcpu=@var{cpu_type}
26156 @opindex mcpu
26157 Set the instruction set, register set, and instruction scheduling parameters
26158 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26159 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26160 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26161 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26162 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26163 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26164
26165 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26166 which selects the best architecture option for the host processor.
26167 @option{-mcpu=native} has no effect if GCC does not recognize
26168 the processor.
26169
26170 Default instruction scheduling parameters are used for values that select
26171 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26172 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26173
26174 Here is a list of each supported architecture and their supported
26175 implementations.
26176
26177 @table @asis
26178 @item v7
26179 cypress, leon3v7
26180
26181 @item v8
26182 supersparc, hypersparc, leon, leon3
26183
26184 @item sparclite
26185 f930, f934, sparclite86x
26186
26187 @item sparclet
26188 tsc701
26189
26190 @item v9
26191 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26192 niagara7, m8
26193 @end table
26194
26195 By default (unless configured otherwise), GCC generates code for the V7
26196 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26197 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26198 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26199 SPARCStation 1, 2, IPX etc.
26200
26201 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26202 architecture. The only difference from V7 code is that the compiler emits
26203 the integer multiply and integer divide instructions which exist in SPARC-V8
26204 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26205 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26206 2000 series.
26207
26208 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26209 the SPARC architecture. This adds the integer multiply, integer divide step
26210 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26211 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26212 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26213 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26214 MB86934 chip, which is the more recent SPARClite with FPU@.
26215
26216 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26217 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26218 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26219 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26220 optimizes it for the TEMIC SPARClet chip.
26221
26222 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26223 architecture. This adds 64-bit integer and floating-point move instructions,
26224 3 additional floating-point condition code registers and conditional move
26225 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26226 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26227 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26228 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26229 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26230 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26231 additionally optimizes it for Sun UltraSPARC T2 chips. With
26232 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26233 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26234 additionally optimizes it for Sun UltraSPARC T4 chips. With
26235 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26236 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26237 additionally optimizes it for Oracle M8 chips.
26238
26239 @item -mtune=@var{cpu_type}
26240 @opindex mtune
26241 Set the instruction scheduling parameters for machine type
26242 @var{cpu_type}, but do not set the instruction set or register set that the
26243 option @option{-mcpu=@var{cpu_type}} does.
26244
26245 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26246 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26247 that select a particular CPU implementation. Those are
26248 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26249 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26250 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26251 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26252 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26253 and GNU/Linux toolchains, @samp{native} can also be used.
26254
26255 @item -mv8plus
26256 @itemx -mno-v8plus
26257 @opindex mv8plus
26258 @opindex mno-v8plus
26259 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26260 difference from the V8 ABI is that the global and out registers are
26261 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26262 mode for all SPARC-V9 processors.
26263
26264 @item -mvis
26265 @itemx -mno-vis
26266 @opindex mvis
26267 @opindex mno-vis
26268 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26269 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26270
26271 @item -mvis2
26272 @itemx -mno-vis2
26273 @opindex mvis2
26274 @opindex mno-vis2
26275 With @option{-mvis2}, GCC generates code that takes advantage of
26276 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26277 default is @option{-mvis2} when targeting a cpu that supports such
26278 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26279 also sets @option{-mvis}.
26280
26281 @item -mvis3
26282 @itemx -mno-vis3
26283 @opindex mvis3
26284 @opindex mno-vis3
26285 With @option{-mvis3}, GCC generates code that takes advantage of
26286 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26287 default is @option{-mvis3} when targeting a cpu that supports such
26288 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26289 also sets @option{-mvis2} and @option{-mvis}.
26290
26291 @item -mvis4
26292 @itemx -mno-vis4
26293 @opindex mvis4
26294 @opindex mno-vis4
26295 With @option{-mvis4}, GCC generates code that takes advantage of
26296 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26297 default is @option{-mvis4} when targeting a cpu that supports such
26298 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26299 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26300
26301 @item -mvis4b
26302 @itemx -mno-vis4b
26303 @opindex mvis4b
26304 @opindex mno-vis4b
26305 With @option{-mvis4b}, GCC generates code that takes advantage of
26306 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26307 the additional VIS instructions introduced in the Oracle SPARC
26308 Architecture 2017. The default is @option{-mvis4b} when targeting a
26309 cpu that supports such instructions, such as m8 and later. Setting
26310 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26311 @option{-mvis2} and @option{-mvis}.
26312
26313 @item -mcbcond
26314 @itemx -mno-cbcond
26315 @opindex mcbcond
26316 @opindex mno-cbcond
26317 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26318 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26319 when targeting a CPU that supports such instructions, such as Niagara-4 and
26320 later.
26321
26322 @item -mfmaf
26323 @itemx -mno-fmaf
26324 @opindex mfmaf
26325 @opindex mno-fmaf
26326 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26327 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26328 when targeting a CPU that supports such instructions, such as Niagara-3 and
26329 later.
26330
26331 @item -mfsmuld
26332 @itemx -mno-fsmuld
26333 @opindex mfsmuld
26334 @opindex mno-fsmuld
26335 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26336 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26337 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26338 or V9 with FPU except @option{-mcpu=leon}.
26339
26340 @item -mpopc
26341 @itemx -mno-popc
26342 @opindex mpopc
26343 @opindex mno-popc
26344 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26345 Population Count instruction. The default is @option{-mpopc}
26346 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26347 later.
26348
26349 @item -msubxc
26350 @itemx -mno-subxc
26351 @opindex msubxc
26352 @opindex mno-subxc
26353 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26354 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26355 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26356 later.
26357
26358 @item -mfix-at697f
26359 @opindex mfix-at697f
26360 Enable the documented workaround for the single erratum of the Atmel AT697F
26361 processor (which corresponds to erratum #13 of the AT697E processor).
26362
26363 @item -mfix-ut699
26364 @opindex mfix-ut699
26365 Enable the documented workarounds for the floating-point errata and the data
26366 cache nullify errata of the UT699 processor.
26367
26368 @item -mfix-ut700
26369 @opindex mfix-ut700
26370 Enable the documented workaround for the back-to-back store errata of
26371 the UT699E/UT700 processor.
26372
26373 @item -mfix-gr712rc
26374 @opindex mfix-gr712rc
26375 Enable the documented workaround for the back-to-back store errata of
26376 the GR712RC processor.
26377 @end table
26378
26379 These @samp{-m} options are supported in addition to the above
26380 on SPARC-V9 processors in 64-bit environments:
26381
26382 @table @gcctabopt
26383 @item -m32
26384 @itemx -m64
26385 @opindex m32
26386 @opindex m64
26387 Generate code for a 32-bit or 64-bit environment.
26388 The 32-bit environment sets int, long and pointer to 32 bits.
26389 The 64-bit environment sets int to 32 bits and long and pointer
26390 to 64 bits.
26391
26392 @item -mcmodel=@var{which}
26393 @opindex mcmodel
26394 Set the code model to one of
26395
26396 @table @samp
26397 @item medlow
26398 The Medium/Low code model: 64-bit addresses, programs
26399 must be linked in the low 32 bits of memory. Programs can be statically
26400 or dynamically linked.
26401
26402 @item medmid
26403 The Medium/Middle code model: 64-bit addresses, programs
26404 must be linked in the low 44 bits of memory, the text and data segments must
26405 be less than 2GB in size and the data segment must be located within 2GB of
26406 the text segment.
26407
26408 @item medany
26409 The Medium/Anywhere code model: 64-bit addresses, programs
26410 may be linked anywhere in memory, the text and data segments must be less
26411 than 2GB in size and the data segment must be located within 2GB of the
26412 text segment.
26413
26414 @item embmedany
26415 The Medium/Anywhere code model for embedded systems:
26416 64-bit addresses, the text and data segments must be less than 2GB in
26417 size, both starting anywhere in memory (determined at link time). The
26418 global register %g4 points to the base of the data segment. Programs
26419 are statically linked and PIC is not supported.
26420 @end table
26421
26422 @item -mmemory-model=@var{mem-model}
26423 @opindex mmemory-model
26424 Set the memory model in force on the processor to one of
26425
26426 @table @samp
26427 @item default
26428 The default memory model for the processor and operating system.
26429
26430 @item rmo
26431 Relaxed Memory Order
26432
26433 @item pso
26434 Partial Store Order
26435
26436 @item tso
26437 Total Store Order
26438
26439 @item sc
26440 Sequential Consistency
26441 @end table
26442
26443 These memory models are formally defined in Appendix D of the SPARC-V9
26444 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26445
26446 @item -mstack-bias
26447 @itemx -mno-stack-bias
26448 @opindex mstack-bias
26449 @opindex mno-stack-bias
26450 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26451 frame pointer if present, are offset by @minus{}2047 which must be added back
26452 when making stack frame references. This is the default in 64-bit mode.
26453 Otherwise, assume no such offset is present.
26454 @end table
26455
26456 @node SPU Options
26457 @subsection SPU Options
26458 @cindex SPU options
26459
26460 These @samp{-m} options are supported on the SPU:
26461
26462 @table @gcctabopt
26463 @item -mwarn-reloc
26464 @itemx -merror-reloc
26465 @opindex mwarn-reloc
26466 @opindex merror-reloc
26467
26468 The loader for SPU does not handle dynamic relocations. By default, GCC
26469 gives an error when it generates code that requires a dynamic
26470 relocation. @option{-mno-error-reloc} disables the error,
26471 @option{-mwarn-reloc} generates a warning instead.
26472
26473 @item -msafe-dma
26474 @itemx -munsafe-dma
26475 @opindex msafe-dma
26476 @opindex munsafe-dma
26477
26478 Instructions that initiate or test completion of DMA must not be
26479 reordered with respect to loads and stores of the memory that is being
26480 accessed.
26481 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26482 memory accesses, but that can lead to inefficient code in places where the
26483 memory is known to not change. Rather than mark the memory as volatile,
26484 you can use @option{-msafe-dma} to tell the compiler to treat
26485 the DMA instructions as potentially affecting all memory.
26486
26487 @item -mbranch-hints
26488 @opindex mbranch-hints
26489
26490 By default, GCC generates a branch hint instruction to avoid
26491 pipeline stalls for always-taken or probably-taken branches. A hint
26492 is not generated closer than 8 instructions away from its branch.
26493 There is little reason to disable them, except for debugging purposes,
26494 or to make an object a little bit smaller.
26495
26496 @item -msmall-mem
26497 @itemx -mlarge-mem
26498 @opindex msmall-mem
26499 @opindex mlarge-mem
26500
26501 By default, GCC generates code assuming that addresses are never larger
26502 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26503 a full 32-bit address.
26504
26505 @item -mstdmain
26506 @opindex mstdmain
26507
26508 By default, GCC links against startup code that assumes the SPU-style
26509 main function interface (which has an unconventional parameter list).
26510 With @option{-mstdmain}, GCC links your program against startup
26511 code that assumes a C99-style interface to @code{main}, including a
26512 local copy of @code{argv} strings.
26513
26514 @item -mfixed-range=@var{register-range}
26515 @opindex mfixed-range
26516 Generate code treating the given register range as fixed registers.
26517 A fixed register is one that the register allocator cannot use. This is
26518 useful when compiling kernel code. A register range is specified as
26519 two registers separated by a dash. Multiple register ranges can be
26520 specified separated by a comma.
26521
26522 @item -mea32
26523 @itemx -mea64
26524 @opindex mea32
26525 @opindex mea64
26526 Compile code assuming that pointers to the PPU address space accessed
26527 via the @code{__ea} named address space qualifier are either 32 or 64
26528 bits wide. The default is 32 bits. As this is an ABI-changing option,
26529 all object code in an executable must be compiled with the same setting.
26530
26531 @item -maddress-space-conversion
26532 @itemx -mno-address-space-conversion
26533 @opindex maddress-space-conversion
26534 @opindex mno-address-space-conversion
26535 Allow/disallow treating the @code{__ea} address space as superset
26536 of the generic address space. This enables explicit type casts
26537 between @code{__ea} and generic pointer as well as implicit
26538 conversions of generic pointers to @code{__ea} pointers. The
26539 default is to allow address space pointer conversions.
26540
26541 @item -mcache-size=@var{cache-size}
26542 @opindex mcache-size
26543 This option controls the version of libgcc that the compiler links to an
26544 executable and selects a software-managed cache for accessing variables
26545 in the @code{__ea} address space with a particular cache size. Possible
26546 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26547 and @samp{128}. The default cache size is 64KB.
26548
26549 @item -matomic-updates
26550 @itemx -mno-atomic-updates
26551 @opindex matomic-updates
26552 @opindex mno-atomic-updates
26553 This option controls the version of libgcc that the compiler links to an
26554 executable and selects whether atomic updates to the software-managed
26555 cache of PPU-side variables are used. If you use atomic updates, changes
26556 to a PPU variable from SPU code using the @code{__ea} named address space
26557 qualifier do not interfere with changes to other PPU variables residing
26558 in the same cache line from PPU code. If you do not use atomic updates,
26559 such interference may occur; however, writing back cache lines is
26560 more efficient. The default behavior is to use atomic updates.
26561
26562 @item -mdual-nops
26563 @itemx -mdual-nops=@var{n}
26564 @opindex mdual-nops
26565 By default, GCC inserts NOPs to increase dual issue when it expects
26566 it to increase performance. @var{n} can be a value from 0 to 10. A
26567 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26568 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26569
26570 @item -mhint-max-nops=@var{n}
26571 @opindex mhint-max-nops
26572 Maximum number of NOPs to insert for a branch hint. A branch hint must
26573 be at least 8 instructions away from the branch it is affecting. GCC
26574 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26575 generate the branch hint.
26576
26577 @item -mhint-max-distance=@var{n}
26578 @opindex mhint-max-distance
26579 The encoding of the branch hint instruction limits the hint to be within
26580 256 instructions of the branch it is affecting. By default, GCC makes
26581 sure it is within 125.
26582
26583 @item -msafe-hints
26584 @opindex msafe-hints
26585 Work around a hardware bug that causes the SPU to stall indefinitely.
26586 By default, GCC inserts the @code{hbrp} instruction to make sure
26587 this stall won't happen.
26588
26589 @end table
26590
26591 @node System V Options
26592 @subsection Options for System V
26593
26594 These additional options are available on System V Release 4 for
26595 compatibility with other compilers on those systems:
26596
26597 @table @gcctabopt
26598 @item -G
26599 @opindex G
26600 Create a shared object.
26601 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26602
26603 @item -Qy
26604 @opindex Qy
26605 Identify the versions of each tool used by the compiler, in a
26606 @code{.ident} assembler directive in the output.
26607
26608 @item -Qn
26609 @opindex Qn
26610 Refrain from adding @code{.ident} directives to the output file (this is
26611 the default).
26612
26613 @item -YP,@var{dirs}
26614 @opindex YP
26615 Search the directories @var{dirs}, and no others, for libraries
26616 specified with @option{-l}.
26617
26618 @item -Ym,@var{dir}
26619 @opindex Ym
26620 Look in the directory @var{dir} to find the M4 preprocessor.
26621 The assembler uses this option.
26622 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26623 @c the generic assembler that comes with Solaris takes just -Ym.
26624 @end table
26625
26626 @node TILE-Gx Options
26627 @subsection TILE-Gx Options
26628 @cindex TILE-Gx options
26629
26630 These @samp{-m} options are supported on the TILE-Gx:
26631
26632 @table @gcctabopt
26633 @item -mcmodel=small
26634 @opindex mcmodel=small
26635 Generate code for the small model. The distance for direct calls is
26636 limited to 500M in either direction. PC-relative addresses are 32
26637 bits. Absolute addresses support the full address range.
26638
26639 @item -mcmodel=large
26640 @opindex mcmodel=large
26641 Generate code for the large model. There is no limitation on call
26642 distance, pc-relative addresses, or absolute addresses.
26643
26644 @item -mcpu=@var{name}
26645 @opindex mcpu
26646 Selects the type of CPU to be targeted. Currently the only supported
26647 type is @samp{tilegx}.
26648
26649 @item -m32
26650 @itemx -m64
26651 @opindex m32
26652 @opindex m64
26653 Generate code for a 32-bit or 64-bit environment. The 32-bit
26654 environment sets int, long, and pointer to 32 bits. The 64-bit
26655 environment sets int to 32 bits and long and pointer to 64 bits.
26656
26657 @item -mbig-endian
26658 @itemx -mlittle-endian
26659 @opindex mbig-endian
26660 @opindex mlittle-endian
26661 Generate code in big/little endian mode, respectively.
26662 @end table
26663
26664 @node TILEPro Options
26665 @subsection TILEPro Options
26666 @cindex TILEPro options
26667
26668 These @samp{-m} options are supported on the TILEPro:
26669
26670 @table @gcctabopt
26671 @item -mcpu=@var{name}
26672 @opindex mcpu
26673 Selects the type of CPU to be targeted. Currently the only supported
26674 type is @samp{tilepro}.
26675
26676 @item -m32
26677 @opindex m32
26678 Generate code for a 32-bit environment, which sets int, long, and
26679 pointer to 32 bits. This is the only supported behavior so the flag
26680 is essentially ignored.
26681 @end table
26682
26683 @node V850 Options
26684 @subsection V850 Options
26685 @cindex V850 Options
26686
26687 These @samp{-m} options are defined for V850 implementations:
26688
26689 @table @gcctabopt
26690 @item -mlong-calls
26691 @itemx -mno-long-calls
26692 @opindex mlong-calls
26693 @opindex mno-long-calls
26694 Treat all calls as being far away (near). If calls are assumed to be
26695 far away, the compiler always loads the function's address into a
26696 register, and calls indirect through the pointer.
26697
26698 @item -mno-ep
26699 @itemx -mep
26700 @opindex mno-ep
26701 @opindex mep
26702 Do not optimize (do optimize) basic blocks that use the same index
26703 pointer 4 or more times to copy pointer into the @code{ep} register, and
26704 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26705 option is on by default if you optimize.
26706
26707 @item -mno-prolog-function
26708 @itemx -mprolog-function
26709 @opindex mno-prolog-function
26710 @opindex mprolog-function
26711 Do not use (do use) external functions to save and restore registers
26712 at the prologue and epilogue of a function. The external functions
26713 are slower, but use less code space if more than one function saves
26714 the same number of registers. The @option{-mprolog-function} option
26715 is on by default if you optimize.
26716
26717 @item -mspace
26718 @opindex mspace
26719 Try to make the code as small as possible. At present, this just turns
26720 on the @option{-mep} and @option{-mprolog-function} options.
26721
26722 @item -mtda=@var{n}
26723 @opindex mtda
26724 Put static or global variables whose size is @var{n} bytes or less into
26725 the tiny data area that register @code{ep} points to. The tiny data
26726 area can hold up to 256 bytes in total (128 bytes for byte references).
26727
26728 @item -msda=@var{n}
26729 @opindex msda
26730 Put static or global variables whose size is @var{n} bytes or less into
26731 the small data area that register @code{gp} points to. The small data
26732 area can hold up to 64 kilobytes.
26733
26734 @item -mzda=@var{n}
26735 @opindex mzda
26736 Put static or global variables whose size is @var{n} bytes or less into
26737 the first 32 kilobytes of memory.
26738
26739 @item -mv850
26740 @opindex mv850
26741 Specify that the target processor is the V850.
26742
26743 @item -mv850e3v5
26744 @opindex mv850e3v5
26745 Specify that the target processor is the V850E3V5. The preprocessor
26746 constant @code{__v850e3v5__} is defined if this option is used.
26747
26748 @item -mv850e2v4
26749 @opindex mv850e2v4
26750 Specify that the target processor is the V850E3V5. This is an alias for
26751 the @option{-mv850e3v5} option.
26752
26753 @item -mv850e2v3
26754 @opindex mv850e2v3
26755 Specify that the target processor is the V850E2V3. The preprocessor
26756 constant @code{__v850e2v3__} is defined if this option is used.
26757
26758 @item -mv850e2
26759 @opindex mv850e2
26760 Specify that the target processor is the V850E2. The preprocessor
26761 constant @code{__v850e2__} is defined if this option is used.
26762
26763 @item -mv850e1
26764 @opindex mv850e1
26765 Specify that the target processor is the V850E1. The preprocessor
26766 constants @code{__v850e1__} and @code{__v850e__} are defined if
26767 this option is used.
26768
26769 @item -mv850es
26770 @opindex mv850es
26771 Specify that the target processor is the V850ES. This is an alias for
26772 the @option{-mv850e1} option.
26773
26774 @item -mv850e
26775 @opindex mv850e
26776 Specify that the target processor is the V850E@. The preprocessor
26777 constant @code{__v850e__} is defined if this option is used.
26778
26779 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26780 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26781 are defined then a default target processor is chosen and the
26782 relevant @samp{__v850*__} preprocessor constant is defined.
26783
26784 The preprocessor constants @code{__v850} and @code{__v851__} are always
26785 defined, regardless of which processor variant is the target.
26786
26787 @item -mdisable-callt
26788 @itemx -mno-disable-callt
26789 @opindex mdisable-callt
26790 @opindex mno-disable-callt
26791 This option suppresses generation of the @code{CALLT} instruction for the
26792 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26793 architecture.
26794
26795 This option is enabled by default when the RH850 ABI is
26796 in use (see @option{-mrh850-abi}), and disabled by default when the
26797 GCC ABI is in use. If @code{CALLT} instructions are being generated
26798 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26799
26800 @item -mrelax
26801 @itemx -mno-relax
26802 @opindex mrelax
26803 @opindex mno-relax
26804 Pass on (or do not pass on) the @option{-mrelax} command-line option
26805 to the assembler.
26806
26807 @item -mlong-jumps
26808 @itemx -mno-long-jumps
26809 @opindex mlong-jumps
26810 @opindex mno-long-jumps
26811 Disable (or re-enable) the generation of PC-relative jump instructions.
26812
26813 @item -msoft-float
26814 @itemx -mhard-float
26815 @opindex msoft-float
26816 @opindex mhard-float
26817 Disable (or re-enable) the generation of hardware floating point
26818 instructions. This option is only significant when the target
26819 architecture is @samp{V850E2V3} or higher. If hardware floating point
26820 instructions are being generated then the C preprocessor symbol
26821 @code{__FPU_OK__} is defined, otherwise the symbol
26822 @code{__NO_FPU__} is defined.
26823
26824 @item -mloop
26825 @opindex mloop
26826 Enables the use of the e3v5 LOOP instruction. The use of this
26827 instruction is not enabled by default when the e3v5 architecture is
26828 selected because its use is still experimental.
26829
26830 @item -mrh850-abi
26831 @itemx -mghs
26832 @opindex mrh850-abi
26833 @opindex mghs
26834 Enables support for the RH850 version of the V850 ABI. This is the
26835 default. With this version of the ABI the following rules apply:
26836
26837 @itemize
26838 @item
26839 Integer sized structures and unions are returned via a memory pointer
26840 rather than a register.
26841
26842 @item
26843 Large structures and unions (more than 8 bytes in size) are passed by
26844 value.
26845
26846 @item
26847 Functions are aligned to 16-bit boundaries.
26848
26849 @item
26850 The @option{-m8byte-align} command-line option is supported.
26851
26852 @item
26853 The @option{-mdisable-callt} command-line option is enabled by
26854 default. The @option{-mno-disable-callt} command-line option is not
26855 supported.
26856 @end itemize
26857
26858 When this version of the ABI is enabled the C preprocessor symbol
26859 @code{__V850_RH850_ABI__} is defined.
26860
26861 @item -mgcc-abi
26862 @opindex mgcc-abi
26863 Enables support for the old GCC version of the V850 ABI. With this
26864 version of the ABI the following rules apply:
26865
26866 @itemize
26867 @item
26868 Integer sized structures and unions are returned in register @code{r10}.
26869
26870 @item
26871 Large structures and unions (more than 8 bytes in size) are passed by
26872 reference.
26873
26874 @item
26875 Functions are aligned to 32-bit boundaries, unless optimizing for
26876 size.
26877
26878 @item
26879 The @option{-m8byte-align} command-line option is not supported.
26880
26881 @item
26882 The @option{-mdisable-callt} command-line option is supported but not
26883 enabled by default.
26884 @end itemize
26885
26886 When this version of the ABI is enabled the C preprocessor symbol
26887 @code{__V850_GCC_ABI__} is defined.
26888
26889 @item -m8byte-align
26890 @itemx -mno-8byte-align
26891 @opindex m8byte-align
26892 @opindex mno-8byte-align
26893 Enables support for @code{double} and @code{long long} types to be
26894 aligned on 8-byte boundaries. The default is to restrict the
26895 alignment of all objects to at most 4-bytes. When
26896 @option{-m8byte-align} is in effect the C preprocessor symbol
26897 @code{__V850_8BYTE_ALIGN__} is defined.
26898
26899 @item -mbig-switch
26900 @opindex mbig-switch
26901 Generate code suitable for big switch tables. Use this option only if
26902 the assembler/linker complain about out of range branches within a switch
26903 table.
26904
26905 @item -mapp-regs
26906 @opindex mapp-regs
26907 This option causes r2 and r5 to be used in the code generated by
26908 the compiler. This setting is the default.
26909
26910 @item -mno-app-regs
26911 @opindex mno-app-regs
26912 This option causes r2 and r5 to be treated as fixed registers.
26913
26914 @end table
26915
26916 @node VAX Options
26917 @subsection VAX Options
26918 @cindex VAX options
26919
26920 These @samp{-m} options are defined for the VAX:
26921
26922 @table @gcctabopt
26923 @item -munix
26924 @opindex munix
26925 Do not output certain jump instructions (@code{aobleq} and so on)
26926 that the Unix assembler for the VAX cannot handle across long
26927 ranges.
26928
26929 @item -mgnu
26930 @opindex mgnu
26931 Do output those jump instructions, on the assumption that the
26932 GNU assembler is being used.
26933
26934 @item -mg
26935 @opindex mg
26936 Output code for G-format floating-point numbers instead of D-format.
26937 @end table
26938
26939 @node Visium Options
26940 @subsection Visium Options
26941 @cindex Visium options
26942
26943 @table @gcctabopt
26944
26945 @item -mdebug
26946 @opindex mdebug
26947 A program which performs file I/O and is destined to run on an MCM target
26948 should be linked with this option. It causes the libraries libc.a and
26949 libdebug.a to be linked. The program should be run on the target under
26950 the control of the GDB remote debugging stub.
26951
26952 @item -msim
26953 @opindex msim
26954 A program which performs file I/O and is destined to run on the simulator
26955 should be linked with option. This causes libraries libc.a and libsim.a to
26956 be linked.
26957
26958 @item -mfpu
26959 @itemx -mhard-float
26960 @opindex mfpu
26961 @opindex mhard-float
26962 Generate code containing floating-point instructions. This is the
26963 default.
26964
26965 @item -mno-fpu
26966 @itemx -msoft-float
26967 @opindex mno-fpu
26968 @opindex msoft-float
26969 Generate code containing library calls for floating-point.
26970
26971 @option{-msoft-float} changes the calling convention in the output file;
26972 therefore, it is only useful if you compile @emph{all} of a program with
26973 this option. In particular, you need to compile @file{libgcc.a}, the
26974 library that comes with GCC, with @option{-msoft-float} in order for
26975 this to work.
26976
26977 @item -mcpu=@var{cpu_type}
26978 @opindex mcpu
26979 Set the instruction set, register set, and instruction scheduling parameters
26980 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26981 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26982
26983 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26984
26985 By default (unless configured otherwise), GCC generates code for the GR5
26986 variant of the Visium architecture.
26987
26988 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26989 architecture. The only difference from GR5 code is that the compiler will
26990 generate block move instructions.
26991
26992 @item -mtune=@var{cpu_type}
26993 @opindex mtune
26994 Set the instruction scheduling parameters for machine type @var{cpu_type},
26995 but do not set the instruction set or register set that the option
26996 @option{-mcpu=@var{cpu_type}} would.
26997
26998 @item -msv-mode
26999 @opindex msv-mode
27000 Generate code for the supervisor mode, where there are no restrictions on
27001 the access to general registers. This is the default.
27002
27003 @item -muser-mode
27004 @opindex muser-mode
27005 Generate code for the user mode, where the access to some general registers
27006 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27007 mode; on the GR6, only registers r29 to r31 are affected.
27008 @end table
27009
27010 @node VMS Options
27011 @subsection VMS Options
27012
27013 These @samp{-m} options are defined for the VMS implementations:
27014
27015 @table @gcctabopt
27016 @item -mvms-return-codes
27017 @opindex mvms-return-codes
27018 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27019 condition (e.g.@: error) codes.
27020
27021 @item -mdebug-main=@var{prefix}
27022 @opindex mdebug-main=@var{prefix}
27023 Flag the first routine whose name starts with @var{prefix} as the main
27024 routine for the debugger.
27025
27026 @item -mmalloc64
27027 @opindex mmalloc64
27028 Default to 64-bit memory allocation routines.
27029
27030 @item -mpointer-size=@var{size}
27031 @opindex mpointer-size=@var{size}
27032 Set the default size of pointers. Possible options for @var{size} are
27033 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27034 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27035 The later option disables @code{pragma pointer_size}.
27036 @end table
27037
27038 @node VxWorks Options
27039 @subsection VxWorks Options
27040 @cindex VxWorks Options
27041
27042 The options in this section are defined for all VxWorks targets.
27043 Options specific to the target hardware are listed with the other
27044 options for that target.
27045
27046 @table @gcctabopt
27047 @item -mrtp
27048 @opindex mrtp
27049 GCC can generate code for both VxWorks kernels and real time processes
27050 (RTPs). This option switches from the former to the latter. It also
27051 defines the preprocessor macro @code{__RTP__}.
27052
27053 @item -non-static
27054 @opindex non-static
27055 Link an RTP executable against shared libraries rather than static
27056 libraries. The options @option{-static} and @option{-shared} can
27057 also be used for RTPs (@pxref{Link Options}); @option{-static}
27058 is the default.
27059
27060 @item -Bstatic
27061 @itemx -Bdynamic
27062 @opindex Bstatic
27063 @opindex Bdynamic
27064 These options are passed down to the linker. They are defined for
27065 compatibility with Diab.
27066
27067 @item -Xbind-lazy
27068 @opindex Xbind-lazy
27069 Enable lazy binding of function calls. This option is equivalent to
27070 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27071
27072 @item -Xbind-now
27073 @opindex Xbind-now
27074 Disable lazy binding of function calls. This option is the default and
27075 is defined for compatibility with Diab.
27076 @end table
27077
27078 @node x86 Options
27079 @subsection x86 Options
27080 @cindex x86 Options
27081
27082 These @samp{-m} options are defined for the x86 family of computers.
27083
27084 @table @gcctabopt
27085
27086 @item -march=@var{cpu-type}
27087 @opindex march
27088 Generate instructions for the machine type @var{cpu-type}. In contrast to
27089 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27090 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27091 to generate code that may not run at all on processors other than the one
27092 indicated. Specifying @option{-march=@var{cpu-type}} implies
27093 @option{-mtune=@var{cpu-type}}.
27094
27095 The choices for @var{cpu-type} are:
27096
27097 @table @samp
27098 @item native
27099 This selects the CPU to generate code for at compilation time by determining
27100 the processor type of the compiling machine. Using @option{-march=native}
27101 enables all instruction subsets supported by the local machine (hence
27102 the result might not run on different machines). Using @option{-mtune=native}
27103 produces code optimized for the local machine under the constraints
27104 of the selected instruction set.
27105
27106 @item x86-64
27107 A generic CPU with 64-bit extensions.
27108
27109 @item i386
27110 Original Intel i386 CPU@.
27111
27112 @item i486
27113 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27114
27115 @item i586
27116 @itemx pentium
27117 Intel Pentium CPU with no MMX support.
27118
27119 @item lakemont
27120 Intel Lakemont MCU, based on Intel Pentium CPU.
27121
27122 @item pentium-mmx
27123 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27124
27125 @item pentiumpro
27126 Intel Pentium Pro CPU@.
27127
27128 @item i686
27129 When used with @option{-march}, the Pentium Pro
27130 instruction set is used, so the code runs on all i686 family chips.
27131 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27132
27133 @item pentium2
27134 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27135 support.
27136
27137 @item pentium3
27138 @itemx pentium3m
27139 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27140 set support.
27141
27142 @item pentium-m
27143 Intel Pentium M; low-power version of Intel Pentium III CPU
27144 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27145
27146 @item pentium4
27147 @itemx pentium4m
27148 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27149
27150 @item prescott
27151 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27152 set support.
27153
27154 @item nocona
27155 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27156 SSE2 and SSE3 instruction set support.
27157
27158 @item core2
27159 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27160 instruction set support.
27161
27162 @item nehalem
27163 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27164 SSE4.1, SSE4.2 and POPCNT instruction set support.
27165
27166 @item westmere
27167 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27168 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27169
27170 @item sandybridge
27171 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27172 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27173
27174 @item ivybridge
27175 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27176 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27177 instruction set support.
27178
27179 @item haswell
27180 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27181 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27182 BMI, BMI2 and F16C instruction set support.
27183
27184 @item broadwell
27185 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27186 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27187 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27188
27189 @item skylake
27190 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27191 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27192 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27193 XSAVES instruction set support.
27194
27195 @item bonnell
27196 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27197 instruction set support.
27198
27199 @item silvermont
27200 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27201 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27202
27203 @item goldmont
27204 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27205 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27206 instruction set support.
27207
27208 @item goldmont-plus
27209 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27210 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27211 PTWRITE, RDPID, SGX and UMIP instruction set support.
27212
27213 @item tremont
27214 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27215 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27216 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27217
27218 @item knl
27219 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27220 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27221 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27222 AVX512CD instruction set support.
27223
27224 @item knm
27225 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27226 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27227 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27228 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27229
27230 @item skylake-avx512
27231 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27232 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27233 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27234 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27235
27236 @item cannonlake
27237 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27238 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27239 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27240 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27241 AVX512IFMA, SHA and UMIP instruction set support.
27242
27243 @item icelake-client
27244 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27245 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27246 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27247 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27248 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27249 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27250
27251 @item icelake-server
27252 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27253 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27254 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27255 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27256 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27257 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27258 set support.
27259
27260 @item k6
27261 AMD K6 CPU with MMX instruction set support.
27262
27263 @item k6-2
27264 @itemx k6-3
27265 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27266
27267 @item athlon
27268 @itemx athlon-tbird
27269 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27270 support.
27271
27272 @item athlon-4
27273 @itemx athlon-xp
27274 @itemx athlon-mp
27275 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27276 instruction set support.
27277
27278 @item k8
27279 @itemx opteron
27280 @itemx athlon64
27281 @itemx athlon-fx
27282 Processors based on the AMD K8 core with x86-64 instruction set support,
27283 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27284 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27285 instruction set extensions.)
27286
27287 @item k8-sse3
27288 @itemx opteron-sse3
27289 @itemx athlon64-sse3
27290 Improved versions of AMD K8 cores with SSE3 instruction set support.
27291
27292 @item amdfam10
27293 @itemx barcelona
27294 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27295 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27296 instruction set extensions.)
27297
27298 @item bdver1
27299 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27300 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27301 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27302 @item bdver2
27303 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27304 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27305 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27306 extensions.)
27307 @item bdver3
27308 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27309 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27310 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27311 64-bit instruction set extensions.
27312 @item bdver4
27313 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27314 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27315 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27316 SSE4.2, ABM and 64-bit instruction set extensions.
27317
27318 @item znver1
27319 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27320 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27321 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27322 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27323 instruction set extensions.
27324 @item znver2
27325 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27326 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27327 MWAITX, SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27328 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27329 instruction set extensions.)
27330
27331
27332 @item btver1
27333 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27334 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27335 instruction set extensions.)
27336
27337 @item btver2
27338 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27339 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27340 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27341
27342 @item winchip-c6
27343 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27344 set support.
27345
27346 @item winchip2
27347 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27348 instruction set support.
27349
27350 @item c3
27351 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27352 (No scheduling is implemented for this chip.)
27353
27354 @item c3-2
27355 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27356 (No scheduling is implemented for this chip.)
27357
27358 @item c7
27359 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27360 (No scheduling is implemented for this chip.)
27361
27362 @item samuel-2
27363 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27364 (No scheduling is implemented for this chip.)
27365
27366 @item nehemiah
27367 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27368 (No scheduling is implemented for this chip.)
27369
27370 @item esther
27371 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27372 (No scheduling is implemented for this chip.)
27373
27374 @item eden-x2
27375 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27376 (No scheduling is implemented for this chip.)
27377
27378 @item eden-x4
27379 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27380 AVX and AVX2 instruction set support.
27381 (No scheduling is implemented for this chip.)
27382
27383 @item nano
27384 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27385 instruction set support.
27386 (No scheduling is implemented for this chip.)
27387
27388 @item nano-1000
27389 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27390 instruction set support.
27391 (No scheduling is implemented for this chip.)
27392
27393 @item nano-2000
27394 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27395 instruction set support.
27396 (No scheduling is implemented for this chip.)
27397
27398 @item nano-3000
27399 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27400 instruction set support.
27401 (No scheduling is implemented for this chip.)
27402
27403 @item nano-x2
27404 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27405 instruction set support.
27406 (No scheduling is implemented for this chip.)
27407
27408 @item nano-x4
27409 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27410 instruction set support.
27411 (No scheduling is implemented for this chip.)
27412
27413 @item geode
27414 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27415 @end table
27416
27417 @item -mtune=@var{cpu-type}
27418 @opindex mtune
27419 Tune to @var{cpu-type} everything applicable about the generated code, except
27420 for the ABI and the set of available instructions.
27421 While picking a specific @var{cpu-type} schedules things appropriately
27422 for that particular chip, the compiler does not generate any code that
27423 cannot run on the default machine type unless you use a
27424 @option{-march=@var{cpu-type}} option.
27425 For example, if GCC is configured for i686-pc-linux-gnu
27426 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27427 but still runs on i686 machines.
27428
27429 The choices for @var{cpu-type} are the same as for @option{-march}.
27430 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27431
27432 @table @samp
27433 @item generic
27434 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27435 If you know the CPU on which your code will run, then you should use
27436 the corresponding @option{-mtune} or @option{-march} option instead of
27437 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27438 of your application will have, then you should use this option.
27439
27440 As new processors are deployed in the marketplace, the behavior of this
27441 option will change. Therefore, if you upgrade to a newer version of
27442 GCC, code generation controlled by this option will change to reflect
27443 the processors
27444 that are most common at the time that version of GCC is released.
27445
27446 There is no @option{-march=generic} option because @option{-march}
27447 indicates the instruction set the compiler can use, and there is no
27448 generic instruction set applicable to all processors. In contrast,
27449 @option{-mtune} indicates the processor (or, in this case, collection of
27450 processors) for which the code is optimized.
27451
27452 @item intel
27453 Produce code optimized for the most current Intel processors, which are
27454 Haswell and Silvermont for this version of GCC. If you know the CPU
27455 on which your code will run, then you should use the corresponding
27456 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27457 But, if you want your application performs better on both Haswell and
27458 Silvermont, then you should use this option.
27459
27460 As new Intel processors are deployed in the marketplace, the behavior of
27461 this option will change. Therefore, if you upgrade to a newer version of
27462 GCC, code generation controlled by this option will change to reflect
27463 the most current Intel processors at the time that version of GCC is
27464 released.
27465
27466 There is no @option{-march=intel} option because @option{-march} indicates
27467 the instruction set the compiler can use, and there is no common
27468 instruction set applicable to all processors. In contrast,
27469 @option{-mtune} indicates the processor (or, in this case, collection of
27470 processors) for which the code is optimized.
27471 @end table
27472
27473 @item -mcpu=@var{cpu-type}
27474 @opindex mcpu
27475 A deprecated synonym for @option{-mtune}.
27476
27477 @item -mfpmath=@var{unit}
27478 @opindex mfpmath
27479 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27480 for @var{unit} are:
27481
27482 @table @samp
27483 @item 387
27484 Use the standard 387 floating-point coprocessor present on the majority of chips and
27485 emulated otherwise. Code compiled with this option runs almost everywhere.
27486 The temporary results are computed in 80-bit precision instead of the precision
27487 specified by the type, resulting in slightly different results compared to most
27488 of other chips. See @option{-ffloat-store} for more detailed description.
27489
27490 This is the default choice for non-Darwin x86-32 targets.
27491
27492 @item sse
27493 Use scalar floating-point instructions present in the SSE instruction set.
27494 This instruction set is supported by Pentium III and newer chips,
27495 and in the AMD line
27496 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27497 instruction set supports only single-precision arithmetic, thus the double and
27498 extended-precision arithmetic are still done using 387. A later version, present
27499 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27500 arithmetic too.
27501
27502 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27503 or @option{-msse2} switches to enable SSE extensions and make this option
27504 effective. For the x86-64 compiler, these extensions are enabled by default.
27505
27506 The resulting code should be considerably faster in the majority of cases and avoid
27507 the numerical instability problems of 387 code, but may break some existing
27508 code that expects temporaries to be 80 bits.
27509
27510 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27511 and the default choice for x86-32 targets with the SSE2 instruction set
27512 when @option{-ffast-math} is enabled.
27513
27514 @item sse,387
27515 @itemx sse+387
27516 @itemx both
27517 Attempt to utilize both instruction sets at once. This effectively doubles the
27518 amount of available registers, and on chips with separate execution units for
27519 387 and SSE the execution resources too. Use this option with care, as it is
27520 still experimental, because the GCC register allocator does not model separate
27521 functional units well, resulting in unstable performance.
27522 @end table
27523
27524 @item -masm=@var{dialect}
27525 @opindex masm=@var{dialect}
27526 Output assembly instructions using selected @var{dialect}. Also affects
27527 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27528 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27529 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27530 not support @samp{intel}.
27531
27532 @item -mieee-fp
27533 @itemx -mno-ieee-fp
27534 @opindex mieee-fp
27535 @opindex mno-ieee-fp
27536 Control whether or not the compiler uses IEEE floating-point
27537 comparisons. These correctly handle the case where the result of a
27538 comparison is unordered.
27539
27540 @item -m80387
27541 @itemx -mhard-float
27542 @opindex 80387
27543 @opindex mhard-float
27544 Generate output containing 80387 instructions for floating point.
27545
27546 @item -mno-80387
27547 @itemx -msoft-float
27548 @opindex no-80387
27549 @opindex msoft-float
27550 Generate output containing library calls for floating point.
27551
27552 @strong{Warning:} the requisite libraries are not part of GCC@.
27553 Normally the facilities of the machine's usual C compiler are used, but
27554 this cannot be done directly in cross-compilation. You must make your
27555 own arrangements to provide suitable library functions for
27556 cross-compilation.
27557
27558 On machines where a function returns floating-point results in the 80387
27559 register stack, some floating-point opcodes may be emitted even if
27560 @option{-msoft-float} is used.
27561
27562 @item -mno-fp-ret-in-387
27563 @opindex mno-fp-ret-in-387
27564 Do not use the FPU registers for return values of functions.
27565
27566 The usual calling convention has functions return values of types
27567 @code{float} and @code{double} in an FPU register, even if there
27568 is no FPU@. The idea is that the operating system should emulate
27569 an FPU@.
27570
27571 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27572 in ordinary CPU registers instead.
27573
27574 @item -mno-fancy-math-387
27575 @opindex mno-fancy-math-387
27576 Some 387 emulators do not support the @code{sin}, @code{cos} and
27577 @code{sqrt} instructions for the 387. Specify this option to avoid
27578 generating those instructions.
27579 This option is overridden when @option{-march}
27580 indicates that the target CPU always has an FPU and so the
27581 instruction does not need emulation. These
27582 instructions are not generated unless you also use the
27583 @option{-funsafe-math-optimizations} switch.
27584
27585 @item -malign-double
27586 @itemx -mno-align-double
27587 @opindex malign-double
27588 @opindex mno-align-double
27589 Control whether GCC aligns @code{double}, @code{long double}, and
27590 @code{long long} variables on a two-word boundary or a one-word
27591 boundary. Aligning @code{double} variables on a two-word boundary
27592 produces code that runs somewhat faster on a Pentium at the
27593 expense of more memory.
27594
27595 On x86-64, @option{-malign-double} is enabled by default.
27596
27597 @strong{Warning:} if you use the @option{-malign-double} switch,
27598 structures containing the above types are aligned differently than
27599 the published application binary interface specifications for the x86-32
27600 and are not binary compatible with structures in code compiled
27601 without that switch.
27602
27603 @item -m96bit-long-double
27604 @itemx -m128bit-long-double
27605 @opindex m96bit-long-double
27606 @opindex m128bit-long-double
27607 These switches control the size of @code{long double} type. The x86-32
27608 application binary interface specifies the size to be 96 bits,
27609 so @option{-m96bit-long-double} is the default in 32-bit mode.
27610
27611 Modern architectures (Pentium and newer) prefer @code{long double}
27612 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27613 conforming to the ABI, this is not possible. So specifying
27614 @option{-m128bit-long-double} aligns @code{long double}
27615 to a 16-byte boundary by padding the @code{long double} with an additional
27616 32-bit zero.
27617
27618 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27619 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27620
27621 Notice that neither of these options enable any extra precision over the x87
27622 standard of 80 bits for a @code{long double}.
27623
27624 @strong{Warning:} if you override the default value for your target ABI, this
27625 changes the size of
27626 structures and arrays containing @code{long double} variables,
27627 as well as modifying the function calling convention for functions taking
27628 @code{long double}. Hence they are not binary-compatible
27629 with code compiled without that switch.
27630
27631 @item -mlong-double-64
27632 @itemx -mlong-double-80
27633 @itemx -mlong-double-128
27634 @opindex mlong-double-64
27635 @opindex mlong-double-80
27636 @opindex mlong-double-128
27637 These switches control the size of @code{long double} type. A size
27638 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27639 type. This is the default for 32-bit Bionic C library. A size
27640 of 128 bits makes the @code{long double} type equivalent to the
27641 @code{__float128} type. This is the default for 64-bit Bionic C library.
27642
27643 @strong{Warning:} if you override the default value for your target ABI, this
27644 changes the size of
27645 structures and arrays containing @code{long double} variables,
27646 as well as modifying the function calling convention for functions taking
27647 @code{long double}. Hence they are not binary-compatible
27648 with code compiled without that switch.
27649
27650 @item -malign-data=@var{type}
27651 @opindex malign-data
27652 Control how GCC aligns variables. Supported values for @var{type} are
27653 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27654 and earlier, @samp{abi} uses alignment value as specified by the
27655 psABI, and @samp{cacheline} uses increased alignment value to match
27656 the cache line size. @samp{compat} is the default.
27657
27658 @item -mlarge-data-threshold=@var{threshold}
27659 @opindex mlarge-data-threshold
27660 When @option{-mcmodel=medium} is specified, data objects larger than
27661 @var{threshold} are placed in the large data section. This value must be the
27662 same across all objects linked into the binary, and defaults to 65535.
27663
27664 @item -mrtd
27665 @opindex mrtd
27666 Use a different function-calling convention, in which functions that
27667 take a fixed number of arguments return with the @code{ret @var{num}}
27668 instruction, which pops their arguments while returning. This saves one
27669 instruction in the caller since there is no need to pop the arguments
27670 there.
27671
27672 You can specify that an individual function is called with this calling
27673 sequence with the function attribute @code{stdcall}. You can also
27674 override the @option{-mrtd} option by using the function attribute
27675 @code{cdecl}. @xref{Function Attributes}.
27676
27677 @strong{Warning:} this calling convention is incompatible with the one
27678 normally used on Unix, so you cannot use it if you need to call
27679 libraries compiled with the Unix compiler.
27680
27681 Also, you must provide function prototypes for all functions that
27682 take variable numbers of arguments (including @code{printf});
27683 otherwise incorrect code is generated for calls to those
27684 functions.
27685
27686 In addition, seriously incorrect code results if you call a
27687 function with too many arguments. (Normally, extra arguments are
27688 harmlessly ignored.)
27689
27690 @item -mregparm=@var{num}
27691 @opindex mregparm
27692 Control how many registers are used to pass integer arguments. By
27693 default, no registers are used to pass arguments, and at most 3
27694 registers can be used. You can control this behavior for a specific
27695 function by using the function attribute @code{regparm}.
27696 @xref{Function Attributes}.
27697
27698 @strong{Warning:} if you use this switch, and
27699 @var{num} is nonzero, then you must build all modules with the same
27700 value, including any libraries. This includes the system libraries and
27701 startup modules.
27702
27703 @item -msseregparm
27704 @opindex msseregparm
27705 Use SSE register passing conventions for float and double arguments
27706 and return values. You can control this behavior for a specific
27707 function by using the function attribute @code{sseregparm}.
27708 @xref{Function Attributes}.
27709
27710 @strong{Warning:} if you use this switch then you must build all
27711 modules with the same value, including any libraries. This includes
27712 the system libraries and startup modules.
27713
27714 @item -mvect8-ret-in-mem
27715 @opindex mvect8-ret-in-mem
27716 Return 8-byte vectors in memory instead of MMX registers. This is the
27717 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27718 Studio compilers until version 12. Later compiler versions (starting
27719 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27720 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27721 you need to remain compatible with existing code produced by those
27722 previous compiler versions or older versions of GCC@.
27723
27724 @item -mpc32
27725 @itemx -mpc64
27726 @itemx -mpc80
27727 @opindex mpc32
27728 @opindex mpc64
27729 @opindex mpc80
27730
27731 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27732 is specified, the significands of results of floating-point operations are
27733 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27734 significands of results of floating-point operations to 53 bits (double
27735 precision) and @option{-mpc80} rounds the significands of results of
27736 floating-point operations to 64 bits (extended double precision), which is
27737 the default. When this option is used, floating-point operations in higher
27738 precisions are not available to the programmer without setting the FPU
27739 control word explicitly.
27740
27741 Setting the rounding of floating-point operations to less than the default
27742 80 bits can speed some programs by 2% or more. Note that some mathematical
27743 libraries assume that extended-precision (80-bit) floating-point operations
27744 are enabled by default; routines in such libraries could suffer significant
27745 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27746 when this option is used to set the precision to less than extended precision.
27747
27748 @item -mstackrealign
27749 @opindex mstackrealign
27750 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27751 option generates an alternate prologue and epilogue that realigns the
27752 run-time stack if necessary. This supports mixing legacy codes that keep
27753 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27754 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27755 applicable to individual functions.
27756
27757 @item -mpreferred-stack-boundary=@var{num}
27758 @opindex mpreferred-stack-boundary
27759 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27760 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27761 the default is 4 (16 bytes or 128 bits).
27762
27763 @strong{Warning:} When generating code for the x86-64 architecture with
27764 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27765 used to keep the stack boundary aligned to 8 byte boundary. Since
27766 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27767 intended to be used in controlled environment where stack space is
27768 important limitation. This option leads to wrong code when functions
27769 compiled with 16 byte stack alignment (such as functions from a standard
27770 library) are called with misaligned stack. In this case, SSE
27771 instructions may lead to misaligned memory access traps. In addition,
27772 variable arguments are handled incorrectly for 16 byte aligned
27773 objects (including x87 long double and __int128), leading to wrong
27774 results. You must build all modules with
27775 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27776 includes the system libraries and startup modules.
27777
27778 @item -mincoming-stack-boundary=@var{num}
27779 @opindex mincoming-stack-boundary
27780 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27781 boundary. If @option{-mincoming-stack-boundary} is not specified,
27782 the one specified by @option{-mpreferred-stack-boundary} is used.
27783
27784 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27785 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27786 suffer significant run time performance penalties. On Pentium III, the
27787 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27788 properly if it is not 16-byte aligned.
27789
27790 To ensure proper alignment of this values on the stack, the stack boundary
27791 must be as aligned as that required by any value stored on the stack.
27792 Further, every function must be generated such that it keeps the stack
27793 aligned. Thus calling a function compiled with a higher preferred
27794 stack boundary from a function compiled with a lower preferred stack
27795 boundary most likely misaligns the stack. It is recommended that
27796 libraries that use callbacks always use the default setting.
27797
27798 This extra alignment does consume extra stack space, and generally
27799 increases code size. Code that is sensitive to stack space usage, such
27800 as embedded systems and operating system kernels, may want to reduce the
27801 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27802
27803 @need 200
27804 @item -mmmx
27805 @opindex mmmx
27806 @need 200
27807 @itemx -msse
27808 @opindex msse
27809 @need 200
27810 @itemx -msse2
27811 @opindex msse2
27812 @need 200
27813 @itemx -msse3
27814 @opindex msse3
27815 @need 200
27816 @itemx -mssse3
27817 @opindex mssse3
27818 @need 200
27819 @itemx -msse4
27820 @opindex msse4
27821 @need 200
27822 @itemx -msse4a
27823 @opindex msse4a
27824 @need 200
27825 @itemx -msse4.1
27826 @opindex msse4.1
27827 @need 200
27828 @itemx -msse4.2
27829 @opindex msse4.2
27830 @need 200
27831 @itemx -mavx
27832 @opindex mavx
27833 @need 200
27834 @itemx -mavx2
27835 @opindex mavx2
27836 @need 200
27837 @itemx -mavx512f
27838 @opindex mavx512f
27839 @need 200
27840 @itemx -mavx512pf
27841 @opindex mavx512pf
27842 @need 200
27843 @itemx -mavx512er
27844 @opindex mavx512er
27845 @need 200
27846 @itemx -mavx512cd
27847 @opindex mavx512cd
27848 @need 200
27849 @itemx -mavx512vl
27850 @opindex mavx512vl
27851 @need 200
27852 @itemx -mavx512bw
27853 @opindex mavx512bw
27854 @need 200
27855 @itemx -mavx512dq
27856 @opindex mavx512dq
27857 @need 200
27858 @itemx -mavx512ifma
27859 @opindex mavx512ifma
27860 @need 200
27861 @itemx -mavx512vbmi
27862 @opindex mavx512vbmi
27863 @need 200
27864 @itemx -msha
27865 @opindex msha
27866 @need 200
27867 @itemx -maes
27868 @opindex maes
27869 @need 200
27870 @itemx -mpclmul
27871 @opindex mpclmul
27872 @need 200
27873 @itemx -mclflushopt
27874 @opindex mclflushopt
27875 @need 200
27876 @itemx -mfsgsbase
27877 @opindex mfsgsbase
27878 @need 200
27879 @itemx -mrdrnd
27880 @opindex mrdrnd
27881 @need 200
27882 @itemx -mf16c
27883 @opindex mf16c
27884 @need 200
27885 @itemx -mfma
27886 @opindex mfma
27887 @need 200
27888 @itemx -mpconfig
27889 @opindex mpconfig
27890 @need 200
27891 @itemx -mwbnoinvd
27892 @opindex mwbnoinvd
27893 @need 200
27894 @itemx -mfma4
27895 @opindex mfma4
27896 @need 200
27897 @itemx -mprefetchwt1
27898 @opindex mprefetchwt1
27899 @need 200
27900 @itemx -mxop
27901 @opindex mxop
27902 @need 200
27903 @itemx -mlwp
27904 @opindex mlwp
27905 @need 200
27906 @itemx -m3dnow
27907 @opindex m3dnow
27908 @need 200
27909 @itemx -m3dnowa
27910 @opindex m3dnowa
27911 @need 200
27912 @itemx -mpopcnt
27913 @opindex mpopcnt
27914 @need 200
27915 @itemx -mabm
27916 @opindex mabm
27917 @need 200
27918 @itemx -mbmi
27919 @opindex mbmi
27920 @need 200
27921 @itemx -mbmi2
27922 @need 200
27923 @itemx -mlzcnt
27924 @opindex mlzcnt
27925 @need 200
27926 @itemx -mfxsr
27927 @opindex mfxsr
27928 @need 200
27929 @itemx -mxsave
27930 @opindex mxsave
27931 @need 200
27932 @itemx -mxsaveopt
27933 @opindex mxsaveopt
27934 @need 200
27935 @itemx -mxsavec
27936 @opindex mxsavec
27937 @need 200
27938 @itemx -mxsaves
27939 @opindex mxsaves
27940 @need 200
27941 @itemx -mrtm
27942 @opindex mrtm
27943 @need 200
27944 @itemx -mtbm
27945 @opindex mtbm
27946 @need 200
27947 @itemx -mmwaitx
27948 @opindex mmwaitx
27949 @need 200
27950 @itemx -mclzero
27951 @opindex mclzero
27952 @need 200
27953 @itemx -mpku
27954 @opindex mpku
27955 @need 200
27956 @itemx -mavx512vbmi2
27957 @opindex mavx512vbmi2
27958 @need 200
27959 @itemx -mgfni
27960 @opindex mgfni
27961 @need 200
27962 @itemx -mvaes
27963 @opindex mvaes
27964 @need 200
27965 @itemx -mwaitpkg
27966 @opindex mwaitpkg
27967 @need 200
27968 @itemx -mvpclmulqdq
27969 @opindex mvpclmulqdq
27970 @need 200
27971 @itemx -mavx512bitalg
27972 @opindex mavx512bitalg
27973 @need 200
27974 @itemx -mmovdiri
27975 @opindex mmovdiri
27976 @need 200
27977 @itemx -mmovdir64b
27978 @opindex mmovdir64b
27979 @need 200
27980 @itemx -mavx512vpopcntdq
27981 @opindex mavx512vpopcntdq
27982 @need 200
27983 @itemx -mcldemote
27984 @opindex mcldemote
27985 These switches enable the use of instructions in the MMX, SSE,
27986 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27987 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
27988 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
27989 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
27990 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
27991 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
27992 sets. Each has a corresponding @option{-mno-} option to disable use of these
27993 instructions.
27994
27995 These extensions are also available as built-in functions: see
27996 @ref{x86 Built-in Functions}, for details of the functions enabled and
27997 disabled by these switches.
27998
27999 To generate SSE/SSE2 instructions automatically from floating-point
28000 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28001
28002 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28003 generates new AVX instructions or AVX equivalence for all SSEx instructions
28004 when needed.
28005
28006 These options enable GCC to use these extended instructions in
28007 generated code, even without @option{-mfpmath=sse}. Applications that
28008 perform run-time CPU detection must compile separate files for each
28009 supported architecture, using the appropriate flags. In particular,
28010 the file containing the CPU detection code should be compiled without
28011 these options.
28012
28013 @item -mdump-tune-features
28014 @opindex mdump-tune-features
28015 This option instructs GCC to dump the names of the x86 performance
28016 tuning features and default settings. The names can be used in
28017 @option{-mtune-ctrl=@var{feature-list}}.
28018
28019 @item -mtune-ctrl=@var{feature-list}
28020 @opindex mtune-ctrl=@var{feature-list}
28021 This option is used to do fine grain control of x86 code generation features.
28022 @var{feature-list} is a comma separated list of @var{feature} names. See also
28023 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28024 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28025 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28026 developers. Using it may lead to code paths not covered by testing and can
28027 potentially result in compiler ICEs or runtime errors.
28028
28029 @item -mno-default
28030 @opindex mno-default
28031 This option instructs GCC to turn off all tunable features. See also
28032 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28033
28034 @item -mcld
28035 @opindex mcld
28036 This option instructs GCC to emit a @code{cld} instruction in the prologue
28037 of functions that use string instructions. String instructions depend on
28038 the DF flag to select between autoincrement or autodecrement mode. While the
28039 ABI specifies the DF flag to be cleared on function entry, some operating
28040 systems violate this specification by not clearing the DF flag in their
28041 exception dispatchers. The exception handler can be invoked with the DF flag
28042 set, which leads to wrong direction mode when string instructions are used.
28043 This option can be enabled by default on 32-bit x86 targets by configuring
28044 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28045 instructions can be suppressed with the @option{-mno-cld} compiler option
28046 in this case.
28047
28048 @item -mvzeroupper
28049 @opindex mvzeroupper
28050 This option instructs GCC to emit a @code{vzeroupper} instruction
28051 before a transfer of control flow out of the function to minimize
28052 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28053 intrinsics.
28054
28055 @item -mprefer-avx128
28056 @opindex mprefer-avx128
28057 This option instructs GCC to use 128-bit AVX instructions instead of
28058 256-bit AVX instructions in the auto-vectorizer.
28059
28060 @item -mprefer-vector-width=@var{opt}
28061 @opindex mprefer-vector-width
28062 This option instructs GCC to use @var{opt}-bit vector width in instructions
28063 instead of default on the selected platform.
28064
28065 @table @samp
28066 @item none
28067 No extra limitations applied to GCC other than defined by the selected platform.
28068
28069 @item 128
28070 Prefer 128-bit vector width for instructions.
28071
28072 @item 256
28073 Prefer 256-bit vector width for instructions.
28074
28075 @item 512
28076 Prefer 512-bit vector width for instructions.
28077 @end table
28078
28079 @item -mcx16
28080 @opindex mcx16
28081 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28082 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28083 objects. This is useful for atomic updates of data structures exceeding one
28084 machine word in size. The compiler uses this instruction to implement
28085 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28086 128-bit integers, a library call is always used.
28087
28088 @item -msahf
28089 @opindex msahf
28090 This option enables generation of @code{SAHF} instructions in 64-bit code.
28091 Early Intel Pentium 4 CPUs with Intel 64 support,
28092 prior to the introduction of Pentium 4 G1 step in December 2005,
28093 lacked the @code{LAHF} and @code{SAHF} instructions
28094 which are supported by AMD64.
28095 These are load and store instructions, respectively, for certain status flags.
28096 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28097 @code{drem}, and @code{remainder} built-in functions;
28098 see @ref{Other Builtins} for details.
28099
28100 @item -mmovbe
28101 @opindex mmovbe
28102 This option enables use of the @code{movbe} instruction to implement
28103 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28104
28105 @item -mshstk
28106 @opindex mshstk
28107 The @option{-mshstk} option enables shadow stack built-in functions
28108 from x86 Control-flow Enforcement Technology (CET).
28109
28110 @item -mcrc32
28111 @opindex mcrc32
28112 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28113 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28114 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28115
28116 @item -mrecip
28117 @opindex mrecip
28118 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28119 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28120 with an additional Newton-Raphson step
28121 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28122 (and their vectorized
28123 variants) for single-precision floating-point arguments. These instructions
28124 are generated only when @option{-funsafe-math-optimizations} is enabled
28125 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28126 Note that while the throughput of the sequence is higher than the throughput
28127 of the non-reciprocal instruction, the precision of the sequence can be
28128 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28129
28130 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28131 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28132 combination), and doesn't need @option{-mrecip}.
28133
28134 Also note that GCC emits the above sequence with additional Newton-Raphson step
28135 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28136 already with @option{-ffast-math} (or the above option combination), and
28137 doesn't need @option{-mrecip}.
28138
28139 @item -mrecip=@var{opt}
28140 @opindex mrecip=opt
28141 This option controls which reciprocal estimate instructions
28142 may be used. @var{opt} is a comma-separated list of options, which may
28143 be preceded by a @samp{!} to invert the option:
28144
28145 @table @samp
28146 @item all
28147 Enable all estimate instructions.
28148
28149 @item default
28150 Enable the default instructions, equivalent to @option{-mrecip}.
28151
28152 @item none
28153 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28154
28155 @item div
28156 Enable the approximation for scalar division.
28157
28158 @item vec-div
28159 Enable the approximation for vectorized division.
28160
28161 @item sqrt
28162 Enable the approximation for scalar square root.
28163
28164 @item vec-sqrt
28165 Enable the approximation for vectorized square root.
28166 @end table
28167
28168 So, for example, @option{-mrecip=all,!sqrt} enables
28169 all of the reciprocal approximations, except for square root.
28170
28171 @item -mveclibabi=@var{type}
28172 @opindex mveclibabi
28173 Specifies the ABI type to use for vectorizing intrinsics using an
28174 external library. Supported values for @var{type} are @samp{svml}
28175 for the Intel short
28176 vector math library and @samp{acml} for the AMD math core library.
28177 To use this option, both @option{-ftree-vectorize} and
28178 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28179 ABI-compatible library must be specified at link time.
28180
28181 GCC currently emits calls to @code{vmldExp2},
28182 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28183 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28184 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28185 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28186 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28187 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28188 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28189 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28190 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28191 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28192 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28193 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28194 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28195 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28196 when @option{-mveclibabi=acml} is used.
28197
28198 @item -mabi=@var{name}
28199 @opindex mabi
28200 Generate code for the specified calling convention. Permissible values
28201 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28202 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28203 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28204 You can control this behavior for specific functions by
28205 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28206 @xref{Function Attributes}.
28207
28208 @item -mforce-indirect-call
28209 @opindex mforce-indirect-call
28210 Force all calls to functions to be indirect. This is useful
28211 when using Intel Processor Trace where it generates more precise timing
28212 information for function calls.
28213
28214 @item -mcall-ms2sysv-xlogues
28215 @opindex mcall-ms2sysv-xlogues
28216 @opindex mno-call-ms2sysv-xlogues
28217 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28218 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28219 default, the code for saving and restoring these registers is emitted inline,
28220 resulting in fairly lengthy prologues and epilogues. Using
28221 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28222 use stubs in the static portion of libgcc to perform these saves and restores,
28223 thus reducing function size at the cost of a few extra instructions.
28224
28225 @item -mtls-dialect=@var{type}
28226 @opindex mtls-dialect
28227 Generate code to access thread-local storage using the @samp{gnu} or
28228 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28229 @samp{gnu2} is more efficient, but it may add compile- and run-time
28230 requirements that cannot be satisfied on all systems.
28231
28232 @item -mpush-args
28233 @itemx -mno-push-args
28234 @opindex mpush-args
28235 @opindex mno-push-args
28236 Use PUSH operations to store outgoing parameters. This method is shorter
28237 and usually equally fast as method using SUB/MOV operations and is enabled
28238 by default. In some cases disabling it may improve performance because of
28239 improved scheduling and reduced dependencies.
28240
28241 @item -maccumulate-outgoing-args
28242 @opindex maccumulate-outgoing-args
28243 If enabled, the maximum amount of space required for outgoing arguments is
28244 computed in the function prologue. This is faster on most modern CPUs
28245 because of reduced dependencies, improved scheduling and reduced stack usage
28246 when the preferred stack boundary is not equal to 2. The drawback is a notable
28247 increase in code size. This switch implies @option{-mno-push-args}.
28248
28249 @item -mthreads
28250 @opindex mthreads
28251 Support thread-safe exception handling on MinGW. Programs that rely
28252 on thread-safe exception handling must compile and link all code with the
28253 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28254 @option{-D_MT}; when linking, it links in a special thread helper library
28255 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28256
28257 @item -mms-bitfields
28258 @itemx -mno-ms-bitfields
28259 @opindex mms-bitfields
28260 @opindex mno-ms-bitfields
28261
28262 Enable/disable bit-field layout compatible with the native Microsoft
28263 Windows compiler.
28264
28265 If @code{packed} is used on a structure, or if bit-fields are used,
28266 it may be that the Microsoft ABI lays out the structure differently
28267 than the way GCC normally does. Particularly when moving packed
28268 data between functions compiled with GCC and the native Microsoft compiler
28269 (either via function call or as data in a file), it may be necessary to access
28270 either format.
28271
28272 This option is enabled by default for Microsoft Windows
28273 targets. This behavior can also be controlled locally by use of variable
28274 or type attributes. For more information, see @ref{x86 Variable Attributes}
28275 and @ref{x86 Type Attributes}.
28276
28277 The Microsoft structure layout algorithm is fairly simple with the exception
28278 of the bit-field packing.
28279 The padding and alignment of members of structures and whether a bit-field
28280 can straddle a storage-unit boundary are determine by these rules:
28281
28282 @enumerate
28283 @item Structure members are stored sequentially in the order in which they are
28284 declared: the first member has the lowest memory address and the last member
28285 the highest.
28286
28287 @item Every data object has an alignment requirement. The alignment requirement
28288 for all data except structures, unions, and arrays is either the size of the
28289 object or the current packing size (specified with either the
28290 @code{aligned} attribute or the @code{pack} pragma),
28291 whichever is less. For structures, unions, and arrays,
28292 the alignment requirement is the largest alignment requirement of its members.
28293 Every object is allocated an offset so that:
28294
28295 @smallexample
28296 offset % alignment_requirement == 0
28297 @end smallexample
28298
28299 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28300 unit if the integral types are the same size and if the next bit-field fits
28301 into the current allocation unit without crossing the boundary imposed by the
28302 common alignment requirements of the bit-fields.
28303 @end enumerate
28304
28305 MSVC interprets zero-length bit-fields in the following ways:
28306
28307 @enumerate
28308 @item If a zero-length bit-field is inserted between two bit-fields that
28309 are normally coalesced, the bit-fields are not coalesced.
28310
28311 For example:
28312
28313 @smallexample
28314 struct
28315 @{
28316 unsigned long bf_1 : 12;
28317 unsigned long : 0;
28318 unsigned long bf_2 : 12;
28319 @} t1;
28320 @end smallexample
28321
28322 @noindent
28323 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28324 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28325
28326 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28327 alignment of the zero-length bit-field is greater than the member that follows it,
28328 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28329
28330 For example:
28331
28332 @smallexample
28333 struct
28334 @{
28335 char foo : 4;
28336 short : 0;
28337 char bar;
28338 @} t2;
28339
28340 struct
28341 @{
28342 char foo : 4;
28343 short : 0;
28344 double bar;
28345 @} t3;
28346 @end smallexample
28347
28348 @noindent
28349 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28350 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28351 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28352 of the structure.
28353
28354 Taking this into account, it is important to note the following:
28355
28356 @enumerate
28357 @item If a zero-length bit-field follows a normal bit-field, the type of the
28358 zero-length bit-field may affect the alignment of the structure as whole. For
28359 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28360 normal bit-field, and is of type short.
28361
28362 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28363 still affect the alignment of the structure:
28364
28365 @smallexample
28366 struct
28367 @{
28368 char foo : 6;
28369 long : 0;
28370 @} t4;
28371 @end smallexample
28372
28373 @noindent
28374 Here, @code{t4} takes up 4 bytes.
28375 @end enumerate
28376
28377 @item Zero-length bit-fields following non-bit-field members are ignored:
28378
28379 @smallexample
28380 struct
28381 @{
28382 char foo;
28383 long : 0;
28384 char bar;
28385 @} t5;
28386 @end smallexample
28387
28388 @noindent
28389 Here, @code{t5} takes up 2 bytes.
28390 @end enumerate
28391
28392
28393 @item -mno-align-stringops
28394 @opindex mno-align-stringops
28395 Do not align the destination of inlined string operations. This switch reduces
28396 code size and improves performance in case the destination is already aligned,
28397 but GCC doesn't know about it.
28398
28399 @item -minline-all-stringops
28400 @opindex minline-all-stringops
28401 By default GCC inlines string operations only when the destination is
28402 known to be aligned to least a 4-byte boundary.
28403 This enables more inlining and increases code
28404 size, but may improve performance of code that depends on fast
28405 @code{memcpy}, @code{strlen},
28406 and @code{memset} for short lengths.
28407
28408 @item -minline-stringops-dynamically
28409 @opindex minline-stringops-dynamically
28410 For string operations of unknown size, use run-time checks with
28411 inline code for small blocks and a library call for large blocks.
28412
28413 @item -mstringop-strategy=@var{alg}
28414 @opindex mstringop-strategy=@var{alg}
28415 Override the internal decision heuristic for the particular algorithm to use
28416 for inlining string operations. The allowed values for @var{alg} are:
28417
28418 @table @samp
28419 @item rep_byte
28420 @itemx rep_4byte
28421 @itemx rep_8byte
28422 Expand using i386 @code{rep} prefix of the specified size.
28423
28424 @item byte_loop
28425 @itemx loop
28426 @itemx unrolled_loop
28427 Expand into an inline loop.
28428
28429 @item libcall
28430 Always use a library call.
28431 @end table
28432
28433 @item -mmemcpy-strategy=@var{strategy}
28434 @opindex mmemcpy-strategy=@var{strategy}
28435 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28436 should be inlined and what inline algorithm to use when the expected size
28437 of the copy operation is known. @var{strategy}
28438 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28439 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28440 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28441 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28442 in the list must be specified in increasing order. The minimal byte size for
28443 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28444 preceding range.
28445
28446 @item -mmemset-strategy=@var{strategy}
28447 @opindex mmemset-strategy=@var{strategy}
28448 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28449 @code{__builtin_memset} expansion.
28450
28451 @item -momit-leaf-frame-pointer
28452 @opindex momit-leaf-frame-pointer
28453 Don't keep the frame pointer in a register for leaf functions. This
28454 avoids the instructions to save, set up, and restore frame pointers and
28455 makes an extra register available in leaf functions. The option
28456 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28457 which might make debugging harder.
28458
28459 @item -mtls-direct-seg-refs
28460 @itemx -mno-tls-direct-seg-refs
28461 @opindex mtls-direct-seg-refs
28462 Controls whether TLS variables may be accessed with offsets from the
28463 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28464 or whether the thread base pointer must be added. Whether or not this
28465 is valid depends on the operating system, and whether it maps the
28466 segment to cover the entire TLS area.
28467
28468 For systems that use the GNU C Library, the default is on.
28469
28470 @item -msse2avx
28471 @itemx -mno-sse2avx
28472 @opindex msse2avx
28473 Specify that the assembler should encode SSE instructions with VEX
28474 prefix. The option @option{-mavx} turns this on by default.
28475
28476 @item -mfentry
28477 @itemx -mno-fentry
28478 @opindex mfentry
28479 If profiling is active (@option{-pg}), put the profiling
28480 counter call before the prologue.
28481 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28482 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28483
28484 @item -mrecord-mcount
28485 @itemx -mno-record-mcount
28486 @opindex mrecord-mcount
28487 If profiling is active (@option{-pg}), generate a __mcount_loc section
28488 that contains pointers to each profiling call. This is useful for
28489 automatically patching and out calls.
28490
28491 @item -mnop-mcount
28492 @itemx -mno-nop-mcount
28493 @opindex mnop-mcount
28494 If profiling is active (@option{-pg}), generate the calls to
28495 the profiling functions as NOPs. This is useful when they
28496 should be patched in later dynamically. This is likely only
28497 useful together with @option{-mrecord-mcount}.
28498
28499 @item -mskip-rax-setup
28500 @itemx -mno-skip-rax-setup
28501 @opindex mskip-rax-setup
28502 When generating code for the x86-64 architecture with SSE extensions
28503 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28504 register when there are no variable arguments passed in vector registers.
28505
28506 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28507 saving vector registers on stack when passing variable arguments, the
28508 impacts of this option are callees may waste some stack space,
28509 misbehave or jump to a random location. GCC 4.4 or newer don't have
28510 those issues, regardless the RAX register value.
28511
28512 @item -m8bit-idiv
28513 @itemx -mno-8bit-idiv
28514 @opindex m8bit-idiv
28515 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28516 much faster than 32-bit/64-bit integer divide. This option generates a
28517 run-time check. If both dividend and divisor are within range of 0
28518 to 255, 8-bit unsigned integer divide is used instead of
28519 32-bit/64-bit integer divide.
28520
28521 @item -mavx256-split-unaligned-load
28522 @itemx -mavx256-split-unaligned-store
28523 @opindex mavx256-split-unaligned-load
28524 @opindex mavx256-split-unaligned-store
28525 Split 32-byte AVX unaligned load and store.
28526
28527 @item -mstack-protector-guard=@var{guard}
28528 @itemx -mstack-protector-guard-reg=@var{reg}
28529 @itemx -mstack-protector-guard-offset=@var{offset}
28530 @opindex mstack-protector-guard
28531 @opindex mstack-protector-guard-reg
28532 @opindex mstack-protector-guard-offset
28533 Generate stack protection code using canary at @var{guard}. Supported
28534 locations are @samp{global} for global canary or @samp{tls} for per-thread
28535 canary in the TLS block (the default). This option has effect only when
28536 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28537
28538 With the latter choice the options
28539 @option{-mstack-protector-guard-reg=@var{reg}} and
28540 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28541 which segment register (@code{%fs} or @code{%gs}) to use as base register
28542 for reading the canary, and from what offset from that base register.
28543 The default for those is as specified in the relevant ABI.
28544
28545 @item -mgeneral-regs-only
28546 @opindex mgeneral-regs-only
28547 Generate code that uses only the general-purpose registers. This
28548 prevents the compiler from using floating-point, vector, mask and bound
28549 registers.
28550
28551 @item -mindirect-branch=@var{choice}
28552 @opindex mindirect-branch
28553 Convert indirect call and jump with @var{choice}. The default is
28554 @samp{keep}, which keeps indirect call and jump unmodified.
28555 @samp{thunk} converts indirect call and jump to call and return thunk.
28556 @samp{thunk-inline} converts indirect call and jump to inlined call
28557 and return thunk. @samp{thunk-extern} converts indirect call and jump
28558 to external call and return thunk provided in a separate object file.
28559 You can control this behavior for a specific function by using the
28560 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28561
28562 Note that @option{-mcmodel=large} is incompatible with
28563 @option{-mindirect-branch=thunk} and
28564 @option{-mindirect-branch=thunk-extern} since the thunk function may
28565 not be reachable in the large code model.
28566
28567 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28568 @option{-fcf-protection=branch} since the external thunk can not be modified
28569 to disable control-flow check.
28570
28571 @item -mfunction-return=@var{choice}
28572 @opindex mfunction-return
28573 Convert function return with @var{choice}. The default is @samp{keep},
28574 which keeps function return unmodified. @samp{thunk} converts function
28575 return to call and return thunk. @samp{thunk-inline} converts function
28576 return to inlined call and return thunk. @samp{thunk-extern} converts
28577 function return to external call and return thunk provided in a separate
28578 object file. You can control this behavior for a specific function by
28579 using the function attribute @code{function_return}.
28580 @xref{Function Attributes}.
28581
28582 Note that @option{-mcmodel=large} is incompatible with
28583 @option{-mfunction-return=thunk} and
28584 @option{-mfunction-return=thunk-extern} since the thunk function may
28585 not be reachable in the large code model.
28586
28587
28588 @item -mindirect-branch-register
28589 @opindex mindirect-branch-register
28590 Force indirect call and jump via register.
28591
28592 @end table
28593
28594 These @samp{-m} switches are supported in addition to the above
28595 on x86-64 processors in 64-bit environments.
28596
28597 @table @gcctabopt
28598 @item -m32
28599 @itemx -m64
28600 @itemx -mx32
28601 @itemx -m16
28602 @itemx -miamcu
28603 @opindex m32
28604 @opindex m64
28605 @opindex mx32
28606 @opindex m16
28607 @opindex miamcu
28608 Generate code for a 16-bit, 32-bit or 64-bit environment.
28609 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28610 to 32 bits, and
28611 generates code that runs on any i386 system.
28612
28613 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28614 types to 64 bits, and generates code for the x86-64 architecture.
28615 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28616 and @option{-mdynamic-no-pic} options.
28617
28618 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28619 to 32 bits, and
28620 generates code for the x86-64 architecture.
28621
28622 The @option{-m16} option is the same as @option{-m32}, except for that
28623 it outputs the @code{.code16gcc} assembly directive at the beginning of
28624 the assembly output so that the binary can run in 16-bit mode.
28625
28626 The @option{-miamcu} option generates code which conforms to Intel MCU
28627 psABI. It requires the @option{-m32} option to be turned on.
28628
28629 @item -mno-red-zone
28630 @opindex mno-red-zone
28631 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28632 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28633 stack pointer that is not modified by signal or interrupt handlers
28634 and therefore can be used for temporary data without adjusting the stack
28635 pointer. The flag @option{-mno-red-zone} disables this red zone.
28636
28637 @item -mcmodel=small
28638 @opindex mcmodel=small
28639 Generate code for the small code model: the program and its symbols must
28640 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28641 Programs can be statically or dynamically linked. This is the default
28642 code model.
28643
28644 @item -mcmodel=kernel
28645 @opindex mcmodel=kernel
28646 Generate code for the kernel code model. The kernel runs in the
28647 negative 2 GB of the address space.
28648 This model has to be used for Linux kernel code.
28649
28650 @item -mcmodel=medium
28651 @opindex mcmodel=medium
28652 Generate code for the medium model: the program is linked in the lower 2
28653 GB of the address space. Small symbols are also placed there. Symbols
28654 with sizes larger than @option{-mlarge-data-threshold} are put into
28655 large data or BSS sections and can be located above 2GB. Programs can
28656 be statically or dynamically linked.
28657
28658 @item -mcmodel=large
28659 @opindex mcmodel=large
28660 Generate code for the large model. This model makes no assumptions
28661 about addresses and sizes of sections.
28662
28663 @item -maddress-mode=long
28664 @opindex maddress-mode=long
28665 Generate code for long address mode. This is only supported for 64-bit
28666 and x32 environments. It is the default address mode for 64-bit
28667 environments.
28668
28669 @item -maddress-mode=short
28670 @opindex maddress-mode=short
28671 Generate code for short address mode. This is only supported for 32-bit
28672 and x32 environments. It is the default address mode for 32-bit and
28673 x32 environments.
28674 @end table
28675
28676 @node x86 Windows Options
28677 @subsection x86 Windows Options
28678 @cindex x86 Windows Options
28679 @cindex Windows Options for x86
28680
28681 These additional options are available for Microsoft Windows targets:
28682
28683 @table @gcctabopt
28684 @item -mconsole
28685 @opindex mconsole
28686 This option
28687 specifies that a console application is to be generated, by
28688 instructing the linker to set the PE header subsystem type
28689 required for console applications.
28690 This option is available for Cygwin and MinGW targets and is
28691 enabled by default on those targets.
28692
28693 @item -mdll
28694 @opindex mdll
28695 This option is available for Cygwin and MinGW targets. It
28696 specifies that a DLL---a dynamic link library---is to be
28697 generated, enabling the selection of the required runtime
28698 startup object and entry point.
28699
28700 @item -mnop-fun-dllimport
28701 @opindex mnop-fun-dllimport
28702 This option is available for Cygwin and MinGW targets. It
28703 specifies that the @code{dllimport} attribute should be ignored.
28704
28705 @item -mthread
28706 @opindex mthread
28707 This option is available for MinGW targets. It specifies
28708 that MinGW-specific thread support is to be used.
28709
28710 @item -municode
28711 @opindex municode
28712 This option is available for MinGW-w64 targets. It causes
28713 the @code{UNICODE} preprocessor macro to be predefined, and
28714 chooses Unicode-capable runtime startup code.
28715
28716 @item -mwin32
28717 @opindex mwin32
28718 This option is available for Cygwin and MinGW targets. It
28719 specifies that the typical Microsoft Windows predefined macros are to
28720 be set in the pre-processor, but does not influence the choice
28721 of runtime library/startup code.
28722
28723 @item -mwindows
28724 @opindex mwindows
28725 This option is available for Cygwin and MinGW targets. It
28726 specifies that a GUI application is to be generated by
28727 instructing the linker to set the PE header subsystem type
28728 appropriately.
28729
28730 @item -fno-set-stack-executable
28731 @opindex fno-set-stack-executable
28732 This option is available for MinGW targets. It specifies that
28733 the executable flag for the stack used by nested functions isn't
28734 set. This is necessary for binaries running in kernel mode of
28735 Microsoft Windows, as there the User32 API, which is used to set executable
28736 privileges, isn't available.
28737
28738 @item -fwritable-relocated-rdata
28739 @opindex fno-writable-relocated-rdata
28740 This option is available for MinGW and Cygwin targets. It specifies
28741 that relocated-data in read-only section is put into the @code{.data}
28742 section. This is a necessary for older runtimes not supporting
28743 modification of @code{.rdata} sections for pseudo-relocation.
28744
28745 @item -mpe-aligned-commons
28746 @opindex mpe-aligned-commons
28747 This option is available for Cygwin and MinGW targets. It
28748 specifies that the GNU extension to the PE file format that
28749 permits the correct alignment of COMMON variables should be
28750 used when generating code. It is enabled by default if
28751 GCC detects that the target assembler found during configuration
28752 supports the feature.
28753 @end table
28754
28755 See also under @ref{x86 Options} for standard options.
28756
28757 @node Xstormy16 Options
28758 @subsection Xstormy16 Options
28759 @cindex Xstormy16 Options
28760
28761 These options are defined for Xstormy16:
28762
28763 @table @gcctabopt
28764 @item -msim
28765 @opindex msim
28766 Choose startup files and linker script suitable for the simulator.
28767 @end table
28768
28769 @node Xtensa Options
28770 @subsection Xtensa Options
28771 @cindex Xtensa Options
28772
28773 These options are supported for Xtensa targets:
28774
28775 @table @gcctabopt
28776 @item -mconst16
28777 @itemx -mno-const16
28778 @opindex mconst16
28779 @opindex mno-const16
28780 Enable or disable use of @code{CONST16} instructions for loading
28781 constant values. The @code{CONST16} instruction is currently not a
28782 standard option from Tensilica. When enabled, @code{CONST16}
28783 instructions are always used in place of the standard @code{L32R}
28784 instructions. The use of @code{CONST16} is enabled by default only if
28785 the @code{L32R} instruction is not available.
28786
28787 @item -mfused-madd
28788 @itemx -mno-fused-madd
28789 @opindex mfused-madd
28790 @opindex mno-fused-madd
28791 Enable or disable use of fused multiply/add and multiply/subtract
28792 instructions in the floating-point option. This has no effect if the
28793 floating-point option is not also enabled. Disabling fused multiply/add
28794 and multiply/subtract instructions forces the compiler to use separate
28795 instructions for the multiply and add/subtract operations. This may be
28796 desirable in some cases where strict IEEE 754-compliant results are
28797 required: the fused multiply add/subtract instructions do not round the
28798 intermediate result, thereby producing results with @emph{more} bits of
28799 precision than specified by the IEEE standard. Disabling fused multiply
28800 add/subtract instructions also ensures that the program output is not
28801 sensitive to the compiler's ability to combine multiply and add/subtract
28802 operations.
28803
28804 @item -mserialize-volatile
28805 @itemx -mno-serialize-volatile
28806 @opindex mserialize-volatile
28807 @opindex mno-serialize-volatile
28808 When this option is enabled, GCC inserts @code{MEMW} instructions before
28809 @code{volatile} memory references to guarantee sequential consistency.
28810 The default is @option{-mserialize-volatile}. Use
28811 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28812
28813 @item -mforce-no-pic
28814 @opindex mforce-no-pic
28815 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28816 position-independent code (PIC), this option disables PIC for compiling
28817 kernel code.
28818
28819 @item -mtext-section-literals
28820 @itemx -mno-text-section-literals
28821 @opindex mtext-section-literals
28822 @opindex mno-text-section-literals
28823 These options control the treatment of literal pools. The default is
28824 @option{-mno-text-section-literals}, which places literals in a separate
28825 section in the output file. This allows the literal pool to be placed
28826 in a data RAM/ROM, and it also allows the linker to combine literal
28827 pools from separate object files to remove redundant literals and
28828 improve code size. With @option{-mtext-section-literals}, the literals
28829 are interspersed in the text section in order to keep them as close as
28830 possible to their references. This may be necessary for large assembly
28831 files. Literals for each function are placed right before that function.
28832
28833 @item -mauto-litpools
28834 @itemx -mno-auto-litpools
28835 @opindex mauto-litpools
28836 @opindex mno-auto-litpools
28837 These options control the treatment of literal pools. The default is
28838 @option{-mno-auto-litpools}, which places literals in a separate
28839 section in the output file unless @option{-mtext-section-literals} is
28840 used. With @option{-mauto-litpools} the literals are interspersed in
28841 the text section by the assembler. Compiler does not produce explicit
28842 @code{.literal} directives and loads literals into registers with
28843 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28844 do relaxation and place literals as necessary. This option allows
28845 assembler to create several literal pools per function and assemble
28846 very big functions, which may not be possible with
28847 @option{-mtext-section-literals}.
28848
28849 @item -mtarget-align
28850 @itemx -mno-target-align
28851 @opindex mtarget-align
28852 @opindex mno-target-align
28853 When this option is enabled, GCC instructs the assembler to
28854 automatically align instructions to reduce branch penalties at the
28855 expense of some code density. The assembler attempts to widen density
28856 instructions to align branch targets and the instructions following call
28857 instructions. If there are not enough preceding safe density
28858 instructions to align a target, no widening is performed. The
28859 default is @option{-mtarget-align}. These options do not affect the
28860 treatment of auto-aligned instructions like @code{LOOP}, which the
28861 assembler always aligns, either by widening density instructions or
28862 by inserting NOP instructions.
28863
28864 @item -mlongcalls
28865 @itemx -mno-longcalls
28866 @opindex mlongcalls
28867 @opindex mno-longcalls
28868 When this option is enabled, GCC instructs the assembler to translate
28869 direct calls to indirect calls unless it can determine that the target
28870 of a direct call is in the range allowed by the call instruction. This
28871 translation typically occurs for calls to functions in other source
28872 files. Specifically, the assembler translates a direct @code{CALL}
28873 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28874 The default is @option{-mno-longcalls}. This option should be used in
28875 programs where the call target can potentially be out of range. This
28876 option is implemented in the assembler, not the compiler, so the
28877 assembly code generated by GCC still shows direct call
28878 instructions---look at the disassembled object code to see the actual
28879 instructions. Note that the assembler uses an indirect call for
28880 every cross-file call, not just those that really are out of range.
28881 @end table
28882
28883 @node zSeries Options
28884 @subsection zSeries Options
28885 @cindex zSeries options
28886
28887 These are listed under @xref{S/390 and zSeries Options}.
28888
28889
28890 @c man end
28891
28892 @node Spec Files
28893 @section Specifying Subprocesses and the Switches to Pass to Them
28894 @cindex Spec Files
28895
28896 @command{gcc} is a driver program. It performs its job by invoking a
28897 sequence of other programs to do the work of compiling, assembling and
28898 linking. GCC interprets its command-line parameters and uses these to
28899 deduce which programs it should invoke, and which command-line options
28900 it ought to place on their command lines. This behavior is controlled
28901 by @dfn{spec strings}. In most cases there is one spec string for each
28902 program that GCC can invoke, but a few programs have multiple spec
28903 strings to control their behavior. The spec strings built into GCC can
28904 be overridden by using the @option{-specs=} command-line switch to specify
28905 a spec file.
28906
28907 @dfn{Spec files} are plain-text files that are used to construct spec
28908 strings. They consist of a sequence of directives separated by blank
28909 lines. The type of directive is determined by the first non-whitespace
28910 character on the line, which can be one of the following:
28911
28912 @table @code
28913 @item %@var{command}
28914 Issues a @var{command} to the spec file processor. The commands that can
28915 appear here are:
28916
28917 @table @code
28918 @item %include <@var{file}>
28919 @cindex @code{%include}
28920 Search for @var{file} and insert its text at the current point in the
28921 specs file.
28922
28923 @item %include_noerr <@var{file}>
28924 @cindex @code{%include_noerr}
28925 Just like @samp{%include}, but do not generate an error message if the include
28926 file cannot be found.
28927
28928 @item %rename @var{old_name} @var{new_name}
28929 @cindex @code{%rename}
28930 Rename the spec string @var{old_name} to @var{new_name}.
28931
28932 @end table
28933
28934 @item *[@var{spec_name}]:
28935 This tells the compiler to create, override or delete the named spec
28936 string. All lines after this directive up to the next directive or
28937 blank line are considered to be the text for the spec string. If this
28938 results in an empty string then the spec is deleted. (Or, if the
28939 spec did not exist, then nothing happens.) Otherwise, if the spec
28940 does not currently exist a new spec is created. If the spec does
28941 exist then its contents are overridden by the text of this
28942 directive, unless the first character of that text is the @samp{+}
28943 character, in which case the text is appended to the spec.
28944
28945 @item [@var{suffix}]:
28946 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
28947 and up to the next directive or blank line are considered to make up the
28948 spec string for the indicated suffix. When the compiler encounters an
28949 input file with the named suffix, it processes the spec string in
28950 order to work out how to compile that file. For example:
28951
28952 @smallexample
28953 .ZZ:
28954 z-compile -input %i
28955 @end smallexample
28956
28957 This says that any input file whose name ends in @samp{.ZZ} should be
28958 passed to the program @samp{z-compile}, which should be invoked with the
28959 command-line switch @option{-input} and with the result of performing the
28960 @samp{%i} substitution. (See below.)
28961
28962 As an alternative to providing a spec string, the text following a
28963 suffix directive can be one of the following:
28964
28965 @table @code
28966 @item @@@var{language}
28967 This says that the suffix is an alias for a known @var{language}. This is
28968 similar to using the @option{-x} command-line switch to GCC to specify a
28969 language explicitly. For example:
28970
28971 @smallexample
28972 .ZZ:
28973 @@c++
28974 @end smallexample
28975
28976 Says that .ZZ files are, in fact, C++ source files.
28977
28978 @item #@var{name}
28979 This causes an error messages saying:
28980
28981 @smallexample
28982 @var{name} compiler not installed on this system.
28983 @end smallexample
28984 @end table
28985
28986 GCC already has an extensive list of suffixes built into it.
28987 This directive adds an entry to the end of the list of suffixes, but
28988 since the list is searched from the end backwards, it is effectively
28989 possible to override earlier entries using this technique.
28990
28991 @end table
28992
28993 GCC has the following spec strings built into it. Spec files can
28994 override these strings or create their own. Note that individual
28995 targets can also add their own spec strings to this list.
28996
28997 @smallexample
28998 asm Options to pass to the assembler
28999 asm_final Options to pass to the assembler post-processor
29000 cpp Options to pass to the C preprocessor
29001 cc1 Options to pass to the C compiler
29002 cc1plus Options to pass to the C++ compiler
29003 endfile Object files to include at the end of the link
29004 link Options to pass to the linker
29005 lib Libraries to include on the command line to the linker
29006 libgcc Decides which GCC support library to pass to the linker
29007 linker Sets the name of the linker
29008 predefines Defines to be passed to the C preprocessor
29009 signed_char Defines to pass to CPP to say whether @code{char} is signed
29010 by default
29011 startfile Object files to include at the start of the link
29012 @end smallexample
29013
29014 Here is a small example of a spec file:
29015
29016 @smallexample
29017 %rename lib old_lib
29018
29019 *lib:
29020 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29021 @end smallexample
29022
29023 This example renames the spec called @samp{lib} to @samp{old_lib} and
29024 then overrides the previous definition of @samp{lib} with a new one.
29025 The new definition adds in some extra command-line options before
29026 including the text of the old definition.
29027
29028 @dfn{Spec strings} are a list of command-line options to be passed to their
29029 corresponding program. In addition, the spec strings can contain
29030 @samp{%}-prefixed sequences to substitute variable text or to
29031 conditionally insert text into the command line. Using these constructs
29032 it is possible to generate quite complex command lines.
29033
29034 Here is a table of all defined @samp{%}-sequences for spec
29035 strings. Note that spaces are not generated automatically around the
29036 results of expanding these sequences. Therefore you can concatenate them
29037 together or combine them with constant text in a single argument.
29038
29039 @table @code
29040 @item %%
29041 Substitute one @samp{%} into the program name or argument.
29042
29043 @item %i
29044 Substitute the name of the input file being processed.
29045
29046 @item %b
29047 Substitute the basename of the input file being processed.
29048 This is the substring up to (and not including) the last period
29049 and not including the directory.
29050
29051 @item %B
29052 This is the same as @samp{%b}, but include the file suffix (text after
29053 the last period).
29054
29055 @item %d
29056 Marks the argument containing or following the @samp{%d} as a
29057 temporary file name, so that that file is deleted if GCC exits
29058 successfully. Unlike @samp{%g}, this contributes no text to the
29059 argument.
29060
29061 @item %g@var{suffix}
29062 Substitute a file name that has suffix @var{suffix} and is chosen
29063 once per compilation, and mark the argument in the same way as
29064 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29065 name is now chosen in a way that is hard to predict even when previously
29066 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29067 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29068 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29069 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29070 was simply substituted with a file name chosen once per compilation,
29071 without regard to any appended suffix (which was therefore treated
29072 just like ordinary text), making such attacks more likely to succeed.
29073
29074 @item %u@var{suffix}
29075 Like @samp{%g}, but generates a new temporary file name
29076 each time it appears instead of once per compilation.
29077
29078 @item %U@var{suffix}
29079 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29080 new one if there is no such last file name. In the absence of any
29081 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29082 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29083 involves the generation of two distinct file names, one
29084 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29085 simply substituted with a file name chosen for the previous @samp{%u},
29086 without regard to any appended suffix.
29087
29088 @item %j@var{suffix}
29089 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29090 writable, and if @option{-save-temps} is not used;
29091 otherwise, substitute the name
29092 of a temporary file, just like @samp{%u}. This temporary file is not
29093 meant for communication between processes, but rather as a junk
29094 disposal mechanism.
29095
29096 @item %|@var{suffix}
29097 @itemx %m@var{suffix}
29098 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29099 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29100 all. These are the two most common ways to instruct a program that it
29101 should read from standard input or write to standard output. If you
29102 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29103 construct: see for example @file{f/lang-specs.h}.
29104
29105 @item %.@var{SUFFIX}
29106 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29107 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29108 terminated by the next space or %.
29109
29110 @item %w
29111 Marks the argument containing or following the @samp{%w} as the
29112 designated output file of this compilation. This puts the argument
29113 into the sequence of arguments that @samp{%o} substitutes.
29114
29115 @item %o
29116 Substitutes the names of all the output files, with spaces
29117 automatically placed around them. You should write spaces
29118 around the @samp{%o} as well or the results are undefined.
29119 @samp{%o} is for use in the specs for running the linker.
29120 Input files whose names have no recognized suffix are not compiled
29121 at all, but they are included among the output files, so they are
29122 linked.
29123
29124 @item %O
29125 Substitutes the suffix for object files. Note that this is
29126 handled specially when it immediately follows @samp{%g, %u, or %U},
29127 because of the need for those to form complete file names. The
29128 handling is such that @samp{%O} is treated exactly as if it had already
29129 been substituted, except that @samp{%g, %u, and %U} do not currently
29130 support additional @var{suffix} characters following @samp{%O} as they do
29131 following, for example, @samp{.o}.
29132
29133 @item %p
29134 Substitutes the standard macro predefinitions for the
29135 current target machine. Use this when running @command{cpp}.
29136
29137 @item %P
29138 Like @samp{%p}, but puts @samp{__} before and after the name of each
29139 predefined macro, except for macros that start with @samp{__} or with
29140 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29141 C@.
29142
29143 @item %I
29144 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29145 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29146 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29147 and @option{-imultilib} as necessary.
29148
29149 @item %s
29150 Current argument is the name of a library or startup file of some sort.
29151 Search for that file in a standard list of directories and substitute
29152 the full name found. The current working directory is included in the
29153 list of directories scanned.
29154
29155 @item %T
29156 Current argument is the name of a linker script. Search for that file
29157 in the current list of directories to scan for libraries. If the file
29158 is located insert a @option{--script} option into the command line
29159 followed by the full path name found. If the file is not found then
29160 generate an error message. Note: the current working directory is not
29161 searched.
29162
29163 @item %e@var{str}
29164 Print @var{str} as an error message. @var{str} is terminated by a newline.
29165 Use this when inconsistent options are detected.
29166
29167 @item %(@var{name})
29168 Substitute the contents of spec string @var{name} at this point.
29169
29170 @item %x@{@var{option}@}
29171 Accumulate an option for @samp{%X}.
29172
29173 @item %X
29174 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29175 spec string.
29176
29177 @item %Y
29178 Output the accumulated assembler options specified by @option{-Wa}.
29179
29180 @item %Z
29181 Output the accumulated preprocessor options specified by @option{-Wp}.
29182
29183 @item %a
29184 Process the @code{asm} spec. This is used to compute the
29185 switches to be passed to the assembler.
29186
29187 @item %A
29188 Process the @code{asm_final} spec. This is a spec string for
29189 passing switches to an assembler post-processor, if such a program is
29190 needed.
29191
29192 @item %l
29193 Process the @code{link} spec. This is the spec for computing the
29194 command line passed to the linker. Typically it makes use of the
29195 @samp{%L %G %S %D and %E} sequences.
29196
29197 @item %D
29198 Dump out a @option{-L} option for each directory that GCC believes might
29199 contain startup files. If the target supports multilibs then the
29200 current multilib directory is prepended to each of these paths.
29201
29202 @item %L
29203 Process the @code{lib} spec. This is a spec string for deciding which
29204 libraries are included on the command line to the linker.
29205
29206 @item %G
29207 Process the @code{libgcc} spec. This is a spec string for deciding
29208 which GCC support library is included on the command line to the linker.
29209
29210 @item %S
29211 Process the @code{startfile} spec. This is a spec for deciding which
29212 object files are the first ones passed to the linker. Typically
29213 this might be a file named @file{crt0.o}.
29214
29215 @item %E
29216 Process the @code{endfile} spec. This is a spec string that specifies
29217 the last object files that are passed to the linker.
29218
29219 @item %C
29220 Process the @code{cpp} spec. This is used to construct the arguments
29221 to be passed to the C preprocessor.
29222
29223 @item %1
29224 Process the @code{cc1} spec. This is used to construct the options to be
29225 passed to the actual C compiler (@command{cc1}).
29226
29227 @item %2
29228 Process the @code{cc1plus} spec. This is used to construct the options to be
29229 passed to the actual C++ compiler (@command{cc1plus}).
29230
29231 @item %*
29232 Substitute the variable part of a matched option. See below.
29233 Note that each comma in the substituted string is replaced by
29234 a single space.
29235
29236 @item %<S
29237 Remove all occurrences of @code{-S} from the command line. Note---this
29238 command is position dependent. @samp{%} commands in the spec string
29239 before this one see @code{-S}, @samp{%} commands in the spec string
29240 after this one do not.
29241
29242 @item %:@var{function}(@var{args})
29243 Call the named function @var{function}, passing it @var{args}.
29244 @var{args} is first processed as a nested spec string, then split
29245 into an argument vector in the usual fashion. The function returns
29246 a string which is processed as if it had appeared literally as part
29247 of the current spec.
29248
29249 The following built-in spec functions are provided:
29250
29251 @table @code
29252 @item @code{getenv}
29253 The @code{getenv} spec function takes two arguments: an environment
29254 variable name and a string. If the environment variable is not
29255 defined, a fatal error is issued. Otherwise, the return value is the
29256 value of the environment variable concatenated with the string. For
29257 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29258
29259 @smallexample
29260 %:getenv(TOPDIR /include)
29261 @end smallexample
29262
29263 expands to @file{/path/to/top/include}.
29264
29265 @item @code{if-exists}
29266 The @code{if-exists} spec function takes one argument, an absolute
29267 pathname to a file. If the file exists, @code{if-exists} returns the
29268 pathname. Here is a small example of its usage:
29269
29270 @smallexample
29271 *startfile:
29272 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29273 @end smallexample
29274
29275 @item @code{if-exists-else}
29276 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29277 spec function, except that it takes two arguments. The first argument is
29278 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29279 returns the pathname. If it does not exist, it returns the second argument.
29280 This way, @code{if-exists-else} can be used to select one file or another,
29281 based on the existence of the first. Here is a small example of its usage:
29282
29283 @smallexample
29284 *startfile:
29285 crt0%O%s %:if-exists(crti%O%s) \
29286 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29287 @end smallexample
29288
29289 @item @code{replace-outfile}
29290 The @code{replace-outfile} spec function takes two arguments. It looks for the
29291 first argument in the outfiles array and replaces it with the second argument. Here
29292 is a small example of its usage:
29293
29294 @smallexample
29295 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29296 @end smallexample
29297
29298 @item @code{remove-outfile}
29299 The @code{remove-outfile} spec function takes one argument. It looks for the
29300 first argument in the outfiles array and removes it. Here is a small example
29301 its usage:
29302
29303 @smallexample
29304 %:remove-outfile(-lm)
29305 @end smallexample
29306
29307 @item @code{pass-through-libs}
29308 The @code{pass-through-libs} spec function takes any number of arguments. It
29309 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29310 assumes are the names of linker input library archive files) and returns a
29311 result containing all the found arguments each prepended by
29312 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29313 intended to be passed to the LTO linker plugin.
29314
29315 @smallexample
29316 %:pass-through-libs(%G %L %G)
29317 @end smallexample
29318
29319 @item @code{print-asm-header}
29320 The @code{print-asm-header} function takes no arguments and simply
29321 prints a banner like:
29322
29323 @smallexample
29324 Assembler options
29325 =================
29326
29327 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29328 @end smallexample
29329
29330 It is used to separate compiler options from assembler options
29331 in the @option{--target-help} output.
29332 @end table
29333
29334 @item %@{S@}
29335 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29336 If that switch is not specified, this substitutes nothing. Note that
29337 the leading dash is omitted when specifying this option, and it is
29338 automatically inserted if the substitution is performed. Thus the spec
29339 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29340 and outputs the command-line option @option{-foo}.
29341
29342 @item %W@{S@}
29343 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29344 deleted on failure.
29345
29346 @item %@{S*@}
29347 Substitutes all the switches specified to GCC whose names start
29348 with @code{-S}, but which also take an argument. This is used for
29349 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29350 GCC considers @option{-o foo} as being
29351 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29352 text, including the space. Thus two arguments are generated.
29353
29354 @item %@{S*&T*@}
29355 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29356 (the order of @code{S} and @code{T} in the spec is not significant).
29357 There can be any number of ampersand-separated variables; for each the
29358 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29359
29360 @item %@{S:X@}
29361 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29362
29363 @item %@{!S:X@}
29364 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29365
29366 @item %@{S*:X@}
29367 Substitutes @code{X} if one or more switches whose names start with
29368 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29369 once, no matter how many such switches appeared. However, if @code{%*}
29370 appears somewhere in @code{X}, then @code{X} is substituted once
29371 for each matching switch, with the @code{%*} replaced by the part of
29372 that switch matching the @code{*}.
29373
29374 If @code{%*} appears as the last part of a spec sequence then a space
29375 is added after the end of the last substitution. If there is more
29376 text in the sequence, however, then a space is not generated. This
29377 allows the @code{%*} substitution to be used as part of a larger
29378 string. For example, a spec string like this:
29379
29380 @smallexample
29381 %@{mcu=*:--script=%*/memory.ld@}
29382 @end smallexample
29383
29384 @noindent
29385 when matching an option like @option{-mcu=newchip} produces:
29386
29387 @smallexample
29388 --script=newchip/memory.ld
29389 @end smallexample
29390
29391 @item %@{.S:X@}
29392 Substitutes @code{X}, if processing a file with suffix @code{S}.
29393
29394 @item %@{!.S:X@}
29395 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29396
29397 @item %@{,S:X@}
29398 Substitutes @code{X}, if processing a file for language @code{S}.
29399
29400 @item %@{!,S:X@}
29401 Substitutes @code{X}, if not processing a file for language @code{S}.
29402
29403 @item %@{S|P:X@}
29404 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29405 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29406 @code{*} sequences as well, although they have a stronger binding than
29407 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29408 alternatives must be starred, and only the first matching alternative
29409 is substituted.
29410
29411 For example, a spec string like this:
29412
29413 @smallexample
29414 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29415 @end smallexample
29416
29417 @noindent
29418 outputs the following command-line options from the following input
29419 command-line options:
29420
29421 @smallexample
29422 fred.c -foo -baz
29423 jim.d -bar -boggle
29424 -d fred.c -foo -baz -boggle
29425 -d jim.d -bar -baz -boggle
29426 @end smallexample
29427
29428 @item %@{S:X; T:Y; :D@}
29429
29430 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29431 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29432 be as many clauses as you need. This may be combined with @code{.},
29433 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29434
29435
29436 @end table
29437
29438 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29439 or similar construct can use a backslash to ignore the special meaning
29440 of the character following it, thus allowing literal matching of a
29441 character that is otherwise specially treated. For example,
29442 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29443 @option{-std=iso9899:1999} option is given.
29444
29445 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29446 construct may contain other nested @samp{%} constructs or spaces, or
29447 even newlines. They are processed as usual, as described above.
29448 Trailing white space in @code{X} is ignored. White space may also
29449 appear anywhere on the left side of the colon in these constructs,
29450 except between @code{.} or @code{*} and the corresponding word.
29451
29452 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29453 handled specifically in these constructs. If another value of
29454 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29455 @option{-W} switch is found later in the command line, the earlier
29456 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29457 just one letter, which passes all matching options.
29458
29459 The character @samp{|} at the beginning of the predicate text is used to
29460 indicate that a command should be piped to the following command, but
29461 only if @option{-pipe} is specified.
29462
29463 It is built into GCC which switches take arguments and which do not.
29464 (You might think it would be useful to generalize this to allow each
29465 compiler's spec to say which switches take arguments. But this cannot
29466 be done in a consistent fashion. GCC cannot even decide which input
29467 files have been specified without knowing which switches take arguments,
29468 and it must know which input files to compile in order to tell which
29469 compilers to run).
29470
29471 GCC also knows implicitly that arguments starting in @option{-l} are to be
29472 treated as compiler output files, and passed to the linker in their
29473 proper position among the other output files.
29474
29475 @node Environment Variables
29476 @section Environment Variables Affecting GCC
29477 @cindex environment variables
29478
29479 @c man begin ENVIRONMENT
29480 This section describes several environment variables that affect how GCC
29481 operates. Some of them work by specifying directories or prefixes to use
29482 when searching for various kinds of files. Some are used to specify other
29483 aspects of the compilation environment.
29484
29485 Note that you can also specify places to search using options such as
29486 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29487 take precedence over places specified using environment variables, which
29488 in turn take precedence over those specified by the configuration of GCC@.
29489 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29490 GNU Compiler Collection (GCC) Internals}.
29491
29492 @table @env
29493 @item LANG
29494 @itemx LC_CTYPE
29495 @c @itemx LC_COLLATE
29496 @itemx LC_MESSAGES
29497 @c @itemx LC_MONETARY
29498 @c @itemx LC_NUMERIC
29499 @c @itemx LC_TIME
29500 @itemx LC_ALL
29501 @findex LANG
29502 @findex LC_CTYPE
29503 @c @findex LC_COLLATE
29504 @findex LC_MESSAGES
29505 @c @findex LC_MONETARY
29506 @c @findex LC_NUMERIC
29507 @c @findex LC_TIME
29508 @findex LC_ALL
29509 @cindex locale
29510 These environment variables control the way that GCC uses
29511 localization information which allows GCC to work with different
29512 national conventions. GCC inspects the locale categories
29513 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29514 so. These locale categories can be set to any value supported by your
29515 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29516 Kingdom encoded in UTF-8.
29517
29518 The @env{LC_CTYPE} environment variable specifies character
29519 classification. GCC uses it to determine the character boundaries in
29520 a string; this is needed for some multibyte encodings that contain quote
29521 and escape characters that are otherwise interpreted as a string
29522 end or escape.
29523
29524 The @env{LC_MESSAGES} environment variable specifies the language to
29525 use in diagnostic messages.
29526
29527 If the @env{LC_ALL} environment variable is set, it overrides the value
29528 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29529 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29530 environment variable. If none of these variables are set, GCC
29531 defaults to traditional C English behavior.
29532
29533 @item TMPDIR
29534 @findex TMPDIR
29535 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29536 files. GCC uses temporary files to hold the output of one stage of
29537 compilation which is to be used as input to the next stage: for example,
29538 the output of the preprocessor, which is the input to the compiler
29539 proper.
29540
29541 @item GCC_COMPARE_DEBUG
29542 @findex GCC_COMPARE_DEBUG
29543 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29544 @option{-fcompare-debug} to the compiler driver. See the documentation
29545 of this option for more details.
29546
29547 @item GCC_EXEC_PREFIX
29548 @findex GCC_EXEC_PREFIX
29549 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29550 names of the subprograms executed by the compiler. No slash is added
29551 when this prefix is combined with the name of a subprogram, but you can
29552 specify a prefix that ends with a slash if you wish.
29553
29554 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29555 an appropriate prefix to use based on the pathname it is invoked with.
29556
29557 If GCC cannot find the subprogram using the specified prefix, it
29558 tries looking in the usual places for the subprogram.
29559
29560 The default value of @env{GCC_EXEC_PREFIX} is
29561 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29562 the installed compiler. In many cases @var{prefix} is the value
29563 of @code{prefix} when you ran the @file{configure} script.
29564
29565 Other prefixes specified with @option{-B} take precedence over this prefix.
29566
29567 This prefix is also used for finding files such as @file{crt0.o} that are
29568 used for linking.
29569
29570 In addition, the prefix is used in an unusual way in finding the
29571 directories to search for header files. For each of the standard
29572 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29573 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29574 replacing that beginning with the specified prefix to produce an
29575 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29576 @file{foo/bar} just before it searches the standard directory
29577 @file{/usr/local/lib/bar}.
29578 If a standard directory begins with the configured
29579 @var{prefix} then the value of @var{prefix} is replaced by
29580 @env{GCC_EXEC_PREFIX} when looking for header files.
29581
29582 @item COMPILER_PATH
29583 @findex COMPILER_PATH
29584 The value of @env{COMPILER_PATH} is a colon-separated list of
29585 directories, much like @env{PATH}. GCC tries the directories thus
29586 specified when searching for subprograms, if it cannot find the
29587 subprograms using @env{GCC_EXEC_PREFIX}.
29588
29589 @item LIBRARY_PATH
29590 @findex LIBRARY_PATH
29591 The value of @env{LIBRARY_PATH} is a colon-separated list of
29592 directories, much like @env{PATH}. When configured as a native compiler,
29593 GCC tries the directories thus specified when searching for special
29594 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29595 using GCC also uses these directories when searching for ordinary
29596 libraries for the @option{-l} option (but directories specified with
29597 @option{-L} come first).
29598
29599 @item LANG
29600 @findex LANG
29601 @cindex locale definition
29602 This variable is used to pass locale information to the compiler. One way in
29603 which this information is used is to determine the character set to be used
29604 when character literals, string literals and comments are parsed in C and C++.
29605 When the compiler is configured to allow multibyte characters,
29606 the following values for @env{LANG} are recognized:
29607
29608 @table @samp
29609 @item C-JIS
29610 Recognize JIS characters.
29611 @item C-SJIS
29612 Recognize SJIS characters.
29613 @item C-EUCJP
29614 Recognize EUCJP characters.
29615 @end table
29616
29617 If @env{LANG} is not defined, or if it has some other value, then the
29618 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29619 recognize and translate multibyte characters.
29620 @end table
29621
29622 @noindent
29623 Some additional environment variables affect the behavior of the
29624 preprocessor.
29625
29626 @include cppenv.texi
29627
29628 @c man end
29629
29630 @node Precompiled Headers
29631 @section Using Precompiled Headers
29632 @cindex precompiled headers
29633 @cindex speed of compilation
29634
29635 Often large projects have many header files that are included in every
29636 source file. The time the compiler takes to process these header files
29637 over and over again can account for nearly all of the time required to
29638 build the project. To make builds faster, GCC allows you to
29639 @dfn{precompile} a header file.
29640
29641 To create a precompiled header file, simply compile it as you would any
29642 other file, if necessary using the @option{-x} option to make the driver
29643 treat it as a C or C++ header file. You may want to use a
29644 tool like @command{make} to keep the precompiled header up-to-date when
29645 the headers it contains change.
29646
29647 A precompiled header file is searched for when @code{#include} is
29648 seen in the compilation. As it searches for the included file
29649 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29650 compiler looks for a precompiled header in each directory just before it
29651 looks for the include file in that directory. The name searched for is
29652 the name specified in the @code{#include} with @samp{.gch} appended. If
29653 the precompiled header file cannot be used, it is ignored.
29654
29655 For instance, if you have @code{#include "all.h"}, and you have
29656 @file{all.h.gch} in the same directory as @file{all.h}, then the
29657 precompiled header file is used if possible, and the original
29658 header is used otherwise.
29659
29660 Alternatively, you might decide to put the precompiled header file in a
29661 directory and use @option{-I} to ensure that directory is searched
29662 before (or instead of) the directory containing the original header.
29663 Then, if you want to check that the precompiled header file is always
29664 used, you can put a file of the same name as the original header in this
29665 directory containing an @code{#error} command.
29666
29667 This also works with @option{-include}. So yet another way to use
29668 precompiled headers, good for projects not designed with precompiled
29669 header files in mind, is to simply take most of the header files used by
29670 a project, include them from another header file, precompile that header
29671 file, and @option{-include} the precompiled header. If the header files
29672 have guards against multiple inclusion, they are skipped because
29673 they've already been included (in the precompiled header).
29674
29675 If you need to precompile the same header file for different
29676 languages, targets, or compiler options, you can instead make a
29677 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29678 header in the directory, perhaps using @option{-o}. It doesn't matter
29679 what you call the files in the directory; every precompiled header in
29680 the directory is considered. The first precompiled header
29681 encountered in the directory that is valid for this compilation is
29682 used; they're searched in no particular order.
29683
29684 There are many other possibilities, limited only by your imagination,
29685 good sense, and the constraints of your build system.
29686
29687 A precompiled header file can be used only when these conditions apply:
29688
29689 @itemize
29690 @item
29691 Only one precompiled header can be used in a particular compilation.
29692
29693 @item
29694 A precompiled header cannot be used once the first C token is seen. You
29695 can have preprocessor directives before a precompiled header; you cannot
29696 include a precompiled header from inside another header.
29697
29698 @item
29699 The precompiled header file must be produced for the same language as
29700 the current compilation. You cannot use a C precompiled header for a C++
29701 compilation.
29702
29703 @item
29704 The precompiled header file must have been produced by the same compiler
29705 binary as the current compilation is using.
29706
29707 @item
29708 Any macros defined before the precompiled header is included must
29709 either be defined in the same way as when the precompiled header was
29710 generated, or must not affect the precompiled header, which usually
29711 means that they don't appear in the precompiled header at all.
29712
29713 The @option{-D} option is one way to define a macro before a
29714 precompiled header is included; using a @code{#define} can also do it.
29715 There are also some options that define macros implicitly, like
29716 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29717 defined this way.
29718
29719 @item If debugging information is output when using the precompiled
29720 header, using @option{-g} or similar, the same kind of debugging information
29721 must have been output when building the precompiled header. However,
29722 a precompiled header built using @option{-g} can be used in a compilation
29723 when no debugging information is being output.
29724
29725 @item The same @option{-m} options must generally be used when building
29726 and using the precompiled header. @xref{Submodel Options},
29727 for any cases where this rule is relaxed.
29728
29729 @item Each of the following options must be the same when building and using
29730 the precompiled header:
29731
29732 @gccoptlist{-fexceptions}
29733
29734 @item
29735 Some other command-line options starting with @option{-f},
29736 @option{-p}, or @option{-O} must be defined in the same way as when
29737 the precompiled header was generated. At present, it's not clear
29738 which options are safe to change and which are not; the safest choice
29739 is to use exactly the same options when generating and using the
29740 precompiled header. The following are known to be safe:
29741
29742 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29743 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29744 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29745 -pedantic-errors}
29746
29747 @end itemize
29748
29749 For all of these except the last, the compiler automatically
29750 ignores the precompiled header if the conditions aren't met. If you
29751 find an option combination that doesn't work and doesn't cause the
29752 precompiled header to be ignored, please consider filing a bug report,
29753 see @ref{Bugs}.
29754
29755 If you do use differing options when generating and using the
29756 precompiled header, the actual behavior is a mixture of the
29757 behavior for the options. For instance, if you use @option{-g} to
29758 generate the precompiled header but not when using it, you may or may
29759 not get debugging information for routines in the precompiled header.