]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
Fix and document -r option
[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-parseable-fixits -fdiagnostics-generate-patch @gol
274 -fdiagnostics-show-template-tree -fno-elide-type @gol
275 -fno-show-column}
276
277 @item Warning Options
278 @xref{Warning Options,,Options to Request or Suppress Warnings}.
279 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
280 -pedantic-errors @gol
281 -w -Wextra -Wall -Waddress -Waggregate-return -Waligned-new @gol
282 -Walloc-zero -Walloc-size-larger-than=@var{byte-size}
283 -Walloca -Walloca-larger-than=@var{byte-size} @gol
284 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
285 -Wno-attributes -Wbool-compare -Wbool-operation @gol
286 -Wno-builtin-declaration-mismatch @gol
287 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
288 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
289 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
290 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
291 -Wclobbered -Wcomment -Wconditionally-supported @gol
292 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
293 -Wdelete-incomplete @gol
294 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
295 -Wdisabled-optimization @gol
296 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
297 -Wno-div-by-zero -Wdouble-promotion @gol
298 -Wduplicated-branches -Wduplicated-cond @gol
299 -Wempty-body -Wenum-compare -Wno-endif-labels -Wexpansion-to-defined @gol
300 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
301 -Wfloat-equal -Wformat -Wformat=2 @gol
302 -Wno-format-contains-nul -Wno-format-extra-args @gol
303 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
304 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
305 -Wformat-y2k -Wframe-address @gol
306 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
307 -Wjump-misses-init @gol
308 -Wif-not-aligned @gol
309 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
310 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
311 -Wimplicit-function-declaration -Wimplicit-int @gol
312 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
313 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
314 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
315 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
316 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
317 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
318 -Wmissing-field-initializers -Wmissing-include-dirs @gol
319 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
320 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
321 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
322 -Woverride-init-side-effects -Woverlength-strings @gol
323 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
324 -Wparentheses -Wno-pedantic-ms-format @gol
325 -Wplacement-new -Wplacement-new=@var{n} @gol
326 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
327 -Wno-pragmas -Wredundant-decls -Wrestrict -Wno-return-local-addr @gol
328 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
329 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
330 -Wshift-overflow -Wshift-overflow=@var{n} @gol
331 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
332 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
333 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
334 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
335 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
336 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
337 -Wstringop-overflow=@var{n} -Wstringop-truncation @gol
338 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
339 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
340 -Wmissing-format-attribute -Wsubobject-linkage @gol
341 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
342 -Wswitch-unreachable -Wsync-nand @gol
343 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
344 -Wtype-limits -Wundef @gol
345 -Wuninitialized -Wunknown-pragmas @gol
346 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
347 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
348 -Wunused-parameter -Wno-unused-result @gol
349 -Wunused-value -Wunused-variable @gol
350 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
351 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
352 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
353 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
354 -Wwrite-strings @gol
355 -Wzero-as-null-pointer-constant -Whsa}
356
357 @item C and Objective-C-only Warning Options
358 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
359 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
360 -Wold-style-declaration -Wold-style-definition @gol
361 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
362 -Wdeclaration-after-statement -Wpointer-sign}
363
364 @item Debugging Options
365 @xref{Debugging Options,,Options for Debugging Your Program}.
366 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
367 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
368 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
369 -gas-loc-support -gno-as-loc-support @gol
370 -gas-locview-support -gno-as-locview-support @gol
371 -gcolumn-info -gno-column-info @gol
372 -gstatement-frontiers -gno-statement-frontiers @gol
373 -gvariable-location-views -gno-variable-location-views @gol
374 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
375 -ginline-points -gno-inline-points @gol
376 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
377 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
378 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
379 -fno-eliminate-unused-debug-types @gol
380 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
381 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
382 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
383 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
384 -fvar-tracking -fvar-tracking-assignments}
385
386 @item Optimization Options
387 @xref{Optimize Options,,Options that Control Optimization}.
388 @gccoptlist{-faggressive-loop-optimizations @gol
389 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
390 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
391 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
392 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
393 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
394 -fauto-inc-dec -fbranch-probabilities @gol
395 -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
396 -fbtr-bb-exclusive -fcaller-saves @gol
397 -fcombine-stack-adjustments -fconserve-stack @gol
398 -fcompare-elim -fcprop-registers -fcrossjumping @gol
399 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
400 -fcx-limited-range @gol
401 -fdata-sections -fdce -fdelayed-branch @gol
402 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
403 -fdevirtualize-at-ltrans -fdse @gol
404 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
405 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
406 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
407 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
408 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
409 -fif-conversion2 -findirect-inlining @gol
410 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
411 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
412 -fipa-bit-cp -fipa-vrp @gol
413 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
414 -fira-algorithm=@var{algorithm} @gol
415 -fira-region=@var{region} -fira-hoist-pressure @gol
416 -fira-loop-pressure -fno-ira-share-save-slots @gol
417 -fno-ira-share-spill-slots @gol
418 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
419 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
420 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
421 -floop-block -floop-interchange -floop-strip-mine @gol
422 -floop-unroll-and-jam -floop-nest-optimize @gol
423 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
424 -flto-partition=@var{alg} -fmerge-all-constants @gol
425 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
426 -fmove-loop-invariants -fno-branch-count-reg @gol
427 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
428 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
429 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
430 -fno-sched-spec -fno-signed-zeros @gol
431 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
432 -fomit-frame-pointer -foptimize-sibling-calls @gol
433 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
434 -fprefetch-loop-arrays @gol
435 -fprofile-correction @gol
436 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
437 -fprofile-reorder-functions @gol
438 -freciprocal-math -free -frename-registers -freorder-blocks @gol
439 -freorder-blocks-algorithm=@var{algorithm} @gol
440 -freorder-blocks-and-partition -freorder-functions @gol
441 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
442 -frounding-math -fsave-optimization-record @gol
443 -fsched2-use-superblocks -fsched-pressure @gol
444 -fsched-spec-load -fsched-spec-load-dangerous @gol
445 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
446 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
447 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
448 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
449 -fschedule-fusion @gol
450 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
451 -fselective-scheduling -fselective-scheduling2 @gol
452 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
453 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
454 -fsignaling-nans @gol
455 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
456 -fsplit-paths @gol
457 -fsplit-wide-types -fssa-backprop -fssa-phiopt @gol
458 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
459 -fthread-jumps -ftracer -ftree-bit-ccp @gol
460 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
461 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
462 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
463 -ftree-loop-if-convert -ftree-loop-im @gol
464 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
465 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
466 -ftree-loop-vectorize @gol
467 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
468 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
469 -ftree-switch-conversion -ftree-tail-merge @gol
470 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
471 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
472 -funsafe-math-optimizations -funswitch-loops @gol
473 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
474 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
475 --param @var{name}=@var{value}
476 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
477
478 @item Program Instrumentation Options
479 @xref{Instrumentation Options,,Program Instrumentation Options}.
480 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
481 -fprofile-abs-path @gol
482 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
483 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
484 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
485 -fsanitize-undefined-trap-on-error -fbounds-check @gol
486 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
487 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
488 -fstack-protector-explicit -fstack-check @gol
489 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
490 -fno-stack-limit -fsplit-stack @gol
491 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
492 -fvtv-counts -fvtv-debug @gol
493 -finstrument-functions @gol
494 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
495 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
496
497 @item Preprocessor Options
498 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
499 @gccoptlist{-A@var{question}=@var{answer} @gol
500 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
501 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
502 -dD -dI -dM -dN -dU @gol
503 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
504 -fexec-charset=@var{charset} -fextended-identifiers @gol
505 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
506 -fno-canonical-system-headers @gol -fpch-deps -fpch-preprocess @gol
507 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
508 -fwide-exec-charset=@var{charset} -fworking-directory @gol
509 -H -imacros @var{file} -include @var{file} @gol
510 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
511 -no-integrated-cpp -P -pthread -remap @gol
512 -traditional -traditional-cpp -trigraphs @gol
513 -U@var{macro} -undef @gol
514 -Wp,@var{option} -Xpreprocessor @var{option}}
515
516 @item Assembler Options
517 @xref{Assembler Options,,Passing Options to the Assembler}.
518 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
519
520 @item Linker Options
521 @xref{Link Options,,Options for Linking}.
522 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
523 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
524 -pie -pthread -r -rdynamic @gol
525 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
526 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
527 -shared -shared-libgcc -symbolic @gol
528 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
529 -u @var{symbol} -z @var{keyword}}
530
531 @item Directory Options
532 @xref{Directory Options,,Options for Directory Search}.
533 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
534 -idirafter @var{dir} @gol
535 -imacros @var{file} -imultilib @var{dir} @gol
536 -iplugindir=@var{dir} -iprefix @var{file} @gol
537 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
538 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
539 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
540 -nostdinc -nostdinc++ --sysroot=@var{dir}}
541
542 @item Code Generation Options
543 @xref{Code Gen Options,,Options for Code Generation Conventions}.
544 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
545 -ffixed-@var{reg} -fexceptions @gol
546 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
547 -fasynchronous-unwind-tables @gol
548 -fno-gnu-unique @gol
549 -finhibit-size-directive -fno-common -fno-ident @gol
550 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
551 -fno-jump-tables @gol
552 -frecord-gcc-switches @gol
553 -freg-struct-return -fshort-enums -fshort-wchar @gol
554 -fverbose-asm -fpack-struct[=@var{n}] @gol
555 -fleading-underscore -ftls-model=@var{model} @gol
556 -fstack-reuse=@var{reuse_level} @gol
557 -ftrampolines -ftrapv -fwrapv @gol
558 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
559 -fstrict-volatile-bitfields -fsync-libcalls}
560
561 @item Developer Options
562 @xref{Developer Options,,GCC Developer Options}.
563 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
564 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
565 -fdbg-cnt=@var{counter-value-list} @gol
566 -fdisable-ipa-@var{pass_name} @gol
567 -fdisable-rtl-@var{pass_name} @gol
568 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
569 -fdisable-tree-@var{pass_name} @gol
570 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
571 -fdump-debug -fdump-earlydebug @gol
572 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
573 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
574 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
575 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
576 -fdump-lang-all @gol
577 -fdump-lang-@var{switch} @gol
578 -fdump-lang-@var{switch}-@var{options} @gol
579 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
580 -fdump-passes @gol
581 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
582 -fdump-statistics @gol
583 -fdump-tree-all @gol
584 -fdump-tree-@var{switch} @gol
585 -fdump-tree-@var{switch}-@var{options} @gol
586 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
587 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
588 -fenable-@var{kind}-@var{pass} @gol
589 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
590 -fira-verbose=@var{n} @gol
591 -flto-report -flto-report-wpa -fmem-report-wpa @gol
592 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
593 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
594 -fprofile-report @gol
595 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
596 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
597 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
598 -fvar-tracking-assignments-toggle -gtoggle @gol
599 -print-file-name=@var{library} -print-libgcc-file-name @gol
600 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
601 -print-prog-name=@var{program} -print-search-dirs -Q @gol
602 -print-sysroot -print-sysroot-headers-suffix @gol
603 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
604
605 @item Machine-Dependent Options
606 @xref{Submodel Options,,Machine-Dependent Options}.
607 @c This list is ordered alphanumerically by subsection name.
608 @c Try and put the significant identifier (CPU or system) first,
609 @c so users have a clue at guessing where the ones they want will be.
610
611 @emph{AArch64 Options}
612 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
613 -mgeneral-regs-only @gol
614 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
615 -mstrict-align -mno-strict-align @gol
616 -momit-leaf-frame-pointer @gol
617 -mtls-dialect=desc -mtls-dialect=traditional @gol
618 -mtls-size=@var{size} @gol
619 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
620 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
621 -mpc-relative-literal-loads @gol
622 -msign-return-address=@var{scope} @gol
623 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
624 -moverride=@var{string} -mverbose-cost-dump -mtrack-speculation}
625
626 @emph{Adapteva Epiphany Options}
627 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
628 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
629 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
630 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
631 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
632 -msplit-vecmove-early -m1reg-@var{reg}}
633
634 @emph{ARC Options}
635 @gccoptlist{-mbarrel-shifter -mjli-always @gol
636 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
637 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
638 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
639 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
640 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
641 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
642 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
643 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
644 -mvolatile-cache -mtp-regno=@var{regno} @gol
645 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
646 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
647 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
648 -mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
649 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
650 -mtune=@var{cpu} -mmultcost=@var{num} @gol
651 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
652 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16}
653
654 @emph{ARM Options}
655 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
656 -mabi=@var{name} @gol
657 -mapcs-stack-check -mno-apcs-stack-check @gol
658 -mapcs-reentrant -mno-apcs-reentrant @gol
659 -msched-prolog -mno-sched-prolog @gol
660 -mlittle-endian -mbig-endian @gol
661 -mbe8 -mbe32 @gol
662 -mfloat-abi=@var{name} @gol
663 -mfp16-format=@var{name}
664 -mthumb-interwork -mno-thumb-interwork @gol
665 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
666 -mtune=@var{name} -mprint-tune-info @gol
667 -mstructure-size-boundary=@var{n} @gol
668 -mabort-on-noreturn @gol
669 -mlong-calls -mno-long-calls @gol
670 -msingle-pic-base -mno-single-pic-base @gol
671 -mpic-register=@var{reg} @gol
672 -mnop-fun-dllimport @gol
673 -mpoke-function-name @gol
674 -mthumb -marm -mflip-thumb @gol
675 -mtpcs-frame -mtpcs-leaf-frame @gol
676 -mcaller-super-interworking -mcallee-super-interworking @gol
677 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
678 -mword-relocations @gol
679 -mfix-cortex-m3-ldrd @gol
680 -munaligned-access @gol
681 -mneon-for-64bits @gol
682 -mslow-flash-data @gol
683 -masm-syntax-unified @gol
684 -mrestrict-it @gol
685 -mverbose-cost-dump @gol
686 -mpure-code @gol
687 -mcmse}
688
689 @emph{AVR Options}
690 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
691 -mbranch-cost=@var{cost} @gol
692 -mcall-prologues -mgas-isr-prologues -mint8 @gol
693 -mn_flash=@var{size} -mno-interrupts @gol
694 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
695 -mfract-convert-truncate @gol
696 -mshort-calls -nodevicelib @gol
697 -Waddr-space-convert -Wmisspelled-isr}
698
699 @emph{Blackfin Options}
700 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
701 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
702 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
703 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
704 -mno-id-shared-library -mshared-library-id=@var{n} @gol
705 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
706 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
707 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
708 -micplb}
709
710 @emph{C6X Options}
711 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
712 -msim -msdata=@var{sdata-type}}
713
714 @emph{CRIS Options}
715 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
716 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
717 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
718 -mstack-align -mdata-align -mconst-align @gol
719 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
720 -melf -maout -melinux -mlinux -sim -sim2 @gol
721 -mmul-bug-workaround -mno-mul-bug-workaround}
722
723 @emph{CR16 Options}
724 @gccoptlist{-mmac @gol
725 -mcr16cplus -mcr16c @gol
726 -msim -mint32 -mbit-ops
727 -mdata-model=@var{model}}
728
729 @emph{C-SKY Options}
730 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
731 -mbig-endian -EB -mlittle-endian -EL @gol
732 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
733 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
734 -mdsp -medsp -mvdsp @gol
735 -mdiv -msmart -mhigh-registers -manchor @gol
736 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
737 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
738
739 @emph{Darwin Options}
740 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
741 -arch_only -bind_at_load -bundle -bundle_loader @gol
742 -client_name -compatibility_version -current_version @gol
743 -dead_strip @gol
744 -dependency-file -dylib_file -dylinker_install_name @gol
745 -dynamic -dynamiclib -exported_symbols_list @gol
746 -filelist -flat_namespace -force_cpusubtype_ALL @gol
747 -force_flat_namespace -headerpad_max_install_names @gol
748 -iframework @gol
749 -image_base -init -install_name -keep_private_externs @gol
750 -multi_module -multiply_defined -multiply_defined_unused @gol
751 -noall_load -no_dead_strip_inits_and_terms @gol
752 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
753 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
754 -private_bundle -read_only_relocs -sectalign @gol
755 -sectobjectsymbols -whyload -seg1addr @gol
756 -sectcreate -sectobjectsymbols -sectorder @gol
757 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
758 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
759 -segprot -segs_read_only_addr -segs_read_write_addr @gol
760 -single_module -static -sub_library -sub_umbrella @gol
761 -twolevel_namespace -umbrella -undefined @gol
762 -unexported_symbols_list -weak_reference_mismatches @gol
763 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
764 -mkernel -mone-byte-bool}
765
766 @emph{DEC Alpha Options}
767 @gccoptlist{-mno-fp-regs -msoft-float @gol
768 -mieee -mieee-with-inexact -mieee-conformant @gol
769 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
770 -mtrap-precision=@var{mode} -mbuild-constants @gol
771 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
772 -mbwx -mmax -mfix -mcix @gol
773 -mfloat-vax -mfloat-ieee @gol
774 -mexplicit-relocs -msmall-data -mlarge-data @gol
775 -msmall-text -mlarge-text @gol
776 -mmemory-latency=@var{time}}
777
778 @emph{FR30 Options}
779 @gccoptlist{-msmall-model -mno-lsim}
780
781 @emph{FT32 Options}
782 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
783
784 @emph{FRV Options}
785 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
786 -mhard-float -msoft-float @gol
787 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
788 -mdouble -mno-double @gol
789 -mmedia -mno-media -mmuladd -mno-muladd @gol
790 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
791 -mlinked-fp -mlong-calls -malign-labels @gol
792 -mlibrary-pic -macc-4 -macc-8 @gol
793 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
794 -moptimize-membar -mno-optimize-membar @gol
795 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
796 -mvliw-branch -mno-vliw-branch @gol
797 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
798 -mno-nested-cond-exec -mtomcat-stats @gol
799 -mTLS -mtls @gol
800 -mcpu=@var{cpu}}
801
802 @emph{GNU/Linux Options}
803 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
804 -tno-android-cc -tno-android-ld}
805
806 @emph{H8/300 Options}
807 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
808
809 @emph{HPPA Options}
810 @gccoptlist{-march=@var{architecture-type} @gol
811 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
812 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
813 -mfixed-range=@var{register-range} @gol
814 -mjump-in-delay -mlinker-opt -mlong-calls @gol
815 -mlong-load-store -mno-disable-fpregs @gol
816 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
817 -mno-jump-in-delay -mno-long-load-store @gol
818 -mno-portable-runtime -mno-soft-float @gol
819 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
820 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
821 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
822 -munix=@var{unix-std} -nolibdld -static -threads}
823
824 @emph{IA-64 Options}
825 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
826 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
827 -mconstant-gp -mauto-pic -mfused-madd @gol
828 -minline-float-divide-min-latency @gol
829 -minline-float-divide-max-throughput @gol
830 -mno-inline-float-divide @gol
831 -minline-int-divide-min-latency @gol
832 -minline-int-divide-max-throughput @gol
833 -mno-inline-int-divide @gol
834 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
835 -mno-inline-sqrt @gol
836 -mdwarf2-asm -mearly-stop-bits @gol
837 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
838 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
839 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
840 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
841 -msched-spec-ldc -msched-spec-control-ldc @gol
842 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
843 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
844 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
845 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
846
847 @emph{LM32 Options}
848 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
849 -msign-extend-enabled -muser-enabled}
850
851 @emph{M32R/D Options}
852 @gccoptlist{-m32r2 -m32rx -m32r @gol
853 -mdebug @gol
854 -malign-loops -mno-align-loops @gol
855 -missue-rate=@var{number} @gol
856 -mbranch-cost=@var{number} @gol
857 -mmodel=@var{code-size-model-type} @gol
858 -msdata=@var{sdata-type} @gol
859 -mno-flush-func -mflush-func=@var{name} @gol
860 -mno-flush-trap -mflush-trap=@var{number} @gol
861 -G @var{num}}
862
863 @emph{M32C Options}
864 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
865
866 @emph{M680x0 Options}
867 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
868 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
869 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
870 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
871 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
872 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
873 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
874 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
875 -mxgot -mno-xgot -mlong-jump-table-offsets}
876
877 @emph{MCore Options}
878 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
879 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
880 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
881 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
882 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
883
884 @emph{MeP Options}
885 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
886 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
887 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
888 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
889 -mtiny=@var{n}}
890
891 @emph{MicroBlaze Options}
892 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
893 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
894 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
895 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
896 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}
897 -mpic-data-is-text-relative}
898
899 @emph{MIPS Options}
900 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
901 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
902 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
903 -mips16 -mno-mips16 -mflip-mips16 @gol
904 -minterlink-compressed -mno-interlink-compressed @gol
905 -minterlink-mips16 -mno-interlink-mips16 @gol
906 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
907 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
908 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
909 -mno-float -msingle-float -mdouble-float @gol
910 -modd-spreg -mno-odd-spreg @gol
911 -mabs=@var{mode} -mnan=@var{encoding} @gol
912 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
913 -mmcu -mmno-mcu @gol
914 -meva -mno-eva @gol
915 -mvirt -mno-virt @gol
916 -mxpa -mno-xpa @gol
917 -mcrc -mno-crc @gol
918 -mginv -mno-ginv @gol
919 -mmicromips -mno-micromips @gol
920 -mmsa -mno-msa @gol
921 -mfpu=@var{fpu-type} @gol
922 -msmartmips -mno-smartmips @gol
923 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
924 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
925 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
926 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
927 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
928 -membedded-data -mno-embedded-data @gol
929 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
930 -mcode-readable=@var{setting} @gol
931 -msplit-addresses -mno-split-addresses @gol
932 -mexplicit-relocs -mno-explicit-relocs @gol
933 -mcheck-zero-division -mno-check-zero-division @gol
934 -mdivide-traps -mdivide-breaks @gol
935 -mload-store-pairs -mno-load-store-pairs @gol
936 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
937 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
938 -mfix-24k -mno-fix-24k @gol
939 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
940 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
941 -mfix-vr4120 -mno-fix-vr4120 @gol
942 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
943 -mflush-func=@var{func} -mno-flush-func @gol
944 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
945 -mcompact-branches=@var{policy} @gol
946 -mfp-exceptions -mno-fp-exceptions @gol
947 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
948 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
949 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
950 -mframe-header-opt -mno-frame-header-opt}
951
952 @emph{MMIX Options}
953 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
954 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
955 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
956 -mno-base-addresses -msingle-exit -mno-single-exit}
957
958 @emph{MN10300 Options}
959 @gccoptlist{-mmult-bug -mno-mult-bug @gol
960 -mno-am33 -mam33 -mam33-2 -mam34 @gol
961 -mtune=@var{cpu-type} @gol
962 -mreturn-pointer-on-d0 @gol
963 -mno-crt0 -mrelax -mliw -msetlb}
964
965 @emph{Moxie Options}
966 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
967
968 @emph{MSP430 Options}
969 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
970 -mwarn-mcu @gol
971 -mcode-region= -mdata-region= @gol
972 -msilicon-errata= -msilicon-errata-warn= @gol
973 -mhwmult= -minrt}
974
975 @emph{NDS32 Options}
976 @gccoptlist{-mbig-endian -mlittle-endian @gol
977 -mreduced-regs -mfull-regs @gol
978 -mcmov -mno-cmov @gol
979 -mext-perf -mno-ext-perf @gol
980 -mext-perf2 -mno-ext-perf2 @gol
981 -mext-string -mno-ext-string @gol
982 -mv3push -mno-v3push @gol
983 -m16bit -mno-16bit @gol
984 -misr-vector-size=@var{num} @gol
985 -mcache-block-size=@var{num} @gol
986 -march=@var{arch} @gol
987 -mcmodel=@var{code-model} @gol
988 -mctor-dtor -mrelax}
989
990 @emph{Nios II Options}
991 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
992 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
993 -mel -meb @gol
994 -mno-bypass-cache -mbypass-cache @gol
995 -mno-cache-volatile -mcache-volatile @gol
996 -mno-fast-sw-div -mfast-sw-div @gol
997 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
998 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
999 -mcustom-fpu-cfg=@var{name} @gol
1000 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1001 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1002
1003 @emph{Nvidia PTX Options}
1004 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1005
1006 @emph{PDP-11 Options}
1007 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1008 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1009 -mfloat32 -mno-float64 -mfloat64 -mno-float32 @gol
1010 -msplit -munix-asm -mdec-asm -mgnu-asm}
1011
1012 @emph{picoChip Options}
1013 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1014 -msymbol-as-address -mno-inefficient-warnings}
1015
1016 @emph{PowerPC Options}
1017 See RS/6000 and PowerPC Options.
1018
1019 @emph{PowerPC SPE Options}
1020 @gccoptlist{-mcpu=@var{cpu-type} @gol
1021 -mtune=@var{cpu-type} @gol
1022 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb @gol
1023 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1024 -m32 -mxl-compat -mno-xl-compat @gol
1025 -malign-power -malign-natural @gol
1026 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1027 -msingle-float -mdouble-float @gol
1028 -mupdate -mno-update @gol
1029 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1030 -mstrict-align -mno-strict-align -mrelocatable @gol
1031 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1032 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1033 -msingle-pic-base @gol
1034 -mprioritize-restricted-insns=@var{priority} @gol
1035 -msched-costly-dep=@var{dependence_type} @gol
1036 -minsert-sched-nops=@var{scheme} @gol
1037 -mcall-sysv -mcall-netbsd @gol
1038 -maix-struct-return -msvr4-struct-return @gol
1039 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1040 -mblock-move-inline-limit=@var{num} @gol
1041 -misel -mno-isel @gol
1042 -misel=yes -misel=no @gol
1043 -mspe -mno-spe @gol
1044 -mspe=yes -mspe=no @gol
1045 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
1046 -mprototype -mno-prototype @gol
1047 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1048 -msdata=@var{opt} -mvxworks -G @var{num} @gol
1049 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1050 -mno-recip-precision @gol
1051 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1052 -msave-toc-indirect -mno-save-toc-indirect @gol
1053 -mcompat-align-parm -mno-compat-align-parm @gol
1054 -mfloat128 -mno-float128 @gol
1055 -mgnu-attribute -mno-gnu-attribute @gol
1056 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1057 -mstack-protector-guard-offset=@var{offset}}
1058
1059 @emph{RISC-V Options}
1060 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1061 -mplt -mno-plt @gol
1062 -mabi=@var{ABI-string} @gol
1063 -mfdiv -mno-fdiv @gol
1064 -mdiv -mno-div @gol
1065 -march=@var{ISA-string} @gol
1066 -mtune=@var{processor-string} @gol
1067 -mpreferred-stack-boundary=@var{num} @gol
1068 -msmall-data-limit=@var{N-bytes} @gol
1069 -msave-restore -mno-save-restore @gol
1070 -mstrict-align -mno-strict-align @gol
1071 -mcmodel=medlow -mcmodel=medany @gol
1072 -mexplicit-relocs -mno-explicit-relocs @gol
1073 -mrelax -mno-relax @gol}
1074
1075 @emph{RL78 Options}
1076 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1077 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1078 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1079
1080 @emph{RS/6000 and PowerPC Options}
1081 @gccoptlist{-mcpu=@var{cpu-type} @gol
1082 -mtune=@var{cpu-type} @gol
1083 -mcmodel=@var{code-model} @gol
1084 -mpowerpc64 @gol
1085 -maltivec -mno-altivec @gol
1086 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1087 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1088 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1089 -mfprnd -mno-fprnd @gol
1090 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
1091 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1092 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1093 -malign-power -malign-natural @gol
1094 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1095 -mupdate -mno-update @gol
1096 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1097 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1098 -mstrict-align -mno-strict-align -mrelocatable @gol
1099 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1100 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1101 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
1102 -mprioritize-restricted-insns=@var{priority} @gol
1103 -msched-costly-dep=@var{dependence_type} @gol
1104 -minsert-sched-nops=@var{scheme} @gol
1105 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1106 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1107 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1108 -mtraceback=@var{traceback_type} @gol
1109 -maix-struct-return -msvr4-struct-return @gol
1110 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1111 -mblock-move-inline-limit=@var{num} @gol
1112 -mblock-compare-inline-limit=@var{num} @gol
1113 -mblock-compare-inline-loop-limit=@var{num} @gol
1114 -mstring-compare-inline-limit=@var{num} @gol
1115 -misel -mno-isel @gol
1116 -mvrsave -mno-vrsave @gol
1117 -mmulhw -mno-mulhw @gol
1118 -mdlmzb -mno-dlmzb @gol
1119 -mprototype -mno-prototype @gol
1120 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1121 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1122 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1123 -mno-recip-precision @gol
1124 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1125 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1126 -msave-toc-indirect -mno-save-toc-indirect @gol
1127 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1128 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1129 -mquad-memory -mno-quad-memory @gol
1130 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1131 -mcompat-align-parm -mno-compat-align-parm @gol
1132 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1133 -mgnu-attribute -mno-gnu-attribute @gol
1134 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1135 -mstack-protector-guard-offset=@var{offset}}
1136
1137 @emph{RX Options}
1138 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1139 -mcpu=@gol
1140 -mbig-endian-data -mlittle-endian-data @gol
1141 -msmall-data @gol
1142 -msim -mno-sim@gol
1143 -mas100-syntax -mno-as100-syntax@gol
1144 -mrelax@gol
1145 -mmax-constant-size=@gol
1146 -mint-register=@gol
1147 -mpid@gol
1148 -mallow-string-insns -mno-allow-string-insns@gol
1149 -mjsr@gol
1150 -mno-warn-multiple-fast-interrupts@gol
1151 -msave-acc-in-interrupts}
1152
1153 @emph{S/390 and zSeries Options}
1154 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1155 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1156 -mlong-double-64 -mlong-double-128 @gol
1157 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1158 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1159 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1160 -mhtm -mvx -mzvector @gol
1161 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1162 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1163 -mhotpatch=@var{halfwords},@var{halfwords}}
1164
1165 @emph{Score Options}
1166 @gccoptlist{-meb -mel @gol
1167 -mnhwloop @gol
1168 -muls @gol
1169 -mmac @gol
1170 -mscore5 -mscore5u -mscore7 -mscore7d}
1171
1172 @emph{SH Options}
1173 @gccoptlist{-m1 -m2 -m2e @gol
1174 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1175 -m3 -m3e @gol
1176 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1177 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1178 -mb -ml -mdalign -mrelax @gol
1179 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1180 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1181 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1182 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1183 -maccumulate-outgoing-args @gol
1184 -matomic-model=@var{atomic-model} @gol
1185 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1186 -mcbranch-force-delay-slot @gol
1187 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1188 -mpretend-cmove -mtas}
1189
1190 @emph{Solaris 2 Options}
1191 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1192 -pthreads}
1193
1194 @emph{SPARC Options}
1195 @gccoptlist{-mcpu=@var{cpu-type} @gol
1196 -mtune=@var{cpu-type} @gol
1197 -mcmodel=@var{code-model} @gol
1198 -mmemory-model=@var{mem-model} @gol
1199 -m32 -m64 -mapp-regs -mno-app-regs @gol
1200 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1201 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1202 -mhard-quad-float -msoft-quad-float @gol
1203 -mstack-bias -mno-stack-bias @gol
1204 -mstd-struct-return -mno-std-struct-return @gol
1205 -munaligned-doubles -mno-unaligned-doubles @gol
1206 -muser-mode -mno-user-mode @gol
1207 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1208 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1209 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1210 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1211 -mpopc -mno-popc -msubxc -mno-subxc @gol
1212 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1213 -mlra -mno-lra}
1214
1215 @emph{SPU Options}
1216 @gccoptlist{-mwarn-reloc -merror-reloc @gol
1217 -msafe-dma -munsafe-dma @gol
1218 -mbranch-hints @gol
1219 -msmall-mem -mlarge-mem -mstdmain @gol
1220 -mfixed-range=@var{register-range} @gol
1221 -mea32 -mea64 @gol
1222 -maddress-space-conversion -mno-address-space-conversion @gol
1223 -mcache-size=@var{cache-size} @gol
1224 -matomic-updates -mno-atomic-updates}
1225
1226 @emph{System V Options}
1227 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1228
1229 @emph{TILE-Gx Options}
1230 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1231 -mcmodel=@var{code-model}}
1232
1233 @emph{TILEPro Options}
1234 @gccoptlist{-mcpu=@var{cpu} -m32}
1235
1236 @emph{V850 Options}
1237 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1238 -mprolog-function -mno-prolog-function -mspace @gol
1239 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1240 -mapp-regs -mno-app-regs @gol
1241 -mdisable-callt -mno-disable-callt @gol
1242 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1243 -mv850e -mv850 -mv850e3v5 @gol
1244 -mloop @gol
1245 -mrelax @gol
1246 -mlong-jumps @gol
1247 -msoft-float @gol
1248 -mhard-float @gol
1249 -mgcc-abi @gol
1250 -mrh850-abi @gol
1251 -mbig-switch}
1252
1253 @emph{VAX Options}
1254 @gccoptlist{-mg -mgnu -munix}
1255
1256 @emph{Visium Options}
1257 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1258 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1259
1260 @emph{VMS Options}
1261 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1262 -mpointer-size=@var{size}}
1263
1264 @emph{VxWorks Options}
1265 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1266 -Xbind-lazy -Xbind-now}
1267
1268 @emph{x86 Options}
1269 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1270 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1271 -mfpmath=@var{unit} @gol
1272 -masm=@var{dialect} -mno-fancy-math-387 @gol
1273 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1274 -mno-wide-multiply -mrtd -malign-double @gol
1275 -mpreferred-stack-boundary=@var{num} @gol
1276 -mincoming-stack-boundary=@var{num} @gol
1277 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1278 -mrecip -mrecip=@var{opt} @gol
1279 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1280 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1281 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1282 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1283 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1284 -mprefetchwt1 -mclflushopt -mxsavec -mxsaves @gol
1285 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1286 -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp @gol
1287 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1288 -mshstk -mforce-indirect-call -mavx512vbmi2 @gol
1289 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq
1290 -mcldemote @gol
1291 -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1292 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1293 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1294 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1295 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1296 -mregparm=@var{num} -msseregparm @gol
1297 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1298 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1299 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1300 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1301 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1302 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1303 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1304 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1305 -mstack-protector-guard-reg=@var{reg} @gol
1306 -mstack-protector-guard-offset=@var{offset} @gol
1307 -mstack-protector-guard-symbol=@var{symbol} @gol
1308 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1309 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1310 -mindirect-branch-register}
1311
1312 @emph{x86 Windows Options}
1313 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1314 -mnop-fun-dllimport -mthread @gol
1315 -municode -mwin32 -mwindows -fno-set-stack-executable}
1316
1317 @emph{Xstormy16 Options}
1318 @gccoptlist{-msim}
1319
1320 @emph{Xtensa Options}
1321 @gccoptlist{-mconst16 -mno-const16 @gol
1322 -mfused-madd -mno-fused-madd @gol
1323 -mforce-no-pic @gol
1324 -mserialize-volatile -mno-serialize-volatile @gol
1325 -mtext-section-literals -mno-text-section-literals @gol
1326 -mauto-litpools -mno-auto-litpools @gol
1327 -mtarget-align -mno-target-align @gol
1328 -mlongcalls -mno-longcalls}
1329
1330 @emph{zSeries Options}
1331 See S/390 and zSeries Options.
1332 @end table
1333
1334
1335 @node Overall Options
1336 @section Options Controlling the Kind of Output
1337
1338 Compilation can involve up to four stages: preprocessing, compilation
1339 proper, assembly and linking, always in that order. GCC is capable of
1340 preprocessing and compiling several files either into several
1341 assembler input files, or into one assembler input file; then each
1342 assembler input file produces an object file, and linking combines all
1343 the object files (those newly compiled, and those specified as input)
1344 into an executable file.
1345
1346 @cindex file name suffix
1347 For any given input file, the file name suffix determines what kind of
1348 compilation is done:
1349
1350 @table @gcctabopt
1351 @item @var{file}.c
1352 C source code that must be preprocessed.
1353
1354 @item @var{file}.i
1355 C source code that should not be preprocessed.
1356
1357 @item @var{file}.ii
1358 C++ source code that should not be preprocessed.
1359
1360 @item @var{file}.m
1361 Objective-C source code. Note that you must link with the @file{libobjc}
1362 library to make an Objective-C program work.
1363
1364 @item @var{file}.mi
1365 Objective-C source code that should not be preprocessed.
1366
1367 @item @var{file}.mm
1368 @itemx @var{file}.M
1369 Objective-C++ source code. Note that you must link with the @file{libobjc}
1370 library to make an Objective-C++ program work. Note that @samp{.M} refers
1371 to a literal capital M@.
1372
1373 @item @var{file}.mii
1374 Objective-C++ source code that should not be preprocessed.
1375
1376 @item @var{file}.h
1377 C, C++, Objective-C or Objective-C++ header file to be turned into a
1378 precompiled header (default), or C, C++ header file to be turned into an
1379 Ada spec (via the @option{-fdump-ada-spec} switch).
1380
1381 @item @var{file}.cc
1382 @itemx @var{file}.cp
1383 @itemx @var{file}.cxx
1384 @itemx @var{file}.cpp
1385 @itemx @var{file}.CPP
1386 @itemx @var{file}.c++
1387 @itemx @var{file}.C
1388 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1389 the last two letters must both be literally @samp{x}. Likewise,
1390 @samp{.C} refers to a literal capital C@.
1391
1392 @item @var{file}.mm
1393 @itemx @var{file}.M
1394 Objective-C++ source code that must be preprocessed.
1395
1396 @item @var{file}.mii
1397 Objective-C++ source code that should not be preprocessed.
1398
1399 @item @var{file}.hh
1400 @itemx @var{file}.H
1401 @itemx @var{file}.hp
1402 @itemx @var{file}.hxx
1403 @itemx @var{file}.hpp
1404 @itemx @var{file}.HPP
1405 @itemx @var{file}.h++
1406 @itemx @var{file}.tcc
1407 C++ header file to be turned into a precompiled header or Ada spec.
1408
1409 @item @var{file}.f
1410 @itemx @var{file}.for
1411 @itemx @var{file}.ftn
1412 Fixed form Fortran source code that should not be preprocessed.
1413
1414 @item @var{file}.F
1415 @itemx @var{file}.FOR
1416 @itemx @var{file}.fpp
1417 @itemx @var{file}.FPP
1418 @itemx @var{file}.FTN
1419 Fixed form Fortran source code that must be preprocessed (with the traditional
1420 preprocessor).
1421
1422 @item @var{file}.f90
1423 @itemx @var{file}.f95
1424 @itemx @var{file}.f03
1425 @itemx @var{file}.f08
1426 Free form Fortran source code that should not be preprocessed.
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 must be preprocessed (with the
1433 traditional preprocessor).
1434
1435 @item @var{file}.go
1436 Go source code.
1437
1438 @item @var{file}.brig
1439 BRIG files (binary representation of HSAIL).
1440
1441 @item @var{file}.ads
1442 Ada source code file that contains a library unit declaration (a
1443 declaration of a package, subprogram, or generic, or a generic
1444 instantiation), or a library unit renaming declaration (a package,
1445 generic, or subprogram renaming declaration). Such files are also
1446 called @dfn{specs}.
1447
1448 @item @var{file}.adb
1449 Ada source code file containing a library unit body (a subprogram or
1450 package body). Such files are also called @dfn{bodies}.
1451
1452 @c GCC also knows about some suffixes for languages not yet included:
1453 @c Pascal:
1454 @c @var{file}.p
1455 @c @var{file}.pas
1456 @c Ratfor:
1457 @c @var{file}.r
1458
1459 @item @var{file}.s
1460 Assembler code.
1461
1462 @item @var{file}.S
1463 @itemx @var{file}.sx
1464 Assembler code that must be preprocessed.
1465
1466 @item @var{other}
1467 An object file to be fed straight into linking.
1468 Any file name with no recognized suffix is treated this way.
1469 @end table
1470
1471 @opindex x
1472 You can specify the input language explicitly with the @option{-x} option:
1473
1474 @table @gcctabopt
1475 @item -x @var{language}
1476 Specify explicitly the @var{language} for the following input files
1477 (rather than letting the compiler choose a default based on the file
1478 name suffix). This option applies to all following input files until
1479 the next @option{-x} option. Possible values for @var{language} are:
1480 @smallexample
1481 c c-header cpp-output
1482 c++ c++-header c++-cpp-output
1483 objective-c objective-c-header objective-c-cpp-output
1484 objective-c++ objective-c++-header objective-c++-cpp-output
1485 assembler assembler-with-cpp
1486 ada
1487 f77 f77-cpp-input f95 f95-cpp-input
1488 go
1489 brig
1490 @end smallexample
1491
1492 @item -x none
1493 Turn off any specification of a language, so that subsequent files are
1494 handled according to their file name suffixes (as they are if @option{-x}
1495 has not been used at all).
1496 @end table
1497
1498 If you only want some of the stages of compilation, you can use
1499 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1500 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1501 @command{gcc} is to stop. Note that some combinations (for example,
1502 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1503
1504 @table @gcctabopt
1505 @item -c
1506 @opindex c
1507 Compile or assemble the source files, but do not link. The linking
1508 stage simply is not done. The ultimate output is in the form of an
1509 object file for each source file.
1510
1511 By default, the object file name for a source file is made by replacing
1512 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1513
1514 Unrecognized input files, not requiring compilation or assembly, are
1515 ignored.
1516
1517 @item -S
1518 @opindex S
1519 Stop after the stage of compilation proper; do not assemble. The output
1520 is in the form of an assembler code file for each non-assembler input
1521 file specified.
1522
1523 By default, the assembler file name for a source file is made by
1524 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1525
1526 Input files that don't require compilation are ignored.
1527
1528 @item -E
1529 @opindex E
1530 Stop after the preprocessing stage; do not run the compiler proper. The
1531 output is in the form of preprocessed source code, which is sent to the
1532 standard output.
1533
1534 Input files that don't require preprocessing are ignored.
1535
1536 @cindex output file option
1537 @item -o @var{file}
1538 @opindex o
1539 Place output in file @var{file}. This applies to whatever
1540 sort of output is being produced, whether it be an executable file,
1541 an object file, an assembler file or preprocessed C code.
1542
1543 If @option{-o} is not specified, the default is to put an executable
1544 file in @file{a.out}, the object file for
1545 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1546 assembler file in @file{@var{source}.s}, a precompiled header file in
1547 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1548 standard output.
1549
1550 @item -v
1551 @opindex v
1552 Print (on standard error output) the commands executed to run the stages
1553 of compilation. Also print the version number of the compiler driver
1554 program and of the preprocessor and the compiler proper.
1555
1556 @item -###
1557 @opindex ###
1558 Like @option{-v} except the commands are not executed and arguments
1559 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1560 This is useful for shell scripts to capture the driver-generated command lines.
1561
1562 @item --help
1563 @opindex help
1564 Print (on the standard output) a description of the command-line options
1565 understood by @command{gcc}. If the @option{-v} option is also specified
1566 then @option{--help} is also passed on to the various processes
1567 invoked by @command{gcc}, so that they can display the command-line options
1568 they accept. If the @option{-Wextra} option has also been specified
1569 (prior to the @option{--help} option), then command-line options that
1570 have no documentation associated with them are also displayed.
1571
1572 @item --target-help
1573 @opindex target-help
1574 Print (on the standard output) a description of target-specific command-line
1575 options for each tool. For some targets extra target-specific
1576 information may also be printed.
1577
1578 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1579 Print (on the standard output) a description of the command-line
1580 options understood by the compiler that fit into all specified classes
1581 and qualifiers. These are the supported classes:
1582
1583 @table @asis
1584 @item @samp{optimizers}
1585 Display all of the optimization options supported by the
1586 compiler.
1587
1588 @item @samp{warnings}
1589 Display all of the options controlling warning messages
1590 produced by the compiler.
1591
1592 @item @samp{target}
1593 Display target-specific options. Unlike the
1594 @option{--target-help} option however, target-specific options of the
1595 linker and assembler are not displayed. This is because those
1596 tools do not currently support the extended @option{--help=} syntax.
1597
1598 @item @samp{params}
1599 Display the values recognized by the @option{--param}
1600 option.
1601
1602 @item @var{language}
1603 Display the options supported for @var{language}, where
1604 @var{language} is the name of one of the languages supported in this
1605 version of GCC@.
1606
1607 @item @samp{common}
1608 Display the options that are common to all languages.
1609 @end table
1610
1611 These are the supported qualifiers:
1612
1613 @table @asis
1614 @item @samp{undocumented}
1615 Display only those options that are undocumented.
1616
1617 @item @samp{joined}
1618 Display options taking an argument that appears after an equal
1619 sign in the same continuous piece of text, such as:
1620 @samp{--help=target}.
1621
1622 @item @samp{separate}
1623 Display options taking an argument that appears as a separate word
1624 following the original option, such as: @samp{-o output-file}.
1625 @end table
1626
1627 Thus for example to display all the undocumented target-specific
1628 switches supported by the compiler, use:
1629
1630 @smallexample
1631 --help=target,undocumented
1632 @end smallexample
1633
1634 The sense of a qualifier can be inverted by prefixing it with the
1635 @samp{^} character, so for example to display all binary warning
1636 options (i.e., ones that are either on or off and that do not take an
1637 argument) that have a description, use:
1638
1639 @smallexample
1640 --help=warnings,^joined,^undocumented
1641 @end smallexample
1642
1643 The argument to @option{--help=} should not consist solely of inverted
1644 qualifiers.
1645
1646 Combining several classes is possible, although this usually
1647 restricts the output so much that there is nothing to display. One
1648 case where it does work, however, is when one of the classes is
1649 @var{target}. For example, to display all the target-specific
1650 optimization options, use:
1651
1652 @smallexample
1653 --help=target,optimizers
1654 @end smallexample
1655
1656 The @option{--help=} option can be repeated on the command line. Each
1657 successive use displays its requested class of options, skipping
1658 those that have already been displayed.
1659
1660 If the @option{-Q} option appears on the command line before the
1661 @option{--help=} option, then the descriptive text displayed by
1662 @option{--help=} is changed. Instead of describing the displayed
1663 options, an indication is given as to whether the option is enabled,
1664 disabled or set to a specific value (assuming that the compiler
1665 knows this at the point where the @option{--help=} option is used).
1666
1667 Here is a truncated example from the ARM port of @command{gcc}:
1668
1669 @smallexample
1670 % gcc -Q -mabi=2 --help=target -c
1671 The following options are target specific:
1672 -mabi= 2
1673 -mabort-on-noreturn [disabled]
1674 -mapcs [disabled]
1675 @end smallexample
1676
1677 The output is sensitive to the effects of previous command-line
1678 options, so for example it is possible to find out which optimizations
1679 are enabled at @option{-O2} by using:
1680
1681 @smallexample
1682 -Q -O2 --help=optimizers
1683 @end smallexample
1684
1685 Alternatively you can discover which binary optimizations are enabled
1686 by @option{-O3} by using:
1687
1688 @smallexample
1689 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1690 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1691 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1692 @end smallexample
1693
1694 @item --version
1695 @opindex version
1696 Display the version number and copyrights of the invoked GCC@.
1697
1698 @item -pass-exit-codes
1699 @opindex pass-exit-codes
1700 Normally the @command{gcc} program exits with the code of 1 if any
1701 phase of the compiler returns a non-success return code. If you specify
1702 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1703 the numerically highest error produced by any phase returning an error
1704 indication. The C, C++, and Fortran front ends return 4 if an internal
1705 compiler error is encountered.
1706
1707 @item -pipe
1708 @opindex pipe
1709 Use pipes rather than temporary files for communication between the
1710 various stages of compilation. This fails to work on some systems where
1711 the assembler is unable to read from a pipe; but the GNU assembler has
1712 no trouble.
1713
1714 @item -specs=@var{file}
1715 @opindex specs
1716 Process @var{file} after the compiler reads in the standard @file{specs}
1717 file, in order to override the defaults which the @command{gcc} driver
1718 program uses when determining what switches to pass to @command{cc1},
1719 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1720 @option{-specs=@var{file}} can be specified on the command line, and they
1721 are processed in order, from left to right. @xref{Spec Files}, for
1722 information about the format of the @var{file}.
1723
1724 @item -wrapper
1725 @opindex wrapper
1726 Invoke all subcommands under a wrapper program. The name of the
1727 wrapper program and its parameters are passed as a comma separated
1728 list.
1729
1730 @smallexample
1731 gcc -c t.c -wrapper gdb,--args
1732 @end smallexample
1733
1734 @noindent
1735 This invokes all subprograms of @command{gcc} under
1736 @samp{gdb --args}, thus the invocation of @command{cc1} is
1737 @samp{gdb --args cc1 @dots{}}.
1738
1739 @item -ffile-prefix-map=@var{old}=@var{new}
1740 @opindex ffile-prefix-map
1741 When compiling files residing in directory @file{@var{old}}, record
1742 any references to them in the result of the compilation as if the
1743 files resided in directory @file{@var{new}} instead. Specifying this
1744 option is equivalent to specifying all the individual
1745 @option{-f*-prefix-map} options. This can be used to make reproducible
1746 builds that are location independent. See also
1747 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1748
1749 @item -fplugin=@var{name}.so
1750 @opindex fplugin
1751 Load the plugin code in file @var{name}.so, assumed to be a
1752 shared object to be dlopen'd by the compiler. The base name of
1753 the shared object file is used to identify the plugin for the
1754 purposes of argument parsing (See
1755 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1756 Each plugin should define the callback functions specified in the
1757 Plugins API.
1758
1759 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1760 @opindex fplugin-arg
1761 Define an argument called @var{key} with a value of @var{value}
1762 for the plugin called @var{name}.
1763
1764 @item -fdump-ada-spec@r{[}-slim@r{]}
1765 @opindex fdump-ada-spec
1766 For C and C++ source and include files, generate corresponding Ada specs.
1767 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1768 GNAT User's Guide}, which provides detailed documentation on this feature.
1769
1770 @item -fada-spec-parent=@var{unit}
1771 @opindex fada-spec-parent
1772 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1773 Ada specs as child units of parent @var{unit}.
1774
1775 @item -fdump-go-spec=@var{file}
1776 @opindex fdump-go-spec
1777 For input files in any language, generate corresponding Go
1778 declarations in @var{file}. This generates Go @code{const},
1779 @code{type}, @code{var}, and @code{func} declarations which may be a
1780 useful way to start writing a Go interface to code written in some
1781 other language.
1782
1783 @include @value{srcdir}/../libiberty/at-file.texi
1784 @end table
1785
1786 @node Invoking G++
1787 @section Compiling C++ Programs
1788
1789 @cindex suffixes for C++ source
1790 @cindex C++ source file suffixes
1791 C++ source files conventionally use one of the suffixes @samp{.C},
1792 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1793 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1794 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1795 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1796 files with these names and compiles them as C++ programs even if you
1797 call the compiler the same way as for compiling C programs (usually
1798 with the name @command{gcc}).
1799
1800 @findex g++
1801 @findex c++
1802 However, the use of @command{gcc} does not add the C++ library.
1803 @command{g++} is a program that calls GCC and automatically specifies linking
1804 against the C++ library. It treats @samp{.c},
1805 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1806 files unless @option{-x} is used. This program is also useful when
1807 precompiling a C header file with a @samp{.h} extension for use in C++
1808 compilations. On many systems, @command{g++} is also installed with
1809 the name @command{c++}.
1810
1811 @cindex invoking @command{g++}
1812 When you compile C++ programs, you may specify many of the same
1813 command-line options that you use for compiling programs in any
1814 language; or command-line options meaningful for C and related
1815 languages; or options that are meaningful only for C++ programs.
1816 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1817 explanations of options for languages related to C@.
1818 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1819 explanations of options that are meaningful only for C++ programs.
1820
1821 @node C Dialect Options
1822 @section Options Controlling C Dialect
1823 @cindex dialect options
1824 @cindex language dialect options
1825 @cindex options, dialect
1826
1827 The following options control the dialect of C (or languages derived
1828 from C, such as C++, Objective-C and Objective-C++) that the compiler
1829 accepts:
1830
1831 @table @gcctabopt
1832 @cindex ANSI support
1833 @cindex ISO support
1834 @item -ansi
1835 @opindex ansi
1836 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1837 equivalent to @option{-std=c++98}.
1838
1839 This turns off certain features of GCC that are incompatible with ISO
1840 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1841 such as the @code{asm} and @code{typeof} keywords, and
1842 predefined macros such as @code{unix} and @code{vax} that identify the
1843 type of system you are using. It also enables the undesirable and
1844 rarely used ISO trigraph feature. For the C compiler,
1845 it disables recognition of C++ style @samp{//} comments as well as
1846 the @code{inline} keyword.
1847
1848 The alternate keywords @code{__asm__}, @code{__extension__},
1849 @code{__inline__} and @code{__typeof__} continue to work despite
1850 @option{-ansi}. You would not want to use them in an ISO C program, of
1851 course, but it is useful to put them in header files that might be included
1852 in compilations done with @option{-ansi}. Alternate predefined macros
1853 such as @code{__unix__} and @code{__vax__} are also available, with or
1854 without @option{-ansi}.
1855
1856 The @option{-ansi} option does not cause non-ISO programs to be
1857 rejected gratuitously. For that, @option{-Wpedantic} is required in
1858 addition to @option{-ansi}. @xref{Warning Options}.
1859
1860 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1861 option is used. Some header files may notice this macro and refrain
1862 from declaring certain functions or defining certain macros that the
1863 ISO standard doesn't call for; this is to avoid interfering with any
1864 programs that might use these names for other things.
1865
1866 Functions that are normally built in but do not have semantics
1867 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1868 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1869 built-in functions provided by GCC}, for details of the functions
1870 affected.
1871
1872 @item -std=
1873 @opindex std
1874 Determine the language standard. @xref{Standards,,Language Standards
1875 Supported by GCC}, for details of these standard versions. This option
1876 is currently only supported when compiling C or C++.
1877
1878 The compiler can accept several base standards, such as @samp{c90} or
1879 @samp{c++98}, and GNU dialects of those standards, such as
1880 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1881 compiler accepts all programs following that standard plus those
1882 using GNU extensions that do not contradict it. For example,
1883 @option{-std=c90} turns off certain features of GCC that are
1884 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1885 keywords, but not other GNU extensions that do not have a meaning in
1886 ISO C90, such as omitting the middle term of a @code{?:}
1887 expression. On the other hand, when a GNU dialect of a standard is
1888 specified, all features supported by the compiler are enabled, even when
1889 those features change the meaning of the base standard. As a result, some
1890 strict-conforming programs may be rejected. The particular standard
1891 is used by @option{-Wpedantic} to identify which features are GNU
1892 extensions given that version of the standard. For example
1893 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1894 comments, while @option{-std=gnu99 -Wpedantic} does not.
1895
1896 A value for this option must be provided; possible values are
1897
1898 @table @samp
1899 @item c90
1900 @itemx c89
1901 @itemx iso9899:1990
1902 Support all ISO C90 programs (certain GNU extensions that conflict
1903 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1904
1905 @item iso9899:199409
1906 ISO C90 as modified in amendment 1.
1907
1908 @item c99
1909 @itemx c9x
1910 @itemx iso9899:1999
1911 @itemx iso9899:199x
1912 ISO C99. This standard is substantially completely supported, modulo
1913 bugs and floating-point issues
1914 (mainly but not entirely relating to optional C99 features from
1915 Annexes F and G). See
1916 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1917 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1918
1919 @item c11
1920 @itemx c1x
1921 @itemx iso9899:2011
1922 ISO C11, the 2011 revision of the ISO C standard. This standard is
1923 substantially completely supported, modulo bugs, floating-point issues
1924 (mainly but not entirely relating to optional C11 features from
1925 Annexes F and G) and the optional Annexes K (Bounds-checking
1926 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1927
1928 @item c17
1929 @itemx c18
1930 @itemx iso9899:2017
1931 @itemx iso9899:2018
1932 ISO C17, the 2017 revision of the ISO C standard (expected to be
1933 published in 2018). This standard is
1934 same as C11 except for corrections of defects (all of which are also
1935 applied with @option{-std=c11}) and a new value of
1936 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1937
1938 @item gnu90
1939 @itemx gnu89
1940 GNU dialect of ISO C90 (including some C99 features).
1941
1942 @item gnu99
1943 @itemx gnu9x
1944 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1945
1946 @item gnu11
1947 @itemx gnu1x
1948 GNU dialect of ISO C11.
1949 The name @samp{gnu1x} is deprecated.
1950
1951 @item gnu17
1952 @itemx gnu18
1953 GNU dialect of ISO C17. This is the default for C code.
1954
1955 @item c++98
1956 @itemx c++03
1957 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1958 additional defect reports. Same as @option{-ansi} for C++ code.
1959
1960 @item gnu++98
1961 @itemx gnu++03
1962 GNU dialect of @option{-std=c++98}.
1963
1964 @item c++11
1965 @itemx c++0x
1966 The 2011 ISO C++ standard plus amendments.
1967 The name @samp{c++0x} is deprecated.
1968
1969 @item gnu++11
1970 @itemx gnu++0x
1971 GNU dialect of @option{-std=c++11}.
1972 The name @samp{gnu++0x} is deprecated.
1973
1974 @item c++14
1975 @itemx c++1y
1976 The 2014 ISO C++ standard plus amendments.
1977 The name @samp{c++1y} is deprecated.
1978
1979 @item gnu++14
1980 @itemx gnu++1y
1981 GNU dialect of @option{-std=c++14}.
1982 This is the default for C++ code.
1983 The name @samp{gnu++1y} is deprecated.
1984
1985 @item c++17
1986 @itemx c++1z
1987 The 2017 ISO C++ standard plus amendments.
1988 The name @samp{c++1z} is deprecated.
1989
1990 @item gnu++17
1991 @itemx gnu++1z
1992 GNU dialect of @option{-std=c++17}.
1993 The name @samp{gnu++1z} is deprecated.
1994
1995 @item c++2a
1996 The next revision of the ISO C++ standard, tentatively planned for
1997 2020. Support is highly experimental, and will almost certainly
1998 change in incompatible ways in future releases.
1999
2000 @item gnu++2a
2001 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2002 and will almost certainly change in incompatible ways in future
2003 releases.
2004 @end table
2005
2006 @item -fgnu89-inline
2007 @opindex fgnu89-inline
2008 The option @option{-fgnu89-inline} tells GCC to use the traditional
2009 GNU semantics for @code{inline} functions when in C99 mode.
2010 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2011 Using this option is roughly equivalent to adding the
2012 @code{gnu_inline} function attribute to all inline functions
2013 (@pxref{Function Attributes}).
2014
2015 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2016 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2017 specifies the default behavior).
2018 This option is not supported in @option{-std=c90} or
2019 @option{-std=gnu90} mode.
2020
2021 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2022 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2023 in effect for @code{inline} functions. @xref{Common Predefined
2024 Macros,,,cpp,The C Preprocessor}.
2025
2026 @item -fpermitted-flt-eval-methods=@var{style}
2027 @opindex fpermitted-flt-eval-methods
2028 @opindex fpermitted-flt-eval-methods=c11
2029 @opindex fpermitted-flt-eval-methods=ts-18661-3
2030 ISO/IEC TS 18661-3 defines new permissible values for
2031 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2032 a semantic type that is an interchange or extended format should be
2033 evaluated to the precision and range of that type. These new values are
2034 a superset of those permitted under C99/C11, which does not specify the
2035 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2036 conforming to C11 may not have been written expecting the possibility of
2037 the new values.
2038
2039 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2040 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2041 or the extended set of values specified in ISO/IEC TS 18661-3.
2042
2043 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2044
2045 The default when in a standards compliant mode (@option{-std=c11} or similar)
2046 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2047 dialect (@option{-std=gnu11} or similar) is
2048 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2049
2050 @item -aux-info @var{filename}
2051 @opindex aux-info
2052 Output to the given filename prototyped declarations for all functions
2053 declared and/or defined in a translation unit, including those in header
2054 files. This option is silently ignored in any language other than C@.
2055
2056 Besides declarations, the file indicates, in comments, the origin of
2057 each declaration (source file and line), whether the declaration was
2058 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2059 @samp{O} for old, respectively, in the first character after the line
2060 number and the colon), and whether it came from a declaration or a
2061 definition (@samp{C} or @samp{F}, respectively, in the following
2062 character). In the case of function definitions, a K&R-style list of
2063 arguments followed by their declarations is also provided, inside
2064 comments, after the declaration.
2065
2066 @item -fallow-parameterless-variadic-functions
2067 @opindex fallow-parameterless-variadic-functions
2068 Accept variadic functions without named parameters.
2069
2070 Although it is possible to define such a function, this is not very
2071 useful as it is not possible to read the arguments. This is only
2072 supported for C as this construct is allowed by C++.
2073
2074 @item -fno-asm
2075 @opindex fno-asm
2076 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2077 keyword, so that code can use these words as identifiers. You can use
2078 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2079 instead. @option{-ansi} implies @option{-fno-asm}.
2080
2081 In C++, this switch only affects the @code{typeof} keyword, since
2082 @code{asm} and @code{inline} are standard keywords. You may want to
2083 use the @option{-fno-gnu-keywords} flag instead, which has the same
2084 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2085 switch only affects the @code{asm} and @code{typeof} keywords, since
2086 @code{inline} is a standard keyword in ISO C99.
2087
2088 @item -fno-builtin
2089 @itemx -fno-builtin-@var{function}
2090 @opindex fno-builtin
2091 @cindex built-in functions
2092 Don't recognize built-in functions that do not begin with
2093 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2094 functions provided by GCC}, for details of the functions affected,
2095 including those which are not built-in functions when @option{-ansi} or
2096 @option{-std} options for strict ISO C conformance are used because they
2097 do not have an ISO standard meaning.
2098
2099 GCC normally generates special code to handle certain built-in functions
2100 more efficiently; for instance, calls to @code{alloca} may become single
2101 instructions which adjust the stack directly, and calls to @code{memcpy}
2102 may become inline copy loops. The resulting code is often both smaller
2103 and faster, but since the function calls no longer appear as such, you
2104 cannot set a breakpoint on those calls, nor can you change the behavior
2105 of the functions by linking with a different library. In addition,
2106 when a function is recognized as a built-in function, GCC may use
2107 information about that function to warn about problems with calls to
2108 that function, or to generate more efficient code, even if the
2109 resulting code still contains calls to that function. For example,
2110 warnings are given with @option{-Wformat} for bad calls to
2111 @code{printf} when @code{printf} is built in and @code{strlen} is
2112 known not to modify global memory.
2113
2114 With the @option{-fno-builtin-@var{function}} option
2115 only the built-in function @var{function} is
2116 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2117 function is named that is not built-in in this version of GCC, this
2118 option is ignored. There is no corresponding
2119 @option{-fbuiltin-@var{function}} option; if you wish to enable
2120 built-in functions selectively when using @option{-fno-builtin} or
2121 @option{-ffreestanding}, you may define macros such as:
2122
2123 @smallexample
2124 #define abs(n) __builtin_abs ((n))
2125 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2126 @end smallexample
2127
2128 @item -fgimple
2129 @opindex fgimple
2130
2131 Enable parsing of function definitions marked with @code{__GIMPLE}.
2132 This is an experimental feature that allows unit testing of GIMPLE
2133 passes.
2134
2135 @item -fhosted
2136 @opindex fhosted
2137 @cindex hosted environment
2138
2139 Assert that compilation targets a hosted environment. This implies
2140 @option{-fbuiltin}. A hosted environment is one in which the
2141 entire standard library is available, and in which @code{main} has a return
2142 type of @code{int}. Examples are nearly everything except a kernel.
2143 This is equivalent to @option{-fno-freestanding}.
2144
2145 @item -ffreestanding
2146 @opindex ffreestanding
2147 @cindex hosted environment
2148
2149 Assert that compilation targets a freestanding environment. This
2150 implies @option{-fno-builtin}. A freestanding environment
2151 is one in which the standard library may not exist, and program startup may
2152 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2153 This is equivalent to @option{-fno-hosted}.
2154
2155 @xref{Standards,,Language Standards Supported by GCC}, for details of
2156 freestanding and hosted environments.
2157
2158 @item -fopenacc
2159 @opindex fopenacc
2160 @cindex OpenACC accelerator programming
2161 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2162 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2163 compiler generates accelerated code according to the OpenACC Application
2164 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2165 implies @option{-pthread}, and thus is only supported on targets that
2166 have support for @option{-pthread}.
2167
2168 @item -fopenacc-dim=@var{geom}
2169 @opindex fopenacc-dim
2170 @cindex OpenACC accelerator programming
2171 Specify default compute dimensions for parallel offload regions that do
2172 not explicitly specify. The @var{geom} value is a triple of
2173 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2174 can be omitted, to use a target-specific default value.
2175
2176 @item -fopenmp
2177 @opindex fopenmp
2178 @cindex OpenMP parallel
2179 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2180 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2181 compiler generates parallel code according to the OpenMP Application
2182 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2183 implies @option{-pthread}, and thus is only supported on targets that
2184 have support for @option{-pthread}. @option{-fopenmp} implies
2185 @option{-fopenmp-simd}.
2186
2187 @item -fopenmp-simd
2188 @opindex fopenmp-simd
2189 @cindex OpenMP SIMD
2190 @cindex SIMD
2191 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2192 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2193 are ignored.
2194
2195 @item -fgnu-tm
2196 @opindex fgnu-tm
2197 When the option @option{-fgnu-tm} is specified, the compiler
2198 generates code for the Linux variant of Intel's current Transactional
2199 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2200 an experimental feature whose interface may change in future versions
2201 of GCC, as the official specification changes. Please note that not
2202 all architectures are supported for this feature.
2203
2204 For more information on GCC's support for transactional memory,
2205 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2206 Transactional Memory Library}.
2207
2208 Note that the transactional memory feature is not supported with
2209 non-call exceptions (@option{-fnon-call-exceptions}).
2210
2211 @item -fms-extensions
2212 @opindex fms-extensions
2213 Accept some non-standard constructs used in Microsoft header files.
2214
2215 In C++ code, this allows member names in structures to be similar
2216 to previous types declarations.
2217
2218 @smallexample
2219 typedef int UOW;
2220 struct ABC @{
2221 UOW UOW;
2222 @};
2223 @end smallexample
2224
2225 Some cases of unnamed fields in structures and unions are only
2226 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2227 fields within structs/unions}, for details.
2228
2229 Note that this option is off for all targets but x86
2230 targets using ms-abi.
2231
2232 @item -fplan9-extensions
2233 @opindex fplan9-extensions
2234 Accept some non-standard constructs used in Plan 9 code.
2235
2236 This enables @option{-fms-extensions}, permits passing pointers to
2237 structures with anonymous fields to functions that expect pointers to
2238 elements of the type of the field, and permits referring to anonymous
2239 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2240 struct/union fields within structs/unions}, for details. This is only
2241 supported for C, not C++.
2242
2243 @item -fcond-mismatch
2244 @opindex fcond-mismatch
2245 Allow conditional expressions with mismatched types in the second and
2246 third arguments. The value of such an expression is void. This option
2247 is not supported for C++.
2248
2249 @item -flax-vector-conversions
2250 @opindex flax-vector-conversions
2251 Allow implicit conversions between vectors with differing numbers of
2252 elements and/or incompatible element types. This option should not be
2253 used for new code.
2254
2255 @item -funsigned-char
2256 @opindex funsigned-char
2257 Let the type @code{char} be unsigned, like @code{unsigned char}.
2258
2259 Each kind of machine has a default for what @code{char} should
2260 be. It is either like @code{unsigned char} by default or like
2261 @code{signed char} by default.
2262
2263 Ideally, a portable program should always use @code{signed char} or
2264 @code{unsigned char} when it depends on the signedness of an object.
2265 But many programs have been written to use plain @code{char} and
2266 expect it to be signed, or expect it to be unsigned, depending on the
2267 machines they were written for. This option, and its inverse, let you
2268 make such a program work with the opposite default.
2269
2270 The type @code{char} is always a distinct type from each of
2271 @code{signed char} or @code{unsigned char}, even though its behavior
2272 is always just like one of those two.
2273
2274 @item -fsigned-char
2275 @opindex fsigned-char
2276 Let the type @code{char} be signed, like @code{signed char}.
2277
2278 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2279 the negative form of @option{-funsigned-char}. Likewise, the option
2280 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2281
2282 @item -fsigned-bitfields
2283 @itemx -funsigned-bitfields
2284 @itemx -fno-signed-bitfields
2285 @itemx -fno-unsigned-bitfields
2286 @opindex fsigned-bitfields
2287 @opindex funsigned-bitfields
2288 @opindex fno-signed-bitfields
2289 @opindex fno-unsigned-bitfields
2290 These options control whether a bit-field is signed or unsigned, when the
2291 declaration does not use either @code{signed} or @code{unsigned}. By
2292 default, such a bit-field is signed, because this is consistent: the
2293 basic integer types such as @code{int} are signed types.
2294
2295 @item -fsso-struct=@var{endianness}
2296 @opindex fsso-struct
2297 Set the default scalar storage order of structures and unions to the
2298 specified endianness. The accepted values are @samp{big-endian},
2299 @samp{little-endian} and @samp{native} for the native endianness of
2300 the target (the default). This option is not supported for C++.
2301
2302 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2303 code that is not binary compatible with code generated without it if the
2304 specified endianness is not the native endianness of the target.
2305 @end table
2306
2307 @node C++ Dialect Options
2308 @section Options Controlling C++ Dialect
2309
2310 @cindex compiler options, C++
2311 @cindex C++ options, command-line
2312 @cindex options, C++
2313 This section describes the command-line options that are only meaningful
2314 for C++ programs. You can also use most of the GNU compiler options
2315 regardless of what language your program is in. For example, you
2316 might compile a file @file{firstClass.C} like this:
2317
2318 @smallexample
2319 g++ -g -fstrict-enums -O -c firstClass.C
2320 @end smallexample
2321
2322 @noindent
2323 In this example, only @option{-fstrict-enums} is an option meant
2324 only for C++ programs; you can use the other options with any
2325 language supported by GCC@.
2326
2327 Some options for compiling C programs, such as @option{-std}, are also
2328 relevant for C++ programs.
2329 @xref{C Dialect Options,,Options Controlling C Dialect}.
2330
2331 Here is a list of options that are @emph{only} for compiling C++ programs:
2332
2333 @table @gcctabopt
2334
2335 @item -fabi-version=@var{n}
2336 @opindex fabi-version
2337 Use version @var{n} of the C++ ABI@. The default is version 0.
2338
2339 Version 0 refers to the version conforming most closely to
2340 the C++ ABI specification. Therefore, the ABI obtained using version 0
2341 will change in different versions of G++ as ABI bugs are fixed.
2342
2343 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2344
2345 Version 2 is the version of the C++ ABI that first appeared in G++
2346 3.4, and was the default through G++ 4.9.
2347
2348 Version 3 corrects an error in mangling a constant address as a
2349 template argument.
2350
2351 Version 4, which first appeared in G++ 4.5, implements a standard
2352 mangling for vector types.
2353
2354 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2355 attribute const/volatile on function pointer types, decltype of a
2356 plain decl, and use of a function parameter in the declaration of
2357 another parameter.
2358
2359 Version 6, which first appeared in G++ 4.7, corrects the promotion
2360 behavior of C++11 scoped enums and the mangling of template argument
2361 packs, const/static_cast, prefix ++ and --, and a class scope function
2362 used as a template argument.
2363
2364 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2365 builtin type and corrects the mangling of lambdas in default argument
2366 scope.
2367
2368 Version 8, which first appeared in G++ 4.9, corrects the substitution
2369 behavior of function types with function-cv-qualifiers.
2370
2371 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2372 @code{nullptr_t}.
2373
2374 Version 10, which first appeared in G++ 6.1, adds mangling of
2375 attributes that affect type identity, such as ia32 calling convention
2376 attributes (e.g. @samp{stdcall}).
2377
2378 Version 11, which first appeared in G++ 7, corrects the mangling of
2379 sizeof... expressions and operator names. For multiple entities with
2380 the same name within a function, that are declared in different scopes,
2381 the mangling now changes starting with the twelfth occurrence. It also
2382 implies @option{-fnew-inheriting-ctors}.
2383
2384 Version 12, which first appeared in G++ 8, corrects the calling
2385 conventions for empty classes on the x86_64 target and for classes
2386 with only deleted copy/move constructors. It accidentally changes the
2387 calling convention for classes with a deleted copy constructor and a
2388 trivial move constructor.
2389
2390 Version 13, which first appeared in G++ 8.2, fixes the accidental
2391 change in version 12.
2392
2393 See also @option{-Wabi}.
2394
2395 @item -fabi-compat-version=@var{n}
2396 @opindex fabi-compat-version
2397 On targets that support strong aliases, G++
2398 works around mangling changes by creating an alias with the correct
2399 mangled name when defining a symbol with an incorrect mangled name.
2400 This switch specifies which ABI version to use for the alias.
2401
2402 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2403 compatibility). If another ABI version is explicitly selected, this
2404 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2405 use @option{-fabi-compat-version=2}.
2406
2407 If this option is not provided but @option{-Wabi=@var{n}} is, that
2408 version is used for compatibility aliases. If this option is provided
2409 along with @option{-Wabi} (without the version), the version from this
2410 option is used for the warning.
2411
2412 @item -fno-access-control
2413 @opindex fno-access-control
2414 Turn off all access checking. This switch is mainly useful for working
2415 around bugs in the access control code.
2416
2417 @item -faligned-new
2418 @opindex faligned-new
2419 Enable support for C++17 @code{new} of types that require more
2420 alignment than @code{void* ::operator new(std::size_t)} provides. A
2421 numeric argument such as @code{-faligned-new=32} can be used to
2422 specify how much alignment (in bytes) is provided by that function,
2423 but few users will need to override the default of
2424 @code{alignof(std::max_align_t)}.
2425
2426 This flag is enabled by default for @option{-std=c++17}.
2427
2428 @item -fcheck-new
2429 @opindex fcheck-new
2430 Check that the pointer returned by @code{operator new} is non-null
2431 before attempting to modify the storage allocated. This check is
2432 normally unnecessary because the C++ standard specifies that
2433 @code{operator new} only returns @code{0} if it is declared
2434 @code{throw()}, in which case the compiler always checks the
2435 return value even without this option. In all other cases, when
2436 @code{operator new} has a non-empty exception specification, memory
2437 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2438 @samp{new (nothrow)}.
2439
2440 @item -fconcepts
2441 @opindex fconcepts
2442 Enable support for the C++ Extensions for Concepts Technical
2443 Specification, ISO 19217 (2015), which allows code like
2444
2445 @smallexample
2446 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2447 template <Addable T> T add (T a, T b) @{ return a + b; @}
2448 @end smallexample
2449
2450 @item -fconstexpr-depth=@var{n}
2451 @opindex fconstexpr-depth
2452 Set the maximum nested evaluation depth for C++11 constexpr functions
2453 to @var{n}. A limit is needed to detect endless recursion during
2454 constant expression evaluation. The minimum specified by the standard
2455 is 512.
2456
2457 @item -fconstexpr-loop-limit=@var{n}
2458 @opindex fconstexpr-loop-limit
2459 Set the maximum number of iterations for a loop in C++14 constexpr functions
2460 to @var{n}. A limit is needed to detect infinite loops during
2461 constant expression evaluation. The default is 262144 (1<<18).
2462
2463 @item -fdeduce-init-list
2464 @opindex fdeduce-init-list
2465 Enable deduction of a template type parameter as
2466 @code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2467
2468 @smallexample
2469 template <class T> auto forward(T t) -> decltype (realfn (t))
2470 @{
2471 return realfn (t);
2472 @}
2473
2474 void f()
2475 @{
2476 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2477 @}
2478 @end smallexample
2479
2480 This deduction was implemented as a possible extension to the
2481 originally proposed semantics for the C++11 standard, but was not part
2482 of the final standard, so it is disabled by default. This option is
2483 deprecated, and may be removed in a future version of G++.
2484
2485 @item -fno-elide-constructors
2486 @opindex fno-elide-constructors
2487 The C++ standard allows an implementation to omit creating a temporary
2488 that is only used to initialize another object of the same type.
2489 Specifying this option disables that optimization, and forces G++ to
2490 call the copy constructor in all cases. This option also causes G++
2491 to call trivial member functions which otherwise would be expanded inline.
2492
2493 In C++17, the compiler is required to omit these temporaries, but this
2494 option still affects trivial member functions.
2495
2496 @item -fno-enforce-eh-specs
2497 @opindex fno-enforce-eh-specs
2498 Don't generate code to check for violation of exception specifications
2499 at run time. This option violates the C++ standard, but may be useful
2500 for reducing code size in production builds, much like defining
2501 @code{NDEBUG}. This does not give user code permission to throw
2502 exceptions in violation of the exception specifications; the compiler
2503 still optimizes based on the specifications, so throwing an
2504 unexpected exception results in undefined behavior at run time.
2505
2506 @item -fextern-tls-init
2507 @itemx -fno-extern-tls-init
2508 @opindex fextern-tls-init
2509 @opindex fno-extern-tls-init
2510 The C++11 and OpenMP standards allow @code{thread_local} and
2511 @code{threadprivate} variables to have dynamic (runtime)
2512 initialization. To support this, any use of such a variable goes
2513 through a wrapper function that performs any necessary initialization.
2514 When the use and definition of the variable are in the same
2515 translation unit, this overhead can be optimized away, but when the
2516 use is in a different translation unit there is significant overhead
2517 even if the variable doesn't actually need dynamic initialization. If
2518 the programmer can be sure that no use of the variable in a
2519 non-defining TU needs to trigger dynamic initialization (either
2520 because the variable is statically initialized, or a use of the
2521 variable in the defining TU will be executed before any uses in
2522 another TU), they can avoid this overhead with the
2523 @option{-fno-extern-tls-init} option.
2524
2525 On targets that support symbol aliases, the default is
2526 @option{-fextern-tls-init}. On targets that do not support symbol
2527 aliases, the default is @option{-fno-extern-tls-init}.
2528
2529 @item -fno-gnu-keywords
2530 @opindex fno-gnu-keywords
2531 Do not recognize @code{typeof} as a keyword, so that code can use this
2532 word as an identifier. You can use the keyword @code{__typeof__} instead.
2533 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2534 @option{-std=c++98}, @option{-std=c++11}, etc.
2535
2536 @item -fno-implicit-templates
2537 @opindex fno-implicit-templates
2538 Never emit code for non-inline templates that are instantiated
2539 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2540 @xref{Template Instantiation}, for more information.
2541
2542 @item -fno-implicit-inline-templates
2543 @opindex fno-implicit-inline-templates
2544 Don't emit code for implicit instantiations of inline templates, either.
2545 The default is to handle inlines differently so that compiles with and
2546 without optimization need the same set of explicit instantiations.
2547
2548 @item -fno-implement-inlines
2549 @opindex fno-implement-inlines
2550 To save space, do not emit out-of-line copies of inline functions
2551 controlled by @code{#pragma implementation}. This causes linker
2552 errors if these functions are not inlined everywhere they are called.
2553
2554 @item -fms-extensions
2555 @opindex fms-extensions
2556 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2557 int and getting a pointer to member function via non-standard syntax.
2558
2559 @item -fnew-inheriting-ctors
2560 @opindex fnew-inheriting-ctors
2561 Enable the P0136 adjustment to the semantics of C++11 constructor
2562 inheritance. This is part of C++17 but also considered to be a Defect
2563 Report against C++11 and C++14. This flag is enabled by default
2564 unless @option{-fabi-version=10} or lower is specified.
2565
2566 @item -fnew-ttp-matching
2567 @opindex fnew-ttp-matching
2568 Enable the P0522 resolution to Core issue 150, template template
2569 parameters and default arguments: this allows a template with default
2570 template arguments as an argument for a template template parameter
2571 with fewer template parameters. This flag is enabled by default for
2572 @option{-std=c++17}.
2573
2574 @item -fno-nonansi-builtins
2575 @opindex fno-nonansi-builtins
2576 Disable built-in declarations of functions that are not mandated by
2577 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2578 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2579
2580 @item -fnothrow-opt
2581 @opindex fnothrow-opt
2582 Treat a @code{throw()} exception specification as if it were a
2583 @code{noexcept} specification to reduce or eliminate the text size
2584 overhead relative to a function with no exception specification. If
2585 the function has local variables of types with non-trivial
2586 destructors, the exception specification actually makes the
2587 function smaller because the EH cleanups for those variables can be
2588 optimized away. The semantic effect is that an exception thrown out of
2589 a function with such an exception specification results in a call
2590 to @code{terminate} rather than @code{unexpected}.
2591
2592 @item -fno-operator-names
2593 @opindex fno-operator-names
2594 Do not treat the operator name keywords @code{and}, @code{bitand},
2595 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2596 synonyms as keywords.
2597
2598 @item -fno-optional-diags
2599 @opindex fno-optional-diags
2600 Disable diagnostics that the standard says a compiler does not need to
2601 issue. Currently, the only such diagnostic issued by G++ is the one for
2602 a name having multiple meanings within a class.
2603
2604 @item -fpermissive
2605 @opindex fpermissive
2606 Downgrade some diagnostics about nonconformant code from errors to
2607 warnings. Thus, using @option{-fpermissive} allows some
2608 nonconforming code to compile.
2609
2610 @item -fno-pretty-templates
2611 @opindex fno-pretty-templates
2612 When an error message refers to a specialization of a function
2613 template, the compiler normally prints the signature of the
2614 template followed by the template arguments and any typedefs or
2615 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2616 rather than @code{void f(int)}) so that it's clear which template is
2617 involved. When an error message refers to a specialization of a class
2618 template, the compiler omits any template arguments that match
2619 the default template arguments for that template. If either of these
2620 behaviors make it harder to understand the error message rather than
2621 easier, you can use @option{-fno-pretty-templates} to disable them.
2622
2623 @item -frepo
2624 @opindex frepo
2625 Enable automatic template instantiation at link time. This option also
2626 implies @option{-fno-implicit-templates}. @xref{Template
2627 Instantiation}, for more information.
2628
2629 @item -fno-rtti
2630 @opindex fno-rtti
2631 Disable generation of information about every class with virtual
2632 functions for use by the C++ run-time type identification features
2633 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2634 of the language, you can save some space by using this flag. Note that
2635 exception handling uses the same information, but G++ generates it as
2636 needed. The @code{dynamic_cast} operator can still be used for casts that
2637 do not require run-time type information, i.e.@: casts to @code{void *} or to
2638 unambiguous base classes.
2639
2640 @item -fsized-deallocation
2641 @opindex fsized-deallocation
2642 Enable the built-in global declarations
2643 @smallexample
2644 void operator delete (void *, std::size_t) noexcept;
2645 void operator delete[] (void *, std::size_t) noexcept;
2646 @end smallexample
2647 as introduced in C++14. This is useful for user-defined replacement
2648 deallocation functions that, for example, use the size of the object
2649 to make deallocation faster. Enabled by default under
2650 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2651 warns about places that might want to add a definition.
2652
2653 @item -fstrict-enums
2654 @opindex fstrict-enums
2655 Allow the compiler to optimize using the assumption that a value of
2656 enumerated type can only be one of the values of the enumeration (as
2657 defined in the C++ standard; basically, a value that can be
2658 represented in the minimum number of bits needed to represent all the
2659 enumerators). This assumption may not be valid if the program uses a
2660 cast to convert an arbitrary integer value to the enumerated type.
2661
2662 @item -fstrong-eval-order
2663 @opindex fstrong-eval-order
2664 Evaluate member access, array subscripting, and shift expressions in
2665 left-to-right order, and evaluate assignment in right-to-left order,
2666 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2667 @option{-fstrong-eval-order=some} enables just the ordering of member
2668 access and shift expressions, and is the default without
2669 @option{-std=c++17}.
2670
2671 @item -ftemplate-backtrace-limit=@var{n}
2672 @opindex ftemplate-backtrace-limit
2673 Set the maximum number of template instantiation notes for a single
2674 warning or error to @var{n}. The default value is 10.
2675
2676 @item -ftemplate-depth=@var{n}
2677 @opindex ftemplate-depth
2678 Set the maximum instantiation depth for template classes to @var{n}.
2679 A limit on the template instantiation depth is needed to detect
2680 endless recursions during template class instantiation. ANSI/ISO C++
2681 conforming programs must not rely on a maximum depth greater than 17
2682 (changed to 1024 in C++11). The default value is 900, as the compiler
2683 can run out of stack space before hitting 1024 in some situations.
2684
2685 @item -fno-threadsafe-statics
2686 @opindex fno-threadsafe-statics
2687 Do not emit the extra code to use the routines specified in the C++
2688 ABI for thread-safe initialization of local statics. You can use this
2689 option to reduce code size slightly in code that doesn't need to be
2690 thread-safe.
2691
2692 @item -fuse-cxa-atexit
2693 @opindex fuse-cxa-atexit
2694 Register destructors for objects with static storage duration with the
2695 @code{__cxa_atexit} function rather than the @code{atexit} function.
2696 This option is required for fully standards-compliant handling of static
2697 destructors, but only works if your C library supports
2698 @code{__cxa_atexit}.
2699
2700 @item -fno-use-cxa-get-exception-ptr
2701 @opindex fno-use-cxa-get-exception-ptr
2702 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2703 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2704 if the runtime routine is not available.
2705
2706 @item -fvisibility-inlines-hidden
2707 @opindex fvisibility-inlines-hidden
2708 This switch declares that the user does not attempt to compare
2709 pointers to inline functions or methods where the addresses of the two functions
2710 are taken in different shared objects.
2711
2712 The effect of this is that GCC may, effectively, mark inline methods with
2713 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2714 appear in the export table of a DSO and do not require a PLT indirection
2715 when used within the DSO@. Enabling this option can have a dramatic effect
2716 on load and link times of a DSO as it massively reduces the size of the
2717 dynamic export table when the library makes heavy use of templates.
2718
2719 The behavior of this switch is not quite the same as marking the
2720 methods as hidden directly, because it does not affect static variables
2721 local to the function or cause the compiler to deduce that
2722 the function is defined in only one shared object.
2723
2724 You may mark a method as having a visibility explicitly to negate the
2725 effect of the switch for that method. For example, if you do want to
2726 compare pointers to a particular inline method, you might mark it as
2727 having default visibility. Marking the enclosing class with explicit
2728 visibility has no effect.
2729
2730 Explicitly instantiated inline methods are unaffected by this option
2731 as their linkage might otherwise cross a shared library boundary.
2732 @xref{Template Instantiation}.
2733
2734 @item -fvisibility-ms-compat
2735 @opindex fvisibility-ms-compat
2736 This flag attempts to use visibility settings to make GCC's C++
2737 linkage model compatible with that of Microsoft Visual Studio.
2738
2739 The flag makes these changes to GCC's linkage model:
2740
2741 @enumerate
2742 @item
2743 It sets the default visibility to @code{hidden}, like
2744 @option{-fvisibility=hidden}.
2745
2746 @item
2747 Types, but not their members, are not hidden by default.
2748
2749 @item
2750 The One Definition Rule is relaxed for types without explicit
2751 visibility specifications that are defined in more than one
2752 shared object: those declarations are permitted if they are
2753 permitted when this option is not used.
2754 @end enumerate
2755
2756 In new code it is better to use @option{-fvisibility=hidden} and
2757 export those classes that are intended to be externally visible.
2758 Unfortunately it is possible for code to rely, perhaps accidentally,
2759 on the Visual Studio behavior.
2760
2761 Among the consequences of these changes are that static data members
2762 of the same type with the same name but defined in different shared
2763 objects are different, so changing one does not change the other;
2764 and that pointers to function members defined in different shared
2765 objects may not compare equal. When this flag is given, it is a
2766 violation of the ODR to define types with the same name differently.
2767
2768 @item -fno-weak
2769 @opindex fno-weak
2770 Do not use weak symbol support, even if it is provided by the linker.
2771 By default, G++ uses weak symbols if they are available. This
2772 option exists only for testing, and should not be used by end-users;
2773 it results in inferior code and has no benefits. This option may
2774 be removed in a future release of G++.
2775
2776 @item -nostdinc++
2777 @opindex nostdinc++
2778 Do not search for header files in the standard directories specific to
2779 C++, but do still search the other standard directories. (This option
2780 is used when building the C++ library.)
2781 @end table
2782
2783 In addition, these optimization, warning, and code generation options
2784 have meanings only for C++ programs:
2785
2786 @table @gcctabopt
2787 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2788 @opindex Wabi
2789 @opindex Wno-abi
2790 Warn when G++ it generates code that is probably not compatible with
2791 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2792 ABI with each major release, normally @option{-Wabi} will warn only if
2793 there is a check added later in a release series for an ABI issue
2794 discovered since the initial release. @option{-Wabi} will warn about
2795 more things if an older ABI version is selected (with
2796 @option{-fabi-version=@var{n}}).
2797
2798 @option{-Wabi} can also be used with an explicit version number to
2799 warn about compatibility with a particular @option{-fabi-version}
2800 level, e.g. @option{-Wabi=2} to warn about changes relative to
2801 @option{-fabi-version=2}.
2802
2803 If an explicit version number is provided and
2804 @option{-fabi-compat-version} is not specified, the version number
2805 from this option is used for compatibility aliases. If no explicit
2806 version number is provided with this option, but
2807 @option{-fabi-compat-version} is specified, that version number is
2808 used for ABI warnings.
2809
2810 Although an effort has been made to warn about
2811 all such cases, there are probably some cases that are not warned about,
2812 even though G++ is generating incompatible code. There may also be
2813 cases where warnings are emitted even though the code that is generated
2814 is compatible.
2815
2816 You should rewrite your code to avoid these warnings if you are
2817 concerned about the fact that code generated by G++ may not be binary
2818 compatible with code generated by other compilers.
2819
2820 Known incompatibilities in @option{-fabi-version=2} (which was the
2821 default from GCC 3.4 to 4.9) include:
2822
2823 @itemize @bullet
2824
2825 @item
2826 A template with a non-type template parameter of reference type was
2827 mangled incorrectly:
2828 @smallexample
2829 extern int N;
2830 template <int &> struct S @{@};
2831 void n (S<N>) @{2@}
2832 @end smallexample
2833
2834 This was fixed in @option{-fabi-version=3}.
2835
2836 @item
2837 SIMD vector types declared using @code{__attribute ((vector_size))} were
2838 mangled in a non-standard way that does not allow for overloading of
2839 functions taking vectors of different sizes.
2840
2841 The mangling was changed in @option{-fabi-version=4}.
2842
2843 @item
2844 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2845 qualifiers, and @code{decltype} of a plain declaration was folded away.
2846
2847 These mangling issues were fixed in @option{-fabi-version=5}.
2848
2849 @item
2850 Scoped enumerators passed as arguments to a variadic function are
2851 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2852 On most targets this does not actually affect the parameter passing
2853 ABI, as there is no way to pass an argument smaller than @code{int}.
2854
2855 Also, the ABI changed the mangling of template argument packs,
2856 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2857 a class scope function used as a template argument.
2858
2859 These issues were corrected in @option{-fabi-version=6}.
2860
2861 @item
2862 Lambdas in default argument scope were mangled incorrectly, and the
2863 ABI changed the mangling of @code{nullptr_t}.
2864
2865 These issues were corrected in @option{-fabi-version=7}.
2866
2867 @item
2868 When mangling a function type with function-cv-qualifiers, the
2869 un-qualified function type was incorrectly treated as a substitution
2870 candidate.
2871
2872 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2873
2874 @item
2875 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2876 unaligned accesses. Note that this did not affect the ABI of a
2877 function with a @code{nullptr_t} parameter, as parameters have a
2878 minimum alignment.
2879
2880 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2881
2882 @item
2883 Target-specific attributes that affect the identity of a type, such as
2884 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2885 did not affect the mangled name, leading to name collisions when
2886 function pointers were used as template arguments.
2887
2888 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2889
2890 @end itemize
2891
2892 It also warns about psABI-related changes. The known psABI changes at this
2893 point include:
2894
2895 @itemize @bullet
2896
2897 @item
2898 For SysV/x86-64, unions with @code{long double} members are
2899 passed in memory as specified in psABI. For example:
2900
2901 @smallexample
2902 union U @{
2903 long double ld;
2904 int i;
2905 @};
2906 @end smallexample
2907
2908 @noindent
2909 @code{union U} is always passed in memory.
2910
2911 @end itemize
2912
2913 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2914 @opindex Wabi-tag
2915 @opindex -Wabi-tag
2916 Warn when a type with an ABI tag is used in a context that does not
2917 have that ABI tag. See @ref{C++ Attributes} for more information
2918 about ABI tags.
2919
2920 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2921 @opindex Wctor-dtor-privacy
2922 @opindex Wno-ctor-dtor-privacy
2923 Warn when a class seems unusable because all the constructors or
2924 destructors in that class are private, and it has neither friends nor
2925 public static member functions. Also warn if there are no non-private
2926 methods, and there's at least one private member function that isn't
2927 a constructor or destructor.
2928
2929 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2930 @opindex Wdelete-non-virtual-dtor
2931 @opindex Wno-delete-non-virtual-dtor
2932 Warn when @code{delete} is used to destroy an instance of a class that
2933 has virtual functions and non-virtual destructor. It is unsafe to delete
2934 an instance of a derived class through a pointer to a base class if the
2935 base class does not have a virtual destructor. This warning is enabled
2936 by @option{-Wall}.
2937
2938 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
2939 @opindex Wdeprecated-copy
2940 @opindex Wno-deprecated-copy
2941 Warn that the implicit declaration of a copy constructor or copy
2942 assignment operator is deprecated if the class has a user-provided
2943 copy constructor, copy assignment operator, or destructor, in C++11
2944 and up. This warning is enabled by @option{-Wall}.
2945
2946 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
2947 @opindex Winit-list-lifetime
2948 @opindex Wno-init-list-lifetime
2949 Do not warn about uses of @code{std::initializer_list} that are likely
2950 to result in dangling pointers. Since the underlying array for an
2951 @code{initializer_list} is handled like a normal C++ temporary object,
2952 it is easy to inadvertently keep a pointer to the array past the end
2953 of the array's lifetime. For example:
2954
2955 @itemize @bullet
2956 @item
2957 If a function returns a temporary @code{initializer_list}, or a local
2958 @code{initializer_list} variable, the array's lifetime ends at the end
2959 of the return statement, so the value returned has a dangling pointer.
2960
2961 @item
2962 If a new-expression creates an @code{initializer_list}, the array only
2963 lives until the end of the enclosing full-expression, so the
2964 @code{initializer_list} in the heap has a dangling pointer.
2965
2966 @item
2967 When an @code{initializer_list} variable is assigned from a
2968 brace-enclosed initializer list, the temporary array created for the
2969 right side of the assignment only lives until the end of the
2970 full-expression, so at the next statement the @code{initializer_list}
2971 variable has a dangling pointer.
2972
2973 @smallexample
2974 // li's initial underlying array lives as long as li
2975 std::initializer_list<int> li = @{ 1,2,3 @};
2976 // assignment changes li to point to a temporary array
2977 li = @{ 4, 5 @};
2978 // now the temporary is gone and li has a dangling pointer
2979 int i = li.begin()[0] // undefined behavior
2980 @end smallexample
2981
2982 @item
2983 When a list constructor stores the @code{begin} pointer from the
2984 @code{initializer_list} argument, this doesn't extend the lifetime of
2985 the array, so if a class variable is constructed from a temporary
2986 @code{initializer_list}, the pointer is left dangling by the end of
2987 the variable declaration statement.
2988
2989 @end itemize
2990
2991 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2992 @opindex Wliteral-suffix
2993 @opindex Wno-literal-suffix
2994 Warn when a string or character literal is followed by a ud-suffix which does
2995 not begin with an underscore. As a conforming extension, GCC treats such
2996 suffixes as separate preprocessing tokens in order to maintain backwards
2997 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2998 For example:
2999
3000 @smallexample
3001 #define __STDC_FORMAT_MACROS
3002 #include <inttypes.h>
3003 #include <stdio.h>
3004
3005 int main() @{
3006 int64_t i64 = 123;
3007 printf("My int64: %" PRId64"\n", i64);
3008 @}
3009 @end smallexample
3010
3011 In this case, @code{PRId64} is treated as a separate preprocessing token.
3012
3013 Additionally, warn when a user-defined literal operator is declared with
3014 a literal suffix identifier that doesn't begin with an underscore. Literal
3015 suffix identifiers that don't begin with an underscore are reserved for
3016 future standardization.
3017
3018 This warning is enabled by default.
3019
3020 @item -Wlto-type-mismatch
3021 @opindex Wlto-type-mismatch
3022 @opindex Wno-lto-type-mismatch
3023
3024 During the link-time optimization warn about type mismatches in
3025 global declarations from different compilation units.
3026 Requires @option{-flto} to be enabled. Enabled by default.
3027
3028 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3029 @opindex Wnarrowing
3030 @opindex Wno-narrowing
3031 For C++11 and later standards, narrowing conversions are diagnosed by default,
3032 as required by the standard. A narrowing conversion from a constant produces
3033 an error, and a narrowing conversion from a non-constant produces a warning,
3034 but @option{-Wno-narrowing} suppresses the diagnostic.
3035 Note that this does not affect the meaning of well-formed code;
3036 narrowing conversions are still considered ill-formed in SFINAE contexts.
3037
3038 With @option{-Wnarrowing} in C++98, warn when a narrowing
3039 conversion prohibited by C++11 occurs within
3040 @samp{@{ @}}, e.g.
3041
3042 @smallexample
3043 int i = @{ 2.2 @}; // error: narrowing from double to int
3044 @end smallexample
3045
3046 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3047
3048 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3049 @opindex Wnoexcept
3050 @opindex Wno-noexcept
3051 Warn when a noexcept-expression evaluates to false because of a call
3052 to a function that does not have a non-throwing exception
3053 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3054 the compiler to never throw an exception.
3055
3056 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3057 @opindex Wnoexcept-type
3058 @opindex Wno-noexcept-type
3059 Warn if the C++17 feature making @code{noexcept} part of a function
3060 type changes the mangled name of a symbol relative to C++14. Enabled
3061 by @option{-Wabi} and @option{-Wc++17-compat}.
3062
3063 As an example:
3064
3065 @smallexample
3066 template <class T> void f(T t) @{ t(); @};
3067 void g() noexcept;
3068 void h() @{ f(g); @}
3069 @end smallexample
3070
3071 @noindent
3072 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3073 C++17 it calls @code{f<void(*)()noexcept>}.
3074
3075 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3076 @opindex Wclass-memaccess
3077 @opindex Wno-class-memaccess
3078 Warn when the destination of a call to a raw memory function such as
3079 @code{memset} or @code{memcpy} is an object of class type, and when writing
3080 into such an object might bypass the class non-trivial or deleted constructor
3081 or copy assignment, violate const-correctness or encapsulation, or corrupt
3082 virtual table pointers. Modifying the representation of such objects may
3083 violate invariants maintained by member functions of the class. For example,
3084 the call to @code{memset} below is undefined because it modifies a non-trivial
3085 class object and is, therefore, diagnosed. The safe way to either initialize
3086 or clear the storage of objects of such types is by using the appropriate
3087 constructor or assignment operator, if one is available.
3088 @smallexample
3089 std::string str = "abc";
3090 memset (&str, 0, sizeof str);
3091 @end smallexample
3092 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3093 Explicitly casting the pointer to the class object to @code{void *} or
3094 to a type that can be safely accessed by the raw memory function suppresses
3095 the warning.
3096
3097 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3098 @opindex Wnon-virtual-dtor
3099 @opindex Wno-non-virtual-dtor
3100 Warn when a class has virtual functions and an accessible non-virtual
3101 destructor itself or in an accessible polymorphic base class, in which
3102 case it is possible but unsafe to delete an instance of a derived
3103 class through a pointer to the class itself or base class. This
3104 warning is automatically enabled if @option{-Weffc++} is specified.
3105
3106 @item -Wregister @r{(C++ and Objective-C++ only)}
3107 @opindex Wregister
3108 @opindex Wno-register
3109 Warn on uses of the @code{register} storage class specifier, except
3110 when it is part of the GNU @ref{Explicit Register Variables} extension.
3111 The use of the @code{register} keyword as storage class specifier has
3112 been deprecated in C++11 and removed in C++17.
3113 Enabled by default with @option{-std=c++17}.
3114
3115 @item -Wreorder @r{(C++ and Objective-C++ only)}
3116 @opindex Wreorder
3117 @opindex Wno-reorder
3118 @cindex reordering, warning
3119 @cindex warning for reordering of member initializers
3120 Warn when the order of member initializers given in the code does not
3121 match the order in which they must be executed. For instance:
3122
3123 @smallexample
3124 struct A @{
3125 int i;
3126 int j;
3127 A(): j (0), i (1) @{ @}
3128 @};
3129 @end smallexample
3130
3131 @noindent
3132 The compiler rearranges the member initializers for @code{i}
3133 and @code{j} to match the declaration order of the members, emitting
3134 a warning to that effect. This warning is enabled by @option{-Wall}.
3135
3136 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3137 @opindex Wpessimizing-move
3138 @opindex Wno-pessimizing-move
3139 This warning warns when a call to @code{std::move} prevents copy
3140 elision. A typical scenario when copy elision can occur is when returning in
3141 a function with a class return type, when the expression being returned is the
3142 name of a non-volatile automatic object, and is not a function parameter, and
3143 has the same type as the function return type.
3144
3145 @smallexample
3146 struct T @{
3147 @dots{}
3148 @};
3149 T fn()
3150 @{
3151 T t;
3152 @dots{}
3153 return std::move (t);
3154 @}
3155 @end smallexample
3156
3157 But in this example, the @code{std::move} call prevents copy elision.
3158
3159 This warning is enabled by @option{-Wall}.
3160
3161 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3162 @opindex Wredundant-move
3163 @opindex Wno-redundant-move
3164 This warning warns about redundant calls to @code{std::move}; that is, when
3165 a move operation would have been performed even without the @code{std::move}
3166 call. This happens because the compiler is forced to treat the object as if
3167 it were an rvalue in certain situations such as returning a local variable,
3168 where copy elision isn't applicable. Consider:
3169
3170 @smallexample
3171 struct T @{
3172 @dots{}
3173 @};
3174 T fn(T t)
3175 @{
3176 @dots{}
3177 return std::move (t);
3178 @}
3179 @end smallexample
3180
3181 Here, the @code{std::move} call is redundant. Because G++ implements Core
3182 Issue 1579, another example is:
3183
3184 @smallexample
3185 struct T @{ // convertible to U
3186 @dots{}
3187 @};
3188 struct U @{
3189 @dots{}
3190 @};
3191 U fn()
3192 @{
3193 T t;
3194 @dots{}
3195 return std::move (t);
3196 @}
3197 @end smallexample
3198 In this example, copy elision isn't applicable because the type of the
3199 expression being returned and the function return type differ, yet G++
3200 treats the return value as if it were designated by an rvalue.
3201
3202 This warning is enabled by @option{-Wextra}.
3203
3204 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3205 @opindex fext-numeric-literals
3206 @opindex fno-ext-numeric-literals
3207 Accept imaginary, fixed-point, or machine-defined
3208 literal number suffixes as GNU extensions.
3209 When this option is turned off these suffixes are treated
3210 as C++11 user-defined literal numeric suffixes.
3211 This is on by default for all pre-C++11 dialects and all GNU dialects:
3212 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3213 @option{-std=gnu++14}.
3214 This option is off by default
3215 for ISO C++11 onwards (@option{-std=c++11}, ...).
3216 @end table
3217
3218 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3219
3220 @table @gcctabopt
3221 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3222 @opindex Weffc++
3223 @opindex Wno-effc++
3224 Warn about violations of the following style guidelines from Scott Meyers'
3225 @cite{Effective C++} series of books:
3226
3227 @itemize @bullet
3228 @item
3229 Define a copy constructor and an assignment operator for classes
3230 with dynamically-allocated memory.
3231
3232 @item
3233 Prefer initialization to assignment in constructors.
3234
3235 @item
3236 Have @code{operator=} return a reference to @code{*this}.
3237
3238 @item
3239 Don't try to return a reference when you must return an object.
3240
3241 @item
3242 Distinguish between prefix and postfix forms of increment and
3243 decrement operators.
3244
3245 @item
3246 Never overload @code{&&}, @code{||}, or @code{,}.
3247
3248 @end itemize
3249
3250 This option also enables @option{-Wnon-virtual-dtor}, which is also
3251 one of the effective C++ recommendations. However, the check is
3252 extended to warn about the lack of virtual destructor in accessible
3253 non-polymorphic bases classes too.
3254
3255 When selecting this option, be aware that the standard library
3256 headers do not obey all of these guidelines; use @samp{grep -v}
3257 to filter out those warnings.
3258
3259 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3260 @opindex Wstrict-null-sentinel
3261 @opindex Wno-strict-null-sentinel
3262 Warn about the use of an uncasted @code{NULL} as sentinel. When
3263 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3264 to @code{__null}. Although it is a null pointer constant rather than a
3265 null pointer, it is guaranteed to be of the same size as a pointer.
3266 But this use is not portable across different compilers.
3267
3268 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3269 @opindex Wno-non-template-friend
3270 @opindex Wnon-template-friend
3271 Disable warnings when non-template friend functions are declared
3272 within a template. In very old versions of GCC that predate implementation
3273 of the ISO standard, declarations such as
3274 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3275 could be interpreted as a particular specialization of a template
3276 function; the warning exists to diagnose compatibility problems,
3277 and is enabled by default.
3278
3279 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3280 @opindex Wold-style-cast
3281 @opindex Wno-old-style-cast
3282 Warn if an old-style (C-style) cast to a non-void type is used within
3283 a C++ program. The new-style casts (@code{dynamic_cast},
3284 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3285 less vulnerable to unintended effects and much easier to search for.
3286
3287 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3288 @opindex Woverloaded-virtual
3289 @opindex Wno-overloaded-virtual
3290 @cindex overloaded virtual function, warning
3291 @cindex warning for overloaded virtual function
3292 Warn when a function declaration hides virtual functions from a
3293 base class. For example, in:
3294
3295 @smallexample
3296 struct A @{
3297 virtual void f();
3298 @};
3299
3300 struct B: public A @{
3301 void f(int);
3302 @};
3303 @end smallexample
3304
3305 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3306 like:
3307
3308 @smallexample
3309 B* b;
3310 b->f();
3311 @end smallexample
3312
3313 @noindent
3314 fails to compile.
3315
3316 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3317 @opindex Wno-pmf-conversions
3318 @opindex Wpmf-conversions
3319 Disable the diagnostic for converting a bound pointer to member function
3320 to a plain pointer.
3321
3322 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3323 @opindex Wsign-promo
3324 @opindex Wno-sign-promo
3325 Warn when overload resolution chooses a promotion from unsigned or
3326 enumerated type to a signed type, over a conversion to an unsigned type of
3327 the same size. Previous versions of G++ tried to preserve
3328 unsignedness, but the standard mandates the current behavior.
3329
3330 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3331 @opindex Wtemplates
3332 @opindex Wno-templates
3333 Warn when a primary template declaration is encountered. Some coding
3334 rules disallow templates, and this may be used to enforce that rule.
3335 The warning is inactive inside a system header file, such as the STL, so
3336 one can still use the STL. One may also instantiate or specialize
3337 templates.
3338
3339 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3340 @opindex Wmultiple-inheritance
3341 @opindex Wno-multiple-inheritance
3342 Warn when a class is defined with multiple direct base classes. Some
3343 coding rules disallow multiple inheritance, and this may be used to
3344 enforce that rule. The warning is inactive inside a system header file,
3345 such as the STL, so one can still use the STL. One may also define
3346 classes that indirectly use multiple inheritance.
3347
3348 @item -Wvirtual-inheritance
3349 @opindex Wvirtual-inheritance
3350 @opindex Wno-virtual-inheritance
3351 Warn when a class is defined with a virtual direct base class. Some
3352 coding rules disallow multiple inheritance, and this may be used to
3353 enforce that rule. The warning is inactive inside a system header file,
3354 such as the STL, so one can still use the STL. One may also define
3355 classes that indirectly use virtual inheritance.
3356
3357 @item -Wnamespaces
3358 @opindex Wnamespaces
3359 @opindex Wno-namespaces
3360 Warn when a namespace definition is opened. Some coding rules disallow
3361 namespaces, and this may be used to enforce that rule. The warning is
3362 inactive inside a system header file, such as the STL, so one can still
3363 use the STL. One may also use using directives and qualified names.
3364
3365 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3366 @opindex Wterminate
3367 @opindex Wno-terminate
3368 Disable the warning about a throw-expression that will immediately
3369 result in a call to @code{terminate}.
3370
3371 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3372 @opindex Wno-class-conversion
3373 @opindex Wclass-conversion
3374 Disable the warning about the case when a conversion function converts an
3375 object to the same type, to a base class of that type, or to void; such
3376 a conversion function will never be called.
3377 @end table
3378
3379 @node Objective-C and Objective-C++ Dialect Options
3380 @section Options Controlling Objective-C and Objective-C++ Dialects
3381
3382 @cindex compiler options, Objective-C and Objective-C++
3383 @cindex Objective-C and Objective-C++ options, command-line
3384 @cindex options, Objective-C and Objective-C++
3385 (NOTE: This manual does not describe the Objective-C and Objective-C++
3386 languages themselves. @xref{Standards,,Language Standards
3387 Supported by GCC}, for references.)
3388
3389 This section describes the command-line options that are only meaningful
3390 for Objective-C and Objective-C++ programs. You can also use most of
3391 the language-independent GNU compiler options.
3392 For example, you might compile a file @file{some_class.m} like this:
3393
3394 @smallexample
3395 gcc -g -fgnu-runtime -O -c some_class.m
3396 @end smallexample
3397
3398 @noindent
3399 In this example, @option{-fgnu-runtime} is an option meant only for
3400 Objective-C and Objective-C++ programs; you can use the other options with
3401 any language supported by GCC@.
3402
3403 Note that since Objective-C is an extension of the C language, Objective-C
3404 compilations may also use options specific to the C front-end (e.g.,
3405 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3406 C++-specific options (e.g., @option{-Wabi}).
3407
3408 Here is a list of options that are @emph{only} for compiling Objective-C
3409 and Objective-C++ programs:
3410
3411 @table @gcctabopt
3412 @item -fconstant-string-class=@var{class-name}
3413 @opindex fconstant-string-class
3414 Use @var{class-name} as the name of the class to instantiate for each
3415 literal string specified with the syntax @code{@@"@dots{}"}. The default
3416 class name is @code{NXConstantString} if the GNU runtime is being used, and
3417 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3418 @option{-fconstant-cfstrings} option, if also present, overrides the
3419 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3420 to be laid out as constant CoreFoundation strings.
3421
3422 @item -fgnu-runtime
3423 @opindex fgnu-runtime
3424 Generate object code compatible with the standard GNU Objective-C
3425 runtime. This is the default for most types of systems.
3426
3427 @item -fnext-runtime
3428 @opindex fnext-runtime
3429 Generate output compatible with the NeXT runtime. This is the default
3430 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3431 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3432 used.
3433
3434 @item -fno-nil-receivers
3435 @opindex fno-nil-receivers
3436 Assume that all Objective-C message dispatches (@code{[receiver
3437 message:arg]}) in this translation unit ensure that the receiver is
3438 not @code{nil}. This allows for more efficient entry points in the
3439 runtime to be used. This option is only available in conjunction with
3440 the NeXT runtime and ABI version 0 or 1.
3441
3442 @item -fobjc-abi-version=@var{n}
3443 @opindex fobjc-abi-version
3444 Use version @var{n} of the Objective-C ABI for the selected runtime.
3445 This option is currently supported only for the NeXT runtime. In that
3446 case, Version 0 is the traditional (32-bit) ABI without support for
3447 properties and other Objective-C 2.0 additions. Version 1 is the
3448 traditional (32-bit) ABI with support for properties and other
3449 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3450 nothing is specified, the default is Version 0 on 32-bit target
3451 machines, and Version 2 on 64-bit target machines.
3452
3453 @item -fobjc-call-cxx-cdtors
3454 @opindex fobjc-call-cxx-cdtors
3455 For each Objective-C class, check if any of its instance variables is a
3456 C++ object with a non-trivial default constructor. If so, synthesize a
3457 special @code{- (id) .cxx_construct} instance method which runs
3458 non-trivial default constructors on any such instance variables, in order,
3459 and then return @code{self}. Similarly, check if any instance variable
3460 is a C++ object with a non-trivial destructor, and if so, synthesize a
3461 special @code{- (void) .cxx_destruct} method which runs
3462 all such default destructors, in reverse order.
3463
3464 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3465 methods thusly generated only operate on instance variables
3466 declared in the current Objective-C class, and not those inherited
3467 from superclasses. It is the responsibility of the Objective-C
3468 runtime to invoke all such methods in an object's inheritance
3469 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3470 by the runtime immediately after a new object instance is allocated;
3471 the @code{- (void) .cxx_destruct} methods are invoked immediately
3472 before the runtime deallocates an object instance.
3473
3474 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3475 support for invoking the @code{- (id) .cxx_construct} and
3476 @code{- (void) .cxx_destruct} methods.
3477
3478 @item -fobjc-direct-dispatch
3479 @opindex fobjc-direct-dispatch
3480 Allow fast jumps to the message dispatcher. On Darwin this is
3481 accomplished via the comm page.
3482
3483 @item -fobjc-exceptions
3484 @opindex fobjc-exceptions
3485 Enable syntactic support for structured exception handling in
3486 Objective-C, similar to what is offered by C++. This option
3487 is required to use the Objective-C keywords @code{@@try},
3488 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3489 @code{@@synchronized}. This option is available with both the GNU
3490 runtime and the NeXT runtime (but not available in conjunction with
3491 the NeXT runtime on Mac OS X 10.2 and earlier).
3492
3493 @item -fobjc-gc
3494 @opindex fobjc-gc
3495 Enable garbage collection (GC) in Objective-C and Objective-C++
3496 programs. This option is only available with the NeXT runtime; the
3497 GNU runtime has a different garbage collection implementation that
3498 does not require special compiler flags.
3499
3500 @item -fobjc-nilcheck
3501 @opindex fobjc-nilcheck
3502 For the NeXT runtime with version 2 of the ABI, check for a nil
3503 receiver in method invocations before doing the actual method call.
3504 This is the default and can be disabled using
3505 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3506 checked for nil in this way no matter what this flag is set to.
3507 Currently this flag does nothing when the GNU runtime, or an older
3508 version of the NeXT runtime ABI, is used.
3509
3510 @item -fobjc-std=objc1
3511 @opindex fobjc-std
3512 Conform to the language syntax of Objective-C 1.0, the language
3513 recognized by GCC 4.0. This only affects the Objective-C additions to
3514 the C/C++ language; it does not affect conformance to C/C++ standards,
3515 which is controlled by the separate C/C++ dialect option flags. When
3516 this option is used with the Objective-C or Objective-C++ compiler,
3517 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3518 This is useful if you need to make sure that your Objective-C code can
3519 be compiled with older versions of GCC@.
3520
3521 @item -freplace-objc-classes
3522 @opindex freplace-objc-classes
3523 Emit a special marker instructing @command{ld(1)} not to statically link in
3524 the resulting object file, and allow @command{dyld(1)} to load it in at
3525 run time instead. This is used in conjunction with the Fix-and-Continue
3526 debugging mode, where the object file in question may be recompiled and
3527 dynamically reloaded in the course of program execution, without the need
3528 to restart the program itself. Currently, Fix-and-Continue functionality
3529 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3530 and later.
3531
3532 @item -fzero-link
3533 @opindex fzero-link
3534 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3535 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3536 compile time) with static class references that get initialized at load time,
3537 which improves run-time performance. Specifying the @option{-fzero-link} flag
3538 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3539 to be retained. This is useful in Zero-Link debugging mode, since it allows
3540 for individual class implementations to be modified during program execution.
3541 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3542 regardless of command-line options.
3543
3544 @item -fno-local-ivars
3545 @opindex fno-local-ivars
3546 @opindex flocal-ivars
3547 By default instance variables in Objective-C can be accessed as if
3548 they were local variables from within the methods of the class they're
3549 declared in. This can lead to shadowing between instance variables
3550 and other variables declared either locally inside a class method or
3551 globally with the same name. Specifying the @option{-fno-local-ivars}
3552 flag disables this behavior thus avoiding variable shadowing issues.
3553
3554 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3555 @opindex fivar-visibility
3556 Set the default instance variable visibility to the specified option
3557 so that instance variables declared outside the scope of any access
3558 modifier directives default to the specified visibility.
3559
3560 @item -gen-decls
3561 @opindex gen-decls
3562 Dump interface declarations for all classes seen in the source file to a
3563 file named @file{@var{sourcename}.decl}.
3564
3565 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3566 @opindex Wassign-intercept
3567 @opindex Wno-assign-intercept
3568 Warn whenever an Objective-C assignment is being intercepted by the
3569 garbage collector.
3570
3571 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3572 @opindex Wno-protocol
3573 @opindex Wprotocol
3574 If a class is declared to implement a protocol, a warning is issued for
3575 every method in the protocol that is not implemented by the class. The
3576 default behavior is to issue a warning for every method not explicitly
3577 implemented in the class, even if a method implementation is inherited
3578 from the superclass. If you use the @option{-Wno-protocol} option, then
3579 methods inherited from the superclass are considered to be implemented,
3580 and no warning is issued for them.
3581
3582 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3583 @opindex Wselector
3584 @opindex Wno-selector
3585 Warn if multiple methods of different types for the same selector are
3586 found during compilation. The check is performed on the list of methods
3587 in the final stage of compilation. Additionally, a check is performed
3588 for each selector appearing in a @code{@@selector(@dots{})}
3589 expression, and a corresponding method for that selector has been found
3590 during compilation. Because these checks scan the method table only at
3591 the end of compilation, these warnings are not produced if the final
3592 stage of compilation is not reached, for example because an error is
3593 found during compilation, or because the @option{-fsyntax-only} option is
3594 being used.
3595
3596 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3597 @opindex Wstrict-selector-match
3598 @opindex Wno-strict-selector-match
3599 Warn if multiple methods with differing argument and/or return types are
3600 found for a given selector when attempting to send a message using this
3601 selector to a receiver of type @code{id} or @code{Class}. When this flag
3602 is off (which is the default behavior), the compiler omits such warnings
3603 if any differences found are confined to types that share the same size
3604 and alignment.
3605
3606 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3607 @opindex Wundeclared-selector
3608 @opindex Wno-undeclared-selector
3609 Warn if a @code{@@selector(@dots{})} expression referring to an
3610 undeclared selector is found. A selector is considered undeclared if no
3611 method with that name has been declared before the
3612 @code{@@selector(@dots{})} expression, either explicitly in an
3613 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3614 an @code{@@implementation} section. This option always performs its
3615 checks as soon as a @code{@@selector(@dots{})} expression is found,
3616 while @option{-Wselector} only performs its checks in the final stage of
3617 compilation. This also enforces the coding style convention
3618 that methods and selectors must be declared before being used.
3619
3620 @item -print-objc-runtime-info
3621 @opindex print-objc-runtime-info
3622 Generate C header describing the largest structure that is passed by
3623 value, if any.
3624
3625 @end table
3626
3627 @node Diagnostic Message Formatting Options
3628 @section Options to Control Diagnostic Messages Formatting
3629 @cindex options to control diagnostics formatting
3630 @cindex diagnostic messages
3631 @cindex message formatting
3632
3633 Traditionally, diagnostic messages have been formatted irrespective of
3634 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3635 options described below
3636 to control the formatting algorithm for diagnostic messages,
3637 e.g.@: how many characters per line, how often source location
3638 information should be reported. Note that some language front ends may not
3639 honor these options.
3640
3641 @table @gcctabopt
3642 @item -fmessage-length=@var{n}
3643 @opindex fmessage-length
3644 Try to format error messages so that they fit on lines of about
3645 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3646 done; each error message appears on a single line. This is the
3647 default for all front ends.
3648
3649 Note - this option also affects the display of the @samp{#error} and
3650 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3651 function/type/variable attribute. It does not however affect the
3652 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3653
3654 @item -fdiagnostics-show-location=once
3655 @opindex fdiagnostics-show-location
3656 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3657 reporter to emit source location information @emph{once}; that is, in
3658 case the message is too long to fit on a single physical line and has to
3659 be wrapped, the source location won't be emitted (as prefix) again,
3660 over and over, in subsequent continuation lines. This is the default
3661 behavior.
3662
3663 @item -fdiagnostics-show-location=every-line
3664 Only meaningful in line-wrapping mode. Instructs the diagnostic
3665 messages reporter to emit the same source location information (as
3666 prefix) for physical lines that result from the process of breaking
3667 a message which is too long to fit on a single line.
3668
3669 @item -fdiagnostics-color[=@var{WHEN}]
3670 @itemx -fno-diagnostics-color
3671 @opindex fdiagnostics-color
3672 @cindex highlight, color
3673 @vindex GCC_COLORS @r{environment variable}
3674 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3675 or @samp{auto}. The default depends on how the compiler has been configured,
3676 it can be any of the above @var{WHEN} options or also @samp{never}
3677 if @env{GCC_COLORS} environment variable isn't present in the environment,
3678 and @samp{auto} otherwise.
3679 @samp{auto} means to use color only when the standard error is a terminal.
3680 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3681 aliases for @option{-fdiagnostics-color=always} and
3682 @option{-fdiagnostics-color=never}, respectively.
3683
3684 The colors are defined by the environment variable @env{GCC_COLORS}.
3685 Its value is a colon-separated list of capabilities and Select Graphic
3686 Rendition (SGR) substrings. SGR commands are interpreted by the
3687 terminal or terminal emulator. (See the section in the documentation
3688 of your text terminal for permitted values and their meanings as
3689 character attributes.) These substring values are integers in decimal
3690 representation and can be concatenated with semicolons.
3691 Common values to concatenate include
3692 @samp{1} for bold,
3693 @samp{4} for underline,
3694 @samp{5} for blink,
3695 @samp{7} for inverse,
3696 @samp{39} for default foreground color,
3697 @samp{30} to @samp{37} for foreground colors,
3698 @samp{90} to @samp{97} for 16-color mode foreground colors,
3699 @samp{38;5;0} to @samp{38;5;255}
3700 for 88-color and 256-color modes foreground colors,
3701 @samp{49} for default background color,
3702 @samp{40} to @samp{47} for background colors,
3703 @samp{100} to @samp{107} for 16-color mode background colors,
3704 and @samp{48;5;0} to @samp{48;5;255}
3705 for 88-color and 256-color modes background colors.
3706
3707 The default @env{GCC_COLORS} is
3708 @smallexample
3709 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3710 quote=01:fixit-insert=32:fixit-delete=31:\
3711 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3712 type-diff=01;32
3713 @end smallexample
3714 @noindent
3715 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3716 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3717 @samp{01} is bold, and @samp{31} is red.
3718 Setting @env{GCC_COLORS} to the empty string disables colors.
3719 Supported capabilities are as follows.
3720
3721 @table @code
3722 @item error=
3723 @vindex error GCC_COLORS @r{capability}
3724 SGR substring for error: markers.
3725
3726 @item warning=
3727 @vindex warning GCC_COLORS @r{capability}
3728 SGR substring for warning: markers.
3729
3730 @item note=
3731 @vindex note GCC_COLORS @r{capability}
3732 SGR substring for note: markers.
3733
3734 @item range1=
3735 @vindex range1 GCC_COLORS @r{capability}
3736 SGR substring for first additional range.
3737
3738 @item range2=
3739 @vindex range2 GCC_COLORS @r{capability}
3740 SGR substring for second additional range.
3741
3742 @item locus=
3743 @vindex locus GCC_COLORS @r{capability}
3744 SGR substring for location information, @samp{file:line} or
3745 @samp{file:line:column} etc.
3746
3747 @item quote=
3748 @vindex quote GCC_COLORS @r{capability}
3749 SGR substring for information printed within quotes.
3750
3751 @item fixit-insert=
3752 @vindex fixit-insert GCC_COLORS @r{capability}
3753 SGR substring for fix-it hints suggesting text to
3754 be inserted or replaced.
3755
3756 @item fixit-delete=
3757 @vindex fixit-delete GCC_COLORS @r{capability}
3758 SGR substring for fix-it hints suggesting text to
3759 be deleted.
3760
3761 @item diff-filename=
3762 @vindex diff-filename GCC_COLORS @r{capability}
3763 SGR substring for filename headers within generated patches.
3764
3765 @item diff-hunk=
3766 @vindex diff-hunk GCC_COLORS @r{capability}
3767 SGR substring for the starts of hunks within generated patches.
3768
3769 @item diff-delete=
3770 @vindex diff-delete GCC_COLORS @r{capability}
3771 SGR substring for deleted lines within generated patches.
3772
3773 @item diff-insert=
3774 @vindex diff-insert GCC_COLORS @r{capability}
3775 SGR substring for inserted lines within generated patches.
3776
3777 @item type-diff=
3778 @vindex type-diff GCC_COLORS @r{capability}
3779 SGR substring for highlighting mismatching types within template
3780 arguments in the C++ frontend.
3781 @end table
3782
3783 @item -fno-diagnostics-show-option
3784 @opindex fno-diagnostics-show-option
3785 @opindex fdiagnostics-show-option
3786 By default, each diagnostic emitted includes text indicating the
3787 command-line option that directly controls the diagnostic (if such an
3788 option is known to the diagnostic machinery). Specifying the
3789 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3790
3791 @item -fno-diagnostics-show-caret
3792 @opindex fno-diagnostics-show-caret
3793 @opindex fdiagnostics-show-caret
3794 By default, each diagnostic emitted includes the original source line
3795 and a caret @samp{^} indicating the column. This option suppresses this
3796 information. The source line is truncated to @var{n} characters, if
3797 the @option{-fmessage-length=n} option is given. When the output is done
3798 to the terminal, the width is limited to the width given by the
3799 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3800
3801 @item -fno-diagnostics-show-labels
3802 @opindex fno-diagnostics-show-labels
3803 @opindex fdiagnostics-show-labels
3804 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3805 diagnostics can label ranges of source code with pertinent information, such
3806 as the types of expressions:
3807
3808 @smallexample
3809 printf ("foo %s bar", long_i + long_j);
3810 ~^ ~~~~~~~~~~~~~~~
3811 | |
3812 char * long int
3813 @end smallexample
3814
3815 This option suppresses the printing of these labels (in the example above,
3816 the vertical bars and the ``char *'' and ``long int'' text).
3817
3818 @item -fno-diagnostics-show-line-numbers
3819 @opindex fno-diagnostics-show-line-numbers
3820 @opindex fdiagnostics-show-line-numbers
3821 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3822 a left margin is printed, showing line numbers. This option suppresses this
3823 left margin.
3824
3825 @item -fdiagnostics-parseable-fixits
3826 @opindex fdiagnostics-parseable-fixits
3827 Emit fix-it hints in a machine-parseable format, suitable for consumption
3828 by IDEs. For each fix-it, a line will be printed after the relevant
3829 diagnostic, starting with the string ``fix-it:''. For example:
3830
3831 @smallexample
3832 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3833 @end smallexample
3834
3835 The location is expressed as a half-open range, expressed as a count of
3836 bytes, starting at byte 1 for the initial column. In the above example,
3837 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3838 given string:
3839
3840 @smallexample
3841 00000000011111111112222222222
3842 12345678901234567890123456789
3843 gtk_widget_showall (dlg);
3844 ^^^^^^^^^^^^^^^^^^
3845 gtk_widget_show_all
3846 @end smallexample
3847
3848 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3849 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3850 (e.g. vertical tab as ``\013'').
3851
3852 An empty replacement string indicates that the given range is to be removed.
3853 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3854 be inserted at the given position.
3855
3856 @item -fdiagnostics-generate-patch
3857 @opindex fdiagnostics-generate-patch
3858 Print fix-it hints to stderr in unified diff format, after any diagnostics
3859 are printed. For example:
3860
3861 @smallexample
3862 --- test.c
3863 +++ test.c
3864 @@ -42,5 +42,5 @@
3865
3866 void show_cb(GtkDialog *dlg)
3867 @{
3868 - gtk_widget_showall(dlg);
3869 + gtk_widget_show_all(dlg);
3870 @}
3871
3872 @end smallexample
3873
3874 The diff may or may not be colorized, following the same rules
3875 as for diagnostics (see @option{-fdiagnostics-color}).
3876
3877 @item -fdiagnostics-show-template-tree
3878 @opindex fdiagnostics-show-template-tree
3879
3880 In the C++ frontend, when printing diagnostics showing mismatching
3881 template types, such as:
3882
3883 @smallexample
3884 could not convert 'std::map<int, std::vector<double> >()'
3885 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3886 @end smallexample
3887
3888 the @option{-fdiagnostics-show-template-tree} flag enables printing a
3889 tree-like structure showing the common and differing parts of the types,
3890 such as:
3891
3892 @smallexample
3893 map<
3894 [...],
3895 vector<
3896 [double != float]>>
3897 @end smallexample
3898
3899 The parts that differ are highlighted with color (``double'' and
3900 ``float'' in this case).
3901
3902 @item -fno-elide-type
3903 @opindex fno-elide-type
3904 @opindex felide-type
3905 By default when the C++ frontend prints diagnostics showing mismatching
3906 template types, common parts of the types are printed as ``[...]'' to
3907 simplify the error message. For example:
3908
3909 @smallexample
3910 could not convert 'std::map<int, std::vector<double> >()'
3911 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
3912 @end smallexample
3913
3914 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
3915 This flag also affects the output of the
3916 @option{-fdiagnostics-show-template-tree} flag.
3917
3918 @item -fno-show-column
3919 @opindex fno-show-column
3920 Do not print column numbers in diagnostics. This may be necessary if
3921 diagnostics are being scanned by a program that does not understand the
3922 column numbers, such as @command{dejagnu}.
3923
3924 @end table
3925
3926 @node Warning Options
3927 @section Options to Request or Suppress Warnings
3928 @cindex options to control warnings
3929 @cindex warning messages
3930 @cindex messages, warning
3931 @cindex suppressing warnings
3932
3933 Warnings are diagnostic messages that report constructions that
3934 are not inherently erroneous but that are risky or suggest there
3935 may have been an error.
3936
3937 The following language-independent options do not enable specific
3938 warnings but control the kinds of diagnostics produced by GCC@.
3939
3940 @table @gcctabopt
3941 @cindex syntax checking
3942 @item -fsyntax-only
3943 @opindex fsyntax-only
3944 Check the code for syntax errors, but don't do anything beyond that.
3945
3946 @item -fmax-errors=@var{n}
3947 @opindex fmax-errors
3948 Limits the maximum number of error messages to @var{n}, at which point
3949 GCC bails out rather than attempting to continue processing the source
3950 code. If @var{n} is 0 (the default), there is no limit on the number
3951 of error messages produced. If @option{-Wfatal-errors} is also
3952 specified, then @option{-Wfatal-errors} takes precedence over this
3953 option.
3954
3955 @item -w
3956 @opindex w
3957 Inhibit all warning messages.
3958
3959 @item -Werror
3960 @opindex Werror
3961 @opindex Wno-error
3962 Make all warnings into errors.
3963
3964 @item -Werror=
3965 @opindex Werror=
3966 @opindex Wno-error=
3967 Make the specified warning into an error. The specifier for a warning
3968 is appended; for example @option{-Werror=switch} turns the warnings
3969 controlled by @option{-Wswitch} into errors. This switch takes a
3970 negative form, to be used to negate @option{-Werror} for specific
3971 warnings; for example @option{-Wno-error=switch} makes
3972 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
3973 is in effect.
3974
3975 The warning message for each controllable warning includes the
3976 option that controls the warning. That option can then be used with
3977 @option{-Werror=} and @option{-Wno-error=} as described above.
3978 (Printing of the option in the warning message can be disabled using the
3979 @option{-fno-diagnostics-show-option} flag.)
3980
3981 Note that specifying @option{-Werror=}@var{foo} automatically implies
3982 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3983 imply anything.
3984
3985 @item -Wfatal-errors
3986 @opindex Wfatal-errors
3987 @opindex Wno-fatal-errors
3988 This option causes the compiler to abort compilation on the first error
3989 occurred rather than trying to keep going and printing further error
3990 messages.
3991
3992 @end table
3993
3994 You can request many specific warnings with options beginning with
3995 @samp{-W}, for example @option{-Wimplicit} to request warnings on
3996 implicit declarations. Each of these specific warning options also
3997 has a negative form beginning @samp{-Wno-} to turn off warnings; for
3998 example, @option{-Wno-implicit}. This manual lists only one of the
3999 two forms, whichever is not the default. For further
4000 language-specific options also refer to @ref{C++ Dialect Options} and
4001 @ref{Objective-C and Objective-C++ Dialect Options}.
4002
4003 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4004 options, such as @option{-Wunused}, which may turn on further options,
4005 such as @option{-Wunused-value}. The combined effect of positive and
4006 negative forms is that more specific options have priority over less
4007 specific ones, independently of their position in the command-line. For
4008 options of the same specificity, the last one takes effect. Options
4009 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4010 as if they appeared at the end of the command-line.
4011
4012 When an unrecognized warning option is requested (e.g.,
4013 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4014 that the option is not recognized. However, if the @option{-Wno-} form
4015 is used, the behavior is slightly different: no diagnostic is
4016 produced for @option{-Wno-unknown-warning} unless other diagnostics
4017 are being produced. This allows the use of new @option{-Wno-} options
4018 with old compilers, but if something goes wrong, the compiler
4019 warns that an unrecognized option is present.
4020
4021 @table @gcctabopt
4022 @item -Wpedantic
4023 @itemx -pedantic
4024 @opindex pedantic
4025 @opindex Wpedantic
4026 @opindex Wno-pedantic
4027 Issue all the warnings demanded by strict ISO C and ISO C++;
4028 reject all programs that use forbidden extensions, and some other
4029 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4030 version of the ISO C standard specified by any @option{-std} option used.
4031
4032 Valid ISO C and ISO C++ programs should compile properly with or without
4033 this option (though a rare few require @option{-ansi} or a
4034 @option{-std} option specifying the required version of ISO C)@. However,
4035 without this option, certain GNU extensions and traditional C and C++
4036 features are supported as well. With this option, they are rejected.
4037
4038 @option{-Wpedantic} does not cause warning messages for use of the
4039 alternate keywords whose names begin and end with @samp{__}. Pedantic
4040 warnings are also disabled in the expression that follows
4041 @code{__extension__}. However, only system header files should use
4042 these escape routes; application programs should avoid them.
4043 @xref{Alternate Keywords}.
4044
4045 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4046 C conformance. They soon find that it does not do quite what they want:
4047 it finds some non-ISO practices, but not all---only those for which
4048 ISO C @emph{requires} a diagnostic, and some others for which
4049 diagnostics have been added.
4050
4051 A feature to report any failure to conform to ISO C might be useful in
4052 some instances, but would require considerable additional work and would
4053 be quite different from @option{-Wpedantic}. We don't have plans to
4054 support such a feature in the near future.
4055
4056 Where the standard specified with @option{-std} represents a GNU
4057 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4058 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4059 extended dialect is based. Warnings from @option{-Wpedantic} are given
4060 where they are required by the base standard. (It does not make sense
4061 for such warnings to be given only for features not in the specified GNU
4062 C dialect, since by definition the GNU dialects of C include all
4063 features the compiler supports with the given option, and there would be
4064 nothing to warn about.)
4065
4066 @item -pedantic-errors
4067 @opindex pedantic-errors
4068 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4069 requires a diagnostic, in some cases where there is undefined behavior
4070 at compile-time and in some other cases that do not prevent compilation
4071 of programs that are valid according to the standard. This is not
4072 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4073 by this option and not enabled by the latter and vice versa.
4074
4075 @item -Wall
4076 @opindex Wall
4077 @opindex Wno-all
4078 This enables all the warnings about constructions that some users
4079 consider questionable, and that are easy to avoid (or modify to
4080 prevent the warning), even in conjunction with macros. This also
4081 enables some language-specific warnings described in @ref{C++ Dialect
4082 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4083
4084 @option{-Wall} turns on the following warning flags:
4085
4086 @gccoptlist{-Waddress @gol
4087 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4088 -Wbool-compare @gol
4089 -Wbool-operation @gol
4090 -Wc++11-compat -Wc++14-compat @gol
4091 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4092 -Wchar-subscripts @gol
4093 -Wcomment @gol
4094 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4095 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4096 -Wformat @gol
4097 -Wint-in-bool-context @gol
4098 -Wimplicit @r{(C and Objective-C only)} @gol
4099 -Wimplicit-int @r{(C and Objective-C only)} @gol
4100 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4101 -Winit-self @r{(only for C++)} @gol
4102 -Wlogical-not-parentheses @gol
4103 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4104 -Wmaybe-uninitialized @gol
4105 -Wmemset-elt-size @gol
4106 -Wmemset-transposed-args @gol
4107 -Wmisleading-indentation @r{(only for C/C++)} @gol
4108 -Wmissing-attributes @gol
4109 -Wmissing-braces @r{(only for C/ObjC)} @gol
4110 -Wmultistatement-macros @gol
4111 -Wnarrowing @r{(only for C++)} @gol
4112 -Wnonnull @gol
4113 -Wnonnull-compare @gol
4114 -Wopenmp-simd @gol
4115 -Wparentheses @gol
4116 -Wpessimizing-move @r{(only for C++)} @gol
4117 -Wpointer-sign @gol
4118 -Wreorder @gol
4119 -Wrestrict @gol
4120 -Wreturn-type @gol
4121 -Wsequence-point @gol
4122 -Wsign-compare @r{(only in C++)} @gol
4123 -Wsizeof-pointer-div @gol
4124 -Wsizeof-pointer-memaccess @gol
4125 -Wstrict-aliasing @gol
4126 -Wstrict-overflow=1 @gol
4127 -Wswitch @gol
4128 -Wtautological-compare @gol
4129 -Wtrigraphs @gol
4130 -Wuninitialized @gol
4131 -Wunknown-pragmas @gol
4132 -Wunused-function @gol
4133 -Wunused-label @gol
4134 -Wunused-value @gol
4135 -Wunused-variable @gol
4136 -Wvolatile-register-var @gol
4137 }
4138
4139 Note that some warning flags are not implied by @option{-Wall}. Some of
4140 them warn about constructions that users generally do not consider
4141 questionable, but which occasionally you might wish to check for;
4142 others warn about constructions that are necessary or hard to avoid in
4143 some cases, and there is no simple way to modify the code to suppress
4144 the warning. Some of them are enabled by @option{-Wextra} but many of
4145 them must be enabled individually.
4146
4147 @item -Wextra
4148 @opindex W
4149 @opindex Wextra
4150 @opindex Wno-extra
4151 This enables some extra warning flags that are not enabled by
4152 @option{-Wall}. (This option used to be called @option{-W}. The older
4153 name is still supported, but the newer name is more descriptive.)
4154
4155 @gccoptlist{-Wclobbered @gol
4156 -Wcast-function-type @gol
4157 -Wempty-body @gol
4158 -Wignored-qualifiers @gol
4159 -Wimplicit-fallthrough=3 @gol
4160 -Wmissing-field-initializers @gol
4161 -Wmissing-parameter-type @r{(C only)} @gol
4162 -Wold-style-declaration @r{(C only)} @gol
4163 -Woverride-init @gol
4164 -Wsign-compare @r{(C only)} @gol
4165 -Wredundant-move @r{(only for C++)} @gol
4166 -Wtype-limits @gol
4167 -Wuninitialized @gol
4168 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4169 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4170 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4171 }
4172
4173 The option @option{-Wextra} also prints warning messages for the
4174 following cases:
4175
4176 @itemize @bullet
4177
4178 @item
4179 A pointer is compared against integer zero with @code{<}, @code{<=},
4180 @code{>}, or @code{>=}.
4181
4182 @item
4183 (C++ only) An enumerator and a non-enumerator both appear in a
4184 conditional expression.
4185
4186 @item
4187 (C++ only) Ambiguous virtual bases.
4188
4189 @item
4190 (C++ only) Subscripting an array that has been declared @code{register}.
4191
4192 @item
4193 (C++ only) Taking the address of a variable that has been declared
4194 @code{register}.
4195
4196 @item
4197 (C++ only) A base class is not initialized in the copy constructor
4198 of a derived class.
4199
4200 @end itemize
4201
4202 @item -Wchar-subscripts
4203 @opindex Wchar-subscripts
4204 @opindex Wno-char-subscripts
4205 Warn if an array subscript has type @code{char}. This is a common cause
4206 of error, as programmers often forget that this type is signed on some
4207 machines.
4208 This warning is enabled by @option{-Wall}.
4209
4210 @item -Wchkp
4211 @opindex Wchkp
4212 @opindex Wno-chkp
4213 Warn about an invalid memory access that is found by Pointer Bounds Checker
4214 (@option{-fcheck-pointer-bounds}).
4215
4216 @item -Wno-coverage-mismatch
4217 @opindex Wno-coverage-mismatch
4218 @opindex Wcoverage-mismatch
4219 Warn if feedback profiles do not match when using the
4220 @option{-fprofile-use} option.
4221 If a source file is changed between compiling with @option{-fprofile-gen} and
4222 with @option{-fprofile-use}, the files with the profile feedback can fail
4223 to match the source file and GCC cannot use the profile feedback
4224 information. By default, this warning is enabled and is treated as an
4225 error. @option{-Wno-coverage-mismatch} can be used to disable the
4226 warning or @option{-Wno-error=coverage-mismatch} can be used to
4227 disable the error. Disabling the error for this warning can result in
4228 poorly optimized code and is useful only in the
4229 case of very minor changes such as bug fixes to an existing code-base.
4230 Completely disabling the warning is not recommended.
4231
4232 @item -Wno-cpp
4233 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4234
4235 Suppress warning messages emitted by @code{#warning} directives.
4236
4237 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4238 @opindex Wdouble-promotion
4239 @opindex Wno-double-promotion
4240 Give a warning when a value of type @code{float} is implicitly
4241 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4242 floating-point unit implement @code{float} in hardware, but emulate
4243 @code{double} in software. On such a machine, doing computations
4244 using @code{double} values is much more expensive because of the
4245 overhead required for software emulation.
4246
4247 It is easy to accidentally do computations with @code{double} because
4248 floating-point literals are implicitly of type @code{double}. For
4249 example, in:
4250 @smallexample
4251 @group
4252 float area(float radius)
4253 @{
4254 return 3.14159 * radius * radius;
4255 @}
4256 @end group
4257 @end smallexample
4258 the compiler performs the entire computation with @code{double}
4259 because the floating-point literal is a @code{double}.
4260
4261 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4262 @opindex Wduplicate-decl-specifier
4263 @opindex Wno-duplicate-decl-specifier
4264 Warn if a declaration has duplicate @code{const}, @code{volatile},
4265 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4266 @option{-Wall}.
4267
4268 @item -Wformat
4269 @itemx -Wformat=@var{n}
4270 @opindex Wformat
4271 @opindex Wno-format
4272 @opindex ffreestanding
4273 @opindex fno-builtin
4274 @opindex Wformat=
4275 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4276 the arguments supplied have types appropriate to the format string
4277 specified, and that the conversions specified in the format string make
4278 sense. This includes standard functions, and others specified by format
4279 attributes (@pxref{Function Attributes}), in the @code{printf},
4280 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4281 not in the C standard) families (or other target-specific families).
4282 Which functions are checked without format attributes having been
4283 specified depends on the standard version selected, and such checks of
4284 functions without the attribute specified are disabled by
4285 @option{-ffreestanding} or @option{-fno-builtin}.
4286
4287 The formats are checked against the format features supported by GNU
4288 libc version 2.2. These include all ISO C90 and C99 features, as well
4289 as features from the Single Unix Specification and some BSD and GNU
4290 extensions. Other library implementations may not support all these
4291 features; GCC does not support warning about features that go beyond a
4292 particular library's limitations. However, if @option{-Wpedantic} is used
4293 with @option{-Wformat}, warnings are given about format features not
4294 in the selected standard version (but not for @code{strfmon} formats,
4295 since those are not in any version of the C standard). @xref{C Dialect
4296 Options,,Options Controlling C Dialect}.
4297
4298 @table @gcctabopt
4299 @item -Wformat=1
4300 @itemx -Wformat
4301 @opindex Wformat
4302 @opindex Wformat=1
4303 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4304 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4305 @option{-Wformat} also checks for null format arguments for several
4306 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4307 aspects of this level of format checking can be disabled by the
4308 options: @option{-Wno-format-contains-nul},
4309 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4310 @option{-Wformat} is enabled by @option{-Wall}.
4311
4312 @item -Wno-format-contains-nul
4313 @opindex Wno-format-contains-nul
4314 @opindex Wformat-contains-nul
4315 If @option{-Wformat} is specified, do not warn about format strings that
4316 contain NUL bytes.
4317
4318 @item -Wno-format-extra-args
4319 @opindex Wno-format-extra-args
4320 @opindex Wformat-extra-args
4321 If @option{-Wformat} is specified, do not warn about excess arguments to a
4322 @code{printf} or @code{scanf} format function. The C standard specifies
4323 that such arguments are ignored.
4324
4325 Where the unused arguments lie between used arguments that are
4326 specified with @samp{$} operand number specifications, normally
4327 warnings are still given, since the implementation could not know what
4328 type to pass to @code{va_arg} to skip the unused arguments. However,
4329 in the case of @code{scanf} formats, this option suppresses the
4330 warning if the unused arguments are all pointers, since the Single
4331 Unix Specification says that such unused arguments are allowed.
4332
4333 @item -Wformat-overflow
4334 @itemx -Wformat-overflow=@var{level}
4335 @opindex Wformat-overflow
4336 @opindex Wno-format-overflow
4337 Warn about calls to formatted input/output functions such as @code{sprintf}
4338 and @code{vsprintf} that might overflow the destination buffer. When the
4339 exact number of bytes written by a format directive cannot be determined
4340 at compile-time it is estimated based on heuristics that depend on the
4341 @var{level} argument and on optimization. While enabling optimization
4342 will in most cases improve the accuracy of the warning, it may also
4343 result in false positives.
4344
4345 @table @gcctabopt
4346 @item -Wformat-overflow
4347 @itemx -Wformat-overflow=1
4348 @opindex Wformat-overflow
4349 @opindex Wno-format-overflow
4350 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4351 employs a conservative approach that warns only about calls that most
4352 likely overflow the buffer. At this level, numeric arguments to format
4353 directives with unknown values are assumed to have the value of one, and
4354 strings of unknown length to be empty. Numeric arguments that are known
4355 to be bounded to a subrange of their type, or string arguments whose output
4356 is bounded either by their directive's precision or by a finite set of
4357 string literals, are assumed to take on the value within the range that
4358 results in the most bytes on output. For example, the call to @code{sprintf}
4359 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4360 the terminating NUL character (@code{'\0'}) appended by the function
4361 to the destination buffer will be written past its end. Increasing
4362 the size of the buffer by a single byte is sufficient to avoid the
4363 warning, though it may not be sufficient to avoid the overflow.
4364
4365 @smallexample
4366 void f (int a, int b)
4367 @{
4368 char buf [13];
4369 sprintf (buf, "a = %i, b = %i\n", a, b);
4370 @}
4371 @end smallexample
4372
4373 @item -Wformat-overflow=2
4374 Level @var{2} warns also about calls that might overflow the destination
4375 buffer given an argument of sufficient length or magnitude. At level
4376 @var{2}, unknown numeric arguments are assumed to have the minimum
4377 representable value for signed types with a precision greater than 1, and
4378 the maximum representable value otherwise. Unknown string arguments whose
4379 length cannot be assumed to be bounded either by the directive's precision,
4380 or by a finite set of string literals they may evaluate to, or the character
4381 array they may point to, are assumed to be 1 character long.
4382
4383 At level @var{2}, the call in the example above is again diagnosed, but
4384 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4385 @code{%i} directive will write some of its digits beyond the end of
4386 the destination buffer. To make the call safe regardless of the values
4387 of the two variables, the size of the destination buffer must be increased
4388 to at least 34 bytes. GCC includes the minimum size of the buffer in
4389 an informational note following the warning.
4390
4391 An alternative to increasing the size of the destination buffer is to
4392 constrain the range of formatted values. The maximum length of string
4393 arguments can be bounded by specifying the precision in the format
4394 directive. When numeric arguments of format directives can be assumed
4395 to be bounded by less than the precision of their type, choosing
4396 an appropriate length modifier to the format specifier will reduce
4397 the required buffer size. For example, if @var{a} and @var{b} in the
4398 example above can be assumed to be within the precision of
4399 the @code{short int} type then using either the @code{%hi} format
4400 directive or casting the argument to @code{short} reduces the maximum
4401 required size of the buffer to 24 bytes.
4402
4403 @smallexample
4404 void f (int a, int b)
4405 @{
4406 char buf [23];
4407 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4408 @}
4409 @end smallexample
4410 @end table
4411
4412 @item -Wno-format-zero-length
4413 @opindex Wno-format-zero-length
4414 @opindex Wformat-zero-length
4415 If @option{-Wformat} is specified, do not warn about zero-length formats.
4416 The C standard specifies that zero-length formats are allowed.
4417
4418
4419 @item -Wformat=2
4420 @opindex Wformat=2
4421 Enable @option{-Wformat} plus additional format checks. Currently
4422 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4423 -Wformat-y2k}.
4424
4425 @item -Wformat-nonliteral
4426 @opindex Wformat-nonliteral
4427 @opindex Wno-format-nonliteral
4428 If @option{-Wformat} is specified, also warn if the format string is not a
4429 string literal and so cannot be checked, unless the format function
4430 takes its format arguments as a @code{va_list}.
4431
4432 @item -Wformat-security
4433 @opindex Wformat-security
4434 @opindex Wno-format-security
4435 If @option{-Wformat} is specified, also warn about uses of format
4436 functions that represent possible security problems. At present, this
4437 warns about calls to @code{printf} and @code{scanf} functions where the
4438 format string is not a string literal and there are no format arguments,
4439 as in @code{printf (foo);}. This may be a security hole if the format
4440 string came from untrusted input and contains @samp{%n}. (This is
4441 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4442 in future warnings may be added to @option{-Wformat-security} that are not
4443 included in @option{-Wformat-nonliteral}.)
4444
4445 @item -Wformat-signedness
4446 @opindex Wformat-signedness
4447 @opindex Wno-format-signedness
4448 If @option{-Wformat} is specified, also warn if the format string
4449 requires an unsigned argument and the argument is signed and vice versa.
4450
4451 @item -Wformat-truncation
4452 @itemx -Wformat-truncation=@var{level}
4453 @opindex Wformat-truncation
4454 @opindex Wno-format-truncation
4455 Warn about calls to formatted input/output functions such as @code{snprintf}
4456 and @code{vsnprintf} that might result in output truncation. When the exact
4457 number of bytes written by a format directive cannot be determined at
4458 compile-time it is estimated based on heuristics that depend on
4459 the @var{level} argument and on optimization. While enabling optimization
4460 will in most cases improve the accuracy of the warning, it may also result
4461 in false positives. Except as noted otherwise, the option uses the same
4462 logic @option{-Wformat-overflow}.
4463
4464 @table @gcctabopt
4465 @item -Wformat-truncation
4466 @itemx -Wformat-truncation=1
4467 @opindex Wformat-truncation
4468 @opindex Wno-format-truncation
4469 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4470 employs a conservative approach that warns only about calls to bounded
4471 functions whose return value is unused and that will most likely result
4472 in output truncation.
4473
4474 @item -Wformat-truncation=2
4475 Level @var{2} warns also about calls to bounded functions whose return
4476 value is used and that might result in truncation given an argument of
4477 sufficient length or magnitude.
4478 @end table
4479
4480 @item -Wformat-y2k
4481 @opindex Wformat-y2k
4482 @opindex Wno-format-y2k
4483 If @option{-Wformat} is specified, also warn about @code{strftime}
4484 formats that may yield only a two-digit year.
4485 @end table
4486
4487 @item -Wnonnull
4488 @opindex Wnonnull
4489 @opindex Wno-nonnull
4490 Warn about passing a null pointer for arguments marked as
4491 requiring a non-null value by the @code{nonnull} function attribute.
4492
4493 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4494 can be disabled with the @option{-Wno-nonnull} option.
4495
4496 @item -Wnonnull-compare
4497 @opindex Wnonnull-compare
4498 @opindex Wno-nonnull-compare
4499 Warn when comparing an argument marked with the @code{nonnull}
4500 function attribute against null inside the function.
4501
4502 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4503 can be disabled with the @option{-Wno-nonnull-compare} option.
4504
4505 @item -Wnull-dereference
4506 @opindex Wnull-dereference
4507 @opindex Wno-null-dereference
4508 Warn if the compiler detects paths that trigger erroneous or
4509 undefined behavior due to dereferencing a null pointer. This option
4510 is only active when @option{-fdelete-null-pointer-checks} is active,
4511 which is enabled by optimizations in most targets. The precision of
4512 the warnings depends on the optimization options used.
4513
4514 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4515 @opindex Winit-self
4516 @opindex Wno-init-self
4517 Warn about uninitialized variables that are initialized with themselves.
4518 Note this option can only be used with the @option{-Wuninitialized} option.
4519
4520 For example, GCC warns about @code{i} being uninitialized in the
4521 following snippet only when @option{-Winit-self} has been specified:
4522 @smallexample
4523 @group
4524 int f()
4525 @{
4526 int i = i;
4527 return i;
4528 @}
4529 @end group
4530 @end smallexample
4531
4532 This warning is enabled by @option{-Wall} in C++.
4533
4534 @item -Wimplicit-int @r{(C and Objective-C only)}
4535 @opindex Wimplicit-int
4536 @opindex Wno-implicit-int
4537 Warn when a declaration does not specify a type.
4538 This warning is enabled by @option{-Wall}.
4539
4540 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4541 @opindex Wimplicit-function-declaration
4542 @opindex Wno-implicit-function-declaration
4543 Give a warning whenever a function is used before being declared. In
4544 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4545 enabled by default and it is made into an error by
4546 @option{-pedantic-errors}. This warning is also enabled by
4547 @option{-Wall}.
4548
4549 @item -Wimplicit @r{(C and Objective-C only)}
4550 @opindex Wimplicit
4551 @opindex Wno-implicit
4552 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4553 This warning is enabled by @option{-Wall}.
4554
4555 @item -Wimplicit-fallthrough
4556 @opindex Wimplicit-fallthrough
4557 @opindex Wno-implicit-fallthrough
4558 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4559 and @option{-Wno-implicit-fallthrough} is the same as
4560 @option{-Wimplicit-fallthrough=0}.
4561
4562 @item -Wimplicit-fallthrough=@var{n}
4563 @opindex Wimplicit-fallthrough=
4564 Warn when a switch case falls through. For example:
4565
4566 @smallexample
4567 @group
4568 switch (cond)
4569 @{
4570 case 1:
4571 a = 1;
4572 break;
4573 case 2:
4574 a = 2;
4575 case 3:
4576 a = 3;
4577 break;
4578 @}
4579 @end group
4580 @end smallexample
4581
4582 This warning does not warn when the last statement of a case cannot
4583 fall through, e.g. when there is a return statement or a call to function
4584 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4585 also takes into account control flow statements, such as ifs, and only
4586 warns when appropriate. E.g.@:
4587
4588 @smallexample
4589 @group
4590 switch (cond)
4591 @{
4592 case 1:
4593 if (i > 3) @{
4594 bar (5);
4595 break;
4596 @} else if (i < 1) @{
4597 bar (0);
4598 @} else
4599 return;
4600 default:
4601 @dots{}
4602 @}
4603 @end group
4604 @end smallexample
4605
4606 Since there are occasions where a switch case fall through is desirable,
4607 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4608 to be used along with a null statement to suppress this warning that
4609 would normally occur:
4610
4611 @smallexample
4612 @group
4613 switch (cond)
4614 @{
4615 case 1:
4616 bar (0);
4617 __attribute__ ((fallthrough));
4618 default:
4619 @dots{}
4620 @}
4621 @end group
4622 @end smallexample
4623
4624 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4625 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4626 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4627 Instead of these attributes, it is also possible to add a fallthrough comment
4628 to silence the warning. The whole body of the C or C++ style comment should
4629 match the given regular expressions listed below. The option argument @var{n}
4630 specifies what kind of comments are accepted:
4631
4632 @itemize @bullet
4633
4634 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4635
4636 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4637 expression, any comment is used as fallthrough comment.
4638
4639 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4640 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4641
4642 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4643 following regular expressions:
4644
4645 @itemize @bullet
4646
4647 @item @code{-fallthrough}
4648
4649 @item @code{@@fallthrough@@}
4650
4651 @item @code{lint -fallthrough[ \t]*}
4652
4653 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4654
4655 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4656
4657 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4658
4659 @end itemize
4660
4661 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4662 following regular expressions:
4663
4664 @itemize @bullet
4665
4666 @item @code{-fallthrough}
4667
4668 @item @code{@@fallthrough@@}
4669
4670 @item @code{lint -fallthrough[ \t]*}
4671
4672 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
4673
4674 @end itemize
4675
4676 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
4677 fallthrough comments, only attributes disable the warning.
4678
4679 @end itemize
4680
4681 The comment needs to be followed after optional whitespace and other comments
4682 by @code{case} or @code{default} keywords or by a user label that precedes some
4683 @code{case} or @code{default} label.
4684
4685 @smallexample
4686 @group
4687 switch (cond)
4688 @{
4689 case 1:
4690 bar (0);
4691 /* FALLTHRU */
4692 default:
4693 @dots{}
4694 @}
4695 @end group
4696 @end smallexample
4697
4698 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
4699
4700 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
4701 @opindex Wif-not-aligned
4702 @opindex Wno-if-not-aligned
4703 Control if warning triggered by the @code{warn_if_not_aligned} attribute
4704 should be issued. This is enabled by default.
4705 Use @option{-Wno-if-not-aligned} to disable it.
4706
4707 @item -Wignored-qualifiers @r{(C and C++ only)}
4708 @opindex Wignored-qualifiers
4709 @opindex Wno-ignored-qualifiers
4710 Warn if the return type of a function has a type qualifier
4711 such as @code{const}. For ISO C such a type qualifier has no effect,
4712 since the value returned by a function is not an lvalue.
4713 For C++, the warning is only emitted for scalar types or @code{void}.
4714 ISO C prohibits qualified @code{void} return types on function
4715 definitions, so such return types always receive a warning
4716 even without this option.
4717
4718 This warning is also enabled by @option{-Wextra}.
4719
4720 @item -Wignored-attributes @r{(C and C++ only)}
4721 @opindex Wignored-attributes
4722 @opindex Wno-ignored-attributes
4723 Warn when an attribute is ignored. This is different from the
4724 @option{-Wattributes} option in that it warns whenever the compiler decides
4725 to drop an attribute, not that the attribute is either unknown, used in a
4726 wrong place, etc. This warning is enabled by default.
4727
4728 @item -Wmain
4729 @opindex Wmain
4730 @opindex Wno-main
4731 Warn if the type of @code{main} is suspicious. @code{main} should be
4732 a function with external linkage, returning int, taking either zero
4733 arguments, two, or three arguments of appropriate types. This warning
4734 is enabled by default in C++ and is enabled by either @option{-Wall}
4735 or @option{-Wpedantic}.
4736
4737 @item -Wmisleading-indentation @r{(C and C++ only)}
4738 @opindex Wmisleading-indentation
4739 @opindex Wno-misleading-indentation
4740 Warn when the indentation of the code does not reflect the block structure.
4741 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
4742 @code{for} clauses with a guarded statement that does not use braces,
4743 followed by an unguarded statement with the same indentation.
4744
4745 In the following example, the call to ``bar'' is misleadingly indented as
4746 if it were guarded by the ``if'' conditional.
4747
4748 @smallexample
4749 if (some_condition ())
4750 foo ();
4751 bar (); /* Gotcha: this is not guarded by the "if". */
4752 @end smallexample
4753
4754 In the case of mixed tabs and spaces, the warning uses the
4755 @option{-ftabstop=} option to determine if the statements line up
4756 (defaulting to 8).
4757
4758 The warning is not issued for code involving multiline preprocessor logic
4759 such as the following example.
4760
4761 @smallexample
4762 if (flagA)
4763 foo (0);
4764 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
4765 if (flagB)
4766 #endif
4767 foo (1);
4768 @end smallexample
4769
4770 The warning is not issued after a @code{#line} directive, since this
4771 typically indicates autogenerated code, and no assumptions can be made
4772 about the layout of the file that the directive references.
4773
4774 This warning is enabled by @option{-Wall} in C and C++.
4775
4776 @item -Wmissing-attributes
4777 @opindex Wmissing-attributes
4778 @opindex Wno-missing-attributes
4779 Warn when a declaration of a function is missing one or more attributes
4780 that a related function is declared with and whose absence may adversely
4781 affect the correctness or efficiency of generated code. For example, in
4782 C++, the warning is issued when an explicit specialization of a primary
4783 template declared with attribute @code{alloc_align}, @code{alloc_size},
4784 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
4785 or @code{nonnull} is declared without it. Attributes @code{deprecated},
4786 @code{error}, and @code{warning} suppress the warning.
4787 (@pxref{Function Attributes}).
4788
4789 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
4790
4791 For example, since the declaration of the primary function template
4792 below makes use of both attribute @code{malloc} and @code{alloc_size}
4793 the declaration of the explicit specialization of the template is
4794 diagnosed because it is missing one of the attributes.
4795
4796 @smallexample
4797 template <class T>
4798 T* __attribute__ ((malloc, alloc_size (1)))
4799 allocate (size_t);
4800
4801 template <>
4802 void* __attribute__ ((malloc)) // missing alloc_size
4803 allocate<void> (size_t);
4804 @end smallexample
4805
4806 @item -Wmissing-braces
4807 @opindex Wmissing-braces
4808 @opindex Wno-missing-braces
4809 Warn if an aggregate or union initializer is not fully bracketed. In
4810 the following example, the initializer for @code{a} is not fully
4811 bracketed, but that for @code{b} is fully bracketed. This warning is
4812 enabled by @option{-Wall} in C.
4813
4814 @smallexample
4815 int a[2][2] = @{ 0, 1, 2, 3 @};
4816 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
4817 @end smallexample
4818
4819 This warning is enabled by @option{-Wall}.
4820
4821 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
4822 @opindex Wmissing-include-dirs
4823 @opindex Wno-missing-include-dirs
4824 Warn if a user-supplied include directory does not exist.
4825
4826 @item -Wmultistatement-macros
4827 @opindex Wmultistatement-macros
4828 @opindex Wno-multistatement-macros
4829 Warn about unsafe multiple statement macros that appear to be guarded
4830 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
4831 @code{while}, in which only the first statement is actually guarded after
4832 the macro is expanded.
4833
4834 For example:
4835
4836 @smallexample
4837 #define DOIT x++; y++
4838 if (c)
4839 DOIT;
4840 @end smallexample
4841
4842 will increment @code{y} unconditionally, not just when @code{c} holds.
4843 The can usually be fixed by wrapping the macro in a do-while loop:
4844 @smallexample
4845 #define DOIT do @{ x++; y++; @} while (0)
4846 if (c)
4847 DOIT;
4848 @end smallexample
4849
4850 This warning is enabled by @option{-Wall} in C and C++.
4851
4852 @item -Wparentheses
4853 @opindex Wparentheses
4854 @opindex Wno-parentheses
4855 Warn if parentheses are omitted in certain contexts, such
4856 as when there is an assignment in a context where a truth value
4857 is expected, or when operators are nested whose precedence people
4858 often get confused about.
4859
4860 Also warn if a comparison like @code{x<=y<=z} appears; this is
4861 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
4862 interpretation from that of ordinary mathematical notation.
4863
4864 Also warn for dangerous uses of the GNU extension to
4865 @code{?:} with omitted middle operand. When the condition
4866 in the @code{?}: operator is a boolean expression, the omitted value is
4867 always 1. Often programmers expect it to be a value computed
4868 inside the conditional expression instead.
4869
4870 For C++ this also warns for some cases of unnecessary parentheses in
4871 declarations, which can indicate an attempt at a function call instead
4872 of a declaration:
4873 @smallexample
4874 @{
4875 // Declares a local variable called mymutex.
4876 std::unique_lock<std::mutex> (mymutex);
4877 // User meant std::unique_lock<std::mutex> lock (mymutex);
4878 @}
4879 @end smallexample
4880
4881 This warning is enabled by @option{-Wall}.
4882
4883 @item -Wsequence-point
4884 @opindex Wsequence-point
4885 @opindex Wno-sequence-point
4886 Warn about code that may have undefined semantics because of violations
4887 of sequence point rules in the C and C++ standards.
4888
4889 The C and C++ standards define the order in which expressions in a C/C++
4890 program are evaluated in terms of @dfn{sequence points}, which represent
4891 a partial ordering between the execution of parts of the program: those
4892 executed before the sequence point, and those executed after it. These
4893 occur after the evaluation of a full expression (one which is not part
4894 of a larger expression), after the evaluation of the first operand of a
4895 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
4896 function is called (but after the evaluation of its arguments and the
4897 expression denoting the called function), and in certain other places.
4898 Other than as expressed by the sequence point rules, the order of
4899 evaluation of subexpressions of an expression is not specified. All
4900 these rules describe only a partial order rather than a total order,
4901 since, for example, if two functions are called within one expression
4902 with no sequence point between them, the order in which the functions
4903 are called is not specified. However, the standards committee have
4904 ruled that function calls do not overlap.
4905
4906 It is not specified when between sequence points modifications to the
4907 values of objects take effect. Programs whose behavior depends on this
4908 have undefined behavior; the C and C++ standards specify that ``Between
4909 the previous and next sequence point an object shall have its stored
4910 value modified at most once by the evaluation of an expression.
4911 Furthermore, the prior value shall be read only to determine the value
4912 to be stored.''. If a program breaks these rules, the results on any
4913 particular implementation are entirely unpredictable.
4914
4915 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
4916 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
4917 diagnosed by this option, and it may give an occasional false positive
4918 result, but in general it has been found fairly effective at detecting
4919 this sort of problem in programs.
4920
4921 The C++17 standard will define the order of evaluation of operands in
4922 more cases: in particular it requires that the right-hand side of an
4923 assignment be evaluated before the left-hand side, so the above
4924 examples are no longer undefined. But this warning will still warn
4925 about them, to help people avoid writing code that is undefined in C
4926 and earlier revisions of C++.
4927
4928 The standard is worded confusingly, therefore there is some debate
4929 over the precise meaning of the sequence point rules in subtle cases.
4930 Links to discussions of the problem, including proposed formal
4931 definitions, may be found on the GCC readings page, at
4932 @uref{http://gcc.gnu.org/@/readings.html}.
4933
4934 This warning is enabled by @option{-Wall} for C and C++.
4935
4936 @item -Wno-return-local-addr
4937 @opindex Wno-return-local-addr
4938 @opindex Wreturn-local-addr
4939 Do not warn about returning a pointer (or in C++, a reference) to a
4940 variable that goes out of scope after the function returns.
4941
4942 @item -Wreturn-type
4943 @opindex Wreturn-type
4944 @opindex Wno-return-type
4945 Warn whenever a function is defined with a return type that defaults
4946 to @code{int}. Also warn about any @code{return} statement with no
4947 return value in a function whose return type is not @code{void}
4948 (falling off the end of the function body is considered returning
4949 without a value).
4950
4951 For C only, warn about a @code{return} statement with an expression in a
4952 function whose return type is @code{void}, unless the expression type is
4953 also @code{void}. As a GNU extension, the latter case is accepted
4954 without a warning unless @option{-Wpedantic} is used.
4955
4956 For C++, a function without return type always produces a diagnostic
4957 message, even when @option{-Wno-return-type} is specified. The only
4958 exceptions are @code{main} and functions defined in system headers.
4959
4960 This warning is enabled by default for C++ and is enabled by @option{-Wall}.
4961
4962 @item -Wshift-count-negative
4963 @opindex Wshift-count-negative
4964 @opindex Wno-shift-count-negative
4965 Warn if shift count is negative. This warning is enabled by default.
4966
4967 @item -Wshift-count-overflow
4968 @opindex Wshift-count-overflow
4969 @opindex Wno-shift-count-overflow
4970 Warn if shift count >= width of type. This warning is enabled by default.
4971
4972 @item -Wshift-negative-value
4973 @opindex Wshift-negative-value
4974 @opindex Wno-shift-negative-value
4975 Warn if left shifting a negative value. This warning is enabled by
4976 @option{-Wextra} in C99 and C++11 modes (and newer).
4977
4978 @item -Wshift-overflow
4979 @itemx -Wshift-overflow=@var{n}
4980 @opindex Wshift-overflow
4981 @opindex Wno-shift-overflow
4982 Warn about left shift overflows. This warning is enabled by
4983 default in C99 and C++11 modes (and newer).
4984
4985 @table @gcctabopt
4986 @item -Wshift-overflow=1
4987 This is the warning level of @option{-Wshift-overflow} and is enabled
4988 by default in C99 and C++11 modes (and newer). This warning level does
4989 not warn about left-shifting 1 into the sign bit. (However, in C, such
4990 an overflow is still rejected in contexts where an integer constant expression
4991 is required.)
4992
4993 @item -Wshift-overflow=2
4994 This warning level also warns about left-shifting 1 into the sign bit,
4995 unless C++14 mode is active.
4996 @end table
4997
4998 @item -Wswitch
4999 @opindex Wswitch
5000 @opindex Wno-switch
5001 Warn whenever a @code{switch} statement has an index of enumerated type
5002 and lacks a @code{case} for one or more of the named codes of that
5003 enumeration. (The presence of a @code{default} label prevents this
5004 warning.) @code{case} labels outside the enumeration range also
5005 provoke warnings when this option is used (even if there is a
5006 @code{default} label).
5007 This warning is enabled by @option{-Wall}.
5008
5009 @item -Wswitch-default
5010 @opindex Wswitch-default
5011 @opindex Wno-switch-default
5012 Warn whenever a @code{switch} statement does not have a @code{default}
5013 case.
5014
5015 @item -Wswitch-enum
5016 @opindex Wswitch-enum
5017 @opindex Wno-switch-enum
5018 Warn whenever a @code{switch} statement has an index of enumerated type
5019 and lacks a @code{case} for one or more of the named codes of that
5020 enumeration. @code{case} labels outside the enumeration range also
5021 provoke warnings when this option is used. The only difference
5022 between @option{-Wswitch} and this option is that this option gives a
5023 warning about an omitted enumeration code even if there is a
5024 @code{default} label.
5025
5026 @item -Wswitch-bool
5027 @opindex Wswitch-bool
5028 @opindex Wno-switch-bool
5029 Warn whenever a @code{switch} statement has an index of boolean type
5030 and the case values are outside the range of a boolean type.
5031 It is possible to suppress this warning by casting the controlling
5032 expression to a type other than @code{bool}. For example:
5033 @smallexample
5034 @group
5035 switch ((int) (a == 4))
5036 @{
5037 @dots{}
5038 @}
5039 @end group
5040 @end smallexample
5041 This warning is enabled by default for C and C++ programs.
5042
5043 @item -Wswitch-unreachable
5044 @opindex Wswitch-unreachable
5045 @opindex Wno-switch-unreachable
5046 Warn whenever a @code{switch} statement contains statements between the
5047 controlling expression and the first case label, which will never be
5048 executed. For example:
5049 @smallexample
5050 @group
5051 switch (cond)
5052 @{
5053 i = 15;
5054 @dots{}
5055 case 5:
5056 @dots{}
5057 @}
5058 @end group
5059 @end smallexample
5060 @option{-Wswitch-unreachable} does not warn if the statement between the
5061 controlling expression and the first case label is just a declaration:
5062 @smallexample
5063 @group
5064 switch (cond)
5065 @{
5066 int i;
5067 @dots{}
5068 case 5:
5069 i = 5;
5070 @dots{}
5071 @}
5072 @end group
5073 @end smallexample
5074 This warning is enabled by default for C and C++ programs.
5075
5076 @item -Wsync-nand @r{(C and C++ only)}
5077 @opindex Wsync-nand
5078 @opindex Wno-sync-nand
5079 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5080 built-in functions are used. These functions changed semantics in GCC 4.4.
5081
5082 @item -Wunused-but-set-parameter
5083 @opindex Wunused-but-set-parameter
5084 @opindex Wno-unused-but-set-parameter
5085 Warn whenever a function parameter is assigned to, but otherwise unused
5086 (aside from its declaration).
5087
5088 To suppress this warning use the @code{unused} attribute
5089 (@pxref{Variable Attributes}).
5090
5091 This warning is also enabled by @option{-Wunused} together with
5092 @option{-Wextra}.
5093
5094 @item -Wunused-but-set-variable
5095 @opindex Wunused-but-set-variable
5096 @opindex Wno-unused-but-set-variable
5097 Warn whenever a local variable is assigned to, but otherwise unused
5098 (aside from its declaration).
5099 This warning is enabled by @option{-Wall}.
5100
5101 To suppress this warning use the @code{unused} attribute
5102 (@pxref{Variable Attributes}).
5103
5104 This warning is also enabled by @option{-Wunused}, which is enabled
5105 by @option{-Wall}.
5106
5107 @item -Wunused-function
5108 @opindex Wunused-function
5109 @opindex Wno-unused-function
5110 Warn whenever a static function is declared but not defined or a
5111 non-inline static function is unused.
5112 This warning is enabled by @option{-Wall}.
5113
5114 @item -Wunused-label
5115 @opindex Wunused-label
5116 @opindex Wno-unused-label
5117 Warn whenever a label is declared but not used.
5118 This warning is enabled by @option{-Wall}.
5119
5120 To suppress this warning use the @code{unused} attribute
5121 (@pxref{Variable Attributes}).
5122
5123 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5124 @opindex Wunused-local-typedefs
5125 @opindex Wno-unused-local-typedefs
5126 Warn when a typedef locally defined in a function is not used.
5127 This warning is enabled by @option{-Wall}.
5128
5129 @item -Wunused-parameter
5130 @opindex Wunused-parameter
5131 @opindex Wno-unused-parameter
5132 Warn whenever a function parameter is unused aside from its declaration.
5133
5134 To suppress this warning use the @code{unused} attribute
5135 (@pxref{Variable Attributes}).
5136
5137 @item -Wno-unused-result
5138 @opindex Wunused-result
5139 @opindex Wno-unused-result
5140 Do not warn if a caller of a function marked with attribute
5141 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5142 its return value. The default is @option{-Wunused-result}.
5143
5144 @item -Wunused-variable
5145 @opindex Wunused-variable
5146 @opindex Wno-unused-variable
5147 Warn whenever a local or static variable is unused aside from its
5148 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5149 but not for C++. This warning is enabled by @option{-Wall}.
5150
5151 To suppress this warning use the @code{unused} attribute
5152 (@pxref{Variable Attributes}).
5153
5154 @item -Wunused-const-variable
5155 @itemx -Wunused-const-variable=@var{n}
5156 @opindex Wunused-const-variable
5157 @opindex Wno-unused-const-variable
5158 Warn whenever a constant static variable is unused aside from its declaration.
5159 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5160 for C, but not for C++. In C this declares variable storage, but in C++ this
5161 is not an error since const variables take the place of @code{#define}s.
5162
5163 To suppress this warning use the @code{unused} attribute
5164 (@pxref{Variable Attributes}).
5165
5166 @table @gcctabopt
5167 @item -Wunused-const-variable=1
5168 This is the warning level that is enabled by @option{-Wunused-variable} for
5169 C. It warns only about unused static const variables defined in the main
5170 compilation unit, but not about static const variables declared in any
5171 header included.
5172
5173 @item -Wunused-const-variable=2
5174 This warning level also warns for unused constant static variables in
5175 headers (excluding system headers). This is the warning level of
5176 @option{-Wunused-const-variable} and must be explicitly requested since
5177 in C++ this isn't an error and in C it might be harder to clean up all
5178 headers included.
5179 @end table
5180
5181 @item -Wunused-value
5182 @opindex Wunused-value
5183 @opindex Wno-unused-value
5184 Warn whenever a statement computes a result that is explicitly not
5185 used. To suppress this warning cast the unused expression to
5186 @code{void}. This includes an expression-statement or the left-hand
5187 side of a comma expression that contains no side effects. For example,
5188 an expression such as @code{x[i,j]} causes a warning, while
5189 @code{x[(void)i,j]} does not.
5190
5191 This warning is enabled by @option{-Wall}.
5192
5193 @item -Wunused
5194 @opindex Wunused
5195 @opindex Wno-unused
5196 All the above @option{-Wunused} options combined.
5197
5198 In order to get a warning about an unused function parameter, you must
5199 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5200 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5201
5202 @item -Wuninitialized
5203 @opindex Wuninitialized
5204 @opindex Wno-uninitialized
5205 Warn if an automatic variable is used without first being initialized
5206 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5207 warn if a non-static reference or non-static @code{const} member
5208 appears in a class without constructors.
5209
5210 If you want to warn about code that uses the uninitialized value of the
5211 variable in its own initializer, use the @option{-Winit-self} option.
5212
5213 These warnings occur for individual uninitialized or clobbered
5214 elements of structure, union or array variables as well as for
5215 variables that are uninitialized or clobbered as a whole. They do
5216 not occur for variables or elements declared @code{volatile}. Because
5217 these warnings depend on optimization, the exact variables or elements
5218 for which there are warnings depends on the precise optimization
5219 options and version of GCC used.
5220
5221 Note that there may be no warning about a variable that is used only
5222 to compute a value that itself is never used, because such
5223 computations may be deleted by data flow analysis before the warnings
5224 are printed.
5225
5226 @item -Winvalid-memory-model
5227 @opindex Winvalid-memory-model
5228 @opindex Wno-invalid-memory-model
5229 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5230 and the C11 atomic generic functions with a memory consistency argument
5231 that is either invalid for the operation or outside the range of values
5232 of the @code{memory_order} enumeration. For example, since the
5233 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5234 defined for the relaxed, release, and sequentially consistent memory
5235 orders the following code is diagnosed:
5236
5237 @smallexample
5238 void store (int *i)
5239 @{
5240 __atomic_store_n (i, 0, memory_order_consume);
5241 @}
5242 @end smallexample
5243
5244 @option{-Winvalid-memory-model} is enabled by default.
5245
5246 @item -Wmaybe-uninitialized
5247 @opindex Wmaybe-uninitialized
5248 @opindex Wno-maybe-uninitialized
5249 For an automatic (i.e.@ local) variable, if there exists a path from the
5250 function entry to a use of the variable that is initialized, but there exist
5251 some other paths for which the variable is not initialized, the compiler
5252 emits a warning if it cannot prove the uninitialized paths are not
5253 executed at run time.
5254
5255 These warnings are only possible in optimizing compilation, because otherwise
5256 GCC does not keep track of the state of variables.
5257
5258 These warnings are made optional because GCC may not be able to determine when
5259 the code is correct in spite of appearing to have an error. Here is one
5260 example of how this can happen:
5261
5262 @smallexample
5263 @group
5264 @{
5265 int x;
5266 switch (y)
5267 @{
5268 case 1: x = 1;
5269 break;
5270 case 2: x = 4;
5271 break;
5272 case 3: x = 5;
5273 @}
5274 foo (x);
5275 @}
5276 @end group
5277 @end smallexample
5278
5279 @noindent
5280 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5281 always initialized, but GCC doesn't know this. To suppress the
5282 warning, you need to provide a default case with assert(0) or
5283 similar code.
5284
5285 @cindex @code{longjmp} warnings
5286 This option also warns when a non-volatile automatic variable might be
5287 changed by a call to @code{longjmp}.
5288 The compiler sees only the calls to @code{setjmp}. It cannot know
5289 where @code{longjmp} will be called; in fact, a signal handler could
5290 call it at any point in the code. As a result, you may get a warning
5291 even when there is in fact no problem because @code{longjmp} cannot
5292 in fact be called at the place that would cause a problem.
5293
5294 Some spurious warnings can be avoided if you declare all the functions
5295 you use that never return as @code{noreturn}. @xref{Function
5296 Attributes}.
5297
5298 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5299
5300 @item -Wunknown-pragmas
5301 @opindex Wunknown-pragmas
5302 @opindex Wno-unknown-pragmas
5303 @cindex warning for unknown pragmas
5304 @cindex unknown pragmas, warning
5305 @cindex pragmas, warning of unknown
5306 Warn when a @code{#pragma} directive is encountered that is not understood by
5307 GCC@. If this command-line option is used, warnings are even issued
5308 for unknown pragmas in system header files. This is not the case if
5309 the warnings are only enabled by the @option{-Wall} command-line option.
5310
5311 @item -Wno-pragmas
5312 @opindex Wno-pragmas
5313 @opindex Wpragmas
5314 Do not warn about misuses of pragmas, such as incorrect parameters,
5315 invalid syntax, or conflicts between pragmas. See also
5316 @option{-Wunknown-pragmas}.
5317
5318 @item -Wstrict-aliasing
5319 @opindex Wstrict-aliasing
5320 @opindex Wno-strict-aliasing
5321 This option is only active when @option{-fstrict-aliasing} is active.
5322 It warns about code that might break the strict aliasing rules that the
5323 compiler is using for optimization. The warning does not catch all
5324 cases, but does attempt to catch the more common pitfalls. It is
5325 included in @option{-Wall}.
5326 It is equivalent to @option{-Wstrict-aliasing=3}
5327
5328 @item -Wstrict-aliasing=n
5329 @opindex Wstrict-aliasing=n
5330 This option is only active when @option{-fstrict-aliasing} is active.
5331 It warns about code that might break the strict aliasing rules that the
5332 compiler is using for optimization.
5333 Higher levels correspond to higher accuracy (fewer false positives).
5334 Higher levels also correspond to more effort, similar to the way @option{-O}
5335 works.
5336 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5337
5338 Level 1: Most aggressive, quick, least accurate.
5339 Possibly useful when higher levels
5340 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5341 false negatives. However, it has many false positives.
5342 Warns for all pointer conversions between possibly incompatible types,
5343 even if never dereferenced. Runs in the front end only.
5344
5345 Level 2: Aggressive, quick, not too precise.
5346 May still have many false positives (not as many as level 1 though),
5347 and few false negatives (but possibly more than level 1).
5348 Unlike level 1, it only warns when an address is taken. Warns about
5349 incomplete types. Runs in the front end only.
5350
5351 Level 3 (default for @option{-Wstrict-aliasing}):
5352 Should have very few false positives and few false
5353 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5354 Takes care of the common pun+dereference pattern in the front end:
5355 @code{*(int*)&some_float}.
5356 If optimization is enabled, it also runs in the back end, where it deals
5357 with multiple statement cases using flow-sensitive points-to information.
5358 Only warns when the converted pointer is dereferenced.
5359 Does not warn about incomplete types.
5360
5361 @item -Wstrict-overflow
5362 @itemx -Wstrict-overflow=@var{n}
5363 @opindex Wstrict-overflow
5364 @opindex Wno-strict-overflow
5365 This option is only active when signed overflow is undefined.
5366 It warns about cases where the compiler optimizes based on the
5367 assumption that signed overflow does not occur. Note that it does not
5368 warn about all cases where the code might overflow: it only warns
5369 about cases where the compiler implements some optimization. Thus
5370 this warning depends on the optimization level.
5371
5372 An optimization that assumes that signed overflow does not occur is
5373 perfectly safe if the values of the variables involved are such that
5374 overflow never does, in fact, occur. Therefore this warning can
5375 easily give a false positive: a warning about code that is not
5376 actually a problem. To help focus on important issues, several
5377 warning levels are defined. No warnings are issued for the use of
5378 undefined signed overflow when estimating how many iterations a loop
5379 requires, in particular when determining whether a loop will be
5380 executed at all.
5381
5382 @table @gcctabopt
5383 @item -Wstrict-overflow=1
5384 Warn about cases that are both questionable and easy to avoid. For
5385 example the compiler simplifies
5386 @code{x + 1 > x} to @code{1}. This level of
5387 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5388 are not, and must be explicitly requested.
5389
5390 @item -Wstrict-overflow=2
5391 Also warn about other cases where a comparison is simplified to a
5392 constant. For example: @code{abs (x) >= 0}. This can only be
5393 simplified when signed integer overflow is undefined, because
5394 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5395 zero. @option{-Wstrict-overflow} (with no level) is the same as
5396 @option{-Wstrict-overflow=2}.
5397
5398 @item -Wstrict-overflow=3
5399 Also warn about other cases where a comparison is simplified. For
5400 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5401
5402 @item -Wstrict-overflow=4
5403 Also warn about other simplifications not covered by the above cases.
5404 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5405
5406 @item -Wstrict-overflow=5
5407 Also warn about cases where the compiler reduces the magnitude of a
5408 constant involved in a comparison. For example: @code{x + 2 > y} is
5409 simplified to @code{x + 1 >= y}. This is reported only at the
5410 highest warning level because this simplification applies to many
5411 comparisons, so this warning level gives a very large number of
5412 false positives.
5413 @end table
5414
5415 @item -Wstringop-overflow
5416 @itemx -Wstringop-overflow=@var{type}
5417 @opindex Wstringop-overflow
5418 @opindex Wno-stringop-overflow
5419 Warn for calls to string manipulation functions such as @code{memcpy} and
5420 @code{strcpy} that are determined to overflow the destination buffer. The
5421 optional argument is one greater than the type of Object Size Checking to
5422 perform to determine the size of the destination. @xref{Object Size Checking}.
5423 The argument is meaningful only for functions that operate on character arrays
5424 but not for raw memory functions like @code{memcpy} which always make use
5425 of Object Size type-0. The option also warns for calls that specify a size
5426 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5427 The option produces the best results with optimization enabled but can detect
5428 a small subset of simple buffer overflows even without optimization in
5429 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5430 correspond to the standard functions. In any case, the option warns about
5431 just a subset of buffer overflows detected by the corresponding overflow
5432 checking built-ins. For example, the option will issue a warning for
5433 the @code{strcpy} call below because it copies at least 5 characters
5434 (the string @code{"blue"} including the terminating NUL) into the buffer
5435 of size 4.
5436
5437 @smallexample
5438 enum Color @{ blue, purple, yellow @};
5439 const char* f (enum Color clr)
5440 @{
5441 static char buf [4];
5442 const char *str;
5443 switch (clr)
5444 @{
5445 case blue: str = "blue"; break;
5446 case purple: str = "purple"; break;
5447 case yellow: str = "yellow"; break;
5448 @}
5449
5450 return strcpy (buf, str); // warning here
5451 @}
5452 @end smallexample
5453
5454 Option @option{-Wstringop-overflow=2} is enabled by default.
5455
5456 @table @gcctabopt
5457 @item -Wstringop-overflow
5458 @itemx -Wstringop-overflow=1
5459 @opindex Wstringop-overflow
5460 @opindex Wno-stringop-overflow
5461 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5462 to determine the sizes of destination objects. This is the default setting
5463 of the option. At this setting the option will not warn for writes past
5464 the end of subobjects of larger objects accessed by pointers unless the
5465 size of the largest surrounding object is known. When the destination may
5466 be one of several objects it is assumed to be the largest one of them. On
5467 Linux systems, when optimization is enabled at this setting the option warns
5468 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5469 a non-zero value.
5470
5471 @item -Wstringop-overflow=2
5472 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5473 to determine the sizes of destination objects. At this setting the option
5474 will warn about overflows when writing to members of the largest complete
5475 objects whose exact size is known. It will, however, not warn for excessive
5476 writes to the same members of unknown objects referenced by pointers since
5477 they may point to arrays containing unknown numbers of elements.
5478
5479 @item -Wstringop-overflow=3
5480 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5481 to determine the sizes of destination objects. At this setting the option
5482 warns about overflowing the smallest object or data member. This is the
5483 most restrictive setting of the option that may result in warnings for safe
5484 code.
5485
5486 @item -Wstringop-overflow=4
5487 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5488 to determine the sizes of destination objects. At this setting the option
5489 will warn about overflowing any data members, and when the destination is
5490 one of several objects it uses the size of the largest of them to decide
5491 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5492 setting of the option may result in warnings for benign code.
5493 @end table
5494
5495 @item -Wstringop-truncation
5496 @opindex Wstringop-truncation
5497 @opindex Wno-stringop-truncation
5498 Warn for calls to bounded string manipulation functions such as @code{strncat},
5499 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5500 or leave the destination unchanged.
5501
5502 In the following example, the call to @code{strncat} specifies a bound that
5503 is less than the length of the source string. As a result, the copy of
5504 the source will be truncated and so the call is diagnosed. To avoid the
5505 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5506
5507 @smallexample
5508 void append (char *buf, size_t bufsize)
5509 @{
5510 strncat (buf, ".txt", 3);
5511 @}
5512 @end smallexample
5513
5514 As another example, the following call to @code{strncpy} results in copying
5515 to @code{d} just the characters preceding the terminating NUL, without
5516 appending the NUL to the end. Assuming the result of @code{strncpy} is
5517 necessarily a NUL-terminated string is a common mistake, and so the call
5518 is diagnosed. To avoid the warning when the result is not expected to be
5519 NUL-terminated, call @code{memcpy} instead.
5520
5521 @smallexample
5522 void copy (char *d, const char *s)
5523 @{
5524 strncpy (d, s, strlen (s));
5525 @}
5526 @end smallexample
5527
5528 In the following example, the call to @code{strncpy} specifies the size
5529 of the destination buffer as the bound. If the length of the source
5530 string is equal to or greater than this size the result of the copy will
5531 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5532 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5533 element of the buffer to @code{NUL}.
5534
5535 @smallexample
5536 void copy (const char *s)
5537 @{
5538 char buf[80];
5539 strncpy (buf, s, sizeof buf);
5540 @dots{}
5541 @}
5542 @end smallexample
5543
5544 In situations where a character array is intended to store a sequence
5545 of bytes with no terminating @code{NUL} such an array may be annotated
5546 with attribute @code{nonstring} to avoid this warning. Such arrays,
5547 however, are not suitable arguments to functions that expect
5548 @code{NUL}-terminated strings. To help detect accidental misuses of
5549 such arrays GCC issues warnings unless it can prove that the use is
5550 safe. @xref{Common Variable Attributes}.
5551
5552 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5553 @opindex Wsuggest-attribute=
5554 @opindex Wno-suggest-attribute=
5555 Warn for cases where adding an attribute may be beneficial. The
5556 attributes currently supported are listed below.
5557
5558 @table @gcctabopt
5559 @item -Wsuggest-attribute=pure
5560 @itemx -Wsuggest-attribute=const
5561 @itemx -Wsuggest-attribute=noreturn
5562 @itemx -Wsuggest-attribute=malloc
5563 @opindex Wsuggest-attribute=pure
5564 @opindex Wno-suggest-attribute=pure
5565 @opindex Wsuggest-attribute=const
5566 @opindex Wno-suggest-attribute=const
5567 @opindex Wsuggest-attribute=noreturn
5568 @opindex Wno-suggest-attribute=noreturn
5569 @opindex Wsuggest-attribute=malloc
5570 @opindex Wno-suggest-attribute=malloc
5571
5572 Warn about functions that might be candidates for attributes
5573 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5574 only warns for functions visible in other compilation units or (in the case of
5575 @code{pure} and @code{const}) if it cannot prove that the function returns
5576 normally. A function returns normally if it doesn't contain an infinite loop or
5577 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5578 requires option @option{-fipa-pure-const}, which is enabled by default at
5579 @option{-O} and higher. Higher optimization levels improve the accuracy
5580 of the analysis.
5581
5582 @item -Wsuggest-attribute=format
5583 @itemx -Wmissing-format-attribute
5584 @opindex Wsuggest-attribute=format
5585 @opindex Wmissing-format-attribute
5586 @opindex Wno-suggest-attribute=format
5587 @opindex Wno-missing-format-attribute
5588 @opindex Wformat
5589 @opindex Wno-format
5590
5591 Warn about function pointers that might be candidates for @code{format}
5592 attributes. Note these are only possible candidates, not absolute ones.
5593 GCC guesses that function pointers with @code{format} attributes that
5594 are used in assignment, initialization, parameter passing or return
5595 statements should have a corresponding @code{format} attribute in the
5596 resulting type. I.e.@: the left-hand side of the assignment or
5597 initialization, the type of the parameter variable, or the return type
5598 of the containing function respectively should also have a @code{format}
5599 attribute to avoid the warning.
5600
5601 GCC also warns about function definitions that might be
5602 candidates for @code{format} attributes. Again, these are only
5603 possible candidates. GCC guesses that @code{format} attributes
5604 might be appropriate for any function that calls a function like
5605 @code{vprintf} or @code{vscanf}, but this might not always be the
5606 case, and some functions for which @code{format} attributes are
5607 appropriate may not be detected.
5608
5609 @item -Wsuggest-attribute=cold
5610 @opindex Wsuggest-attribute=cold
5611 @opindex Wno-suggest-attribute=cold
5612
5613 Warn about functions that might be candidates for @code{cold} attribute. This
5614 is based on static detection and generally will only warn about functions which
5615 always leads to a call to another @code{cold} function such as wrappers of
5616 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
5617 @end table
5618
5619 @item -Wsuggest-final-types
5620 @opindex Wno-suggest-final-types
5621 @opindex Wsuggest-final-types
5622 Warn about types with virtual methods where code quality would be improved
5623 if the type were declared with the C++11 @code{final} specifier,
5624 or, if possible,
5625 declared in an anonymous namespace. This allows GCC to more aggressively
5626 devirtualize the polymorphic calls. This warning is more effective with link
5627 time optimization, where the information about the class hierarchy graph is
5628 more complete.
5629
5630 @item -Wsuggest-final-methods
5631 @opindex Wno-suggest-final-methods
5632 @opindex Wsuggest-final-methods
5633 Warn about virtual methods where code quality would be improved if the method
5634 were declared with the C++11 @code{final} specifier,
5635 or, if possible, its type were
5636 declared in an anonymous namespace or with the @code{final} specifier.
5637 This warning is
5638 more effective with link-time optimization, where the information about the
5639 class hierarchy graph is more complete. It is recommended to first consider
5640 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
5641 annotations.
5642
5643 @item -Wsuggest-override
5644 Warn about overriding virtual functions that are not marked with the override
5645 keyword.
5646
5647 @item -Walloc-zero
5648 @opindex Wno-alloc-zero
5649 @opindex Walloc-zero
5650 Warn about calls to allocation functions decorated with attribute
5651 @code{alloc_size} that specify zero bytes, including those to the built-in
5652 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
5653 @code{malloc}, and @code{realloc}. Because the behavior of these functions
5654 when called with a zero size differs among implementations (and in the case
5655 of @code{realloc} has been deprecated) relying on it may result in subtle
5656 portability bugs and should be avoided.
5657
5658 @item -Walloc-size-larger-than=@var{byte-size}
5659 @opindex Walloc-size-larger-than=
5660 @opindex Wno-alloc-size-larger-than
5661 Warn about calls to functions decorated with attribute @code{alloc_size}
5662 that attempt to allocate objects larger than the specified number of bytes,
5663 or where the result of the size computation in an integer type with infinite
5664 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
5665 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
5666 Warnings controlled by the option can be disabled either by specifying
5667 @var{byte-size} of @samp{SIZE_MAX} or more or by
5668 @option{-Wno-alloc-size-larger-than}.
5669 @xref{Function Attributes}.
5670
5671 @item -Wno-alloc-size-larger-than
5672 @opindex Wno-alloc-size-larger-than
5673 Disable @option{-Walloc-size-larger-than=} warnings. The option is
5674 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
5675 larger.
5676
5677 @item -Walloca
5678 @opindex Wno-alloca
5679 @opindex Walloca
5680 This option warns on all uses of @code{alloca} in the source.
5681
5682 @item -Walloca-larger-than=@var{byte-size}
5683 @opindex -Walloca-larger-than=
5684 @opindex -Wno-alloca-larger-than
5685 This option warns on calls to @code{alloca} with an integer argument whose
5686 value is either zero, or that is not bounded by a controlling predicate
5687 that limits its value to at most @var{byte-size}. It also warns for calls
5688 to @code{alloca} where the bound value is unknown. Arguments of non-integer
5689 types are considered unbounded even if they appear to be constrained to
5690 the expected range.
5691
5692 For example, a bounded case of @code{alloca} could be:
5693
5694 @smallexample
5695 void func (size_t n)
5696 @{
5697 void *p;
5698 if (n <= 1000)
5699 p = alloca (n);
5700 else
5701 p = malloc (n);
5702 f (p);
5703 @}
5704 @end smallexample
5705
5706 In the above example, passing @code{-Walloca-larger-than=1000} would not
5707 issue a warning because the call to @code{alloca} is known to be at most
5708 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
5709 the compiler would emit a warning.
5710
5711 Unbounded uses, on the other hand, are uses of @code{alloca} with no
5712 controlling predicate constraining its integer argument. For example:
5713
5714 @smallexample
5715 void func ()
5716 @{
5717 void *p = alloca (n);
5718 f (p);
5719 @}
5720 @end smallexample
5721
5722 If @code{-Walloca-larger-than=500} were passed, the above would trigger
5723 a warning, but this time because of the lack of bounds checking.
5724
5725 Note, that even seemingly correct code involving signed integers could
5726 cause a warning:
5727
5728 @smallexample
5729 void func (signed int n)
5730 @{
5731 if (n < 500)
5732 @{
5733 p = alloca (n);
5734 f (p);
5735 @}
5736 @}
5737 @end smallexample
5738
5739 In the above example, @var{n} could be negative, causing a larger than
5740 expected argument to be implicitly cast into the @code{alloca} call.
5741
5742 This option also warns when @code{alloca} is used in a loop.
5743
5744 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
5745 but is usually only effective when @option{-ftree-vrp} is active (default
5746 for @option{-O2} and above).
5747
5748 See also @option{-Wvla-larger-than=}@samp{byte-size}.
5749
5750 @item -Wno-alloca-larger-than
5751 @opindex Wno-alloca-larger-than
5752 Disable @option{-Walloca-larger-than=} warnings. The option is
5753 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
5754
5755 @item -Warray-bounds
5756 @itemx -Warray-bounds=@var{n}
5757 @opindex Wno-array-bounds
5758 @opindex Warray-bounds
5759 This option is only active when @option{-ftree-vrp} is active
5760 (default for @option{-O2} and above). It warns about subscripts to arrays
5761 that are always out of bounds. This warning is enabled by @option{-Wall}.
5762
5763 @table @gcctabopt
5764 @item -Warray-bounds=1
5765 This is the warning level of @option{-Warray-bounds} and is enabled
5766 by @option{-Wall}; higher levels are not, and must be explicitly requested.
5767
5768 @item -Warray-bounds=2
5769 This warning level also warns about out of bounds access for
5770 arrays at the end of a struct and for arrays accessed through
5771 pointers. This warning level may give a larger number of
5772 false positives and is deactivated by default.
5773 @end table
5774
5775 @item -Wattribute-alias
5776 Warn about declarations using the @code{alias} and similar attributes whose
5777 target is incompatible with the type of the alias. @xref{Function Attributes,
5778 ,Declaring Attributes of Functions}.
5779
5780 @item -Wbool-compare
5781 @opindex Wno-bool-compare
5782 @opindex Wbool-compare
5783 Warn about boolean expression compared with an integer value different from
5784 @code{true}/@code{false}. For instance, the following comparison is
5785 always false:
5786 @smallexample
5787 int n = 5;
5788 @dots{}
5789 if ((n > 1) == 2) @{ @dots{} @}
5790 @end smallexample
5791 This warning is enabled by @option{-Wall}.
5792
5793 @item -Wbool-operation
5794 @opindex Wno-bool-operation
5795 @opindex Wbool-operation
5796 Warn about suspicious operations on expressions of a boolean type. For
5797 instance, bitwise negation of a boolean is very likely a bug in the program.
5798 For C, this warning also warns about incrementing or decrementing a boolean,
5799 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
5800 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
5801
5802 This warning is enabled by @option{-Wall}.
5803
5804 @item -Wduplicated-branches
5805 @opindex Wno-duplicated-branches
5806 @opindex Wduplicated-branches
5807 Warn when an if-else has identical branches. This warning detects cases like
5808 @smallexample
5809 if (p != NULL)
5810 return 0;
5811 else
5812 return 0;
5813 @end smallexample
5814 It doesn't warn when both branches contain just a null statement. This warning
5815 also warn for conditional operators:
5816 @smallexample
5817 int i = x ? *p : *p;
5818 @end smallexample
5819
5820 @item -Wduplicated-cond
5821 @opindex Wno-duplicated-cond
5822 @opindex Wduplicated-cond
5823 Warn about duplicated conditions in an if-else-if chain. For instance,
5824 warn for the following code:
5825 @smallexample
5826 if (p->q != NULL) @{ @dots{} @}
5827 else if (p->q != NULL) @{ @dots{} @}
5828 @end smallexample
5829
5830 @item -Wframe-address
5831 @opindex Wno-frame-address
5832 @opindex Wframe-address
5833 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
5834 is called with an argument greater than 0. Such calls may return indeterminate
5835 values or crash the program. The warning is included in @option{-Wall}.
5836
5837 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
5838 @opindex Wno-discarded-qualifiers
5839 @opindex Wdiscarded-qualifiers
5840 Do not warn if type qualifiers on pointers are being discarded.
5841 Typically, the compiler warns if a @code{const char *} variable is
5842 passed to a function that takes a @code{char *} parameter. This option
5843 can be used to suppress such a warning.
5844
5845 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
5846 @opindex Wno-discarded-array-qualifiers
5847 @opindex Wdiscarded-array-qualifiers
5848 Do not warn if type qualifiers on arrays which are pointer targets
5849 are being discarded. Typically, the compiler warns if a
5850 @code{const int (*)[]} variable is passed to a function that
5851 takes a @code{int (*)[]} parameter. This option can be used to
5852 suppress such a warning.
5853
5854 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
5855 @opindex Wno-incompatible-pointer-types
5856 @opindex Wincompatible-pointer-types
5857 Do not warn when there is a conversion between pointers that have incompatible
5858 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
5859 which warns for pointer argument passing or assignment with different
5860 signedness.
5861
5862 @item -Wno-int-conversion @r{(C and Objective-C only)}
5863 @opindex Wno-int-conversion
5864 @opindex Wint-conversion
5865 Do not warn about incompatible integer to pointer and pointer to integer
5866 conversions. This warning is about implicit conversions; for explicit
5867 conversions the warnings @option{-Wno-int-to-pointer-cast} and
5868 @option{-Wno-pointer-to-int-cast} may be used.
5869
5870 @item -Wno-div-by-zero
5871 @opindex Wno-div-by-zero
5872 @opindex Wdiv-by-zero
5873 Do not warn about compile-time integer division by zero. Floating-point
5874 division by zero is not warned about, as it can be a legitimate way of
5875 obtaining infinities and NaNs.
5876
5877 @item -Wsystem-headers
5878 @opindex Wsystem-headers
5879 @opindex Wno-system-headers
5880 @cindex warnings from system headers
5881 @cindex system headers, warnings from
5882 Print warning messages for constructs found in system header files.
5883 Warnings from system headers are normally suppressed, on the assumption
5884 that they usually do not indicate real problems and would only make the
5885 compiler output harder to read. Using this command-line option tells
5886 GCC to emit warnings from system headers as if they occurred in user
5887 code. However, note that using @option{-Wall} in conjunction with this
5888 option does @emph{not} warn about unknown pragmas in system
5889 headers---for that, @option{-Wunknown-pragmas} must also be used.
5890
5891 @item -Wtautological-compare
5892 @opindex Wtautological-compare
5893 @opindex Wno-tautological-compare
5894 Warn if a self-comparison always evaluates to true or false. This
5895 warning detects various mistakes such as:
5896 @smallexample
5897 int i = 1;
5898 @dots{}
5899 if (i > i) @{ @dots{} @}
5900 @end smallexample
5901
5902 This warning also warns about bitwise comparisons that always evaluate
5903 to true or false, for instance:
5904 @smallexample
5905 if ((a & 16) == 10) @{ @dots{} @}
5906 @end smallexample
5907 will always be false.
5908
5909 This warning is enabled by @option{-Wall}.
5910
5911 @item -Wtrampolines
5912 @opindex Wtrampolines
5913 @opindex Wno-trampolines
5914 Warn about trampolines generated for pointers to nested functions.
5915 A trampoline is a small piece of data or code that is created at run
5916 time on the stack when the address of a nested function is taken, and is
5917 used to call the nested function indirectly. For some targets, it is
5918 made up of data only and thus requires no special treatment. But, for
5919 most targets, it is made up of code and thus requires the stack to be
5920 made executable in order for the program to work properly.
5921
5922 @item -Wfloat-equal
5923 @opindex Wfloat-equal
5924 @opindex Wno-float-equal
5925 Warn if floating-point values are used in equality comparisons.
5926
5927 The idea behind this is that sometimes it is convenient (for the
5928 programmer) to consider floating-point values as approximations to
5929 infinitely precise real numbers. If you are doing this, then you need
5930 to compute (by analyzing the code, or in some other way) the maximum or
5931 likely maximum error that the computation introduces, and allow for it
5932 when performing comparisons (and when producing output, but that's a
5933 different problem). In particular, instead of testing for equality, you
5934 should check to see whether the two values have ranges that overlap; and
5935 this is done with the relational operators, so equality comparisons are
5936 probably mistaken.
5937
5938 @item -Wtraditional @r{(C and Objective-C only)}
5939 @opindex Wtraditional
5940 @opindex Wno-traditional
5941 Warn about certain constructs that behave differently in traditional and
5942 ISO C@. Also warn about ISO C constructs that have no traditional C
5943 equivalent, and/or problematic constructs that should be avoided.
5944
5945 @itemize @bullet
5946 @item
5947 Macro parameters that appear within string literals in the macro body.
5948 In traditional C macro replacement takes place within string literals,
5949 but in ISO C it does not.
5950
5951 @item
5952 In traditional C, some preprocessor directives did not exist.
5953 Traditional preprocessors only considered a line to be a directive
5954 if the @samp{#} appeared in column 1 on the line. Therefore
5955 @option{-Wtraditional} warns about directives that traditional C
5956 understands but ignores because the @samp{#} does not appear as the
5957 first character on the line. It also suggests you hide directives like
5958 @code{#pragma} not understood by traditional C by indenting them. Some
5959 traditional implementations do not recognize @code{#elif}, so this option
5960 suggests avoiding it altogether.
5961
5962 @item
5963 A function-like macro that appears without arguments.
5964
5965 @item
5966 The unary plus operator.
5967
5968 @item
5969 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
5970 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
5971 constants.) Note, these suffixes appear in macros defined in the system
5972 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
5973 Use of these macros in user code might normally lead to spurious
5974 warnings, however GCC's integrated preprocessor has enough context to
5975 avoid warning in these cases.
5976
5977 @item
5978 A function declared external in one block and then used after the end of
5979 the block.
5980
5981 @item
5982 A @code{switch} statement has an operand of type @code{long}.
5983
5984 @item
5985 A non-@code{static} function declaration follows a @code{static} one.
5986 This construct is not accepted by some traditional C compilers.
5987
5988 @item
5989 The ISO type of an integer constant has a different width or
5990 signedness from its traditional type. This warning is only issued if
5991 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
5992 typically represent bit patterns, are not warned about.
5993
5994 @item
5995 Usage of ISO string concatenation is detected.
5996
5997 @item
5998 Initialization of automatic aggregates.
5999
6000 @item
6001 Identifier conflicts with labels. Traditional C lacks a separate
6002 namespace for labels.
6003
6004 @item
6005 Initialization of unions. If the initializer is zero, the warning is
6006 omitted. This is done under the assumption that the zero initializer in
6007 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6008 initializer warnings and relies on default initialization to zero in the
6009 traditional C case.
6010
6011 @item
6012 Conversions by prototypes between fixed/floating-point values and vice
6013 versa. The absence of these prototypes when compiling with traditional
6014 C causes serious problems. This is a subset of the possible
6015 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6016
6017 @item
6018 Use of ISO C style function definitions. This warning intentionally is
6019 @emph{not} issued for prototype declarations or variadic functions
6020 because these ISO C features appear in your code when using
6021 libiberty's traditional C compatibility macros, @code{PARAMS} and
6022 @code{VPARAMS}. This warning is also bypassed for nested functions
6023 because that feature is already a GCC extension and thus not relevant to
6024 traditional C compatibility.
6025 @end itemize
6026
6027 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6028 @opindex Wtraditional-conversion
6029 @opindex Wno-traditional-conversion
6030 Warn if a prototype causes a type conversion that is different from what
6031 would happen to the same argument in the absence of a prototype. This
6032 includes conversions of fixed point to floating and vice versa, and
6033 conversions changing the width or signedness of a fixed-point argument
6034 except when the same as the default promotion.
6035
6036 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6037 @opindex Wdeclaration-after-statement
6038 @opindex Wno-declaration-after-statement
6039 Warn when a declaration is found after a statement in a block. This
6040 construct, known from C++, was introduced with ISO C99 and is by default
6041 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6042
6043 @item -Wshadow
6044 @opindex Wshadow
6045 @opindex Wno-shadow
6046 Warn whenever a local variable or type declaration shadows another
6047 variable, parameter, type, class member (in C++), or instance variable
6048 (in Objective-C) or whenever a built-in function is shadowed. Note
6049 that in C++, the compiler warns if a local variable shadows an
6050 explicit typedef, but not if it shadows a struct/class/enum.
6051 Same as @option{-Wshadow=global}.
6052
6053 @item -Wno-shadow-ivar @r{(Objective-C only)}
6054 @opindex Wno-shadow-ivar
6055 @opindex Wshadow-ivar
6056 Do not warn whenever a local variable shadows an instance variable in an
6057 Objective-C method.
6058
6059 @item -Wshadow=global
6060 @opindex Wshadow=local
6061 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6062
6063 @item -Wshadow=local
6064 @opindex Wshadow=local
6065 Warn when a local variable shadows another local variable or parameter.
6066 This warning is enabled by @option{-Wshadow=global}.
6067
6068 @item -Wshadow=compatible-local
6069 @opindex Wshadow=compatible-local
6070 Warn when a local variable shadows another local variable or parameter
6071 whose type is compatible with that of the shadowing variable. In C++,
6072 type compatibility here means the type of the shadowing variable can be
6073 converted to that of the shadowed variable. The creation of this flag
6074 (in addition to @option{-Wshadow=local}) is based on the idea that when
6075 a local variable shadows another one of incompatible type, it is most
6076 likely intentional, not a bug or typo, as shown in the following example:
6077
6078 @smallexample
6079 @group
6080 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6081 @{
6082 for (int i = 0; i < N; ++i)
6083 @{
6084 ...
6085 @}
6086 ...
6087 @}
6088 @end group
6089 @end smallexample
6090
6091 Since the two variable @code{i} in the example above have incompatible types,
6092 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6093 Because their types are incompatible, if a programmer accidentally uses one
6094 in place of the other, type checking will catch that and emit an error or
6095 warning. So not warning (about shadowing) in this case will not lead to
6096 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6097 possibly reduce the number of warnings triggered by intentional shadowing.
6098
6099 This warning is enabled by @option{-Wshadow=local}.
6100
6101 @item -Wlarger-than=@var{byte-size}
6102 @opindex Wlarger-than=
6103 @opindex Wlarger-than-@var{byte-size}
6104 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6105 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6106 Warnings controlled by the option can be disabled either by specifying
6107 @var{byte-size} of @samp{SIZE_MAX} or more or by
6108 @option{-Wno-larger-than}.
6109
6110 @item -Wno-larger-than
6111 @opindex Wno-larger-than
6112 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6113 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6114
6115 @item -Wframe-larger-than=@var{byte-size}
6116 @opindex Wframe-larger-than=
6117 @opindex Wno-frame-larger-than
6118 Warn if the size of a function frame exceeds @var{byte-size}.
6119 The computation done to determine the stack frame size is approximate
6120 and not conservative.
6121 The actual requirements may be somewhat greater than @var{byte-size}
6122 even if you do not get a warning. In addition, any space allocated
6123 via @code{alloca}, variable-length arrays, or related constructs
6124 is not included by the compiler when determining
6125 whether or not to issue a warning.
6126 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6127 Warnings controlled by the option can be disabled either by specifying
6128 @var{byte-size} of @samp{SIZE_MAX} or more or by
6129 @option{-Wno-frame-larger-than}.
6130
6131 @item -Wno-frame-larger-than
6132 @opindex Wno-frame-larger-than
6133 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6134 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6135
6136 @item -Wno-free-nonheap-object
6137 @opindex Wno-free-nonheap-object
6138 @opindex Wfree-nonheap-object
6139 Do not warn when attempting to free an object that was not allocated
6140 on the heap.
6141
6142 @item -Wstack-usage=@var{byte-size}
6143 @opindex Wstack-usage
6144 @opindex Wno-stack-usage
6145 Warn if the stack usage of a function might exceed @var{byte-size}.
6146 The computation done to determine the stack usage is conservative.
6147 Any space allocated via @code{alloca}, variable-length arrays, or related
6148 constructs is included by the compiler when determining whether or not to
6149 issue a warning.
6150
6151 The message is in keeping with the output of @option{-fstack-usage}.
6152
6153 @itemize
6154 @item
6155 If the stack usage is fully static but exceeds the specified amount, it's:
6156
6157 @smallexample
6158 warning: stack usage is 1120 bytes
6159 @end smallexample
6160 @item
6161 If the stack usage is (partly) dynamic but bounded, it's:
6162
6163 @smallexample
6164 warning: stack usage might be 1648 bytes
6165 @end smallexample
6166 @item
6167 If the stack usage is (partly) dynamic and not bounded, it's:
6168
6169 @smallexample
6170 warning: stack usage might be unbounded
6171 @end smallexample
6172 @end itemize
6173
6174 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6175 Warnings controlled by the option can be disabled either by specifying
6176 @var{byte-size} of @samp{SIZE_MAX} or more or by
6177 @option{-Wno-stack-usage}.
6178
6179 @item -Wno-stack-usage
6180 @opindex Wno-stack-usage
6181 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6182 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6183
6184 @item -Wunsafe-loop-optimizations
6185 @opindex Wunsafe-loop-optimizations
6186 @opindex Wno-unsafe-loop-optimizations
6187 Warn if the loop cannot be optimized because the compiler cannot
6188 assume anything on the bounds of the loop indices. With
6189 @option{-funsafe-loop-optimizations} warn if the compiler makes
6190 such assumptions.
6191
6192 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6193 @opindex Wno-pedantic-ms-format
6194 @opindex Wpedantic-ms-format
6195 When used in combination with @option{-Wformat}
6196 and @option{-pedantic} without GNU extensions, this option
6197 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6198 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6199 which depend on the MS runtime.
6200
6201 @item -Waligned-new
6202 @opindex Waligned-new
6203 @opindex Wno-aligned-new
6204 Warn about a new-expression of a type that requires greater alignment
6205 than the @code{alignof(std::max_align_t)} but uses an allocation
6206 function without an explicit alignment parameter. This option is
6207 enabled by @option{-Wall}.
6208
6209 Normally this only warns about global allocation functions, but
6210 @option{-Waligned-new=all} also warns about class member allocation
6211 functions.
6212
6213 @item -Wplacement-new
6214 @itemx -Wplacement-new=@var{n}
6215 @opindex Wplacement-new
6216 @opindex Wno-placement-new
6217 Warn about placement new expressions with undefined behavior, such as
6218 constructing an object in a buffer that is smaller than the type of
6219 the object. For example, the placement new expression below is diagnosed
6220 because it attempts to construct an array of 64 integers in a buffer only
6221 64 bytes large.
6222 @smallexample
6223 char buf [64];
6224 new (buf) int[64];
6225 @end smallexample
6226 This warning is enabled by default.
6227
6228 @table @gcctabopt
6229 @item -Wplacement-new=1
6230 This is the default warning level of @option{-Wplacement-new}. At this
6231 level the warning is not issued for some strictly undefined constructs that
6232 GCC allows as extensions for compatibility with legacy code. For example,
6233 the following @code{new} expression is not diagnosed at this level even
6234 though it has undefined behavior according to the C++ standard because
6235 it writes past the end of the one-element array.
6236 @smallexample
6237 struct S @{ int n, a[1]; @};
6238 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6239 new (s->a)int [32]();
6240 @end smallexample
6241
6242 @item -Wplacement-new=2
6243 At this level, in addition to diagnosing all the same constructs as at level
6244 1, a diagnostic is also issued for placement new expressions that construct
6245 an object in the last member of structure whose type is an array of a single
6246 element and whose size is less than the size of the object being constructed.
6247 While the previous example would be diagnosed, the following construct makes
6248 use of the flexible member array extension to avoid the warning at level 2.
6249 @smallexample
6250 struct S @{ int n, a[]; @};
6251 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6252 new (s->a)int [32]();
6253 @end smallexample
6254
6255 @end table
6256
6257 @item -Wpointer-arith
6258 @opindex Wpointer-arith
6259 @opindex Wno-pointer-arith
6260 Warn about anything that depends on the ``size of'' a function type or
6261 of @code{void}. GNU C assigns these types a size of 1, for
6262 convenience in calculations with @code{void *} pointers and pointers
6263 to functions. In C++, warn also when an arithmetic operation involves
6264 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6265
6266 @item -Wpointer-compare
6267 @opindex Wpointer-compare
6268 @opindex Wno-pointer-compare
6269 Warn if a pointer is compared with a zero character constant. This usually
6270 means that the pointer was meant to be dereferenced. For example:
6271
6272 @smallexample
6273 const char *p = foo ();
6274 if (p == '\0')
6275 return 42;
6276 @end smallexample
6277
6278 Note that the code above is invalid in C++11.
6279
6280 This warning is enabled by default.
6281
6282 @item -Wtype-limits
6283 @opindex Wtype-limits
6284 @opindex Wno-type-limits
6285 Warn if a comparison is always true or always false due to the limited
6286 range of the data type, but do not warn for constant expressions. For
6287 example, warn if an unsigned variable is compared against zero with
6288 @code{<} or @code{>=}. This warning is also enabled by
6289 @option{-Wextra}.
6290
6291 @item -Wabsolute-value @r{(C and Objective-C only)}
6292 @opindex Wabsolute-value
6293 @opindex Wno-absolute-value
6294 Warn when a wrong absolute value function seems to be used or when it
6295 does not have any effect because its argument is an unsigned type.
6296 This warning be suppressed with an explicit type cast and it is also
6297 enabled by @option{-Wextra}.
6298
6299 @include cppwarnopts.texi
6300
6301 @item -Wbad-function-cast @r{(C and Objective-C only)}
6302 @opindex Wbad-function-cast
6303 @opindex Wno-bad-function-cast
6304 Warn when a function call is cast to a non-matching type.
6305 For example, warn if a call to a function returning an integer type
6306 is cast to a pointer type.
6307
6308 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6309 @opindex Wc90-c99-compat
6310 @opindex Wno-c90-c99-compat
6311 Warn about features not present in ISO C90, but present in ISO C99.
6312 For instance, warn about use of variable length arrays, @code{long long}
6313 type, @code{bool} type, compound literals, designated initializers, and so
6314 on. This option is independent of the standards mode. Warnings are disabled
6315 in the expression that follows @code{__extension__}.
6316
6317 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6318 @opindex Wc99-c11-compat
6319 @opindex Wno-c99-c11-compat
6320 Warn about features not present in ISO C99, but present in ISO C11.
6321 For instance, warn about use of anonymous structures and unions,
6322 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6323 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6324 and so on. This option is independent of the standards mode. Warnings are
6325 disabled in the expression that follows @code{__extension__}.
6326
6327 @item -Wc++-compat @r{(C and Objective-C only)}
6328 @opindex Wc++-compat
6329 @opindex Wno-c++-compat
6330 Warn about ISO C constructs that are outside of the common subset of
6331 ISO C and ISO C++, e.g.@: request for implicit conversion from
6332 @code{void *} to a pointer to non-@code{void} type.
6333
6334 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6335 @opindex Wc++11-compat
6336 @opindex Wno-c++11-compat
6337 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6338 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6339 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6340 enabled by @option{-Wall}.
6341
6342 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6343 @opindex Wc++14-compat
6344 @opindex Wno-c++14-compat
6345 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6346 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6347
6348 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6349 @opindex Wc++17-compat
6350 @opindex Wno-c++17-compat
6351 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6352 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6353
6354 @item -Wcast-qual
6355 @opindex Wcast-qual
6356 @opindex Wno-cast-qual
6357 Warn whenever a pointer is cast so as to remove a type qualifier from
6358 the target type. For example, warn if a @code{const char *} is cast
6359 to an ordinary @code{char *}.
6360
6361 Also warn when making a cast that introduces a type qualifier in an
6362 unsafe way. For example, casting @code{char **} to @code{const char **}
6363 is unsafe, as in this example:
6364
6365 @smallexample
6366 /* p is char ** value. */
6367 const char **q = (const char **) p;
6368 /* Assignment of readonly string to const char * is OK. */
6369 *q = "string";
6370 /* Now char** pointer points to read-only memory. */
6371 **p = 'b';
6372 @end smallexample
6373
6374 @item -Wcast-align
6375 @opindex Wcast-align
6376 @opindex Wno-cast-align
6377 Warn whenever a pointer is cast such that the required alignment of the
6378 target is increased. For example, warn if a @code{char *} is cast to
6379 an @code{int *} on machines where integers can only be accessed at
6380 two- or four-byte boundaries.
6381
6382 @item -Wcast-align=strict
6383 @opindex Wcast-align=strict
6384 Warn whenever a pointer is cast such that the required alignment of the
6385 target is increased. For example, warn if a @code{char *} is cast to
6386 an @code{int *} regardless of the target machine.
6387
6388 @item -Wcast-function-type
6389 @opindex Wcast-function-type
6390 @opindex Wno-cast-function-type
6391 Warn when a function pointer is cast to an incompatible function pointer.
6392 In a cast involving function types with a variable argument list only
6393 the types of initial arguments that are provided are considered.
6394 Any parameter of pointer-type matches any other pointer-type. Any benign
6395 differences in integral types are ignored, like @code{int} vs. @code{long}
6396 on ILP32 targets. Likewise type qualifiers are ignored. The function
6397 type @code{void (*) (void)} is special and matches everything, which can
6398 be used to suppress this warning.
6399 In a cast involving pointer to member types this warning warns whenever
6400 the type cast is changing the pointer to member type.
6401 This warning is enabled by @option{-Wextra}.
6402
6403 @item -Wwrite-strings
6404 @opindex Wwrite-strings
6405 @opindex Wno-write-strings
6406 When compiling C, give string constants the type @code{const
6407 char[@var{length}]} so that copying the address of one into a
6408 non-@code{const} @code{char *} pointer produces a warning. These
6409 warnings help you find at compile time code that can try to write
6410 into a string constant, but only if you have been very careful about
6411 using @code{const} in declarations and prototypes. Otherwise, it is
6412 just a nuisance. This is why we did not make @option{-Wall} request
6413 these warnings.
6414
6415 When compiling C++, warn about the deprecated conversion from string
6416 literals to @code{char *}. This warning is enabled by default for C++
6417 programs.
6418
6419 @item -Wcatch-value
6420 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6421 @opindex Wcatch-value
6422 @opindex Wno-catch-value
6423 Warn about catch handlers that do not catch via reference.
6424 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6425 warn about polymorphic class types that are caught by value.
6426 With @option{-Wcatch-value=2} warn about all class types that are caught
6427 by value. With @option{-Wcatch-value=3} warn about all types that are
6428 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6429
6430 @item -Wclobbered
6431 @opindex Wclobbered
6432 @opindex Wno-clobbered
6433 Warn for variables that might be changed by @code{longjmp} or
6434 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6435
6436 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6437 @opindex Wconditionally-supported
6438 @opindex Wno-conditionally-supported
6439 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6440
6441 @item -Wconversion
6442 @opindex Wconversion
6443 @opindex Wno-conversion
6444 Warn for implicit conversions that may alter a value. This includes
6445 conversions between real and integer, like @code{abs (x)} when
6446 @code{x} is @code{double}; conversions between signed and unsigned,
6447 like @code{unsigned ui = -1}; and conversions to smaller types, like
6448 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6449 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6450 changed by the conversion like in @code{abs (2.0)}. Warnings about
6451 conversions between signed and unsigned integers can be disabled by
6452 using @option{-Wno-sign-conversion}.
6453
6454 For C++, also warn for confusing overload resolution for user-defined
6455 conversions; and conversions that never use a type conversion
6456 operator: conversions to @code{void}, the same type, a base class or a
6457 reference to them. Warnings about conversions between signed and
6458 unsigned integers are disabled by default in C++ unless
6459 @option{-Wsign-conversion} is explicitly enabled.
6460
6461 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6462 @opindex Wconversion-null
6463 @opindex Wno-conversion-null
6464 Do not warn for conversions between @code{NULL} and non-pointer
6465 types. @option{-Wconversion-null} is enabled by default.
6466
6467 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6468 @opindex Wzero-as-null-pointer-constant
6469 @opindex Wno-zero-as-null-pointer-constant
6470 Warn when a literal @samp{0} is used as null pointer constant. This can
6471 be useful to facilitate the conversion to @code{nullptr} in C++11.
6472
6473 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6474 @opindex Wsubobject-linkage
6475 @opindex Wno-subobject-linkage
6476 Warn if a class type has a base or a field whose type uses the anonymous
6477 namespace or depends on a type with no linkage. If a type A depends on
6478 a type B with no or internal linkage, defining it in multiple
6479 translation units would be an ODR violation because the meaning of B
6480 is different in each translation unit. If A only appears in a single
6481 translation unit, the best way to silence the warning is to give it
6482 internal linkage by putting it in an anonymous namespace as well. The
6483 compiler doesn't give this warning for types defined in the main .C
6484 file, as those are unlikely to have multiple definitions.
6485 @option{-Wsubobject-linkage} is enabled by default.
6486
6487 @item -Wdangling-else
6488 @opindex Wdangling-else
6489 @opindex Wno-dangling-else
6490 Warn about constructions where there may be confusion to which
6491 @code{if} statement an @code{else} branch belongs. Here is an example of
6492 such a case:
6493
6494 @smallexample
6495 @group
6496 @{
6497 if (a)
6498 if (b)
6499 foo ();
6500 else
6501 bar ();
6502 @}
6503 @end group
6504 @end smallexample
6505
6506 In C/C++, every @code{else} branch belongs to the innermost possible
6507 @code{if} statement, which in this example is @code{if (b)}. This is
6508 often not what the programmer expected, as illustrated in the above
6509 example by indentation the programmer chose. When there is the
6510 potential for this confusion, GCC issues a warning when this flag
6511 is specified. To eliminate the warning, add explicit braces around
6512 the innermost @code{if} statement so there is no way the @code{else}
6513 can belong to the enclosing @code{if}. The resulting code
6514 looks like this:
6515
6516 @smallexample
6517 @group
6518 @{
6519 if (a)
6520 @{
6521 if (b)
6522 foo ();
6523 else
6524 bar ();
6525 @}
6526 @}
6527 @end group
6528 @end smallexample
6529
6530 This warning is enabled by @option{-Wparentheses}.
6531
6532 @item -Wdate-time
6533 @opindex Wdate-time
6534 @opindex Wno-date-time
6535 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6536 are encountered as they might prevent bit-wise-identical reproducible
6537 compilations.
6538
6539 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6540 @opindex Wdelete-incomplete
6541 @opindex Wno-delete-incomplete
6542 Warn when deleting a pointer to incomplete type, which may cause
6543 undefined behavior at runtime. This warning is enabled by default.
6544
6545 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6546 @opindex Wuseless-cast
6547 @opindex Wno-useless-cast
6548 Warn when an expression is casted to its own type.
6549
6550 @item -Wempty-body
6551 @opindex Wempty-body
6552 @opindex Wno-empty-body
6553 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6554 while} statement. This warning is also enabled by @option{-Wextra}.
6555
6556 @item -Wenum-compare
6557 @opindex Wenum-compare
6558 @opindex Wno-enum-compare
6559 Warn about a comparison between values of different enumerated types.
6560 In C++ enumerated type mismatches in conditional expressions are also
6561 diagnosed and the warning is enabled by default. In C this warning is
6562 enabled by @option{-Wall}.
6563
6564 @item -Wextra-semi @r{(C++, Objective-C++ only)}
6565 @opindex Wextra-semi
6566 @opindex Wno-extra-semi
6567 Warn about redundant semicolon after in-class function definition.
6568
6569 @item -Wjump-misses-init @r{(C, Objective-C only)}
6570 @opindex Wjump-misses-init
6571 @opindex Wno-jump-misses-init
6572 Warn if a @code{goto} statement or a @code{switch} statement jumps
6573 forward across the initialization of a variable, or jumps backward to a
6574 label after the variable has been initialized. This only warns about
6575 variables that are initialized when they are declared. This warning is
6576 only supported for C and Objective-C; in C++ this sort of branch is an
6577 error in any case.
6578
6579 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
6580 can be disabled with the @option{-Wno-jump-misses-init} option.
6581
6582 @item -Wsign-compare
6583 @opindex Wsign-compare
6584 @opindex Wno-sign-compare
6585 @cindex warning for comparison of signed and unsigned values
6586 @cindex comparison of signed and unsigned values, warning
6587 @cindex signed and unsigned values, comparison warning
6588 Warn when a comparison between signed and unsigned values could produce
6589 an incorrect result when the signed value is converted to unsigned.
6590 In C++, this warning is also enabled by @option{-Wall}. In C, it is
6591 also enabled by @option{-Wextra}.
6592
6593 @item -Wsign-conversion
6594 @opindex Wsign-conversion
6595 @opindex Wno-sign-conversion
6596 Warn for implicit conversions that may change the sign of an integer
6597 value, like assigning a signed integer expression to an unsigned
6598 integer variable. An explicit cast silences the warning. In C, this
6599 option is enabled also by @option{-Wconversion}.
6600
6601 @item -Wfloat-conversion
6602 @opindex Wfloat-conversion
6603 @opindex Wno-float-conversion
6604 Warn for implicit conversions that reduce the precision of a real value.
6605 This includes conversions from real to integer, and from higher precision
6606 real to lower precision real values. This option is also enabled by
6607 @option{-Wconversion}.
6608
6609 @item -Wno-scalar-storage-order
6610 @opindex -Wno-scalar-storage-order
6611 @opindex -Wscalar-storage-order
6612 Do not warn on suspicious constructs involving reverse scalar storage order.
6613
6614 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
6615 @opindex Wsized-deallocation
6616 @opindex Wno-sized-deallocation
6617 Warn about a definition of an unsized deallocation function
6618 @smallexample
6619 void operator delete (void *) noexcept;
6620 void operator delete[] (void *) noexcept;
6621 @end smallexample
6622 without a definition of the corresponding sized deallocation function
6623 @smallexample
6624 void operator delete (void *, std::size_t) noexcept;
6625 void operator delete[] (void *, std::size_t) noexcept;
6626 @end smallexample
6627 or vice versa. Enabled by @option{-Wextra} along with
6628 @option{-fsized-deallocation}.
6629
6630 @item -Wsizeof-pointer-div
6631 @opindex Wsizeof-pointer-div
6632 @opindex Wno-sizeof-pointer-div
6633 Warn for suspicious divisions of two sizeof expressions that divide
6634 the pointer size by the element size, which is the usual way to compute
6635 the array size but won't work out correctly with pointers. This warning
6636 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
6637 not an array, but a pointer. This warning is enabled by @option{-Wall}.
6638
6639 @item -Wsizeof-pointer-memaccess
6640 @opindex Wsizeof-pointer-memaccess
6641 @opindex Wno-sizeof-pointer-memaccess
6642 Warn for suspicious length parameters to certain string and memory built-in
6643 functions if the argument uses @code{sizeof}. This warning triggers for
6644 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
6645 an array, but a pointer, and suggests a possible fix, or about
6646 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
6647 also warns about calls to bounded string copy functions like @code{strncat}
6648 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
6649 the source array. For example, in the following function the call to
6650 @code{strncat} specifies the size of the source string as the bound. That
6651 is almost certainly a mistake and so the call is diagnosed.
6652 @smallexample
6653 void make_file (const char *name)
6654 @{
6655 char path[PATH_MAX];
6656 strncpy (path, name, sizeof path - 1);
6657 strncat (path, ".text", sizeof ".text");
6658 @dots{}
6659 @}
6660 @end smallexample
6661
6662 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
6663
6664 @item -Wsizeof-array-argument
6665 @opindex Wsizeof-array-argument
6666 @opindex Wno-sizeof-array-argument
6667 Warn when the @code{sizeof} operator is applied to a parameter that is
6668 declared as an array in a function definition. This warning is enabled by
6669 default for C and C++ programs.
6670
6671 @item -Wmemset-elt-size
6672 @opindex Wmemset-elt-size
6673 @opindex Wno-memset-elt-size
6674 Warn for suspicious calls to the @code{memset} built-in function, if the
6675 first argument references an array, and the third argument is a number
6676 equal to the number of elements, but not equal to the size of the array
6677 in memory. This indicates that the user has omitted a multiplication by
6678 the element size. This warning is enabled by @option{-Wall}.
6679
6680 @item -Wmemset-transposed-args
6681 @opindex Wmemset-transposed-args
6682 @opindex Wno-memset-transposed-args
6683 Warn for suspicious calls to the @code{memset} built-in function, if the
6684 second argument is not zero and the third argument is zero. This warns e.g.@
6685 about @code{memset (buf, sizeof buf, 0)} where most probably
6686 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostics
6687 is only emitted if the third argument is literal zero. If it is some
6688 expression that is folded to zero, a cast of zero to some type, etc.,
6689 it is far less likely that the user has mistakenly exchanged the arguments
6690 and no warning is emitted. This warning is enabled by @option{-Wall}.
6691
6692 @item -Waddress
6693 @opindex Waddress
6694 @opindex Wno-address
6695 Warn about suspicious uses of memory addresses. These include using
6696 the address of a function in a conditional expression, such as
6697 @code{void func(void); if (func)}, and comparisons against the memory
6698 address of a string literal, such as @code{if (x == "abc")}. Such
6699 uses typically indicate a programmer error: the address of a function
6700 always evaluates to true, so their use in a conditional usually
6701 indicate that the programmer forgot the parentheses in a function
6702 call; and comparisons against string literals result in unspecified
6703 behavior and are not portable in C, so they usually indicate that the
6704 programmer intended to use @code{strcmp}. This warning is enabled by
6705 @option{-Wall}.
6706
6707 @item -Wlogical-op
6708 @opindex Wlogical-op
6709 @opindex Wno-logical-op
6710 Warn about suspicious uses of logical operators in expressions.
6711 This includes using logical operators in contexts where a
6712 bit-wise operator is likely to be expected. Also warns when
6713 the operands of a logical operator are the same:
6714 @smallexample
6715 extern int a;
6716 if (a < 0 && a < 0) @{ @dots{} @}
6717 @end smallexample
6718
6719 @item -Wlogical-not-parentheses
6720 @opindex Wlogical-not-parentheses
6721 @opindex Wno-logical-not-parentheses
6722 Warn about logical not used on the left hand side operand of a comparison.
6723 This option does not warn if the right operand is considered to be a boolean
6724 expression. Its purpose is to detect suspicious code like the following:
6725 @smallexample
6726 int a;
6727 @dots{}
6728 if (!a > 1) @{ @dots{} @}
6729 @end smallexample
6730
6731 It is possible to suppress the warning by wrapping the LHS into
6732 parentheses:
6733 @smallexample
6734 if ((!a) > 1) @{ @dots{} @}
6735 @end smallexample
6736
6737 This warning is enabled by @option{-Wall}.
6738
6739 @item -Waggregate-return
6740 @opindex Waggregate-return
6741 @opindex Wno-aggregate-return
6742 Warn if any functions that return structures or unions are defined or
6743 called. (In languages where you can return an array, this also elicits
6744 a warning.)
6745
6746 @item -Wno-aggressive-loop-optimizations
6747 @opindex Wno-aggressive-loop-optimizations
6748 @opindex Waggressive-loop-optimizations
6749 Warn if in a loop with constant number of iterations the compiler detects
6750 undefined behavior in some statement during one or more of the iterations.
6751
6752 @item -Wno-attributes
6753 @opindex Wno-attributes
6754 @opindex Wattributes
6755 Do not warn if an unexpected @code{__attribute__} is used, such as
6756 unrecognized attributes, function attributes applied to variables,
6757 etc. This does not stop errors for incorrect use of supported
6758 attributes.
6759
6760 @item -Wno-builtin-declaration-mismatch
6761 @opindex Wno-builtin-declaration-mismatch
6762 @opindex Wbuiltin-declaration-mismatch
6763 Warn if a built-in function is declared with the wrong signature or
6764 as non-function.
6765 This warning is enabled by default.
6766
6767 @item -Wno-builtin-macro-redefined
6768 @opindex Wno-builtin-macro-redefined
6769 @opindex Wbuiltin-macro-redefined
6770 Do not warn if certain built-in macros are redefined. This suppresses
6771 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
6772 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
6773
6774 @item -Wstrict-prototypes @r{(C and Objective-C only)}
6775 @opindex Wstrict-prototypes
6776 @opindex Wno-strict-prototypes
6777 Warn if a function is declared or defined without specifying the
6778 argument types. (An old-style function definition is permitted without
6779 a warning if preceded by a declaration that specifies the argument
6780 types.)
6781
6782 @item -Wold-style-declaration @r{(C and Objective-C only)}
6783 @opindex Wold-style-declaration
6784 @opindex Wno-old-style-declaration
6785 Warn for obsolescent usages, according to the C Standard, in a
6786 declaration. For example, warn if storage-class specifiers like
6787 @code{static} are not the first things in a declaration. This warning
6788 is also enabled by @option{-Wextra}.
6789
6790 @item -Wold-style-definition @r{(C and Objective-C only)}
6791 @opindex Wold-style-definition
6792 @opindex Wno-old-style-definition
6793 Warn if an old-style function definition is used. A warning is given
6794 even if there is a previous prototype.
6795
6796 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
6797 @opindex Wmissing-parameter-type
6798 @opindex Wno-missing-parameter-type
6799 A function parameter is declared without a type specifier in K&R-style
6800 functions:
6801
6802 @smallexample
6803 void foo(bar) @{ @}
6804 @end smallexample
6805
6806 This warning is also enabled by @option{-Wextra}.
6807
6808 @item -Wmissing-prototypes @r{(C and Objective-C only)}
6809 @opindex Wmissing-prototypes
6810 @opindex Wno-missing-prototypes
6811 Warn if a global function is defined without a previous prototype
6812 declaration. This warning is issued even if the definition itself
6813 provides a prototype. Use this option to detect global functions
6814 that do not have a matching prototype declaration in a header file.
6815 This option is not valid for C++ because all function declarations
6816 provide prototypes and a non-matching declaration declares an
6817 overload rather than conflict with an earlier declaration.
6818 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
6819
6820 @item -Wmissing-declarations
6821 @opindex Wmissing-declarations
6822 @opindex Wno-missing-declarations
6823 Warn if a global function is defined without a previous declaration.
6824 Do so even if the definition itself provides a prototype.
6825 Use this option to detect global functions that are not declared in
6826 header files. In C, no warnings are issued for functions with previous
6827 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
6828 missing prototypes. In C++, no warnings are issued for function templates,
6829 or for inline functions, or for functions in anonymous namespaces.
6830
6831 @item -Wmissing-field-initializers
6832 @opindex Wmissing-field-initializers
6833 @opindex Wno-missing-field-initializers
6834 @opindex W
6835 @opindex Wextra
6836 @opindex Wno-extra
6837 Warn if a structure's initializer has some fields missing. For
6838 example, the following code causes such a warning, because
6839 @code{x.h} is implicitly zero:
6840
6841 @smallexample
6842 struct s @{ int f, g, h; @};
6843 struct s x = @{ 3, 4 @};
6844 @end smallexample
6845
6846 This option does not warn about designated initializers, so the following
6847 modification does not trigger a warning:
6848
6849 @smallexample
6850 struct s @{ int f, g, h; @};
6851 struct s x = @{ .f = 3, .g = 4 @};
6852 @end smallexample
6853
6854 In C this option does not warn about the universal zero initializer
6855 @samp{@{ 0 @}}:
6856
6857 @smallexample
6858 struct s @{ int f, g, h; @};
6859 struct s x = @{ 0 @};
6860 @end smallexample
6861
6862 Likewise, in C++ this option does not warn about the empty @{ @}
6863 initializer, for example:
6864
6865 @smallexample
6866 struct s @{ int f, g, h; @};
6867 s x = @{ @};
6868 @end smallexample
6869
6870 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
6871 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
6872
6873 @item -Wno-multichar
6874 @opindex Wno-multichar
6875 @opindex Wmultichar
6876 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
6877 Usually they indicate a typo in the user's code, as they have
6878 implementation-defined values, and should not be used in portable code.
6879
6880 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
6881 @opindex Wnormalized=
6882 @opindex Wnormalized
6883 @opindex Wno-normalized
6884 @cindex NFC
6885 @cindex NFKC
6886 @cindex character set, input normalization
6887 In ISO C and ISO C++, two identifiers are different if they are
6888 different sequences of characters. However, sometimes when characters
6889 outside the basic ASCII character set are used, you can have two
6890 different character sequences that look the same. To avoid confusion,
6891 the ISO 10646 standard sets out some @dfn{normalization rules} which
6892 when applied ensure that two sequences that look the same are turned into
6893 the same sequence. GCC can warn you if you are using identifiers that
6894 have not been normalized; this option controls that warning.
6895
6896 There are four levels of warning supported by GCC@. The default is
6897 @option{-Wnormalized=nfc}, which warns about any identifier that is
6898 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
6899 recommended form for most uses. It is equivalent to
6900 @option{-Wnormalized}.
6901
6902 Unfortunately, there are some characters allowed in identifiers by
6903 ISO C and ISO C++ that, when turned into NFC, are not allowed in
6904 identifiers. That is, there's no way to use these symbols in portable
6905 ISO C or C++ and have all your identifiers in NFC@.
6906 @option{-Wnormalized=id} suppresses the warning for these characters.
6907 It is hoped that future versions of the standards involved will correct
6908 this, which is why this option is not the default.
6909
6910 You can switch the warning off for all characters by writing
6911 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
6912 only do this if you are using some other normalization scheme (like
6913 ``D''), because otherwise you can easily create bugs that are
6914 literally impossible to see.
6915
6916 Some characters in ISO 10646 have distinct meanings but look identical
6917 in some fonts or display methodologies, especially once formatting has
6918 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
6919 LETTER N'', displays just like a regular @code{n} that has been
6920 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6921 normalization scheme to convert all these into a standard form as
6922 well, and GCC warns if your code is not in NFKC if you use
6923 @option{-Wnormalized=nfkc}. This warning is comparable to warning
6924 about every identifier that contains the letter O because it might be
6925 confused with the digit 0, and so is not the default, but may be
6926 useful as a local coding convention if the programming environment
6927 cannot be fixed to display these characters distinctly.
6928
6929 @item -Wno-deprecated
6930 @opindex Wno-deprecated
6931 @opindex Wdeprecated
6932 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
6933
6934 @item -Wno-deprecated-declarations
6935 @opindex Wno-deprecated-declarations
6936 @opindex Wdeprecated-declarations
6937 Do not warn about uses of functions (@pxref{Function Attributes}),
6938 variables (@pxref{Variable Attributes}), and types (@pxref{Type
6939 Attributes}) marked as deprecated by using the @code{deprecated}
6940 attribute.
6941
6942 @item -Wno-overflow
6943 @opindex Wno-overflow
6944 @opindex Woverflow
6945 Do not warn about compile-time overflow in constant expressions.
6946
6947 @item -Wno-odr
6948 @opindex Wno-odr
6949 @opindex Wodr
6950 Warn about One Definition Rule violations during link-time optimization.
6951 Requires @option{-flto-odr-type-merging} to be enabled. Enabled by default.
6952
6953 @item -Wopenmp-simd
6954 @opindex Wopenmp-simd
6955 @opindex Wno-openmp-simd
6956 Warn if the vectorizer cost model overrides the OpenMP
6957 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
6958 option can be used to relax the cost model.
6959
6960 @item -Woverride-init @r{(C and Objective-C only)}
6961 @opindex Woverride-init
6962 @opindex Wno-override-init
6963 @opindex W
6964 @opindex Wextra
6965 @opindex Wno-extra
6966 Warn if an initialized field without side effects is overridden when
6967 using designated initializers (@pxref{Designated Inits, , Designated
6968 Initializers}).
6969
6970 This warning is included in @option{-Wextra}. To get other
6971 @option{-Wextra} warnings without this one, use @option{-Wextra
6972 -Wno-override-init}.
6973
6974 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
6975 @opindex Woverride-init-side-effects
6976 @opindex Wno-override-init-side-effects
6977 Warn if an initialized field with side effects is overridden when
6978 using designated initializers (@pxref{Designated Inits, , Designated
6979 Initializers}). This warning is enabled by default.
6980
6981 @item -Wpacked
6982 @opindex Wpacked
6983 @opindex Wno-packed
6984 Warn if a structure is given the packed attribute, but the packed
6985 attribute has no effect on the layout or size of the structure.
6986 Such structures may be mis-aligned for little benefit. For
6987 instance, in this code, the variable @code{f.x} in @code{struct bar}
6988 is misaligned even though @code{struct bar} does not itself
6989 have the packed attribute:
6990
6991 @smallexample
6992 @group
6993 struct foo @{
6994 int x;
6995 char a, b, c, d;
6996 @} __attribute__((packed));
6997 struct bar @{
6998 char z;
6999 struct foo f;
7000 @};
7001 @end group
7002 @end smallexample
7003
7004 @item -Wpacked-bitfield-compat
7005 @opindex Wpacked-bitfield-compat
7006 @opindex Wno-packed-bitfield-compat
7007 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7008 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7009 the change can lead to differences in the structure layout. GCC
7010 informs you when the offset of such a field has changed in GCC 4.4.
7011 For example there is no longer a 4-bit padding between field @code{a}
7012 and @code{b} in this structure:
7013
7014 @smallexample
7015 struct foo
7016 @{
7017 char a:4;
7018 char b:8;
7019 @} __attribute__ ((packed));
7020 @end smallexample
7021
7022 This warning is enabled by default. Use
7023 @option{-Wno-packed-bitfield-compat} to disable this warning.
7024
7025 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7026 @opindex Wpacked-not-aligned
7027 @opindex Wno-packed-not-aligned
7028 Warn if a structure field with explicitly specified alignment in a
7029 packed struct or union is misaligned. For example, a warning will
7030 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7031 'struct S' is less than 8}, in this code:
7032
7033 @smallexample
7034 @group
7035 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7036 struct __attribute__ ((packed)) S @{
7037 struct S8 s8;
7038 @};
7039 @end group
7040 @end smallexample
7041
7042 This warning is enabled by @option{-Wall}.
7043
7044 @item -Wpadded
7045 @opindex Wpadded
7046 @opindex Wno-padded
7047 Warn if padding is included in a structure, either to align an element
7048 of the structure or to align the whole structure. Sometimes when this
7049 happens it is possible to rearrange the fields of the structure to
7050 reduce the padding and so make the structure smaller.
7051
7052 @item -Wredundant-decls
7053 @opindex Wredundant-decls
7054 @opindex Wno-redundant-decls
7055 Warn if anything is declared more than once in the same scope, even in
7056 cases where multiple declaration is valid and changes nothing.
7057
7058 @item -Wno-restrict
7059 @opindex Wrestrict
7060 @opindex Wno-restrict
7061 Warn when an object referenced by a @code{restrict}-qualified parameter
7062 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7063 argument, or when copies between such objects overlap. For example,
7064 the call to the @code{strcpy} function below attempts to truncate the string
7065 by replacing its initial characters with the last four. However, because
7066 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7067 the call is diagnosed.
7068
7069 @smallexample
7070 void foo (void)
7071 @{
7072 char a[] = "abcd1234";
7073 strcpy (a, a + 4);
7074 @dots{}
7075 @}
7076 @end smallexample
7077 The @option{-Wrestrict} option detects some instances of simple overlap
7078 even without optimization but works best at @option{-O2} and above. It
7079 is included in @option{-Wall}.
7080
7081 @item -Wnested-externs @r{(C and Objective-C only)}
7082 @opindex Wnested-externs
7083 @opindex Wno-nested-externs
7084 Warn if an @code{extern} declaration is encountered within a function.
7085
7086 @item -Wno-inherited-variadic-ctor
7087 @opindex Winherited-variadic-ctor
7088 @opindex Wno-inherited-variadic-ctor
7089 Suppress warnings about use of C++11 inheriting constructors when the
7090 base class inherited from has a C variadic constructor; the warning is
7091 on by default because the ellipsis is not inherited.
7092
7093 @item -Winline
7094 @opindex Winline
7095 @opindex Wno-inline
7096 Warn if a function that is declared as inline cannot be inlined.
7097 Even with this option, the compiler does not warn about failures to
7098 inline functions declared in system headers.
7099
7100 The compiler uses a variety of heuristics to determine whether or not
7101 to inline a function. For example, the compiler takes into account
7102 the size of the function being inlined and the amount of inlining
7103 that has already been done in the current function. Therefore,
7104 seemingly insignificant changes in the source program can cause the
7105 warnings produced by @option{-Winline} to appear or disappear.
7106
7107 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7108 @opindex Wno-invalid-offsetof
7109 @opindex Winvalid-offsetof
7110 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7111 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7112 to a non-standard-layout type is undefined. In existing C++ implementations,
7113 however, @code{offsetof} typically gives meaningful results.
7114 This flag is for users who are aware that they are
7115 writing nonportable code and who have deliberately chosen to ignore the
7116 warning about it.
7117
7118 The restrictions on @code{offsetof} may be relaxed in a future version
7119 of the C++ standard.
7120
7121 @item -Wint-in-bool-context
7122 @opindex Wint-in-bool-context
7123 @opindex Wno-int-in-bool-context
7124 Warn for suspicious use of integer values where boolean values are expected,
7125 such as conditional expressions (?:) using non-boolean integer constants in
7126 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7127 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7128 for all kinds of multiplications regardless of the data type.
7129 This warning is enabled by @option{-Wall}.
7130
7131 @item -Wno-int-to-pointer-cast
7132 @opindex Wno-int-to-pointer-cast
7133 @opindex Wint-to-pointer-cast
7134 Suppress warnings from casts to pointer type of an integer of a
7135 different size. In C++, casting to a pointer type of smaller size is
7136 an error. @option{Wint-to-pointer-cast} is enabled by default.
7137
7138
7139 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7140 @opindex Wno-pointer-to-int-cast
7141 @opindex Wpointer-to-int-cast
7142 Suppress warnings from casts from a pointer to an integer type of a
7143 different size.
7144
7145 @item -Winvalid-pch
7146 @opindex Winvalid-pch
7147 @opindex Wno-invalid-pch
7148 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7149 the search path but cannot be used.
7150
7151 @item -Wlong-long
7152 @opindex Wlong-long
7153 @opindex Wno-long-long
7154 Warn if @code{long long} type is used. This is enabled by either
7155 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7156 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7157
7158 @item -Wvariadic-macros
7159 @opindex Wvariadic-macros
7160 @opindex Wno-variadic-macros
7161 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7162 alternate syntax is used in ISO C99 mode. This is enabled by either
7163 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7164 messages, use @option{-Wno-variadic-macros}.
7165
7166 @item -Wvarargs
7167 @opindex Wvarargs
7168 @opindex Wno-varargs
7169 Warn upon questionable usage of the macros used to handle variable
7170 arguments like @code{va_start}. This is default. To inhibit the
7171 warning messages, use @option{-Wno-varargs}.
7172
7173 @item -Wvector-operation-performance
7174 @opindex Wvector-operation-performance
7175 @opindex Wno-vector-operation-performance
7176 Warn if vector operation is not implemented via SIMD capabilities of the
7177 architecture. Mainly useful for the performance tuning.
7178 Vector operation can be implemented @code{piecewise}, which means that the
7179 scalar operation is performed on every vector element;
7180 @code{in parallel}, which means that the vector operation is implemented
7181 using scalars of wider type, which normally is more performance efficient;
7182 and @code{as a single scalar}, which means that vector fits into a
7183 scalar type.
7184
7185 @item -Wno-virtual-move-assign
7186 @opindex Wvirtual-move-assign
7187 @opindex Wno-virtual-move-assign
7188 Suppress warnings about inheriting from a virtual base with a
7189 non-trivial C++11 move assignment operator. This is dangerous because
7190 if the virtual base is reachable along more than one path, it is
7191 moved multiple times, which can mean both objects end up in the
7192 moved-from state. If the move assignment operator is written to avoid
7193 moving from a moved-from object, this warning can be disabled.
7194
7195 @item -Wvla
7196 @opindex Wvla
7197 @opindex Wno-vla
7198 Warn if a variable-length array is used in the code.
7199 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7200 the variable-length array.
7201
7202 @item -Wvla-larger-than=@var{byte-size}
7203 @opindex -Wvla-larger-than=
7204 @opindex -Wno-vla-larger-than
7205 If this option is used, the compiler will warn for declarations of
7206 variable-length arrays whose size is either unbounded, or bounded
7207 by an argument that allows the array size to exceed @var{byte-size}
7208 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7209 works, but with variable-length arrays.
7210
7211 Note that GCC may optimize small variable-length arrays of a known
7212 value into plain arrays, so this warning may not get triggered for
7213 such arrays.
7214
7215 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7216 is typically only effective when @option{-ftree-vrp} is active (default
7217 for @option{-O2} and above).
7218
7219 See also @option{-Walloca-larger-than=@var{byte-size}}.
7220
7221 @item -Wno-vla-larger-than
7222 @opindex Wno-vla-larger-than
7223 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7224 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7225
7226 @item -Wvolatile-register-var
7227 @opindex Wvolatile-register-var
7228 @opindex Wno-volatile-register-var
7229 Warn if a register variable is declared volatile. The volatile
7230 modifier does not inhibit all optimizations that may eliminate reads
7231 and/or writes to register variables. This warning is enabled by
7232 @option{-Wall}.
7233
7234 @item -Wdisabled-optimization
7235 @opindex Wdisabled-optimization
7236 @opindex Wno-disabled-optimization
7237 Warn if a requested optimization pass is disabled. This warning does
7238 not generally indicate that there is anything wrong with your code; it
7239 merely indicates that GCC's optimizers are unable to handle the code
7240 effectively. Often, the problem is that your code is too big or too
7241 complex; GCC refuses to optimize programs when the optimization
7242 itself is likely to take inordinate amounts of time.
7243
7244 @item -Wpointer-sign @r{(C and Objective-C only)}
7245 @opindex Wpointer-sign
7246 @opindex Wno-pointer-sign
7247 Warn for pointer argument passing or assignment with different signedness.
7248 This option is only supported for C and Objective-C@. It is implied by
7249 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7250 @option{-Wno-pointer-sign}.
7251
7252 @item -Wstack-protector
7253 @opindex Wstack-protector
7254 @opindex Wno-stack-protector
7255 This option is only active when @option{-fstack-protector} is active. It
7256 warns about functions that are not protected against stack smashing.
7257
7258 @item -Woverlength-strings
7259 @opindex Woverlength-strings
7260 @opindex Wno-overlength-strings
7261 Warn about string constants that are longer than the ``minimum
7262 maximum'' length specified in the C standard. Modern compilers
7263 generally allow string constants that are much longer than the
7264 standard's minimum limit, but very portable programs should avoid
7265 using longer strings.
7266
7267 The limit applies @emph{after} string constant concatenation, and does
7268 not count the trailing NUL@. In C90, the limit was 509 characters; in
7269 C99, it was raised to 4095. C++98 does not specify a normative
7270 minimum maximum, so we do not diagnose overlength strings in C++@.
7271
7272 This option is implied by @option{-Wpedantic}, and can be disabled with
7273 @option{-Wno-overlength-strings}.
7274
7275 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7276 @opindex Wunsuffixed-float-constants
7277 @opindex Wno-unsuffixed-float-constants
7278
7279 Issue a warning for any floating constant that does not have
7280 a suffix. When used together with @option{-Wsystem-headers} it
7281 warns about such constants in system header files. This can be useful
7282 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7283 from the decimal floating-point extension to C99.
7284
7285 @item -Wno-designated-init @r{(C and Objective-C only)}
7286 Suppress warnings when a positional initializer is used to initialize
7287 a structure that has been marked with the @code{designated_init}
7288 attribute.
7289
7290 @item -Whsa
7291 Issue a warning when HSAIL cannot be emitted for the compiled function or
7292 OpenMP construct.
7293
7294 @end table
7295
7296 @node Debugging Options
7297 @section Options for Debugging Your Program
7298 @cindex options, debugging
7299 @cindex debugging information options
7300
7301 To tell GCC to emit extra information for use by a debugger, in almost
7302 all cases you need only to add @option{-g} to your other options.
7303
7304 GCC allows you to use @option{-g} with
7305 @option{-O}. The shortcuts taken by optimized code may occasionally
7306 be surprising: some variables you declared may not exist
7307 at all; flow of control may briefly move where you did not expect it;
7308 some statements may not be executed because they compute constant
7309 results or their values are already at hand; some statements may
7310 execute in different places because they have been moved out of loops.
7311 Nevertheless it is possible to debug optimized output. This makes
7312 it reasonable to use the optimizer for programs that might have bugs.
7313
7314 If you are not using some other optimization option, consider
7315 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7316 With no @option{-O} option at all, some compiler passes that collect
7317 information useful for debugging do not run at all, so that
7318 @option{-Og} may result in a better debugging experience.
7319
7320 @table @gcctabopt
7321 @item -g
7322 @opindex g
7323 Produce debugging information in the operating system's native format
7324 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7325 information.
7326
7327 On most systems that use stabs format, @option{-g} enables use of extra
7328 debugging information that only GDB can use; this extra information
7329 makes debugging work better in GDB but probably makes other debuggers
7330 crash or
7331 refuse to read the program. If you want to control for certain whether
7332 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7333 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7334
7335 @item -ggdb
7336 @opindex ggdb
7337 Produce debugging information for use by GDB@. This means to use the
7338 most expressive format available (DWARF, stabs, or the native format
7339 if neither of those are supported), including GDB extensions if at all
7340 possible.
7341
7342 @item -gdwarf
7343 @itemx -gdwarf-@var{version}
7344 @opindex gdwarf
7345 Produce debugging information in DWARF format (if that is supported).
7346 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7347 for most targets is 4. DWARF Version 5 is only experimental.
7348
7349 Note that with DWARF Version 2, some ports require and always
7350 use some non-conflicting DWARF 3 extensions in the unwind tables.
7351
7352 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7353 for maximum benefit.
7354
7355 GCC no longer supports DWARF Version 1, which is substantially
7356 different than Version 2 and later. For historical reasons, some
7357 other DWARF-related options such as
7358 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7359 in their names, but apply to all currently-supported versions of DWARF.
7360
7361 @item -gstabs
7362 @opindex gstabs
7363 Produce debugging information in stabs format (if that is supported),
7364 without GDB extensions. This is the format used by DBX on most BSD
7365 systems. On MIPS, Alpha and System V Release 4 systems this option
7366 produces stabs debugging output that is not understood by DBX@.
7367 On System V Release 4 systems this option requires the GNU assembler.
7368
7369 @item -gstabs+
7370 @opindex gstabs+
7371 Produce debugging information in stabs format (if that is supported),
7372 using GNU extensions understood only by the GNU debugger (GDB)@. The
7373 use of these extensions is likely to make other debuggers crash or
7374 refuse to read the program.
7375
7376 @item -gxcoff
7377 @opindex gxcoff
7378 Produce debugging information in XCOFF format (if that is supported).
7379 This is the format used by the DBX debugger on IBM RS/6000 systems.
7380
7381 @item -gxcoff+
7382 @opindex gxcoff+
7383 Produce debugging information in XCOFF format (if that is supported),
7384 using GNU extensions understood only by the GNU debugger (GDB)@. The
7385 use of these extensions is likely to make other debuggers crash or
7386 refuse to read the program, and may cause assemblers other than the GNU
7387 assembler (GAS) to fail with an error.
7388
7389 @item -gvms
7390 @opindex gvms
7391 Produce debugging information in Alpha/VMS debug format (if that is
7392 supported). This is the format used by DEBUG on Alpha/VMS systems.
7393
7394 @item -g@var{level}
7395 @itemx -ggdb@var{level}
7396 @itemx -gstabs@var{level}
7397 @itemx -gxcoff@var{level}
7398 @itemx -gvms@var{level}
7399 Request debugging information and also use @var{level} to specify how
7400 much information. The default level is 2.
7401
7402 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7403 @option{-g}.
7404
7405 Level 1 produces minimal information, enough for making backtraces in
7406 parts of the program that you don't plan to debug. This includes
7407 descriptions of functions and external variables, and line number
7408 tables, but no information about local variables.
7409
7410 Level 3 includes extra information, such as all the macro definitions
7411 present in the program. Some debuggers support macro expansion when
7412 you use @option{-g3}.
7413
7414 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7415 confusion with @option{-gdwarf-@var{level}}.
7416 Instead use an additional @option{-g@var{level}} option to change the
7417 debug level for DWARF.
7418
7419 @item -feliminate-unused-debug-symbols
7420 @opindex feliminate-unused-debug-symbols
7421 Produce debugging information in stabs format (if that is supported),
7422 for only symbols that are actually used.
7423
7424 @item -femit-class-debug-always
7425 @opindex femit-class-debug-always
7426 Instead of emitting debugging information for a C++ class in only one
7427 object file, emit it in all object files using the class. This option
7428 should be used only with debuggers that are unable to handle the way GCC
7429 normally emits debugging information for classes because using this
7430 option increases the size of debugging information by as much as a
7431 factor of two.
7432
7433 @item -fno-merge-debug-strings
7434 @opindex fmerge-debug-strings
7435 @opindex fno-merge-debug-strings
7436 Direct the linker to not merge together strings in the debugging
7437 information that are identical in different object files. Merging is
7438 not supported by all assemblers or linkers. Merging decreases the size
7439 of the debug information in the output file at the cost of increasing
7440 link processing time. Merging is enabled by default.
7441
7442 @item -fdebug-prefix-map=@var{old}=@var{new}
7443 @opindex fdebug-prefix-map
7444 When compiling files residing in directory @file{@var{old}}, record
7445 debugging information describing them as if the files resided in
7446 directory @file{@var{new}} instead. This can be used to replace a
7447 build-time path with an install-time path in the debug info. It can
7448 also be used to change an absolute path to a relative path by using
7449 @file{.} for @var{new}. This can give more reproducible builds, which
7450 are location independent, but may require an extra command to tell GDB
7451 where to find the source files. See also @option{-ffile-prefix-map}.
7452
7453 @item -fvar-tracking
7454 @opindex fvar-tracking
7455 Run variable tracking pass. It computes where variables are stored at each
7456 position in code. Better debugging information is then generated
7457 (if the debugging information format supports this information).
7458
7459 It is enabled by default when compiling with optimization (@option{-Os},
7460 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7461 the debug info format supports it.
7462
7463 @item -fvar-tracking-assignments
7464 @opindex fvar-tracking-assignments
7465 @opindex fno-var-tracking-assignments
7466 Annotate assignments to user variables early in the compilation and
7467 attempt to carry the annotations over throughout the compilation all the
7468 way to the end, in an attempt to improve debug information while
7469 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7470
7471 It can be enabled even if var-tracking is disabled, in which case
7472 annotations are created and maintained, but discarded at the end.
7473 By default, this flag is enabled together with @option{-fvar-tracking},
7474 except when selective scheduling is enabled.
7475
7476 @item -gsplit-dwarf
7477 @opindex gsplit-dwarf
7478 Separate as much DWARF debugging information as possible into a
7479 separate output file with the extension @file{.dwo}. This option allows
7480 the build system to avoid linking files with debug information. To
7481 be useful, this option requires a debugger capable of reading @file{.dwo}
7482 files.
7483
7484 @item -gdescribe-dies
7485 @opindex gdescribe-dies
7486 Add description attributes to some DWARF DIEs that have no name attribute,
7487 such as artificial variables, external references and call site
7488 parameter DIEs.
7489
7490 @item -gpubnames
7491 @opindex gpubnames
7492 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7493
7494 @item -ggnu-pubnames
7495 @opindex ggnu-pubnames
7496 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7497 suitable for conversion into a GDB@ index. This option is only useful
7498 with a linker that can produce GDB@ index version 7.
7499
7500 @item -fdebug-types-section
7501 @opindex fdebug-types-section
7502 @opindex fno-debug-types-section
7503 When using DWARF Version 4 or higher, type DIEs can be put into
7504 their own @code{.debug_types} section instead of making them part of the
7505 @code{.debug_info} section. It is more efficient to put them in a separate
7506 comdat section since the linker can then remove duplicates.
7507 But not all DWARF consumers support @code{.debug_types} sections yet
7508 and on some objects @code{.debug_types} produces larger instead of smaller
7509 debugging information.
7510
7511 @item -grecord-gcc-switches
7512 @itemx -gno-record-gcc-switches
7513 @opindex grecord-gcc-switches
7514 @opindex gno-record-gcc-switches
7515 This switch causes the command-line options used to invoke the
7516 compiler that may affect code generation to be appended to the
7517 DW_AT_producer attribute in DWARF debugging information. The options
7518 are concatenated with spaces separating them from each other and from
7519 the compiler version.
7520 It is enabled by default.
7521 See also @option{-frecord-gcc-switches} for another
7522 way of storing compiler options into the object file.
7523
7524 @item -gstrict-dwarf
7525 @opindex gstrict-dwarf
7526 Disallow using extensions of later DWARF standard version than selected
7527 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
7528 DWARF extensions from later standard versions is allowed.
7529
7530 @item -gno-strict-dwarf
7531 @opindex gno-strict-dwarf
7532 Allow using extensions of later DWARF standard version than selected with
7533 @option{-gdwarf-@var{version}}.
7534
7535 @item -gas-loc-support
7536 @opindex gas-loc-support
7537 Inform the compiler that the assembler supports @code{.loc} directives.
7538 It may then use them for the assembler to generate DWARF2+ line number
7539 tables.
7540
7541 This is generally desirable, because assembler-generated line-number
7542 tables are a lot more compact than those the compiler can generate
7543 itself.
7544
7545 This option will be enabled by default if, at GCC configure time, the
7546 assembler was found to support such directives.
7547
7548 @item -gno-as-loc-support
7549 @opindex gno-as-loc-support
7550 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
7551 line number tables are to be generated.
7552
7553 @item gas-locview-support
7554 @opindex gas-locview-support
7555 Inform the compiler that the assembler supports @code{view} assignment
7556 and reset assertion checking in @code{.loc} directives.
7557
7558 This option will be enabled by default if, at GCC configure time, the
7559 assembler was found to support them.
7560
7561 @item gno-as-locview-support
7562 Force GCC to assign view numbers internally, if
7563 @option{-gvariable-location-views} are explicitly requested.
7564
7565 @item -gcolumn-info
7566 @itemx -gno-column-info
7567 @opindex gcolumn-info
7568 @opindex gno-column-info
7569 Emit location column information into DWARF debugging information, rather
7570 than just file and line.
7571 This option is enabled by default.
7572
7573 @item -gstatement-frontiers
7574 @itemx -gno-statement-frontiers
7575 @opindex gstatement-frontiers
7576 @opindex gno-statement-frontiers
7577 This option causes GCC to create markers in the internal representation
7578 at the beginning of statements, and to keep them roughly in place
7579 throughout compilation, using them to guide the output of @code{is_stmt}
7580 markers in the line number table. This is enabled by default when
7581 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
7582 @dots{}), and outputting DWARF 2 debug information at the normal level.
7583
7584 @item -gvariable-location-views
7585 @itemx -gvariable-location-views=incompat5
7586 @itemx -gno-variable-location-views
7587 @opindex gvariable-location-views
7588 @opindex gvariable-location-views=incompat5
7589 @opindex gno-variable-location-views
7590 Augment variable location lists with progressive view numbers implied
7591 from the line number table. This enables debug information consumers to
7592 inspect state at certain points of the program, even if no instructions
7593 associated with the corresponding source locations are present at that
7594 point. If the assembler lacks support for view numbers in line number
7595 tables, this will cause the compiler to emit the line number table,
7596 which generally makes them somewhat less compact. The augmented line
7597 number tables and location lists are fully backward-compatible, so they
7598 can be consumed by debug information consumers that are not aware of
7599 these augmentations, but they won't derive any benefit from them either.
7600
7601 This is enabled by default when outputting DWARF 2 debug information at
7602 the normal level, as long as there is assembler support,
7603 @option{-fvar-tracking-assignments} is enabled and
7604 @option{-gstrict-dwarf} is not. When assembler support is not
7605 available, this may still be enabled, but it will force GCC to output
7606 internal line number tables, and if
7607 @option{-ginternal-reset-location-views} is not enabled, that will most
7608 certainly lead to silently mismatching location views.
7609
7610 There is a proposed representation for view numbers that is not backward
7611 compatible with the location list format introduced in DWARF 5, that can
7612 be enabled with @option{-gvariable-location-views=incompat5}. This
7613 option may be removed in the future, is only provided as a reference
7614 implementation of the proposed representation. Debug information
7615 consumers are not expected to support this extended format, and they
7616 would be rendered unable to decode location lists using it.
7617
7618 @item -ginternal-reset-location-views
7619 @itemx -gnointernal-reset-location-views
7620 @opindex ginternal-reset-location-views
7621 @opindex gno-internal-reset-location-views
7622 Attempt to determine location views that can be omitted from location
7623 view lists. This requires the compiler to have very accurate insn
7624 length estimates, which isn't always the case, and it may cause
7625 incorrect view lists to be generated silently when using an assembler
7626 that does not support location view lists. The GNU assembler will flag
7627 any such error as a @code{view number mismatch}. This is only enabled
7628 on ports that define a reliable estimation function.
7629
7630 @item -ginline-points
7631 @itemx -gno-inline-points
7632 @opindex ginline-points
7633 @opindex gno-inline-points
7634 Generate extended debug information for inlined functions. Location
7635 view tracking markers are inserted at inlined entry points, so that
7636 address and view numbers can be computed and output in debug
7637 information. This can be enabled independently of location views, in
7638 which case the view numbers won't be output, but it can only be enabled
7639 along with statement frontiers, and it is only enabled by default if
7640 location views are enabled.
7641
7642 @item -gz@r{[}=@var{type}@r{]}
7643 @opindex gz
7644 Produce compressed debug sections in DWARF format, if that is supported.
7645 If @var{type} is not given, the default type depends on the capabilities
7646 of the assembler and linker used. @var{type} may be one of
7647 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
7648 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
7649 compression in traditional GNU format). If the linker doesn't support
7650 writing compressed debug sections, the option is rejected. Otherwise,
7651 if the assembler does not support them, @option{-gz} is silently ignored
7652 when producing object files.
7653
7654 @item -femit-struct-debug-baseonly
7655 @opindex femit-struct-debug-baseonly
7656 Emit debug information for struct-like types
7657 only when the base name of the compilation source file
7658 matches the base name of file in which the struct is defined.
7659
7660 This option substantially reduces the size of debugging information,
7661 but at significant potential loss in type information to the debugger.
7662 See @option{-femit-struct-debug-reduced} for a less aggressive option.
7663 See @option{-femit-struct-debug-detailed} for more detailed control.
7664
7665 This option works only with DWARF debug output.
7666
7667 @item -femit-struct-debug-reduced
7668 @opindex femit-struct-debug-reduced
7669 Emit debug information for struct-like types
7670 only when the base name of the compilation source file
7671 matches the base name of file in which the type is defined,
7672 unless the struct is a template or defined in a system header.
7673
7674 This option significantly reduces the size of debugging information,
7675 with some potential loss in type information to the debugger.
7676 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
7677 See @option{-femit-struct-debug-detailed} for more detailed control.
7678
7679 This option works only with DWARF debug output.
7680
7681 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
7682 @opindex femit-struct-debug-detailed
7683 Specify the struct-like types
7684 for which the compiler generates debug information.
7685 The intent is to reduce duplicate struct debug information
7686 between different object files within the same program.
7687
7688 This option is a detailed version of
7689 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
7690 which serves for most needs.
7691
7692 A specification has the syntax@*
7693 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
7694
7695 The optional first word limits the specification to
7696 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
7697 A struct type is used directly when it is the type of a variable, member.
7698 Indirect uses arise through pointers to structs.
7699 That is, when use of an incomplete struct is valid, the use is indirect.
7700 An example is
7701 @samp{struct one direct; struct two * indirect;}.
7702
7703 The optional second word limits the specification to
7704 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
7705 Generic structs are a bit complicated to explain.
7706 For C++, these are non-explicit specializations of template classes,
7707 or non-template classes within the above.
7708 Other programming languages have generics,
7709 but @option{-femit-struct-debug-detailed} does not yet implement them.
7710
7711 The third word specifies the source files for those
7712 structs for which the compiler should emit debug information.
7713 The values @samp{none} and @samp{any} have the normal meaning.
7714 The value @samp{base} means that
7715 the base of name of the file in which the type declaration appears
7716 must match the base of the name of the main compilation file.
7717 In practice, this means that when compiling @file{foo.c}, debug information
7718 is generated for types declared in that file and @file{foo.h},
7719 but not other header files.
7720 The value @samp{sys} means those types satisfying @samp{base}
7721 or declared in system or compiler headers.
7722
7723 You may need to experiment to determine the best settings for your application.
7724
7725 The default is @option{-femit-struct-debug-detailed=all}.
7726
7727 This option works only with DWARF debug output.
7728
7729 @item -fno-dwarf2-cfi-asm
7730 @opindex fdwarf2-cfi-asm
7731 @opindex fno-dwarf2-cfi-asm
7732 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
7733 instead of using GAS @code{.cfi_*} directives.
7734
7735 @item -fno-eliminate-unused-debug-types
7736 @opindex feliminate-unused-debug-types
7737 @opindex fno-eliminate-unused-debug-types
7738 Normally, when producing DWARF output, GCC avoids producing debug symbol
7739 output for types that are nowhere used in the source file being compiled.
7740 Sometimes it is useful to have GCC emit debugging
7741 information for all types declared in a compilation
7742 unit, regardless of whether or not they are actually used
7743 in that compilation unit, for example
7744 if, in the debugger, you want to cast a value to a type that is
7745 not actually used in your program (but is declared). More often,
7746 however, this results in a significant amount of wasted space.
7747 @end table
7748
7749 @node Optimize Options
7750 @section Options That Control Optimization
7751 @cindex optimize options
7752 @cindex options, optimization
7753
7754 These options control various sorts of optimizations.
7755
7756 Without any optimization option, the compiler's goal is to reduce the
7757 cost of compilation and to make debugging produce the expected
7758 results. Statements are independent: if you stop the program with a
7759 breakpoint between statements, you can then assign a new value to any
7760 variable or change the program counter to any other statement in the
7761 function and get exactly the results you expect from the source
7762 code.
7763
7764 Turning on optimization flags makes the compiler attempt to improve
7765 the performance and/or code size at the expense of compilation time
7766 and possibly the ability to debug the program.
7767
7768 The compiler performs optimization based on the knowledge it has of the
7769 program. Compiling multiple files at once to a single output file mode allows
7770 the compiler to use information gained from all of the files when compiling
7771 each of them.
7772
7773 Not all optimizations are controlled directly by a flag. Only
7774 optimizations that have a flag are listed in this section.
7775
7776 Most optimizations are only enabled if an @option{-O} level is set on
7777 the command line. Otherwise they are disabled, even if individual
7778 optimization flags are specified.
7779
7780 Depending on the target and how GCC was configured, a slightly different
7781 set of optimizations may be enabled at each @option{-O} level than
7782 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
7783 to find out the exact set of optimizations that are enabled at each level.
7784 @xref{Overall Options}, for examples.
7785
7786 @table @gcctabopt
7787 @item -O
7788 @itemx -O1
7789 @opindex O
7790 @opindex O1
7791 Optimize. Optimizing compilation takes somewhat more time, and a lot
7792 more memory for a large function.
7793
7794 With @option{-O}, the compiler tries to reduce code size and execution
7795 time, without performing any optimizations that take a great deal of
7796 compilation time.
7797
7798 @option{-O} turns on the following optimization flags:
7799 @gccoptlist{
7800 -fauto-inc-dec @gol
7801 -fbranch-count-reg @gol
7802 -fcombine-stack-adjustments @gol
7803 -fcompare-elim @gol
7804 -fcprop-registers @gol
7805 -fdce @gol
7806 -fdefer-pop @gol
7807 -fdelayed-branch @gol
7808 -fdse @gol
7809 -fforward-propagate @gol
7810 -fguess-branch-probability @gol
7811 -fif-conversion2 @gol
7812 -fif-conversion @gol
7813 -finline-functions-called-once @gol
7814 -fipa-pure-const @gol
7815 -fipa-profile @gol
7816 -fipa-reference @gol
7817 -fmerge-constants @gol
7818 -fmove-loop-invariants @gol
7819 -fomit-frame-pointer @gol
7820 -freorder-blocks @gol
7821 -fshrink-wrap @gol
7822 -fshrink-wrap-separate @gol
7823 -fsplit-wide-types @gol
7824 -fssa-backprop @gol
7825 -fssa-phiopt @gol
7826 -ftree-bit-ccp @gol
7827 -ftree-ccp @gol
7828 -ftree-ch @gol
7829 -ftree-coalesce-vars @gol
7830 -ftree-copy-prop @gol
7831 -ftree-dce @gol
7832 -ftree-dominator-opts @gol
7833 -ftree-dse @gol
7834 -ftree-forwprop @gol
7835 -ftree-fre @gol
7836 -ftree-phiprop @gol
7837 -ftree-scev-cprop @gol
7838 -ftree-sink @gol
7839 -ftree-slsr @gol
7840 -ftree-sra @gol
7841 -ftree-pta @gol
7842 -ftree-ter @gol
7843 -funit-at-a-time}
7844
7845 @item -O2
7846 @opindex O2
7847 Optimize even more. GCC performs nearly all supported optimizations
7848 that do not involve a space-speed tradeoff.
7849 As compared to @option{-O}, this option increases both compilation time
7850 and the performance of the generated code.
7851
7852 @option{-O2} turns on all optimization flags specified by @option{-O}. It
7853 also turns on the following optimization flags:
7854 @gccoptlist{-fthread-jumps @gol
7855 -falign-functions -falign-jumps @gol
7856 -falign-loops -falign-labels @gol
7857 -fcaller-saves @gol
7858 -fcrossjumping @gol
7859 -fcse-follow-jumps -fcse-skip-blocks @gol
7860 -fdelete-null-pointer-checks @gol
7861 -fdevirtualize -fdevirtualize-speculatively @gol
7862 -fexpensive-optimizations @gol
7863 -fgcse -fgcse-lm @gol
7864 -fhoist-adjacent-loads @gol
7865 -finline-small-functions @gol
7866 -findirect-inlining @gol
7867 -fipa-cp @gol
7868 -fipa-bit-cp @gol
7869 -fipa-vrp @gol
7870 -fipa-sra @gol
7871 -fipa-icf @gol
7872 -fisolate-erroneous-paths-dereference @gol
7873 -flra-remat @gol
7874 -foptimize-sibling-calls @gol
7875 -foptimize-strlen @gol
7876 -fpartial-inlining @gol
7877 -fpeephole2 @gol
7878 -freorder-blocks-algorithm=stc @gol
7879 -freorder-blocks-and-partition -freorder-functions @gol
7880 -frerun-cse-after-loop @gol
7881 -fsched-interblock -fsched-spec @gol
7882 -fschedule-insns -fschedule-insns2 @gol
7883 -fstore-merging @gol
7884 -fstrict-aliasing @gol
7885 -ftree-builtin-call-dce @gol
7886 -ftree-switch-conversion -ftree-tail-merge @gol
7887 -fcode-hoisting @gol
7888 -ftree-pre @gol
7889 -ftree-vrp @gol
7890 -fipa-ra}
7891
7892 Please note the warning under @option{-fgcse} about
7893 invoking @option{-O2} on programs that use computed gotos.
7894
7895 @item -O3
7896 @opindex O3
7897 Optimize yet more. @option{-O3} turns on all optimizations specified
7898 by @option{-O2} and also turns on the following optimization flags:
7899 @gccoptlist{-finline-functions @gol
7900 -funswitch-loops @gol
7901 -fpredictive-commoning @gol
7902 -fgcse-after-reload @gol
7903 -ftree-loop-vectorize @gol
7904 -ftree-loop-distribution @gol
7905 -ftree-loop-distribute-patterns @gol
7906 -floop-interchange @gol
7907 -floop-unroll-and-jam @gol
7908 -fsplit-paths @gol
7909 -ftree-slp-vectorize @gol
7910 -fvect-cost-model @gol
7911 -ftree-partial-pre @gol
7912 -fpeel-loops @gol
7913 -fipa-cp-clone}
7914
7915 @item -O0
7916 @opindex O0
7917 Reduce compilation time and make debugging produce the expected
7918 results. This is the default.
7919
7920 @item -Os
7921 @opindex Os
7922 Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
7923 do not typically increase code size. It also performs further
7924 optimizations designed to reduce code size.
7925
7926 @option{-Os} disables the following optimization flags:
7927 @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
7928 -falign-labels -freorder-blocks -freorder-blocks-algorithm=stc @gol
7929 -freorder-blocks-and-partition -fprefetch-loop-arrays}
7930
7931 @item -Ofast
7932 @opindex Ofast
7933 Disregard strict standards compliance. @option{-Ofast} enables all
7934 @option{-O3} optimizations. It also enables optimizations that are not
7935 valid for all standard-compliant programs.
7936 It turns on @option{-ffast-math} and the Fortran-specific
7937 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
7938 specified, and @option{-fno-protect-parens}.
7939
7940 @item -Og
7941 @opindex Og
7942 Optimize debugging experience. @option{-Og} enables optimizations
7943 that do not interfere with debugging. It should be the optimization
7944 level of choice for the standard edit-compile-debug cycle, offering
7945 a reasonable level of optimization while maintaining fast compilation
7946 and a good debugging experience.
7947 @end table
7948
7949 If you use multiple @option{-O} options, with or without level numbers,
7950 the last such option is the one that is effective.
7951
7952 Options of the form @option{-f@var{flag}} specify machine-independent
7953 flags. Most flags have both positive and negative forms; the negative
7954 form of @option{-ffoo} is @option{-fno-foo}. In the table
7955 below, only one of the forms is listed---the one you typically
7956 use. You can figure out the other form by either removing @samp{no-}
7957 or adding it.
7958
7959 The following options control specific optimizations. They are either
7960 activated by @option{-O} options or are related to ones that are. You
7961 can use the following flags in the rare cases when ``fine-tuning'' of
7962 optimizations to be performed is desired.
7963
7964 @table @gcctabopt
7965 @item -fno-defer-pop
7966 @opindex fno-defer-pop
7967 Always pop the arguments to each function call as soon as that function
7968 returns. For machines that must pop arguments after a function call,
7969 the compiler normally lets arguments accumulate on the stack for several
7970 function calls and pops them all at once.
7971
7972 Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7973
7974 @item -fforward-propagate
7975 @opindex fforward-propagate
7976 Perform a forward propagation pass on RTL@. The pass tries to combine two
7977 instructions and checks if the result can be simplified. If loop unrolling
7978 is active, two passes are performed and the second is scheduled after
7979 loop unrolling.
7980
7981 This option is enabled by default at optimization levels @option{-O},
7982 @option{-O2}, @option{-O3}, @option{-Os}.
7983
7984 @item -ffp-contract=@var{style}
7985 @opindex ffp-contract
7986 @option{-ffp-contract=off} disables floating-point expression contraction.
7987 @option{-ffp-contract=fast} enables floating-point expression contraction
7988 such as forming of fused multiply-add operations if the target has
7989 native support for them.
7990 @option{-ffp-contract=on} enables floating-point expression contraction
7991 if allowed by the language standard. This is currently not implemented
7992 and treated equal to @option{-ffp-contract=off}.
7993
7994 The default is @option{-ffp-contract=fast}.
7995
7996 @item -fomit-frame-pointer
7997 @opindex fomit-frame-pointer
7998 Omit the frame pointer in functions that don't need one. This avoids the
7999 instructions to save, set up and restore the frame pointer; on many targets
8000 it also makes an extra register available.
8001
8002 On some targets this flag has no effect because the standard calling sequence
8003 always uses a frame pointer, so it cannot be omitted.
8004
8005 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8006 is used in all functions. Several targets always omit the frame pointer in
8007 leaf functions.
8008
8009 Enabled by default at @option{-O} and higher.
8010
8011 @item -foptimize-sibling-calls
8012 @opindex foptimize-sibling-calls
8013 Optimize sibling and tail recursive calls.
8014
8015 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8016
8017 @item -foptimize-strlen
8018 @opindex foptimize-strlen
8019 Optimize various standard C string functions (e.g. @code{strlen},
8020 @code{strchr} or @code{strcpy}) and
8021 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8022
8023 Enabled at levels @option{-O2}, @option{-O3}.
8024
8025 @item -fno-inline
8026 @opindex fno-inline
8027 Do not expand any functions inline apart from those marked with
8028 the @code{always_inline} attribute. This is the default when not
8029 optimizing.
8030
8031 Single functions can be exempted from inlining by marking them
8032 with the @code{noinline} attribute.
8033
8034 @item -finline-small-functions
8035 @opindex finline-small-functions
8036 Integrate functions into their callers when their body is smaller than expected
8037 function call code (so overall size of program gets smaller). The compiler
8038 heuristically decides which functions are simple enough to be worth integrating
8039 in this way. This inlining applies to all functions, even those not declared
8040 inline.
8041
8042 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8043
8044 @item -findirect-inlining
8045 @opindex findirect-inlining
8046 Inline also indirect calls that are discovered to be known at compile
8047 time thanks to previous inlining. This option has any effect only
8048 when inlining itself is turned on by the @option{-finline-functions}
8049 or @option{-finline-small-functions} options.
8050
8051 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8052
8053 @item -finline-functions
8054 @opindex finline-functions
8055 Consider all functions for inlining, even if they are not declared inline.
8056 The compiler heuristically decides which functions are worth integrating
8057 in this way.
8058
8059 If all calls to a given function are integrated, and the function is
8060 declared @code{static}, then the function is normally not output as
8061 assembler code in its own right.
8062
8063 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8064
8065 @item -finline-functions-called-once
8066 @opindex finline-functions-called-once
8067 Consider all @code{static} functions called once for inlining into their
8068 caller even if they are not marked @code{inline}. If a call to a given
8069 function is integrated, then the function is not output as assembler code
8070 in its own right.
8071
8072 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
8073
8074 @item -fearly-inlining
8075 @opindex fearly-inlining
8076 Inline functions marked by @code{always_inline} and functions whose body seems
8077 smaller than the function call overhead early before doing
8078 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8079 makes profiling significantly cheaper and usually inlining faster on programs
8080 having large chains of nested wrapper functions.
8081
8082 Enabled by default.
8083
8084 @item -fipa-sra
8085 @opindex fipa-sra
8086 Perform interprocedural scalar replacement of aggregates, removal of
8087 unused parameters and replacement of parameters passed by reference
8088 by parameters passed by value.
8089
8090 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8091
8092 @item -finline-limit=@var{n}
8093 @opindex finline-limit
8094 By default, GCC limits the size of functions that can be inlined. This flag
8095 allows coarse control of this limit. @var{n} is the size of functions that
8096 can be inlined in number of pseudo instructions.
8097
8098 Inlining is actually controlled by a number of parameters, which may be
8099 specified individually by using @option{--param @var{name}=@var{value}}.
8100 The @option{-finline-limit=@var{n}} option sets some of these parameters
8101 as follows:
8102
8103 @table @gcctabopt
8104 @item max-inline-insns-single
8105 is set to @var{n}/2.
8106 @item max-inline-insns-auto
8107 is set to @var{n}/2.
8108 @end table
8109
8110 See below for a documentation of the individual
8111 parameters controlling inlining and for the defaults of these parameters.
8112
8113 @emph{Note:} there may be no value to @option{-finline-limit} that results
8114 in default behavior.
8115
8116 @emph{Note:} pseudo instruction represents, in this particular context, an
8117 abstract measurement of function's size. In no way does it represent a count
8118 of assembly instructions and as such its exact meaning might change from one
8119 release to an another.
8120
8121 @item -fno-keep-inline-dllexport
8122 @opindex fno-keep-inline-dllexport
8123 This is a more fine-grained version of @option{-fkeep-inline-functions},
8124 which applies only to functions that are declared using the @code{dllexport}
8125 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8126 Functions}.
8127
8128 @item -fkeep-inline-functions
8129 @opindex fkeep-inline-functions
8130 In C, emit @code{static} functions that are declared @code{inline}
8131 into the object file, even if the function has been inlined into all
8132 of its callers. This switch does not affect functions using the
8133 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8134 inline functions into the object file.
8135
8136 @item -fkeep-static-functions
8137 @opindex fkeep-static-functions
8138 Emit @code{static} functions into the object file, even if the function
8139 is never used.
8140
8141 @item -fkeep-static-consts
8142 @opindex fkeep-static-consts
8143 Emit variables declared @code{static const} when optimization isn't turned
8144 on, even if the variables aren't referenced.
8145
8146 GCC enables this option by default. If you want to force the compiler to
8147 check if a variable is referenced, regardless of whether or not
8148 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8149
8150 @item -fmerge-constants
8151 @opindex fmerge-constants
8152 Attempt to merge identical constants (string constants and floating-point
8153 constants) across compilation units.
8154
8155 This option is the default for optimized compilation if the assembler and
8156 linker support it. Use @option{-fno-merge-constants} to inhibit this
8157 behavior.
8158
8159 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8160
8161 @item -fmerge-all-constants
8162 @opindex fmerge-all-constants
8163 Attempt to merge identical constants and identical variables.
8164
8165 This option implies @option{-fmerge-constants}. In addition to
8166 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8167 arrays or initialized constant variables with integral or floating-point
8168 types. Languages like C or C++ require each variable, including multiple
8169 instances of the same variable in recursive calls, to have distinct locations,
8170 so using this option results in non-conforming
8171 behavior.
8172
8173 @item -fmodulo-sched
8174 @opindex fmodulo-sched
8175 Perform swing modulo scheduling immediately before the first scheduling
8176 pass. This pass looks at innermost loops and reorders their
8177 instructions by overlapping different iterations.
8178
8179 @item -fmodulo-sched-allow-regmoves
8180 @opindex fmodulo-sched-allow-regmoves
8181 Perform more aggressive SMS-based modulo scheduling with register moves
8182 allowed. By setting this flag certain anti-dependences edges are
8183 deleted, which triggers the generation of reg-moves based on the
8184 life-range analysis. This option is effective only with
8185 @option{-fmodulo-sched} enabled.
8186
8187 @item -fno-branch-count-reg
8188 @opindex fno-branch-count-reg
8189 Avoid running a pass scanning for opportunities to use ``decrement and
8190 branch'' instructions on a count register instead of generating sequences
8191 of instructions that decrement a register, compare it against zero, and
8192 then branch based upon the result. This option is only meaningful on
8193 architectures that support such instructions, which include x86, PowerPC,
8194 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8195 doesn't remove the decrement and branch instructions from the generated
8196 instruction stream introduced by other optimization passes.
8197
8198 Enabled by default at @option{-O1} and higher.
8199
8200 The default is @option{-fbranch-count-reg}.
8201
8202 @item -fno-function-cse
8203 @opindex fno-function-cse
8204 Do not put function addresses in registers; make each instruction that
8205 calls a constant function contain the function's address explicitly.
8206
8207 This option results in less efficient code, but some strange hacks
8208 that alter the assembler output may be confused by the optimizations
8209 performed when this option is not used.
8210
8211 The default is @option{-ffunction-cse}
8212
8213 @item -fno-zero-initialized-in-bss
8214 @opindex fno-zero-initialized-in-bss
8215 If the target supports a BSS section, GCC by default puts variables that
8216 are initialized to zero into BSS@. This can save space in the resulting
8217 code.
8218
8219 This option turns off this behavior because some programs explicitly
8220 rely on variables going to the data section---e.g., so that the
8221 resulting executable can find the beginning of that section and/or make
8222 assumptions based on that.
8223
8224 The default is @option{-fzero-initialized-in-bss}.
8225
8226 @item -fthread-jumps
8227 @opindex fthread-jumps
8228 Perform optimizations that check to see if a jump branches to a
8229 location where another comparison subsumed by the first is found. If
8230 so, the first branch is redirected to either the destination of the
8231 second branch or a point immediately following it, depending on whether
8232 the condition is known to be true or false.
8233
8234 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8235
8236 @item -fsplit-wide-types
8237 @opindex fsplit-wide-types
8238 When using a type that occupies multiple registers, such as @code{long
8239 long} on a 32-bit system, split the registers apart and allocate them
8240 independently. This normally generates better code for those types,
8241 but may make debugging more difficult.
8242
8243 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8244 @option{-Os}.
8245
8246 @item -fcse-follow-jumps
8247 @opindex fcse-follow-jumps
8248 In common subexpression elimination (CSE), scan through jump instructions
8249 when the target of the jump is not reached by any other path. For
8250 example, when CSE encounters an @code{if} statement with an
8251 @code{else} clause, CSE follows the jump when the condition
8252 tested is false.
8253
8254 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8255
8256 @item -fcse-skip-blocks
8257 @opindex fcse-skip-blocks
8258 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8259 follow jumps that conditionally skip over blocks. When CSE
8260 encounters a simple @code{if} statement with no else clause,
8261 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8262 body of the @code{if}.
8263
8264 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8265
8266 @item -frerun-cse-after-loop
8267 @opindex frerun-cse-after-loop
8268 Re-run common subexpression elimination after loop optimizations are
8269 performed.
8270
8271 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8272
8273 @item -fgcse
8274 @opindex fgcse
8275 Perform a global common subexpression elimination pass.
8276 This pass also performs global constant and copy propagation.
8277
8278 @emph{Note:} When compiling a program using computed gotos, a GCC
8279 extension, you may get better run-time performance if you disable
8280 the global common subexpression elimination pass by adding
8281 @option{-fno-gcse} to the command line.
8282
8283 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8284
8285 @item -fgcse-lm
8286 @opindex fgcse-lm
8287 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8288 attempts to move loads that are only killed by stores into themselves. This
8289 allows a loop containing a load/store sequence to be changed to a load outside
8290 the loop, and a copy/store within the loop.
8291
8292 Enabled by default when @option{-fgcse} is enabled.
8293
8294 @item -fgcse-sm
8295 @opindex fgcse-sm
8296 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8297 global common subexpression elimination. This pass attempts to move
8298 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8299 loops containing a load/store sequence can be changed to a load before
8300 the loop and a store after the loop.
8301
8302 Not enabled at any optimization level.
8303
8304 @item -fgcse-las
8305 @opindex fgcse-las
8306 When @option{-fgcse-las} is enabled, the global common subexpression
8307 elimination pass eliminates redundant loads that come after stores to the
8308 same memory location (both partial and full redundancies).
8309
8310 Not enabled at any optimization level.
8311
8312 @item -fgcse-after-reload
8313 @opindex fgcse-after-reload
8314 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8315 pass is performed after reload. The purpose of this pass is to clean up
8316 redundant spilling.
8317
8318 @item -faggressive-loop-optimizations
8319 @opindex faggressive-loop-optimizations
8320 This option tells the loop optimizer to use language constraints to
8321 derive bounds for the number of iterations of a loop. This assumes that
8322 loop code does not invoke undefined behavior by for example causing signed
8323 integer overflows or out-of-bound array accesses. The bounds for the
8324 number of iterations of a loop are used to guide loop unrolling and peeling
8325 and loop exit test optimizations.
8326 This option is enabled by default.
8327
8328 @item -funconstrained-commons
8329 @opindex funconstrained-commons
8330 This option tells the compiler that variables declared in common blocks
8331 (e.g. Fortran) may later be overridden with longer trailing arrays. This
8332 prevents certain optimizations that depend on knowing the array bounds.
8333
8334 @item -fcrossjumping
8335 @opindex fcrossjumping
8336 Perform cross-jumping transformation.
8337 This transformation unifies equivalent code and saves code size. The
8338 resulting code may or may not perform better than without cross-jumping.
8339
8340 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8341
8342 @item -fauto-inc-dec
8343 @opindex fauto-inc-dec
8344 Combine increments or decrements of addresses with memory accesses.
8345 This pass is always skipped on architectures that do not have
8346 instructions to support this. Enabled by default at @option{-O} and
8347 higher on architectures that support this.
8348
8349 @item -fdce
8350 @opindex fdce
8351 Perform dead code elimination (DCE) on RTL@.
8352 Enabled by default at @option{-O} and higher.
8353
8354 @item -fdse
8355 @opindex fdse
8356 Perform dead store elimination (DSE) on RTL@.
8357 Enabled by default at @option{-O} and higher.
8358
8359 @item -fif-conversion
8360 @opindex fif-conversion
8361 Attempt to transform conditional jumps into branch-less equivalents. This
8362 includes use of conditional moves, min, max, set flags and abs instructions, and
8363 some tricks doable by standard arithmetics. The use of conditional execution
8364 on chips where it is available is controlled by @option{-fif-conversion2}.
8365
8366 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8367
8368 @item -fif-conversion2
8369 @opindex fif-conversion2
8370 Use conditional execution (where available) to transform conditional jumps into
8371 branch-less equivalents.
8372
8373 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8374
8375 @item -fdeclone-ctor-dtor
8376 @opindex fdeclone-ctor-dtor
8377 The C++ ABI requires multiple entry points for constructors and
8378 destructors: one for a base subobject, one for a complete object, and
8379 one for a virtual destructor that calls operator delete afterwards.
8380 For a hierarchy with virtual bases, the base and complete variants are
8381 clones, which means two copies of the function. With this option, the
8382 base and complete variants are changed to be thunks that call a common
8383 implementation.
8384
8385 Enabled by @option{-Os}.
8386
8387 @item -fdelete-null-pointer-checks
8388 @opindex fdelete-null-pointer-checks
8389 Assume that programs cannot safely dereference null pointers, and that
8390 no code or data element resides at address zero.
8391 This option enables simple constant
8392 folding optimizations at all optimization levels. In addition, other
8393 optimization passes in GCC use this flag to control global dataflow
8394 analyses that eliminate useless checks for null pointers; these assume
8395 that a memory access to address zero always results in a trap, so
8396 that if a pointer is checked after it has already been dereferenced,
8397 it cannot be null.
8398
8399 Note however that in some environments this assumption is not true.
8400 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8401 for programs that depend on that behavior.
8402
8403 This option is enabled by default on most targets. On Nios II ELF, it
8404 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8405
8406 Passes that use the dataflow information
8407 are enabled independently at different optimization levels.
8408
8409 @item -fdevirtualize
8410 @opindex fdevirtualize
8411 Attempt to convert calls to virtual functions to direct calls. This
8412 is done both within a procedure and interprocedurally as part of
8413 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8414 propagation (@option{-fipa-cp}).
8415 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8416
8417 @item -fdevirtualize-speculatively
8418 @opindex fdevirtualize-speculatively
8419 Attempt to convert calls to virtual functions to speculative direct calls.
8420 Based on the analysis of the type inheritance graph, determine for a given call
8421 the set of likely targets. If the set is small, preferably of size 1, change
8422 the call into a conditional deciding between direct and indirect calls. The
8423 speculative calls enable more optimizations, such as inlining. When they seem
8424 useless after further optimization, they are converted back into original form.
8425
8426 @item -fdevirtualize-at-ltrans
8427 @opindex fdevirtualize-at-ltrans
8428 Stream extra information needed for aggressive devirtualization when running
8429 the link-time optimizer in local transformation mode.
8430 This option enables more devirtualization but
8431 significantly increases the size of streamed data. For this reason it is
8432 disabled by default.
8433
8434 @item -fexpensive-optimizations
8435 @opindex fexpensive-optimizations
8436 Perform a number of minor optimizations that are relatively expensive.
8437
8438 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8439
8440 @item -free
8441 @opindex free
8442 Attempt to remove redundant extension instructions. This is especially
8443 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8444 registers after writing to their lower 32-bit half.
8445
8446 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8447 @option{-O3}, @option{-Os}.
8448
8449 @item -fno-lifetime-dse
8450 @opindex fno-lifetime-dse
8451 In C++ the value of an object is only affected by changes within its
8452 lifetime: when the constructor begins, the object has an indeterminate
8453 value, and any changes during the lifetime of the object are dead when
8454 the object is destroyed. Normally dead store elimination will take
8455 advantage of this; if your code relies on the value of the object
8456 storage persisting beyond the lifetime of the object, you can use this
8457 flag to disable this optimization. To preserve stores before the
8458 constructor starts (e.g. because your operator new clears the object
8459 storage) but still treat the object as dead after the destructor you,
8460 can use @option{-flifetime-dse=1}. The default behavior can be
8461 explicitly selected with @option{-flifetime-dse=2}.
8462 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8463
8464 @item -flive-range-shrinkage
8465 @opindex flive-range-shrinkage
8466 Attempt to decrease register pressure through register live range
8467 shrinkage. This is helpful for fast processors with small or moderate
8468 size register sets.
8469
8470 @item -fira-algorithm=@var{algorithm}
8471 @opindex fira-algorithm
8472 Use the specified coloring algorithm for the integrated register
8473 allocator. The @var{algorithm} argument can be @samp{priority}, which
8474 specifies Chow's priority coloring, or @samp{CB}, which specifies
8475 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8476 for all architectures, but for those targets that do support it, it is
8477 the default because it generates better code.
8478
8479 @item -fira-region=@var{region}
8480 @opindex fira-region
8481 Use specified regions for the integrated register allocator. The
8482 @var{region} argument should be one of the following:
8483
8484 @table @samp
8485
8486 @item all
8487 Use all loops as register allocation regions.
8488 This can give the best results for machines with a small and/or
8489 irregular register set.
8490
8491 @item mixed
8492 Use all loops except for loops with small register pressure
8493 as the regions. This value usually gives
8494 the best results in most cases and for most architectures,
8495 and is enabled by default when compiling with optimization for speed
8496 (@option{-O}, @option{-O2}, @dots{}).
8497
8498 @item one
8499 Use all functions as a single region.
8500 This typically results in the smallest code size, and is enabled by default for
8501 @option{-Os} or @option{-O0}.
8502
8503 @end table
8504
8505 @item -fira-hoist-pressure
8506 @opindex fira-hoist-pressure
8507 Use IRA to evaluate register pressure in the code hoisting pass for
8508 decisions to hoist expressions. This option usually results in smaller
8509 code, but it can slow the compiler down.
8510
8511 This option is enabled at level @option{-Os} for all targets.
8512
8513 @item -fira-loop-pressure
8514 @opindex fira-loop-pressure
8515 Use IRA to evaluate register pressure in loops for decisions to move
8516 loop invariants. This option usually results in generation
8517 of faster and smaller code on machines with large register files (>= 32
8518 registers), but it can slow the compiler down.
8519
8520 This option is enabled at level @option{-O3} for some targets.
8521
8522 @item -fno-ira-share-save-slots
8523 @opindex fno-ira-share-save-slots
8524 Disable sharing of stack slots used for saving call-used hard
8525 registers living through a call. Each hard register gets a
8526 separate stack slot, and as a result function stack frames are
8527 larger.
8528
8529 @item -fno-ira-share-spill-slots
8530 @opindex fno-ira-share-spill-slots
8531 Disable sharing of stack slots allocated for pseudo-registers. Each
8532 pseudo-register that does not get a hard register gets a separate
8533 stack slot, and as a result function stack frames are larger.
8534
8535 @item -flra-remat
8536 @opindex flra-remat
8537 Enable CFG-sensitive rematerialization in LRA. Instead of loading
8538 values of spilled pseudos, LRA tries to rematerialize (recalculate)
8539 values if it is profitable.
8540
8541 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8542
8543 @item -fdelayed-branch
8544 @opindex fdelayed-branch
8545 If supported for the target machine, attempt to reorder instructions
8546 to exploit instruction slots available after delayed branch
8547 instructions.
8548
8549 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8550
8551 @item -fschedule-insns
8552 @opindex fschedule-insns
8553 If supported for the target machine, attempt to reorder instructions to
8554 eliminate execution stalls due to required data being unavailable. This
8555 helps machines that have slow floating point or memory load instructions
8556 by allowing other instructions to be issued until the result of the load
8557 or floating-point instruction is required.
8558
8559 Enabled at levels @option{-O2}, @option{-O3}.
8560
8561 @item -fschedule-insns2
8562 @opindex fschedule-insns2
8563 Similar to @option{-fschedule-insns}, but requests an additional pass of
8564 instruction scheduling after register allocation has been done. This is
8565 especially useful on machines with a relatively small number of
8566 registers and where memory load instructions take more than one cycle.
8567
8568 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8569
8570 @item -fno-sched-interblock
8571 @opindex fno-sched-interblock
8572 Don't schedule instructions across basic blocks. This is normally
8573 enabled by default when scheduling before register allocation, i.e.@:
8574 with @option{-fschedule-insns} or at @option{-O2} or higher.
8575
8576 @item -fno-sched-spec
8577 @opindex fno-sched-spec
8578 Don't allow speculative motion of non-load instructions. This is normally
8579 enabled by default when scheduling before register allocation, i.e.@:
8580 with @option{-fschedule-insns} or at @option{-O2} or higher.
8581
8582 @item -fsched-pressure
8583 @opindex fsched-pressure
8584 Enable register pressure sensitive insn scheduling before register
8585 allocation. This only makes sense when scheduling before register
8586 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
8587 @option{-O2} or higher. Usage of this option can improve the
8588 generated code and decrease its size by preventing register pressure
8589 increase above the number of available hard registers and subsequent
8590 spills in register allocation.
8591
8592 @item -fsched-spec-load
8593 @opindex fsched-spec-load
8594 Allow speculative motion of some load instructions. This only makes
8595 sense when scheduling before register allocation, i.e.@: with
8596 @option{-fschedule-insns} or at @option{-O2} or higher.
8597
8598 @item -fsched-spec-load-dangerous
8599 @opindex fsched-spec-load-dangerous
8600 Allow speculative motion of more load instructions. This only makes
8601 sense when scheduling before register allocation, i.e.@: with
8602 @option{-fschedule-insns} or at @option{-O2} or higher.
8603
8604 @item -fsched-stalled-insns
8605 @itemx -fsched-stalled-insns=@var{n}
8606 @opindex fsched-stalled-insns
8607 Define how many insns (if any) can be moved prematurely from the queue
8608 of stalled insns into the ready list during the second scheduling pass.
8609 @option{-fno-sched-stalled-insns} means that no insns are moved
8610 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
8611 on how many queued insns can be moved prematurely.
8612 @option{-fsched-stalled-insns} without a value is equivalent to
8613 @option{-fsched-stalled-insns=1}.
8614
8615 @item -fsched-stalled-insns-dep
8616 @itemx -fsched-stalled-insns-dep=@var{n}
8617 @opindex fsched-stalled-insns-dep
8618 Define how many insn groups (cycles) are examined for a dependency
8619 on a stalled insn that is a candidate for premature removal from the queue
8620 of stalled insns. This has an effect only during the second scheduling pass,
8621 and only if @option{-fsched-stalled-insns} is used.
8622 @option{-fno-sched-stalled-insns-dep} is equivalent to
8623 @option{-fsched-stalled-insns-dep=0}.
8624 @option{-fsched-stalled-insns-dep} without a value is equivalent to
8625 @option{-fsched-stalled-insns-dep=1}.
8626
8627 @item -fsched2-use-superblocks
8628 @opindex fsched2-use-superblocks
8629 When scheduling after register allocation, use superblock scheduling.
8630 This allows motion across basic block boundaries,
8631 resulting in faster schedules. This option is experimental, as not all machine
8632 descriptions used by GCC model the CPU closely enough to avoid unreliable
8633 results from the algorithm.
8634
8635 This only makes sense when scheduling after register allocation, i.e.@: with
8636 @option{-fschedule-insns2} or at @option{-O2} or higher.
8637
8638 @item -fsched-group-heuristic
8639 @opindex fsched-group-heuristic
8640 Enable the group heuristic in the scheduler. This heuristic favors
8641 the instruction that belongs to a schedule group. This is enabled
8642 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8643 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8644
8645 @item -fsched-critical-path-heuristic
8646 @opindex fsched-critical-path-heuristic
8647 Enable the critical-path heuristic in the scheduler. This heuristic favors
8648 instructions on the critical path. This is enabled by default when
8649 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
8650 or @option{-fschedule-insns2} or at @option{-O2} or higher.
8651
8652 @item -fsched-spec-insn-heuristic
8653 @opindex fsched-spec-insn-heuristic
8654 Enable the speculative instruction heuristic in the scheduler. This
8655 heuristic favors speculative instructions with greater dependency weakness.
8656 This is enabled by default when scheduling is enabled, i.e.@:
8657 with @option{-fschedule-insns} or @option{-fschedule-insns2}
8658 or at @option{-O2} or higher.
8659
8660 @item -fsched-rank-heuristic
8661 @opindex fsched-rank-heuristic
8662 Enable the rank heuristic in the scheduler. This heuristic favors
8663 the instruction belonging to a basic block with greater size or frequency.
8664 This is enabled by default when scheduling is enabled, i.e.@:
8665 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8666 at @option{-O2} or higher.
8667
8668 @item -fsched-last-insn-heuristic
8669 @opindex fsched-last-insn-heuristic
8670 Enable the last-instruction heuristic in the scheduler. This heuristic
8671 favors the instruction that is less dependent on the last instruction
8672 scheduled. This is enabled by default when scheduling is enabled,
8673 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8674 at @option{-O2} or higher.
8675
8676 @item -fsched-dep-count-heuristic
8677 @opindex fsched-dep-count-heuristic
8678 Enable the dependent-count heuristic in the scheduler. This heuristic
8679 favors the instruction that has more instructions depending on it.
8680 This is enabled by default when scheduling is enabled, i.e.@:
8681 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
8682 at @option{-O2} or higher.
8683
8684 @item -freschedule-modulo-scheduled-loops
8685 @opindex freschedule-modulo-scheduled-loops
8686 Modulo scheduling is performed before traditional scheduling. If a loop
8687 is modulo scheduled, later scheduling passes may change its schedule.
8688 Use this option to control that behavior.
8689
8690 @item -fselective-scheduling
8691 @opindex fselective-scheduling
8692 Schedule instructions using selective scheduling algorithm. Selective
8693 scheduling runs instead of the first scheduler pass.
8694
8695 @item -fselective-scheduling2
8696 @opindex fselective-scheduling2
8697 Schedule instructions using selective scheduling algorithm. Selective
8698 scheduling runs instead of the second scheduler pass.
8699
8700 @item -fsel-sched-pipelining
8701 @opindex fsel-sched-pipelining
8702 Enable software pipelining of innermost loops during selective scheduling.
8703 This option has no effect unless one of @option{-fselective-scheduling} or
8704 @option{-fselective-scheduling2} is turned on.
8705
8706 @item -fsel-sched-pipelining-outer-loops
8707 @opindex fsel-sched-pipelining-outer-loops
8708 When pipelining loops during selective scheduling, also pipeline outer loops.
8709 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
8710
8711 @item -fsemantic-interposition
8712 @opindex fsemantic-interposition
8713 Some object formats, like ELF, allow interposing of symbols by the
8714 dynamic linker.
8715 This means that for symbols exported from the DSO, the compiler cannot perform
8716 interprocedural propagation, inlining and other optimizations in anticipation
8717 that the function or variable in question may change. While this feature is
8718 useful, for example, to rewrite memory allocation functions by a debugging
8719 implementation, it is expensive in the terms of code quality.
8720 With @option{-fno-semantic-interposition} the compiler assumes that
8721 if interposition happens for functions the overwriting function will have
8722 precisely the same semantics (and side effects).
8723 Similarly if interposition happens
8724 for variables, the constructor of the variable will be the same. The flag
8725 has no effect for functions explicitly declared inline
8726 (where it is never allowed for interposition to change semantics)
8727 and for symbols explicitly declared weak.
8728
8729 @item -fshrink-wrap
8730 @opindex fshrink-wrap
8731 Emit function prologues only before parts of the function that need it,
8732 rather than at the top of the function. This flag is enabled by default at
8733 @option{-O} and higher.
8734
8735 @item -fshrink-wrap-separate
8736 @opindex fshrink-wrap-separate
8737 Shrink-wrap separate parts of the prologue and epilogue separately, so that
8738 those parts are only executed when needed.
8739 This option is on by default, but has no effect unless @option{-fshrink-wrap}
8740 is also turned on and the target supports this.
8741
8742 @item -fcaller-saves
8743 @opindex fcaller-saves
8744 Enable allocation of values to registers that are clobbered by
8745 function calls, by emitting extra instructions to save and restore the
8746 registers around such calls. Such allocation is done only when it
8747 seems to result in better code.
8748
8749 This option is always enabled by default on certain machines, usually
8750 those which have no call-preserved registers to use instead.
8751
8752 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8753
8754 @item -fcombine-stack-adjustments
8755 @opindex fcombine-stack-adjustments
8756 Tracks stack adjustments (pushes and pops) and stack memory references
8757 and then tries to find ways to combine them.
8758
8759 Enabled by default at @option{-O1} and higher.
8760
8761 @item -fipa-ra
8762 @opindex fipa-ra
8763 Use caller save registers for allocation if those registers are not used by
8764 any called function. In that case it is not necessary to save and restore
8765 them around calls. This is only possible if called functions are part of
8766 same compilation unit as current function and they are compiled before it.
8767
8768 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
8769 is disabled if generated code will be instrumented for profiling
8770 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
8771 exactly (this happens on targets that do not expose prologues
8772 and epilogues in RTL).
8773
8774 @item -fconserve-stack
8775 @opindex fconserve-stack
8776 Attempt to minimize stack usage. The compiler attempts to use less
8777 stack space, even if that makes the program slower. This option
8778 implies setting the @option{large-stack-frame} parameter to 100
8779 and the @option{large-stack-frame-growth} parameter to 400.
8780
8781 @item -ftree-reassoc
8782 @opindex ftree-reassoc
8783 Perform reassociation on trees. This flag is enabled by default
8784 at @option{-O} and higher.
8785
8786 @item -fcode-hoisting
8787 @opindex fcode-hoisting
8788 Perform code hoisting. Code hoisting tries to move the
8789 evaluation of expressions executed on all paths to the function exit
8790 as early as possible. This is especially useful as a code size
8791 optimization, but it often helps for code speed as well.
8792 This flag is enabled by default at @option{-O2} and higher.
8793
8794 @item -ftree-pre
8795 @opindex ftree-pre
8796 Perform partial redundancy elimination (PRE) on trees. This flag is
8797 enabled by default at @option{-O2} and @option{-O3}.
8798
8799 @item -ftree-partial-pre
8800 @opindex ftree-partial-pre
8801 Make partial redundancy elimination (PRE) more aggressive. This flag is
8802 enabled by default at @option{-O3}.
8803
8804 @item -ftree-forwprop
8805 @opindex ftree-forwprop
8806 Perform forward propagation on trees. This flag is enabled by default
8807 at @option{-O} and higher.
8808
8809 @item -ftree-fre
8810 @opindex ftree-fre
8811 Perform full redundancy elimination (FRE) on trees. The difference
8812 between FRE and PRE is that FRE only considers expressions
8813 that are computed on all paths leading to the redundant computation.
8814 This analysis is faster than PRE, though it exposes fewer redundancies.
8815 This flag is enabled by default at @option{-O} and higher.
8816
8817 @item -ftree-phiprop
8818 @opindex ftree-phiprop
8819 Perform hoisting of loads from conditional pointers on trees. This
8820 pass is enabled by default at @option{-O} and higher.
8821
8822 @item -fhoist-adjacent-loads
8823 @opindex fhoist-adjacent-loads
8824 Speculatively hoist loads from both branches of an if-then-else if the
8825 loads are from adjacent locations in the same structure and the target
8826 architecture has a conditional move instruction. This flag is enabled
8827 by default at @option{-O2} and higher.
8828
8829 @item -ftree-copy-prop
8830 @opindex ftree-copy-prop
8831 Perform copy propagation on trees. This pass eliminates unnecessary
8832 copy operations. This flag is enabled by default at @option{-O} and
8833 higher.
8834
8835 @item -fipa-pure-const
8836 @opindex fipa-pure-const
8837 Discover which functions are pure or constant.
8838 Enabled by default at @option{-O} and higher.
8839
8840 @item -fipa-reference
8841 @opindex fipa-reference
8842 Discover which static variables do not escape the
8843 compilation unit.
8844 Enabled by default at @option{-O} and higher.
8845
8846 @item -fipa-pta
8847 @opindex fipa-pta
8848 Perform interprocedural pointer analysis and interprocedural modification
8849 and reference analysis. This option can cause excessive memory and
8850 compile-time usage on large compilation units. It is not enabled by
8851 default at any optimization level.
8852
8853 @item -fipa-profile
8854 @opindex fipa-profile
8855 Perform interprocedural profile propagation. The functions called only from
8856 cold functions are marked as cold. Also functions executed once (such as
8857 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
8858 functions and loop less parts of functions executed once are then optimized for
8859 size.
8860 Enabled by default at @option{-O} and higher.
8861
8862 @item -fipa-cp
8863 @opindex fipa-cp
8864 Perform interprocedural constant propagation.
8865 This optimization analyzes the program to determine when values passed
8866 to functions are constants and then optimizes accordingly.
8867 This optimization can substantially increase performance
8868 if the application has constants passed to functions.
8869 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
8870
8871 @item -fipa-cp-clone
8872 @opindex fipa-cp-clone
8873 Perform function cloning to make interprocedural constant propagation stronger.
8874 When enabled, interprocedural constant propagation performs function cloning
8875 when externally visible function can be called with constant arguments.
8876 Because this optimization can create multiple copies of functions,
8877 it may significantly increase code size
8878 (see @option{--param ipcp-unit-growth=@var{value}}).
8879 This flag is enabled by default at @option{-O3}.
8880
8881 @item -fipa-bit-cp
8882 @opindex -fipa-bit-cp
8883 When enabled, perform interprocedural bitwise constant
8884 propagation. This flag is enabled by default at @option{-O2}. It
8885 requires that @option{-fipa-cp} is enabled.
8886
8887 @item -fipa-vrp
8888 @opindex -fipa-vrp
8889 When enabled, perform interprocedural propagation of value
8890 ranges. This flag is enabled by default at @option{-O2}. It requires
8891 that @option{-fipa-cp} is enabled.
8892
8893 @item -fipa-icf
8894 @opindex fipa-icf
8895 Perform Identical Code Folding for functions and read-only variables.
8896 The optimization reduces code size and may disturb unwind stacks by replacing
8897 a function by equivalent one with a different name. The optimization works
8898 more effectively with link-time optimization enabled.
8899
8900 Nevertheless the behavior is similar to Gold Linker ICF optimization, GCC ICF
8901 works on different levels and thus the optimizations are not same - there are
8902 equivalences that are found only by GCC and equivalences found only by Gold.
8903
8904 This flag is enabled by default at @option{-O2} and @option{-Os}.
8905
8906 @item -fisolate-erroneous-paths-dereference
8907 @opindex fisolate-erroneous-paths-dereference
8908 Detect paths that trigger erroneous or undefined behavior due to
8909 dereferencing a null pointer. Isolate those paths from the main control
8910 flow and turn the statement with erroneous or undefined behavior into a trap.
8911 This flag is enabled by default at @option{-O2} and higher and depends on
8912 @option{-fdelete-null-pointer-checks} also being enabled.
8913
8914 @item -fisolate-erroneous-paths-attribute
8915 @opindex fisolate-erroneous-paths-attribute
8916 Detect paths that trigger erroneous or undefined behavior due to a null value
8917 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
8918 attribute. Isolate those paths from the main control flow and turn the
8919 statement with erroneous or undefined behavior into a trap. This is not
8920 currently enabled, but may be enabled by @option{-O2} in the future.
8921
8922 @item -ftree-sink
8923 @opindex ftree-sink
8924 Perform forward store motion on trees. This flag is
8925 enabled by default at @option{-O} and higher.
8926
8927 @item -ftree-bit-ccp
8928 @opindex ftree-bit-ccp
8929 Perform sparse conditional bit constant propagation on trees and propagate
8930 pointer alignment information.
8931 This pass only operates on local scalar variables and is enabled by default
8932 at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
8933
8934 @item -ftree-ccp
8935 @opindex ftree-ccp
8936 Perform sparse conditional constant propagation (CCP) on trees. This
8937 pass only operates on local scalar variables and is enabled by default
8938 at @option{-O} and higher.
8939
8940 @item -fssa-backprop
8941 @opindex fssa-backprop
8942 Propagate information about uses of a value up the definition chain
8943 in order to simplify the definitions. For example, this pass strips
8944 sign operations if the sign of a value never matters. The flag is
8945 enabled by default at @option{-O} and higher.
8946
8947 @item -fssa-phiopt
8948 @opindex fssa-phiopt
8949 Perform pattern matching on SSA PHI nodes to optimize conditional
8950 code. This pass is enabled by default at @option{-O} and higher.
8951
8952 @item -ftree-switch-conversion
8953 @opindex ftree-switch-conversion
8954 Perform conversion of simple initializations in a switch to
8955 initializations from a scalar array. This flag is enabled by default
8956 at @option{-O2} and higher.
8957
8958 @item -ftree-tail-merge
8959 @opindex ftree-tail-merge
8960 Look for identical code sequences. When found, replace one with a jump to the
8961 other. This optimization is known as tail merging or cross jumping. This flag
8962 is enabled by default at @option{-O2} and higher. The compilation time
8963 in this pass can
8964 be limited using @option{max-tail-merge-comparisons} parameter and
8965 @option{max-tail-merge-iterations} parameter.
8966
8967 @item -ftree-dce
8968 @opindex ftree-dce
8969 Perform dead code elimination (DCE) on trees. This flag is enabled by
8970 default at @option{-O} and higher.
8971
8972 @item -ftree-builtin-call-dce
8973 @opindex ftree-builtin-call-dce
8974 Perform conditional dead code elimination (DCE) for calls to built-in functions
8975 that may set @code{errno} but are otherwise free of side effects. This flag is
8976 enabled by default at @option{-O2} and higher if @option{-Os} is not also
8977 specified.
8978
8979 @item -ftree-dominator-opts
8980 @opindex ftree-dominator-opts
8981 Perform a variety of simple scalar cleanups (constant/copy
8982 propagation, redundancy elimination, range propagation and expression
8983 simplification) based on a dominator tree traversal. This also
8984 performs jump threading (to reduce jumps to jumps). This flag is
8985 enabled by default at @option{-O} and higher.
8986
8987 @item -ftree-dse
8988 @opindex ftree-dse
8989 Perform dead store elimination (DSE) on trees. A dead store is a store into
8990 a memory location that is later overwritten by another store without
8991 any intervening loads. In this case the earlier store can be deleted. This
8992 flag is enabled by default at @option{-O} and higher.
8993
8994 @item -ftree-ch
8995 @opindex ftree-ch
8996 Perform loop header copying on trees. This is beneficial since it increases
8997 effectiveness of code motion optimizations. It also saves one jump. This flag
8998 is enabled by default at @option{-O} and higher. It is not enabled
8999 for @option{-Os}, since it usually increases code size.
9000
9001 @item -ftree-loop-optimize
9002 @opindex ftree-loop-optimize
9003 Perform loop optimizations on trees. This flag is enabled by default
9004 at @option{-O} and higher.
9005
9006 @item -ftree-loop-linear
9007 @itemx -floop-strip-mine
9008 @itemx -floop-block
9009 @opindex ftree-loop-linear
9010 @opindex floop-strip-mine
9011 @opindex floop-block
9012 Perform loop nest optimizations. Same as
9013 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9014 to be configured with @option{--with-isl} to enable the Graphite loop
9015 transformation infrastructure.
9016
9017 @item -fgraphite-identity
9018 @opindex fgraphite-identity
9019 Enable the identity transformation for graphite. For every SCoP we generate
9020 the polyhedral representation and transform it back to gimple. Using
9021 @option{-fgraphite-identity} we can check the costs or benefits of the
9022 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9023 are also performed by the code generator isl, like index splitting and
9024 dead code elimination in loops.
9025
9026 @item -floop-nest-optimize
9027 @opindex floop-nest-optimize
9028 Enable the isl based loop nest optimizer. This is a generic loop nest
9029 optimizer based on the Pluto optimization algorithms. It calculates a loop
9030 structure optimized for data-locality and parallelism. This option
9031 is experimental.
9032
9033 @item -floop-parallelize-all
9034 @opindex floop-parallelize-all
9035 Use the Graphite data dependence analysis to identify loops that can
9036 be parallelized. Parallelize all the loops that can be analyzed to
9037 not contain loop carried dependences without checking that it is
9038 profitable to parallelize the loops.
9039
9040 @item -ftree-coalesce-vars
9041 @opindex ftree-coalesce-vars
9042 While transforming the program out of the SSA representation, attempt to
9043 reduce copying by coalescing versions of different user-defined
9044 variables, instead of just compiler temporaries. This may severely
9045 limit the ability to debug an optimized program compiled with
9046 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9047 prevents SSA coalescing of user variables. This option is enabled by
9048 default if optimization is enabled, and it does very little otherwise.
9049
9050 @item -ftree-loop-if-convert
9051 @opindex ftree-loop-if-convert
9052 Attempt to transform conditional jumps in the innermost loops to
9053 branch-less equivalents. The intent is to remove control-flow from
9054 the innermost loops in order to improve the ability of the
9055 vectorization pass to handle these loops. This is enabled by default
9056 if vectorization is enabled.
9057
9058 @item -ftree-loop-distribution
9059 @opindex ftree-loop-distribution
9060 Perform loop distribution. This flag can improve cache performance on
9061 big loop bodies and allow further loop optimizations, like
9062 parallelization or vectorization, to take place. For example, the loop
9063 @smallexample
9064 DO I = 1, N
9065 A(I) = B(I) + C
9066 D(I) = E(I) * F
9067 ENDDO
9068 @end smallexample
9069 is transformed to
9070 @smallexample
9071 DO I = 1, N
9072 A(I) = B(I) + C
9073 ENDDO
9074 DO I = 1, N
9075 D(I) = E(I) * F
9076 ENDDO
9077 @end smallexample
9078
9079 @item -ftree-loop-distribute-patterns
9080 @opindex ftree-loop-distribute-patterns
9081 Perform loop distribution of patterns that can be code generated with
9082 calls to a library. This flag is enabled by default at @option{-O3}.
9083
9084 This pass distributes the initialization loops and generates a call to
9085 memset zero. For example, the loop
9086 @smallexample
9087 DO I = 1, N
9088 A(I) = 0
9089 B(I) = A(I) + I
9090 ENDDO
9091 @end smallexample
9092 is transformed to
9093 @smallexample
9094 DO I = 1, N
9095 A(I) = 0
9096 ENDDO
9097 DO I = 1, N
9098 B(I) = A(I) + I
9099 ENDDO
9100 @end smallexample
9101 and the initialization loop is transformed into a call to memset zero.
9102
9103 @item -floop-interchange
9104 @opindex floop-interchange
9105 Perform loop interchange outside of graphite. This flag can improve cache
9106 performance on loop nest and allow further loop optimizations, like
9107 vectorization, to take place. For example, the loop
9108 @smallexample
9109 for (int i = 0; i < N; i++)
9110 for (int j = 0; j < N; j++)
9111 for (int k = 0; k < N; k++)
9112 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9113 @end smallexample
9114 is transformed to
9115 @smallexample
9116 for (int i = 0; i < N; i++)
9117 for (int k = 0; k < N; k++)
9118 for (int j = 0; j < N; j++)
9119 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9120 @end smallexample
9121 This flag is enabled by default at @option{-O3}.
9122
9123 @item -floop-unroll-and-jam
9124 @opindex floop-unroll-and-jam
9125 Apply unroll and jam transformations on feasible loops. In a loop
9126 nest this unrolls the outer loop by some factor and fuses the resulting
9127 multiple inner loops. This flag is enabled by default at @option{-O3}.
9128
9129 @item -ftree-loop-im
9130 @opindex ftree-loop-im
9131 Perform loop invariant motion on trees. This pass moves only invariants that
9132 are hard to handle at RTL level (function calls, operations that expand to
9133 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9134 operands of conditions that are invariant out of the loop, so that we can use
9135 just trivial invariantness analysis in loop unswitching. The pass also includes
9136 store motion.
9137
9138 @item -ftree-loop-ivcanon
9139 @opindex ftree-loop-ivcanon
9140 Create a canonical counter for number of iterations in loops for which
9141 determining number of iterations requires complicated analysis. Later
9142 optimizations then may determine the number easily. Useful especially
9143 in connection with unrolling.
9144
9145 @item -ftree-scev-cprop
9146 @opindex ftree-scev-cprop
9147 Perform final value replacement. If a variable is modified in a loop
9148 in such a way that its value when exiting the loop can be determined using
9149 only its initial value and the number of loop iterations, replace uses of
9150 the final value by such a computation, provided it is sufficiently cheap.
9151 This reduces data dependencies and may allow further simplifications.
9152 Enabled by default at @option{-O} and higher.
9153
9154 @item -fivopts
9155 @opindex fivopts
9156 Perform induction variable optimizations (strength reduction, induction
9157 variable merging and induction variable elimination) on trees.
9158
9159 @item -ftree-parallelize-loops=n
9160 @opindex ftree-parallelize-loops
9161 Parallelize loops, i.e., split their iteration space to run in n threads.
9162 This is only possible for loops whose iterations are independent
9163 and can be arbitrarily reordered. The optimization is only
9164 profitable on multiprocessor machines, for loops that are CPU-intensive,
9165 rather than constrained e.g.@: by memory bandwidth. This option
9166 implies @option{-pthread}, and thus is only supported on targets
9167 that have support for @option{-pthread}.
9168
9169 @item -ftree-pta
9170 @opindex ftree-pta
9171 Perform function-local points-to analysis on trees. This flag is
9172 enabled by default at @option{-O} and higher.
9173
9174 @item -ftree-sra
9175 @opindex ftree-sra
9176 Perform scalar replacement of aggregates. This pass replaces structure
9177 references with scalars to prevent committing structures to memory too
9178 early. This flag is enabled by default at @option{-O} and higher.
9179
9180 @item -fstore-merging
9181 @opindex fstore-merging
9182 Perform merging of narrow stores to consecutive memory addresses. This pass
9183 merges contiguous stores of immediate values narrower than a word into fewer
9184 wider stores to reduce the number of instructions. This is enabled by default
9185 at @option{-O2} and higher as well as @option{-Os}.
9186
9187 @item -ftree-ter
9188 @opindex ftree-ter
9189 Perform temporary expression replacement during the SSA->normal phase. Single
9190 use/single def temporaries are replaced at their use location with their
9191 defining expression. This results in non-GIMPLE code, but gives the expanders
9192 much more complex trees to work on resulting in better RTL generation. This is
9193 enabled by default at @option{-O} and higher.
9194
9195 @item -ftree-slsr
9196 @opindex ftree-slsr
9197 Perform straight-line strength reduction on trees. This recognizes related
9198 expressions involving multiplications and replaces them by less expensive
9199 calculations when possible. This is enabled by default at @option{-O} and
9200 higher.
9201
9202 @item -ftree-vectorize
9203 @opindex ftree-vectorize
9204 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9205 and @option{-ftree-slp-vectorize} if not explicitly specified.
9206
9207 @item -ftree-loop-vectorize
9208 @opindex ftree-loop-vectorize
9209 Perform loop vectorization on trees. This flag is enabled by default at
9210 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9211
9212 @item -ftree-slp-vectorize
9213 @opindex ftree-slp-vectorize
9214 Perform basic block vectorization on trees. This flag is enabled by default at
9215 @option{-O3} and when @option{-ftree-vectorize} is enabled.
9216
9217 @item -fvect-cost-model=@var{model}
9218 @opindex fvect-cost-model
9219 Alter the cost model used for vectorization. The @var{model} argument
9220 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9221 With the @samp{unlimited} model the vectorized code-path is assumed
9222 to be profitable while with the @samp{dynamic} model a runtime check
9223 guards the vectorized code-path to enable it only for iteration
9224 counts that will likely execute faster than when executing the original
9225 scalar loop. The @samp{cheap} model disables vectorization of
9226 loops where doing so would be cost prohibitive for example due to
9227 required runtime checks for data dependence or alignment but otherwise
9228 is equal to the @samp{dynamic} model.
9229 The default cost model depends on other optimization flags and is
9230 either @samp{dynamic} or @samp{cheap}.
9231
9232 @item -fsimd-cost-model=@var{model}
9233 @opindex fsimd-cost-model
9234 Alter the cost model used for vectorization of loops marked with the OpenMP
9235 simd directive. The @var{model} argument should be one of
9236 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9237 have the same meaning as described in @option{-fvect-cost-model} and by
9238 default a cost model defined with @option{-fvect-cost-model} is used.
9239
9240 @item -ftree-vrp
9241 @opindex ftree-vrp
9242 Perform Value Range Propagation on trees. This is similar to the
9243 constant propagation pass, but instead of values, ranges of values are
9244 propagated. This allows the optimizers to remove unnecessary range
9245 checks like array bound checks and null pointer checks. This is
9246 enabled by default at @option{-O2} and higher. Null pointer check
9247 elimination is only done if @option{-fdelete-null-pointer-checks} is
9248 enabled.
9249
9250 @item -fsplit-paths
9251 @opindex fsplit-paths
9252 Split paths leading to loop backedges. This can improve dead code
9253 elimination and common subexpression elimination. This is enabled by
9254 default at @option{-O2} and above.
9255
9256 @item -fsplit-ivs-in-unroller
9257 @opindex fsplit-ivs-in-unroller
9258 Enables expression of values of induction variables in later iterations
9259 of the unrolled loop using the value in the first iteration. This breaks
9260 long dependency chains, thus improving efficiency of the scheduling passes.
9261
9262 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9263 same effect. However, that is not reliable in cases where the loop body
9264 is more complicated than a single basic block. It also does not work at all
9265 on some architectures due to restrictions in the CSE pass.
9266
9267 This optimization is enabled by default.
9268
9269 @item -fvariable-expansion-in-unroller
9270 @opindex fvariable-expansion-in-unroller
9271 With this option, the compiler creates multiple copies of some
9272 local variables when unrolling a loop, which can result in superior code.
9273
9274 @item -fpartial-inlining
9275 @opindex fpartial-inlining
9276 Inline parts of functions. This option has any effect only
9277 when inlining itself is turned on by the @option{-finline-functions}
9278 or @option{-finline-small-functions} options.
9279
9280 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9281
9282 @item -fpredictive-commoning
9283 @opindex fpredictive-commoning
9284 Perform predictive commoning optimization, i.e., reusing computations
9285 (especially memory loads and stores) performed in previous
9286 iterations of loops.
9287
9288 This option is enabled at level @option{-O3}.
9289
9290 @item -fprefetch-loop-arrays
9291 @opindex fprefetch-loop-arrays
9292 If supported by the target machine, generate instructions to prefetch
9293 memory to improve the performance of loops that access large arrays.
9294
9295 This option may generate better or worse code; results are highly
9296 dependent on the structure of loops within the source code.
9297
9298 Disabled at level @option{-Os}.
9299
9300 @item -fno-printf-return-value
9301 @opindex fno-printf-return-value
9302 Do not substitute constants for known return value of formatted output
9303 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9304 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9305 transformation allows GCC to optimize or even eliminate branches based
9306 on the known return value of these functions called with arguments that
9307 are either constant, or whose values are known to be in a range that
9308 makes determining the exact return value possible. For example, when
9309 @option{-fprintf-return-value} is in effect, both the branch and the
9310 body of the @code{if} statement (but not the call to @code{snprint})
9311 can be optimized away when @code{i} is a 32-bit or smaller integer
9312 because the return value is guaranteed to be at most 8.
9313
9314 @smallexample
9315 char buf[9];
9316 if (snprintf (buf, "%08x", i) >= sizeof buf)
9317 @dots{}
9318 @end smallexample
9319
9320 The @option{-fprintf-return-value} option relies on other optimizations
9321 and yields best results with @option{-O2} and above. It works in tandem
9322 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9323 options. The @option{-fprintf-return-value} option is enabled by default.
9324
9325 @item -fno-peephole
9326 @itemx -fno-peephole2
9327 @opindex fno-peephole
9328 @opindex fno-peephole2
9329 Disable any machine-specific peephole optimizations. The difference
9330 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9331 are implemented in the compiler; some targets use one, some use the
9332 other, a few use both.
9333
9334 @option{-fpeephole} is enabled by default.
9335 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9336
9337 @item -fno-guess-branch-probability
9338 @opindex fno-guess-branch-probability
9339 Do not guess branch probabilities using heuristics.
9340
9341 GCC uses heuristics to guess branch probabilities if they are
9342 not provided by profiling feedback (@option{-fprofile-arcs}). These
9343 heuristics are based on the control flow graph. If some branch probabilities
9344 are specified by @code{__builtin_expect}, then the heuristics are
9345 used to guess branch probabilities for the rest of the control flow graph,
9346 taking the @code{__builtin_expect} info into account. The interactions
9347 between the heuristics and @code{__builtin_expect} can be complex, and in
9348 some cases, it may be useful to disable the heuristics so that the effects
9349 of @code{__builtin_expect} are easier to understand.
9350
9351 It is also possible to specify expected probability of the expression
9352 with @code{__builtin_expect_with_probability} built-in function.
9353
9354 The default is @option{-fguess-branch-probability} at levels
9355 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9356
9357 @item -freorder-blocks
9358 @opindex freorder-blocks
9359 Reorder basic blocks in the compiled function in order to reduce number of
9360 taken branches and improve code locality.
9361
9362 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9363
9364 @item -freorder-blocks-algorithm=@var{algorithm}
9365 @opindex freorder-blocks-algorithm
9366 Use the specified algorithm for basic block reordering. The
9367 @var{algorithm} argument can be @samp{simple}, which does not increase
9368 code size (except sometimes due to secondary effects like alignment),
9369 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9370 put all often executed code together, minimizing the number of branches
9371 executed by making extra copies of code.
9372
9373 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9374 @samp{stc} at levels @option{-O2}, @option{-O3}.
9375
9376 @item -freorder-blocks-and-partition
9377 @opindex freorder-blocks-and-partition
9378 In addition to reordering basic blocks in the compiled function, in order
9379 to reduce number of taken branches, partitions hot and cold basic blocks
9380 into separate sections of the assembly and @file{.o} files, to improve
9381 paging and cache locality performance.
9382
9383 This optimization is automatically turned off in the presence of
9384 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
9385 section attribute and on any architecture that does not support named
9386 sections. When @option{-fsplit-stack} is used this option is not
9387 enabled by default (to avoid linker errors), but may be enabled
9388 explicitly (if using a working linker).
9389
9390 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
9391
9392 @item -freorder-functions
9393 @opindex freorder-functions
9394 Reorder functions in the object file in order to
9395 improve code locality. This is implemented by using special
9396 subsections @code{.text.hot} for most frequently executed functions and
9397 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
9398 the linker so object file format must support named sections and linker must
9399 place them in a reasonable way.
9400
9401 Also profile feedback must be available to make this option effective. See
9402 @option{-fprofile-arcs} for details.
9403
9404 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9405
9406 @item -fstrict-aliasing
9407 @opindex fstrict-aliasing
9408 Allow the compiler to assume the strictest aliasing rules applicable to
9409 the language being compiled. For C (and C++), this activates
9410 optimizations based on the type of expressions. In particular, an
9411 object of one type is assumed never to reside at the same address as an
9412 object of a different type, unless the types are almost the same. For
9413 example, an @code{unsigned int} can alias an @code{int}, but not a
9414 @code{void*} or a @code{double}. A character type may alias any other
9415 type.
9416
9417 @anchor{Type-punning}Pay special attention to code like this:
9418 @smallexample
9419 union a_union @{
9420 int i;
9421 double d;
9422 @};
9423
9424 int f() @{
9425 union a_union t;
9426 t.d = 3.0;
9427 return t.i;
9428 @}
9429 @end smallexample
9430 The practice of reading from a different union member than the one most
9431 recently written to (called ``type-punning'') is common. Even with
9432 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
9433 is accessed through the union type. So, the code above works as
9434 expected. @xref{Structures unions enumerations and bit-fields
9435 implementation}. However, this code might not:
9436 @smallexample
9437 int f() @{
9438 union a_union t;
9439 int* ip;
9440 t.d = 3.0;
9441 ip = &t.i;
9442 return *ip;
9443 @}
9444 @end smallexample
9445
9446 Similarly, access by taking the address, casting the resulting pointer
9447 and dereferencing the result has undefined behavior, even if the cast
9448 uses a union type, e.g.:
9449 @smallexample
9450 int f() @{
9451 double d = 3.0;
9452 return ((union a_union *) &d)->i;
9453 @}
9454 @end smallexample
9455
9456 The @option{-fstrict-aliasing} option is enabled at levels
9457 @option{-O2}, @option{-O3}, @option{-Os}.
9458
9459 @item -falign-functions
9460 @itemx -falign-functions=@var{n}
9461 @itemx -falign-functions=@var{n}:@var{m}
9462 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
9463 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
9464 @opindex falign-functions
9465 Align the start of functions to the next power-of-two greater than
9466 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
9467 the first @var{m} bytes of the function can be fetched by the CPU
9468 without crossing an @var{n}-byte alignment boundary.
9469
9470 If @var{m} is not specified, it defaults to @var{n}.
9471
9472 Examples: @option{-falign-functions=32} aligns functions to the next
9473 32-byte boundary, @option{-falign-functions=24} aligns to the next
9474 32-byte boundary only if this can be done by skipping 23 bytes or less,
9475 @option{-falign-functions=32:7} aligns to the next
9476 32-byte boundary only if this can be done by skipping 6 bytes or less.
9477
9478 The second pair of @var{n2}:@var{m2} values allows you to specify
9479 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
9480 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
9481 otherwise aligns to the next 32-byte boundary if this can be done
9482 by skipping 2 bytes or less.
9483 If @var{m2} is not specified, it defaults to @var{n2}.
9484
9485 Some assemblers only support this flag when @var{n} is a power of two;
9486 in that case, it is rounded up.
9487
9488 @option{-fno-align-functions} and @option{-falign-functions=1} are
9489 equivalent and mean that functions are not aligned.
9490
9491 If @var{n} is not specified or is zero, use a machine-dependent default.
9492 The maximum allowed @var{n} option value is 65536.
9493
9494 Enabled at levels @option{-O2}, @option{-O3}.
9495
9496 @item -flimit-function-alignment
9497 If this option is enabled, the compiler tries to avoid unnecessarily
9498 overaligning functions. It attempts to instruct the assembler to align
9499 by the amount specified by @option{-falign-functions}, but not to
9500 skip more bytes than the size of the function.
9501
9502 @item -falign-labels
9503 @itemx -falign-labels=@var{n}
9504 @itemx -falign-labels=@var{n}:@var{m}
9505 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
9506 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
9507 @opindex falign-labels
9508 Align all branch targets to a power-of-two boundary.
9509
9510 Parameters of this option are analogous to the @option{-falign-functions} option.
9511 @option{-fno-align-labels} and @option{-falign-labels=1} are
9512 equivalent and mean that labels are not aligned.
9513
9514 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
9515 are greater than this value, then their values are used instead.
9516
9517 If @var{n} is not specified or is zero, use a machine-dependent default
9518 which is very likely to be @samp{1}, meaning no alignment.
9519 The maximum allowed @var{n} option value is 65536.
9520
9521 Enabled at levels @option{-O2}, @option{-O3}.
9522
9523 @item -falign-loops
9524 @itemx -falign-loops=@var{n}
9525 @itemx -falign-loops=@var{n}:@var{m}
9526 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
9527 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
9528 @opindex falign-loops
9529 Align loops to a power-of-two boundary. If the loops are executed
9530 many times, this makes up for any execution of the dummy padding
9531 instructions.
9532
9533 Parameters of this option are analogous to the @option{-falign-functions} option.
9534 @option{-fno-align-loops} and @option{-falign-loops=1} are
9535 equivalent and mean that loops are not aligned.
9536 The maximum allowed @var{n} option value is 65536.
9537
9538 If @var{n} is not specified or is zero, use a machine-dependent default.
9539
9540 Enabled at levels @option{-O2}, @option{-O3}.
9541
9542 @item -falign-jumps
9543 @itemx -falign-jumps=@var{n}
9544 @itemx -falign-jumps=@var{n}:@var{m}
9545 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
9546 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
9547 @opindex falign-jumps
9548 Align branch targets to a power-of-two boundary, for branch targets
9549 where the targets can only be reached by jumping. In this case,
9550 no dummy operations need be executed.
9551
9552 Parameters of this option are analogous to the @option{-falign-functions} option.
9553 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
9554 equivalent and mean that loops are not aligned.
9555
9556 If @var{n} is not specified or is zero, use a machine-dependent default.
9557 The maximum allowed @var{n} option value is 65536.
9558
9559 Enabled at levels @option{-O2}, @option{-O3}.
9560
9561 @item -funit-at-a-time
9562 @opindex funit-at-a-time
9563 This option is left for compatibility reasons. @option{-funit-at-a-time}
9564 has no effect, while @option{-fno-unit-at-a-time} implies
9565 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
9566
9567 Enabled by default.
9568
9569 @item -fno-toplevel-reorder
9570 @opindex fno-toplevel-reorder
9571 Do not reorder top-level functions, variables, and @code{asm}
9572 statements. Output them in the same order that they appear in the
9573 input file. When this option is used, unreferenced static variables
9574 are not removed. This option is intended to support existing code
9575 that relies on a particular ordering. For new code, it is better to
9576 use attributes when possible.
9577
9578 Enabled at level @option{-O0}. When disabled explicitly, it also implies
9579 @option{-fno-section-anchors}, which is otherwise enabled at @option{-O0} on some
9580 targets.
9581
9582 @item -fweb
9583 @opindex fweb
9584 Constructs webs as commonly used for register allocation purposes and assign
9585 each web individual pseudo register. This allows the register allocation pass
9586 to operate on pseudos directly, but also strengthens several other optimization
9587 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
9588 however, make debugging impossible, since variables no longer stay in a
9589 ``home register''.
9590
9591 Enabled by default with @option{-funroll-loops}.
9592
9593 @item -fwhole-program
9594 @opindex fwhole-program
9595 Assume that the current compilation unit represents the whole program being
9596 compiled. All public functions and variables with the exception of @code{main}
9597 and those merged by attribute @code{externally_visible} become static functions
9598 and in effect are optimized more aggressively by interprocedural optimizers.
9599
9600 This option should not be used in combination with @option{-flto}.
9601 Instead relying on a linker plugin should provide safer and more precise
9602 information.
9603
9604 @item -flto[=@var{n}]
9605 @opindex flto
9606 This option runs the standard link-time optimizer. When invoked
9607 with source code, it generates GIMPLE (one of GCC's internal
9608 representations) and writes it to special ELF sections in the object
9609 file. When the object files are linked together, all the function
9610 bodies are read from these ELF sections and instantiated as if they
9611 had been part of the same translation unit.
9612
9613 To use the link-time optimizer, @option{-flto} and optimization
9614 options should be specified at compile time and during the final link.
9615 It is recommended that you compile all the files participating in the
9616 same link with the same options and also specify those options at
9617 link time.
9618 For example:
9619
9620 @smallexample
9621 gcc -c -O2 -flto foo.c
9622 gcc -c -O2 -flto bar.c
9623 gcc -o myprog -flto -O2 foo.o bar.o
9624 @end smallexample
9625
9626 The first two invocations to GCC save a bytecode representation
9627 of GIMPLE into special ELF sections inside @file{foo.o} and
9628 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
9629 @file{foo.o} and @file{bar.o}, merges the two files into a single
9630 internal image, and compiles the result as usual. Since both
9631 @file{foo.o} and @file{bar.o} are merged into a single image, this
9632 causes all the interprocedural analyses and optimizations in GCC to
9633 work across the two files as if they were a single one. This means,
9634 for example, that the inliner is able to inline functions in
9635 @file{bar.o} into functions in @file{foo.o} and vice-versa.
9636
9637 Another (simpler) way to enable link-time optimization is:
9638
9639 @smallexample
9640 gcc -o myprog -flto -O2 foo.c bar.c
9641 @end smallexample
9642
9643 The above generates bytecode for @file{foo.c} and @file{bar.c},
9644 merges them together into a single GIMPLE representation and optimizes
9645 them as usual to produce @file{myprog}.
9646
9647 The only important thing to keep in mind is that to enable link-time
9648 optimizations you need to use the GCC driver to perform the link step.
9649 GCC then automatically performs link-time optimization if any of the
9650 objects involved were compiled with the @option{-flto} command-line option.
9651 You generally
9652 should specify the optimization options to be used for link-time
9653 optimization though GCC tries to be clever at guessing an
9654 optimization level to use from the options used at compile time
9655 if you fail to specify one at link time. You can always override
9656 the automatic decision to do link-time optimization
9657 by passing @option{-fno-lto} to the link command.
9658
9659 To make whole program optimization effective, it is necessary to make
9660 certain whole program assumptions. The compiler needs to know
9661 what functions and variables can be accessed by libraries and runtime
9662 outside of the link-time optimized unit. When supported by the linker,
9663 the linker plugin (see @option{-fuse-linker-plugin}) passes information
9664 to the compiler about used and externally visible symbols. When
9665 the linker plugin is not available, @option{-fwhole-program} should be
9666 used to allow the compiler to make these assumptions, which leads
9667 to more aggressive optimization decisions.
9668
9669 When @option{-fuse-linker-plugin} is not enabled, when a file is
9670 compiled with @option{-flto}, the generated object file is larger than
9671 a regular object file because it contains GIMPLE bytecodes and the usual
9672 final code (see @option{-ffat-lto-objects}. This means that
9673 object files with LTO information can be linked as normal object
9674 files; if @option{-fno-lto} is passed to the linker, no
9675 interprocedural optimizations are applied. Note that when
9676 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
9677 but you cannot perform a regular, non-LTO link on them.
9678
9679 Additionally, the optimization flags used to compile individual files
9680 are not necessarily related to those used at link time. For instance,
9681
9682 @smallexample
9683 gcc -c -O0 -ffat-lto-objects -flto foo.c
9684 gcc -c -O0 -ffat-lto-objects -flto bar.c
9685 gcc -o myprog -O3 foo.o bar.o
9686 @end smallexample
9687
9688 This produces individual object files with unoptimized assembler
9689 code, but the resulting binary @file{myprog} is optimized at
9690 @option{-O3}. If, instead, the final binary is generated with
9691 @option{-fno-lto}, then @file{myprog} is not optimized.
9692
9693 When producing the final binary, GCC only
9694 applies link-time optimizations to those files that contain bytecode.
9695 Therefore, you can mix and match object files and libraries with
9696 GIMPLE bytecodes and final object code. GCC automatically selects
9697 which files to optimize in LTO mode and which files to link without
9698 further processing.
9699
9700 There are some code generation flags preserved by GCC when
9701 generating bytecodes, as they need to be used during the final link
9702 stage. Generally options specified at link time override those
9703 specified at compile time.
9704
9705 If you do not specify an optimization level option @option{-O} at
9706 link time, then GCC uses the highest optimization level
9707 used when compiling the object files.
9708
9709 Currently, the following options and their settings are taken from
9710 the first object file that explicitly specifies them:
9711 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
9712 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
9713 and all the @option{-m} target flags.
9714
9715 Certain ABI-changing flags are required to match in all compilation units,
9716 and trying to override this at link time with a conflicting value
9717 is ignored. This includes options such as @option{-freg-struct-return}
9718 and @option{-fpcc-struct-return}.
9719
9720 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
9721 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
9722 are passed through to the link stage and merged conservatively for
9723 conflicting translation units. Specifically
9724 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
9725 precedence; and for example @option{-ffp-contract=off} takes precedence
9726 over @option{-ffp-contract=fast}. You can override them at link time.
9727
9728 If LTO encounters objects with C linkage declared with incompatible
9729 types in separate translation units to be linked together (undefined
9730 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
9731 issued. The behavior is still undefined at run time. Similar
9732 diagnostics may be raised for other languages.
9733
9734 Another feature of LTO is that it is possible to apply interprocedural
9735 optimizations on files written in different languages:
9736
9737 @smallexample
9738 gcc -c -flto foo.c
9739 g++ -c -flto bar.cc
9740 gfortran -c -flto baz.f90
9741 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
9742 @end smallexample
9743
9744 Notice that the final link is done with @command{g++} to get the C++
9745 runtime libraries and @option{-lgfortran} is added to get the Fortran
9746 runtime libraries. In general, when mixing languages in LTO mode, you
9747 should use the same link command options as when mixing languages in a
9748 regular (non-LTO) compilation.
9749
9750 If object files containing GIMPLE bytecode are stored in a library archive, say
9751 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
9752 are using a linker with plugin support. To create static libraries suitable
9753 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
9754 and @command{ranlib};
9755 to show the symbols of object files with GIMPLE bytecode, use
9756 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
9757 and @command{nm} have been compiled with plugin support. At link time, use the
9758 flag @option{-fuse-linker-plugin} to ensure that the library participates in
9759 the LTO optimization process:
9760
9761 @smallexample
9762 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
9763 @end smallexample
9764
9765 With the linker plugin enabled, the linker extracts the needed
9766 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
9767 to make them part of the aggregated GIMPLE image to be optimized.
9768
9769 If you are not using a linker with plugin support and/or do not
9770 enable the linker plugin, then the objects inside @file{libfoo.a}
9771 are extracted and linked as usual, but they do not participate
9772 in the LTO optimization process. In order to make a static library suitable
9773 for both LTO optimization and usual linkage, compile its object files with
9774 @option{-flto} @option{-ffat-lto-objects}.
9775
9776 Link-time optimizations do not require the presence of the whole program to
9777 operate. If the program does not require any symbols to be exported, it is
9778 possible to combine @option{-flto} and @option{-fwhole-program} to allow
9779 the interprocedural optimizers to use more aggressive assumptions which may
9780 lead to improved optimization opportunities.
9781 Use of @option{-fwhole-program} is not needed when linker plugin is
9782 active (see @option{-fuse-linker-plugin}).
9783
9784 The current implementation of LTO makes no
9785 attempt to generate bytecode that is portable between different
9786 types of hosts. The bytecode files are versioned and there is a
9787 strict version check, so bytecode files generated in one version of
9788 GCC do not work with an older or newer version of GCC.
9789
9790 Link-time optimization does not work well with generation of debugging
9791 information on systems other than those using a combination of ELF and
9792 DWARF.
9793
9794 If you specify the optional @var{n}, the optimization and code
9795 generation done at link time is executed in parallel using @var{n}
9796 parallel jobs by utilizing an installed @command{make} program. The
9797 environment variable @env{MAKE} may be used to override the program
9798 used. The default value for @var{n} is 1.
9799
9800 You can also specify @option{-flto=jobserver} to use GNU make's
9801 job server mode to determine the number of parallel jobs. This
9802 is useful when the Makefile calling GCC is already executing in parallel.
9803 You must prepend a @samp{+} to the command recipe in the parent Makefile
9804 for this to work. This option likely only works if @env{MAKE} is
9805 GNU make.
9806
9807 @item -flto-partition=@var{alg}
9808 @opindex flto-partition
9809 Specify the partitioning algorithm used by the link-time optimizer.
9810 The value is either @samp{1to1} to specify a partitioning mirroring
9811 the original source files or @samp{balanced} to specify partitioning
9812 into equally sized chunks (whenever possible) or @samp{max} to create
9813 new partition for every symbol where possible. Specifying @samp{none}
9814 as an algorithm disables partitioning and streaming completely.
9815 The default value is @samp{balanced}. While @samp{1to1} can be used
9816 as an workaround for various code ordering issues, the @samp{max}
9817 partitioning is intended for internal testing only.
9818 The value @samp{one} specifies that exactly one partition should be
9819 used while the value @samp{none} bypasses partitioning and executes
9820 the link-time optimization step directly from the WPA phase.
9821
9822 @item -flto-odr-type-merging
9823 @opindex flto-odr-type-merging
9824 Enable streaming of mangled types names of C++ types and their unification
9825 at link time. This increases size of LTO object files, but enables
9826 diagnostics about One Definition Rule violations.
9827
9828 @item -flto-compression-level=@var{n}
9829 @opindex flto-compression-level
9830 This option specifies the level of compression used for intermediate
9831 language written to LTO object files, and is only meaningful in
9832 conjunction with LTO mode (@option{-flto}). Valid
9833 values are 0 (no compression) to 9 (maximum compression). Values
9834 outside this range are clamped to either 0 or 9. If the option is not
9835 given, a default balanced compression setting is used.
9836
9837 @item -fuse-linker-plugin
9838 @opindex fuse-linker-plugin
9839 Enables the use of a linker plugin during link-time optimization. This
9840 option relies on plugin support in the linker, which is available in gold
9841 or in GNU ld 2.21 or newer.
9842
9843 This option enables the extraction of object files with GIMPLE bytecode out
9844 of library archives. This improves the quality of optimization by exposing
9845 more code to the link-time optimizer. This information specifies what
9846 symbols can be accessed externally (by non-LTO object or during dynamic
9847 linking). Resulting code quality improvements on binaries (and shared
9848 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
9849 See @option{-flto} for a description of the effect of this flag and how to
9850 use it.
9851
9852 This option is enabled by default when LTO support in GCC is enabled
9853 and GCC was configured for use with
9854 a linker supporting plugins (GNU ld 2.21 or newer or gold).
9855
9856 @item -ffat-lto-objects
9857 @opindex ffat-lto-objects
9858 Fat LTO objects are object files that contain both the intermediate language
9859 and the object code. This makes them usable for both LTO linking and normal
9860 linking. This option is effective only when compiling with @option{-flto}
9861 and is ignored at link time.
9862
9863 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
9864 requires the complete toolchain to be aware of LTO. It requires a linker with
9865 linker plugin support for basic functionality. Additionally,
9866 @command{nm}, @command{ar} and @command{ranlib}
9867 need to support linker plugins to allow a full-featured build environment
9868 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
9869 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
9870 to these tools. With non fat LTO makefiles need to be modified to use them.
9871
9872 Note that modern binutils provide plugin auto-load mechanism.
9873 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
9874 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
9875 @command{gcc-ranlib}).
9876
9877 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
9878 support.
9879
9880 @item -fcompare-elim
9881 @opindex fcompare-elim
9882 After register allocation and post-register allocation instruction splitting,
9883 identify arithmetic instructions that compute processor flags similar to a
9884 comparison operation based on that arithmetic. If possible, eliminate the
9885 explicit comparison operation.
9886
9887 This pass only applies to certain targets that cannot explicitly represent
9888 the comparison operation before register allocation is complete.
9889
9890 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9891
9892 @item -fcprop-registers
9893 @opindex fcprop-registers
9894 After register allocation and post-register allocation instruction splitting,
9895 perform a copy-propagation pass to try to reduce scheduling dependencies
9896 and occasionally eliminate the copy.
9897
9898 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9899
9900 @item -fprofile-correction
9901 @opindex fprofile-correction
9902 Profiles collected using an instrumented binary for multi-threaded programs may
9903 be inconsistent due to missed counter updates. When this option is specified,
9904 GCC uses heuristics to correct or smooth out such inconsistencies. By
9905 default, GCC emits an error message when an inconsistent profile is detected.
9906
9907 @item -fprofile-use
9908 @itemx -fprofile-use=@var{path}
9909 @opindex fprofile-use
9910 Enable profile feedback-directed optimizations,
9911 and the following optimizations
9912 which are generally profitable only with profile feedback available:
9913 @option{-fbranch-probabilities}, @option{-fvpt},
9914 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9915 @option{-ftree-vectorize}, and @option{ftree-loop-distribute-patterns}.
9916
9917 Before you can use this option, you must first generate profiling information.
9918 @xref{Instrumentation Options}, for information about the
9919 @option{-fprofile-generate} option.
9920
9921 By default, GCC emits an error message if the feedback profiles do not
9922 match the source code. This error can be turned into a warning by using
9923 @option{-Wcoverage-mismatch}. Note this may result in poorly optimized
9924 code.
9925
9926 If @var{path} is specified, GCC looks at the @var{path} to find
9927 the profile feedback data files. See @option{-fprofile-dir}.
9928
9929 @item -fauto-profile
9930 @itemx -fauto-profile=@var{path}
9931 @opindex fauto-profile
9932 Enable sampling-based feedback-directed optimizations,
9933 and the following optimizations
9934 which are generally profitable only with profile feedback available:
9935 @option{-fbranch-probabilities}, @option{-fvpt},
9936 @option{-funroll-loops}, @option{-fpeel-loops}, @option{-ftracer},
9937 @option{-ftree-vectorize},
9938 @option{-finline-functions}, @option{-fipa-cp}, @option{-fipa-cp-clone},
9939 @option{-fpredictive-commoning}, @option{-funswitch-loops},
9940 @option{-fgcse-after-reload}, and @option{-ftree-loop-distribute-patterns}.
9941
9942 @var{path} is the name of a file containing AutoFDO profile information.
9943 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
9944
9945 Producing an AutoFDO profile data file requires running your program
9946 with the @command{perf} utility on a supported GNU/Linux target system.
9947 For more information, see @uref{https://perf.wiki.kernel.org/}.
9948
9949 E.g.
9950 @smallexample
9951 perf record -e br_inst_retired:near_taken -b -o perf.data \
9952 -- your_program
9953 @end smallexample
9954
9955 Then use the @command{create_gcov} tool to convert the raw profile data
9956 to a format that can be used by GCC.@ You must also supply the
9957 unstripped binary for your program to this tool.
9958 See @uref{https://github.com/google/autofdo}.
9959
9960 E.g.
9961 @smallexample
9962 create_gcov --binary=your_program.unstripped --profile=perf.data \
9963 --gcov=profile.afdo
9964 @end smallexample
9965 @end table
9966
9967 The following options control compiler behavior regarding floating-point
9968 arithmetic. These options trade off between speed and
9969 correctness. All must be specifically enabled.
9970
9971 @table @gcctabopt
9972 @item -ffloat-store
9973 @opindex ffloat-store
9974 Do not store floating-point variables in registers, and inhibit other
9975 options that might change whether a floating-point value is taken from a
9976 register or memory.
9977
9978 @cindex floating-point precision
9979 This option prevents undesirable excess precision on machines such as
9980 the 68000 where the floating registers (of the 68881) keep more
9981 precision than a @code{double} is supposed to have. Similarly for the
9982 x86 architecture. For most programs, the excess precision does only
9983 good, but a few programs rely on the precise definition of IEEE floating
9984 point. Use @option{-ffloat-store} for such programs, after modifying
9985 them to store all pertinent intermediate computations into variables.
9986
9987 @item -fexcess-precision=@var{style}
9988 @opindex fexcess-precision
9989 This option allows further control over excess precision on machines
9990 where floating-point operations occur in a format with more precision or
9991 range than the IEEE standard and interchange floating-point types. By
9992 default, @option{-fexcess-precision=fast} is in effect; this means that
9993 operations may be carried out in a wider precision than the types specified
9994 in the source if that would result in faster code, and it is unpredictable
9995 when rounding to the types specified in the source code takes place.
9996 When compiling C, if @option{-fexcess-precision=standard} is specified then
9997 excess precision follows the rules specified in ISO C99; in particular,
9998 both casts and assignments cause values to be rounded to their
9999 semantic types (whereas @option{-ffloat-store} only affects
10000 assignments). This option is enabled by default for C if a strict
10001 conformance option such as @option{-std=c99} is used.
10002 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10003 regardless of whether a strict conformance option is used.
10004
10005 @opindex mfpmath
10006 @option{-fexcess-precision=standard} is not implemented for languages
10007 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10008 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10009 semantics apply without excess precision, and in the latter, rounding
10010 is unpredictable.
10011
10012 @item -ffast-math
10013 @opindex ffast-math
10014 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10015 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10016 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10017 @option{-fexcess-precision=fast}.
10018
10019 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10020
10021 This option is not turned on by any @option{-O} option besides
10022 @option{-Ofast} since it can result in incorrect output for programs
10023 that depend on an exact implementation of IEEE or ISO rules/specifications
10024 for math functions. It may, however, yield faster code for programs
10025 that do not require the guarantees of these specifications.
10026
10027 @item -fno-math-errno
10028 @opindex fno-math-errno
10029 Do not set @code{errno} after calling math functions that are executed
10030 with a single instruction, e.g., @code{sqrt}. A program that relies on
10031 IEEE exceptions for math error handling may want to use this flag
10032 for speed while maintaining IEEE arithmetic compatibility.
10033
10034 This option is not turned on by any @option{-O} option since
10035 it can result in incorrect output for programs that depend on
10036 an exact implementation of IEEE or ISO rules/specifications for
10037 math functions. It may, however, yield faster code for programs
10038 that do not require the guarantees of these specifications.
10039
10040 The default is @option{-fmath-errno}.
10041
10042 On Darwin systems, the math library never sets @code{errno}. There is
10043 therefore no reason for the compiler to consider the possibility that
10044 it might, and @option{-fno-math-errno} is the default.
10045
10046 @item -funsafe-math-optimizations
10047 @opindex funsafe-math-optimizations
10048
10049 Allow optimizations for floating-point arithmetic that (a) assume
10050 that arguments and results are valid and (b) may violate IEEE or
10051 ANSI standards. When used at link time, it may include libraries
10052 or startup files that change the default FPU control word or other
10053 similar optimizations.
10054
10055 This option is not turned on by any @option{-O} option since
10056 it can result in incorrect output for programs that depend on
10057 an exact implementation of IEEE or ISO rules/specifications for
10058 math functions. It may, however, yield faster code for programs
10059 that do not require the guarantees of these specifications.
10060 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10061 @option{-fassociative-math} and @option{-freciprocal-math}.
10062
10063 The default is @option{-fno-unsafe-math-optimizations}.
10064
10065 @item -fassociative-math
10066 @opindex fassociative-math
10067
10068 Allow re-association of operands in series of floating-point operations.
10069 This violates the ISO C and C++ language standard by possibly changing
10070 computation result. NOTE: re-ordering may change the sign of zero as
10071 well as ignore NaNs and inhibit or create underflow or overflow (and
10072 thus cannot be used on code that relies on rounding behavior like
10073 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10074 and thus may not be used when ordered comparisons are required.
10075 This option requires that both @option{-fno-signed-zeros} and
10076 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10077 much sense with @option{-frounding-math}. For Fortran the option
10078 is automatically enabled when both @option{-fno-signed-zeros} and
10079 @option{-fno-trapping-math} are in effect.
10080
10081 The default is @option{-fno-associative-math}.
10082
10083 @item -freciprocal-math
10084 @opindex freciprocal-math
10085
10086 Allow the reciprocal of a value to be used instead of dividing by
10087 the value if this enables optimizations. For example @code{x / y}
10088 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10089 is subject to common subexpression elimination. Note that this loses
10090 precision and increases the number of flops operating on the value.
10091
10092 The default is @option{-fno-reciprocal-math}.
10093
10094 @item -ffinite-math-only
10095 @opindex ffinite-math-only
10096 Allow optimizations for floating-point arithmetic that assume
10097 that arguments and results are not NaNs or +-Infs.
10098
10099 This option is not turned on by any @option{-O} option since
10100 it can result in incorrect output for programs that depend on
10101 an exact implementation of IEEE or ISO rules/specifications for
10102 math functions. It may, however, yield faster code for programs
10103 that do not require the guarantees of these specifications.
10104
10105 The default is @option{-fno-finite-math-only}.
10106
10107 @item -fno-signed-zeros
10108 @opindex fno-signed-zeros
10109 Allow optimizations for floating-point arithmetic that ignore the
10110 signedness of zero. IEEE arithmetic specifies the behavior of
10111 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10112 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10113 This option implies that the sign of a zero result isn't significant.
10114
10115 The default is @option{-fsigned-zeros}.
10116
10117 @item -fno-trapping-math
10118 @opindex fno-trapping-math
10119 Compile code assuming that floating-point operations cannot generate
10120 user-visible traps. These traps include division by zero, overflow,
10121 underflow, inexact result and invalid operation. This option requires
10122 that @option{-fno-signaling-nans} be in effect. Setting this option may
10123 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10124
10125 This option should never be turned on by any @option{-O} option since
10126 it can result in incorrect output for programs that depend on
10127 an exact implementation of IEEE or ISO rules/specifications for
10128 math functions.
10129
10130 The default is @option{-ftrapping-math}.
10131
10132 @item -frounding-math
10133 @opindex frounding-math
10134 Disable transformations and optimizations that assume default floating-point
10135 rounding behavior. This is round-to-zero for all floating point
10136 to integer conversions, and round-to-nearest for all other arithmetic
10137 truncations. This option should be specified for programs that change
10138 the FP rounding mode dynamically, or that may be executed with a
10139 non-default rounding mode. This option disables constant folding of
10140 floating-point expressions at compile time (which may be affected by
10141 rounding mode) and arithmetic transformations that are unsafe in the
10142 presence of sign-dependent rounding modes.
10143
10144 The default is @option{-fno-rounding-math}.
10145
10146 This option is experimental and does not currently guarantee to
10147 disable all GCC optimizations that are affected by rounding mode.
10148 Future versions of GCC may provide finer control of this setting
10149 using C99's @code{FENV_ACCESS} pragma. This command-line option
10150 will be used to specify the default state for @code{FENV_ACCESS}.
10151
10152 @item -fsignaling-nans
10153 @opindex fsignaling-nans
10154 Compile code assuming that IEEE signaling NaNs may generate user-visible
10155 traps during floating-point operations. Setting this option disables
10156 optimizations that may change the number of exceptions visible with
10157 signaling NaNs. This option implies @option{-ftrapping-math}.
10158
10159 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10160 be defined.
10161
10162 The default is @option{-fno-signaling-nans}.
10163
10164 This option is experimental and does not currently guarantee to
10165 disable all GCC optimizations that affect signaling NaN behavior.
10166
10167 @item -fno-fp-int-builtin-inexact
10168 @opindex fno-fp-int-builtin-inexact
10169 Do not allow the built-in functions @code{ceil}, @code{floor},
10170 @code{round} and @code{trunc}, and their @code{float} and @code{long
10171 double} variants, to generate code that raises the ``inexact''
10172 floating-point exception for noninteger arguments. ISO C99 and C11
10173 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10174 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10175 functions to do so.
10176
10177 The default is @option{-ffp-int-builtin-inexact}, allowing the
10178 exception to be raised. This option does nothing unless
10179 @option{-ftrapping-math} is in effect.
10180
10181 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10182 generate a call to a library function then the ``inexact'' exception
10183 may be raised if the library implementation does not follow TS 18661.
10184
10185 @item -fsingle-precision-constant
10186 @opindex fsingle-precision-constant
10187 Treat floating-point constants as single precision instead of
10188 implicitly converting them to double-precision constants.
10189
10190 @item -fcx-limited-range
10191 @opindex fcx-limited-range
10192 When enabled, this option states that a range reduction step is not
10193 needed when performing complex division. Also, there is no checking
10194 whether the result of a complex multiplication or division is @code{NaN
10195 + I*NaN}, with an attempt to rescue the situation in that case. The
10196 default is @option{-fno-cx-limited-range}, but is enabled by
10197 @option{-ffast-math}.
10198
10199 This option controls the default setting of the ISO C99
10200 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10201 all languages.
10202
10203 @item -fcx-fortran-rules
10204 @opindex fcx-fortran-rules
10205 Complex multiplication and division follow Fortran rules. Range
10206 reduction is done as part of complex division, but there is no checking
10207 whether the result of a complex multiplication or division is @code{NaN
10208 + I*NaN}, with an attempt to rescue the situation in that case.
10209
10210 The default is @option{-fno-cx-fortran-rules}.
10211
10212 @end table
10213
10214 The following options control optimizations that may improve
10215 performance, but are not enabled by any @option{-O} options. This
10216 section includes experimental options that may produce broken code.
10217
10218 @table @gcctabopt
10219 @item -fbranch-probabilities
10220 @opindex fbranch-probabilities
10221 After running a program compiled with @option{-fprofile-arcs}
10222 (@pxref{Instrumentation Options}),
10223 you can compile it a second time using
10224 @option{-fbranch-probabilities}, to improve optimizations based on
10225 the number of times each branch was taken. When a program
10226 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10227 counts to a file called @file{@var{sourcename}.gcda} for each source
10228 file. The information in this data file is very dependent on the
10229 structure of the generated code, so you must use the same source code
10230 and the same optimization options for both compilations.
10231
10232 With @option{-fbranch-probabilities}, GCC puts a
10233 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10234 These can be used to improve optimization. Currently, they are only
10235 used in one place: in @file{reorg.c}, instead of guessing which path a
10236 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10237 exactly determine which path is taken more often.
10238
10239 @item -fprofile-values
10240 @opindex fprofile-values
10241 If combined with @option{-fprofile-arcs}, it adds code so that some
10242 data about values of expressions in the program is gathered.
10243
10244 With @option{-fbranch-probabilities}, it reads back the data gathered
10245 from profiling values of expressions for usage in optimizations.
10246
10247 Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
10248
10249 @item -fprofile-reorder-functions
10250 @opindex fprofile-reorder-functions
10251 Function reordering based on profile instrumentation collects
10252 first time of execution of a function and orders these functions
10253 in ascending order.
10254
10255 Enabled with @option{-fprofile-use}.
10256
10257 @item -fvpt
10258 @opindex fvpt
10259 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10260 to add code to gather information about values of expressions.
10261
10262 With @option{-fbranch-probabilities}, it reads back the data gathered
10263 and actually performs the optimizations based on them.
10264 Currently the optimizations include specialization of division operations
10265 using the knowledge about the value of the denominator.
10266
10267 @item -frename-registers
10268 @opindex frename-registers
10269 Attempt to avoid false dependencies in scheduled code by making use
10270 of registers left over after register allocation. This optimization
10271 most benefits processors with lots of registers. Depending on the
10272 debug information format adopted by the target, however, it can
10273 make debugging impossible, since variables no longer stay in
10274 a ``home register''.
10275
10276 Enabled by default with @option{-funroll-loops}.
10277
10278 @item -fschedule-fusion
10279 @opindex fschedule-fusion
10280 Performs a target dependent pass over the instruction stream to schedule
10281 instructions of same type together because target machine can execute them
10282 more efficiently if they are adjacent to each other in the instruction flow.
10283
10284 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10285
10286 @item -ftracer
10287 @opindex ftracer
10288 Perform tail duplication to enlarge superblock size. This transformation
10289 simplifies the control flow of the function allowing other optimizations to do
10290 a better job.
10291
10292 Enabled with @option{-fprofile-use}.
10293
10294 @item -funroll-loops
10295 @opindex funroll-loops
10296 Unroll loops whose number of iterations can be determined at compile time or
10297 upon entry to the loop. @option{-funroll-loops} implies
10298 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10299 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10300 a small constant number of iterations). This option makes code larger, and may
10301 or may not make it run faster.
10302
10303 Enabled with @option{-fprofile-use}.
10304
10305 @item -funroll-all-loops
10306 @opindex funroll-all-loops
10307 Unroll all loops, even if their number of iterations is uncertain when
10308 the loop is entered. This usually makes programs run more slowly.
10309 @option{-funroll-all-loops} implies the same options as
10310 @option{-funroll-loops}.
10311
10312 @item -fpeel-loops
10313 @opindex fpeel-loops
10314 Peels loops for which there is enough information that they do not
10315 roll much (from profile feedback or static analysis). It also turns on
10316 complete loop peeling (i.e.@: complete removal of loops with small constant
10317 number of iterations).
10318
10319 Enabled with @option{-O3} and/or @option{-fprofile-use}.
10320
10321 @item -fmove-loop-invariants
10322 @opindex fmove-loop-invariants
10323 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10324 at level @option{-O1}
10325
10326 @item -fsplit-loops
10327 @opindex fsplit-loops
10328 Split a loop into two if it contains a condition that's always true
10329 for one side of the iteration space and false for the other.
10330
10331 @item -funswitch-loops
10332 @opindex funswitch-loops
10333 Move branches with loop invariant conditions out of the loop, with duplicates
10334 of the loop on both branches (modified according to result of the condition).
10335
10336 @item -ffunction-sections
10337 @itemx -fdata-sections
10338 @opindex ffunction-sections
10339 @opindex fdata-sections
10340 Place each function or data item into its own section in the output
10341 file if the target supports arbitrary sections. The name of the
10342 function or the name of the data item determines the section's name
10343 in the output file.
10344
10345 Use these options on systems where the linker can perform optimizations to
10346 improve locality of reference in the instruction space. Most systems using the
10347 ELF object format have linkers with such optimizations. On AIX, the linker
10348 rearranges sections (CSECTs) based on the call graph. The performance impact
10349 varies.
10350
10351 Together with a linker garbage collection (linker @option{--gc-sections}
10352 option) these options may lead to smaller statically-linked executables (after
10353 stripping).
10354
10355 On ELF/DWARF systems these options do not degenerate the quality of the debug
10356 information. There could be issues with other object files/debug info formats.
10357
10358 Only use these options when there are significant benefits from doing so. When
10359 you specify these options, the assembler and linker create larger object and
10360 executable files and are also slower. These options affect code generation.
10361 They prevent optimizations by the compiler and assembler using relative
10362 locations inside a translation unit since the locations are unknown until
10363 link time. An example of such an optimization is relaxing calls to short call
10364 instructions.
10365
10366 @item -fbranch-target-load-optimize
10367 @opindex fbranch-target-load-optimize
10368 Perform branch target register load optimization before prologue / epilogue
10369 threading.
10370 The use of target registers can typically be exposed only during reload,
10371 thus hoisting loads out of loops and doing inter-block scheduling needs
10372 a separate optimization pass.
10373
10374 @item -fbranch-target-load-optimize2
10375 @opindex fbranch-target-load-optimize2
10376 Perform branch target register load optimization after prologue / epilogue
10377 threading.
10378
10379 @item -fbtr-bb-exclusive
10380 @opindex fbtr-bb-exclusive
10381 When performing branch target register load optimization, don't reuse
10382 branch target registers within any basic block.
10383
10384 @item -fstdarg-opt
10385 @opindex fstdarg-opt
10386 Optimize the prologue of variadic argument functions with respect to usage of
10387 those arguments.
10388
10389 @item -fsection-anchors
10390 @opindex fsection-anchors
10391 Try to reduce the number of symbolic address calculations by using
10392 shared ``anchor'' symbols to address nearby objects. This transformation
10393 can help to reduce the number of GOT entries and GOT accesses on some
10394 targets.
10395
10396 For example, the implementation of the following function @code{foo}:
10397
10398 @smallexample
10399 static int a, b, c;
10400 int foo (void) @{ return a + b + c; @}
10401 @end smallexample
10402
10403 @noindent
10404 usually calculates the addresses of all three variables, but if you
10405 compile it with @option{-fsection-anchors}, it accesses the variables
10406 from a common anchor point instead. The effect is similar to the
10407 following pseudocode (which isn't valid C):
10408
10409 @smallexample
10410 int foo (void)
10411 @{
10412 register int *xr = &x;
10413 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
10414 @}
10415 @end smallexample
10416
10417 Not all targets support this option.
10418
10419 @item --param @var{name}=@var{value}
10420 @opindex param
10421 In some places, GCC uses various constants to control the amount of
10422 optimization that is done. For example, GCC does not inline functions
10423 that contain more than a certain number of instructions. You can
10424 control some of these constants on the command line using the
10425 @option{--param} option.
10426
10427 The names of specific parameters, and the meaning of the values, are
10428 tied to the internals of the compiler, and are subject to change
10429 without notice in future releases.
10430
10431 In each case, the @var{value} is an integer. The allowable choices for
10432 @var{name} are:
10433
10434 @table @gcctabopt
10435 @item predictable-branch-outcome
10436 When branch is predicted to be taken with probability lower than this threshold
10437 (in percent), then it is considered well predictable. The default is 10.
10438
10439 @item max-rtl-if-conversion-insns
10440 RTL if-conversion tries to remove conditional branches around a block and
10441 replace them with conditionally executed instructions. This parameter
10442 gives the maximum number of instructions in a block which should be
10443 considered for if-conversion. The default is 10, though the compiler will
10444 also use other heuristics to decide whether if-conversion is likely to be
10445 profitable.
10446
10447 @item max-rtl-if-conversion-predictable-cost
10448 @itemx max-rtl-if-conversion-unpredictable-cost
10449 RTL if-conversion will try to remove conditional branches around a block
10450 and replace them with conditionally executed instructions. These parameters
10451 give the maximum permissible cost for the sequence that would be generated
10452 by if-conversion depending on whether the branch is statically determined
10453 to be predictable or not. The units for this parameter are the same as
10454 those for the GCC internal seq_cost metric. The compiler will try to
10455 provide a reasonable default for this parameter using the BRANCH_COST
10456 target macro.
10457
10458 @item max-crossjump-edges
10459 The maximum number of incoming edges to consider for cross-jumping.
10460 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
10461 the number of edges incoming to each block. Increasing values mean
10462 more aggressive optimization, making the compilation time increase with
10463 probably small improvement in executable size.
10464
10465 @item min-crossjump-insns
10466 The minimum number of instructions that must be matched at the end
10467 of two blocks before cross-jumping is performed on them. This
10468 value is ignored in the case where all instructions in the block being
10469 cross-jumped from are matched. The default value is 5.
10470
10471 @item max-grow-copy-bb-insns
10472 The maximum code size expansion factor when copying basic blocks
10473 instead of jumping. The expansion is relative to a jump instruction.
10474 The default value is 8.
10475
10476 @item max-goto-duplication-insns
10477 The maximum number of instructions to duplicate to a block that jumps
10478 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
10479 passes, GCC factors computed gotos early in the compilation process,
10480 and unfactors them as late as possible. Only computed jumps at the
10481 end of a basic blocks with no more than max-goto-duplication-insns are
10482 unfactored. The default value is 8.
10483
10484 @item max-delay-slot-insn-search
10485 The maximum number of instructions to consider when looking for an
10486 instruction to fill a delay slot. If more than this arbitrary number of
10487 instructions are searched, the time savings from filling the delay slot
10488 are minimal, so stop searching. Increasing values mean more
10489 aggressive optimization, making the compilation time increase with probably
10490 small improvement in execution time.
10491
10492 @item max-delay-slot-live-search
10493 When trying to fill delay slots, the maximum number of instructions to
10494 consider when searching for a block with valid live register
10495 information. Increasing this arbitrarily chosen value means more
10496 aggressive optimization, increasing the compilation time. This parameter
10497 should be removed when the delay slot code is rewritten to maintain the
10498 control-flow graph.
10499
10500 @item max-gcse-memory
10501 The approximate maximum amount of memory that can be allocated in
10502 order to perform the global common subexpression elimination
10503 optimization. If more memory than specified is required, the
10504 optimization is not done.
10505
10506 @item max-gcse-insertion-ratio
10507 If the ratio of expression insertions to deletions is larger than this value
10508 for any expression, then RTL PRE inserts or removes the expression and thus
10509 leaves partially redundant computations in the instruction stream. The default value is 20.
10510
10511 @item max-pending-list-length
10512 The maximum number of pending dependencies scheduling allows
10513 before flushing the current state and starting over. Large functions
10514 with few branches or calls can create excessively large lists which
10515 needlessly consume memory and resources.
10516
10517 @item max-modulo-backtrack-attempts
10518 The maximum number of backtrack attempts the scheduler should make
10519 when modulo scheduling a loop. Larger values can exponentially increase
10520 compilation time.
10521
10522 @item max-inline-insns-single
10523 Several parameters control the tree inliner used in GCC@.
10524 This number sets the maximum number of instructions (counted in GCC's
10525 internal representation) in a single function that the tree inliner
10526 considers for inlining. This only affects functions declared
10527 inline and methods implemented in a class declaration (C++).
10528 The default value is 400.
10529
10530 @item max-inline-insns-auto
10531 When you use @option{-finline-functions} (included in @option{-O3}),
10532 a lot of functions that would otherwise not be considered for inlining
10533 by the compiler are investigated. To those functions, a different
10534 (more restrictive) limit compared to functions declared inline can
10535 be applied.
10536 The default value is 30.
10537
10538 @item inline-min-speedup
10539 When estimated performance improvement of caller + callee runtime exceeds this
10540 threshold (in percent), the function can be inlined regardless of the limit on
10541 @option{--param max-inline-insns-single} and @option{--param
10542 max-inline-insns-auto}.
10543 The default value is 15.
10544
10545 @item large-function-insns
10546 The limit specifying really large functions. For functions larger than this
10547 limit after inlining, inlining is constrained by
10548 @option{--param large-function-growth}. This parameter is useful primarily
10549 to avoid extreme compilation time caused by non-linear algorithms used by the
10550 back end.
10551 The default value is 2700.
10552
10553 @item large-function-growth
10554 Specifies maximal growth of large function caused by inlining in percents.
10555 The default value is 100 which limits large function growth to 2.0 times
10556 the original size.
10557
10558 @item large-unit-insns
10559 The limit specifying large translation unit. Growth caused by inlining of
10560 units larger than this limit is limited by @option{--param inline-unit-growth}.
10561 For small units this might be too tight.
10562 For example, consider a unit consisting of function A
10563 that is inline and B that just calls A three times. If B is small relative to
10564 A, the growth of unit is 300\% and yet such inlining is very sane. For very
10565 large units consisting of small inlineable functions, however, the overall unit
10566 growth limit is needed to avoid exponential explosion of code size. Thus for
10567 smaller units, the size is increased to @option{--param large-unit-insns}
10568 before applying @option{--param inline-unit-growth}. The default is 10000.
10569
10570 @item inline-unit-growth
10571 Specifies maximal overall growth of the compilation unit caused by inlining.
10572 The default value is 20 which limits unit growth to 1.2 times the original
10573 size. Cold functions (either marked cold via an attribute or by profile
10574 feedback) are not accounted into the unit size.
10575
10576 @item ipcp-unit-growth
10577 Specifies maximal overall growth of the compilation unit caused by
10578 interprocedural constant propagation. The default value is 10 which limits
10579 unit growth to 1.1 times the original size.
10580
10581 @item large-stack-frame
10582 The limit specifying large stack frames. While inlining the algorithm is trying
10583 to not grow past this limit too much. The default value is 256 bytes.
10584
10585 @item large-stack-frame-growth
10586 Specifies maximal growth of large stack frames caused by inlining in percents.
10587 The default value is 1000 which limits large stack frame growth to 11 times
10588 the original size.
10589
10590 @item max-inline-insns-recursive
10591 @itemx max-inline-insns-recursive-auto
10592 Specifies the maximum number of instructions an out-of-line copy of a
10593 self-recursive inline
10594 function can grow into by performing recursive inlining.
10595
10596 @option{--param max-inline-insns-recursive} applies to functions
10597 declared inline.
10598 For functions not declared inline, recursive inlining
10599 happens only when @option{-finline-functions} (included in @option{-O3}) is
10600 enabled; @option{--param max-inline-insns-recursive-auto} applies instead. The
10601 default value is 450.
10602
10603 @item max-inline-recursive-depth
10604 @itemx max-inline-recursive-depth-auto
10605 Specifies the maximum recursion depth used for recursive inlining.
10606
10607 @option{--param max-inline-recursive-depth} applies to functions
10608 declared inline. For functions not declared inline, recursive inlining
10609 happens only when @option{-finline-functions} (included in @option{-O3}) is
10610 enabled; @option{--param max-inline-recursive-depth-auto} applies instead. The
10611 default value is 8.
10612
10613 @item min-inline-recursive-probability
10614 Recursive inlining is profitable only for function having deep recursion
10615 in average and can hurt for function having little recursion depth by
10616 increasing the prologue size or complexity of function body to other
10617 optimizers.
10618
10619 When profile feedback is available (see @option{-fprofile-generate}) the actual
10620 recursion depth can be guessed from the probability that function recurses
10621 via a given call expression. This parameter limits inlining only to call
10622 expressions whose probability exceeds the given threshold (in percents).
10623 The default value is 10.
10624
10625 @item early-inlining-insns
10626 Specify growth that the early inliner can make. In effect it increases
10627 the amount of inlining for code having a large abstraction penalty.
10628 The default value is 14.
10629
10630 @item max-early-inliner-iterations
10631 Limit of iterations of the early inliner. This basically bounds
10632 the number of nested indirect calls the early inliner can resolve.
10633 Deeper chains are still handled by late inlining.
10634
10635 @item comdat-sharing-probability
10636 Probability (in percent) that C++ inline function with comdat visibility
10637 are shared across multiple compilation units. The default value is 20.
10638
10639 @item profile-func-internal-id
10640 A parameter to control whether to use function internal id in profile
10641 database lookup. If the value is 0, the compiler uses an id that
10642 is based on function assembler name and filename, which makes old profile
10643 data more tolerant to source changes such as function reordering etc.
10644 The default value is 0.
10645
10646 @item min-vect-loop-bound
10647 The minimum number of iterations under which loops are not vectorized
10648 when @option{-ftree-vectorize} is used. The number of iterations after
10649 vectorization needs to be greater than the value specified by this option
10650 to allow vectorization. The default value is 0.
10651
10652 @item gcse-cost-distance-ratio
10653 Scaling factor in calculation of maximum distance an expression
10654 can be moved by GCSE optimizations. This is currently supported only in the
10655 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
10656 is with simple expressions, i.e., the expressions that have cost
10657 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
10658 hoisting of simple expressions. The default value is 10.
10659
10660 @item gcse-unrestricted-cost
10661 Cost, roughly measured as the cost of a single typical machine
10662 instruction, at which GCSE optimizations do not constrain
10663 the distance an expression can travel. This is currently
10664 supported only in the code hoisting pass. The lesser the cost,
10665 the more aggressive code hoisting is. Specifying 0
10666 allows all expressions to travel unrestricted distances.
10667 The default value is 3.
10668
10669 @item max-hoist-depth
10670 The depth of search in the dominator tree for expressions to hoist.
10671 This is used to avoid quadratic behavior in hoisting algorithm.
10672 The value of 0 does not limit on the search, but may slow down compilation
10673 of huge functions. The default value is 30.
10674
10675 @item max-tail-merge-comparisons
10676 The maximum amount of similar bbs to compare a bb with. This is used to
10677 avoid quadratic behavior in tree tail merging. The default value is 10.
10678
10679 @item max-tail-merge-iterations
10680 The maximum amount of iterations of the pass over the function. This is used to
10681 limit compilation time in tree tail merging. The default value is 2.
10682
10683 @item store-merging-allow-unaligned
10684 Allow the store merging pass to introduce unaligned stores if it is legal to
10685 do so. The default value is 1.
10686
10687 @item max-stores-to-merge
10688 The maximum number of stores to attempt to merge into wider stores in the store
10689 merging pass. The minimum value is 2 and the default is 64.
10690
10691 @item max-unrolled-insns
10692 The maximum number of instructions that a loop may have to be unrolled.
10693 If a loop is unrolled, this parameter also determines how many times
10694 the loop code is unrolled.
10695
10696 @item max-average-unrolled-insns
10697 The maximum number of instructions biased by probabilities of their execution
10698 that a loop may have to be unrolled. If a loop is unrolled,
10699 this parameter also determines how many times the loop code is unrolled.
10700
10701 @item max-unroll-times
10702 The maximum number of unrollings of a single loop.
10703
10704 @item max-peeled-insns
10705 The maximum number of instructions that a loop may have to be peeled.
10706 If a loop is peeled, this parameter also determines how many times
10707 the loop code is peeled.
10708
10709 @item max-peel-times
10710 The maximum number of peelings of a single loop.
10711
10712 @item max-peel-branches
10713 The maximum number of branches on the hot path through the peeled sequence.
10714
10715 @item max-completely-peeled-insns
10716 The maximum number of insns of a completely peeled loop.
10717
10718 @item max-completely-peel-times
10719 The maximum number of iterations of a loop to be suitable for complete peeling.
10720
10721 @item max-completely-peel-loop-nest-depth
10722 The maximum depth of a loop nest suitable for complete peeling.
10723
10724 @item max-unswitch-insns
10725 The maximum number of insns of an unswitched loop.
10726
10727 @item max-unswitch-level
10728 The maximum number of branches unswitched in a single loop.
10729
10730 @item max-loop-headers-insns
10731 The maximum number of insns in loop header duplicated by the copy loop headers
10732 pass.
10733
10734 @item lim-expensive
10735 The minimum cost of an expensive expression in the loop invariant motion.
10736
10737 @item iv-consider-all-candidates-bound
10738 Bound on number of candidates for induction variables, below which
10739 all candidates are considered for each use in induction variable
10740 optimizations. If there are more candidates than this,
10741 only the most relevant ones are considered to avoid quadratic time complexity.
10742
10743 @item iv-max-considered-uses
10744 The induction variable optimizations give up on loops that contain more
10745 induction variable uses.
10746
10747 @item iv-always-prune-cand-set-bound
10748 If the number of candidates in the set is smaller than this value,
10749 always try to remove unnecessary ivs from the set
10750 when adding a new one.
10751
10752 @item avg-loop-niter
10753 Average number of iterations of a loop.
10754
10755 @item dse-max-object-size
10756 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
10757 Larger values may result in larger compilation times.
10758
10759 @item dse-max-alias-queries-per-store
10760 Maximum number of queries into the alias oracle per store.
10761 Larger values result in larger compilation times and may result in more
10762 removed dead stores.
10763
10764 @item scev-max-expr-size
10765 Bound on size of expressions used in the scalar evolutions analyzer.
10766 Large expressions slow the analyzer.
10767
10768 @item scev-max-expr-complexity
10769 Bound on the complexity of the expressions in the scalar evolutions analyzer.
10770 Complex expressions slow the analyzer.
10771
10772 @item max-tree-if-conversion-phi-args
10773 Maximum number of arguments in a PHI supported by TREE if conversion
10774 unless the loop is marked with simd pragma.
10775
10776 @item vect-max-version-for-alignment-checks
10777 The maximum number of run-time checks that can be performed when
10778 doing loop versioning for alignment in the vectorizer.
10779
10780 @item vect-max-version-for-alias-checks
10781 The maximum number of run-time checks that can be performed when
10782 doing loop versioning for alias in the vectorizer.
10783
10784 @item vect-max-peeling-for-alignment
10785 The maximum number of loop peels to enhance access alignment
10786 for vectorizer. Value -1 means no limit.
10787
10788 @item max-iterations-to-track
10789 The maximum number of iterations of a loop the brute-force algorithm
10790 for analysis of the number of iterations of the loop tries to evaluate.
10791
10792 @item hot-bb-count-ws-permille
10793 A basic block profile count is considered hot if it contributes to
10794 the given permillage (i.e. 0...1000) of the entire profiled execution.
10795
10796 @item hot-bb-frequency-fraction
10797 Select fraction of the entry block frequency of executions of basic block in
10798 function given basic block needs to have to be considered hot.
10799
10800 @item max-predicted-iterations
10801 The maximum number of loop iterations we predict statically. This is useful
10802 in cases where a function contains a single loop with known bound and
10803 another loop with unknown bound.
10804 The known number of iterations is predicted correctly, while
10805 the unknown number of iterations average to roughly 10. This means that the
10806 loop without bounds appears artificially cold relative to the other one.
10807
10808 @item builtin-expect-probability
10809 Control the probability of the expression having the specified value. This
10810 parameter takes a percentage (i.e. 0 ... 100) as input.
10811 The default probability of 90 is obtained empirically.
10812
10813 @item builtin-string-cmp-inline-length
10814 The maximum length of a constant string for a builtin string cmp call
10815 eligible for inlining.
10816 The default value is 3.
10817
10818 @item align-threshold
10819
10820 Select fraction of the maximal frequency of executions of a basic block in
10821 a function to align the basic block.
10822
10823 @item align-loop-iterations
10824
10825 A loop expected to iterate at least the selected number of iterations is
10826 aligned.
10827
10828 @item tracer-dynamic-coverage
10829 @itemx tracer-dynamic-coverage-feedback
10830
10831 This value is used to limit superblock formation once the given percentage of
10832 executed instructions is covered. This limits unnecessary code size
10833 expansion.
10834
10835 The @option{tracer-dynamic-coverage-feedback} parameter
10836 is used only when profile
10837 feedback is available. The real profiles (as opposed to statically estimated
10838 ones) are much less balanced allowing the threshold to be larger value.
10839
10840 @item tracer-max-code-growth
10841 Stop tail duplication once code growth has reached given percentage. This is
10842 a rather artificial limit, as most of the duplicates are eliminated later in
10843 cross jumping, so it may be set to much higher values than is the desired code
10844 growth.
10845
10846 @item tracer-min-branch-ratio
10847
10848 Stop reverse growth when the reverse probability of best edge is less than this
10849 threshold (in percent).
10850
10851 @item tracer-min-branch-probability
10852 @itemx tracer-min-branch-probability-feedback
10853
10854 Stop forward growth if the best edge has probability lower than this
10855 threshold.
10856
10857 Similarly to @option{tracer-dynamic-coverage} two parameters are
10858 provided. @option{tracer-min-branch-probability-feedback} is used for
10859 compilation with profile feedback and @option{tracer-min-branch-probability}
10860 compilation without. The value for compilation with profile feedback
10861 needs to be more conservative (higher) in order to make tracer
10862 effective.
10863
10864 @item stack-clash-protection-guard-size
10865 Specify the size of the operating system provided stack guard as
10866 2 raised to @var{num} bytes. The default value is 12 (4096 bytes).
10867 Acceptable values are between 12 and 30. Higher values may reduce the
10868 number of explicit probes, but a value larger than the operating system
10869 provided guard will leave code vulnerable to stack clash style attacks.
10870
10871 @item stack-clash-protection-probe-interval
10872 Stack clash protection involves probing stack space as it is allocated. This
10873 param controls the maximum distance between probes into the stack as 2 raised
10874 to @var{num} bytes. Acceptable values are between 10 and 16 and defaults to
10875 12. Higher values may reduce the number of explicit probes, but a value
10876 larger than the operating system provided guard will leave code vulnerable to
10877 stack clash style attacks.
10878
10879 @item max-cse-path-length
10880
10881 The maximum number of basic blocks on path that CSE considers.
10882 The default is 10.
10883
10884 @item max-cse-insns
10885 The maximum number of instructions CSE processes before flushing.
10886 The default is 1000.
10887
10888 @item ggc-min-expand
10889
10890 GCC uses a garbage collector to manage its own memory allocation. This
10891 parameter specifies the minimum percentage by which the garbage
10892 collector's heap should be allowed to expand between collections.
10893 Tuning this may improve compilation speed; it has no effect on code
10894 generation.
10895
10896 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
10897 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
10898 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
10899 GCC is not able to calculate RAM on a particular platform, the lower
10900 bound of 30% is used. Setting this parameter and
10901 @option{ggc-min-heapsize} to zero causes a full collection to occur at
10902 every opportunity. This is extremely slow, but can be useful for
10903 debugging.
10904
10905 @item ggc-min-heapsize
10906
10907 Minimum size of the garbage collector's heap before it begins bothering
10908 to collect garbage. The first collection occurs after the heap expands
10909 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
10910 tuning this may improve compilation speed, and has no effect on code
10911 generation.
10912
10913 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
10914 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
10915 with a lower bound of 4096 (four megabytes) and an upper bound of
10916 131072 (128 megabytes). If GCC is not able to calculate RAM on a
10917 particular platform, the lower bound is used. Setting this parameter
10918 very large effectively disables garbage collection. Setting this
10919 parameter and @option{ggc-min-expand} to zero causes a full collection
10920 to occur at every opportunity.
10921
10922 @item max-reload-search-insns
10923 The maximum number of instruction reload should look backward for equivalent
10924 register. Increasing values mean more aggressive optimization, making the
10925 compilation time increase with probably slightly better performance.
10926 The default value is 100.
10927
10928 @item max-cselib-memory-locations
10929 The maximum number of memory locations cselib should take into account.
10930 Increasing values mean more aggressive optimization, making the compilation time
10931 increase with probably slightly better performance. The default value is 500.
10932
10933 @item max-sched-ready-insns
10934 The maximum number of instructions ready to be issued the scheduler should
10935 consider at any given time during the first scheduling pass. Increasing
10936 values mean more thorough searches, making the compilation time increase
10937 with probably little benefit. The default value is 100.
10938
10939 @item max-sched-region-blocks
10940 The maximum number of blocks in a region to be considered for
10941 interblock scheduling. The default value is 10.
10942
10943 @item max-pipeline-region-blocks
10944 The maximum number of blocks in a region to be considered for
10945 pipelining in the selective scheduler. The default value is 15.
10946
10947 @item max-sched-region-insns
10948 The maximum number of insns in a region to be considered for
10949 interblock scheduling. The default value is 100.
10950
10951 @item max-pipeline-region-insns
10952 The maximum number of insns in a region to be considered for
10953 pipelining in the selective scheduler. The default value is 200.
10954
10955 @item min-spec-prob
10956 The minimum probability (in percents) of reaching a source block
10957 for interblock speculative scheduling. The default value is 40.
10958
10959 @item max-sched-extend-regions-iters
10960 The maximum number of iterations through CFG to extend regions.
10961 A value of 0 (the default) disables region extensions.
10962
10963 @item max-sched-insn-conflict-delay
10964 The maximum conflict delay for an insn to be considered for speculative motion.
10965 The default value is 3.
10966
10967 @item sched-spec-prob-cutoff
10968 The minimal probability of speculation success (in percents), so that
10969 speculative insns are scheduled.
10970 The default value is 40.
10971
10972 @item sched-state-edge-prob-cutoff
10973 The minimum probability an edge must have for the scheduler to save its
10974 state across it.
10975 The default value is 10.
10976
10977 @item sched-mem-true-dep-cost
10978 Minimal distance (in CPU cycles) between store and load targeting same
10979 memory locations. The default value is 1.
10980
10981 @item selsched-max-lookahead
10982 The maximum size of the lookahead window of selective scheduling. It is a
10983 depth of search for available instructions.
10984 The default value is 50.
10985
10986 @item selsched-max-sched-times
10987 The maximum number of times that an instruction is scheduled during
10988 selective scheduling. This is the limit on the number of iterations
10989 through which the instruction may be pipelined. The default value is 2.
10990
10991 @item selsched-insns-to-rename
10992 The maximum number of best instructions in the ready list that are considered
10993 for renaming in the selective scheduler. The default value is 2.
10994
10995 @item sms-min-sc
10996 The minimum value of stage count that swing modulo scheduler
10997 generates. The default value is 2.
10998
10999 @item max-last-value-rtl
11000 The maximum size measured as number of RTLs that can be recorded in an expression
11001 in combiner for a pseudo register as last known value of that register. The default
11002 is 10000.
11003
11004 @item max-combine-insns
11005 The maximum number of instructions the RTL combiner tries to combine.
11006 The default value is 2 at @option{-Og} and 4 otherwise.
11007
11008 @item integer-share-limit
11009 Small integer constants can use a shared data structure, reducing the
11010 compiler's memory usage and increasing its speed. This sets the maximum
11011 value of a shared integer constant. The default value is 256.
11012
11013 @item ssp-buffer-size
11014 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11015 protection when @option{-fstack-protection} is used.
11016
11017 @item min-size-for-stack-sharing
11018 The minimum size of variables taking part in stack slot sharing when not
11019 optimizing. The default value is 32.
11020
11021 @item max-jump-thread-duplication-stmts
11022 Maximum number of statements allowed in a block that needs to be
11023 duplicated when threading jumps.
11024
11025 @item max-fields-for-field-sensitive
11026 Maximum number of fields in a structure treated in
11027 a field sensitive manner during pointer analysis. The default is zero
11028 for @option{-O0} and @option{-O1},
11029 and 100 for @option{-Os}, @option{-O2}, and @option{-O3}.
11030
11031 @item prefetch-latency
11032 Estimate on average number of instructions that are executed before
11033 prefetch finishes. The distance prefetched ahead is proportional
11034 to this constant. Increasing this number may also lead to less
11035 streams being prefetched (see @option{simultaneous-prefetches}).
11036
11037 @item simultaneous-prefetches
11038 Maximum number of prefetches that can run at the same time.
11039
11040 @item l1-cache-line-size
11041 The size of cache line in L1 cache, in bytes.
11042
11043 @item l1-cache-size
11044 The size of L1 cache, in kilobytes.
11045
11046 @item l2-cache-size
11047 The size of L2 cache, in kilobytes.
11048
11049 @item prefetch-dynamic-strides
11050 Whether the loop array prefetch pass should issue software prefetch hints
11051 for strides that are non-constant. In some cases this may be
11052 beneficial, though the fact the stride is non-constant may make it
11053 hard to predict when there is clear benefit to issuing these hints.
11054
11055 Set to 1, the default, if the prefetch hints should be issued for non-constant
11056 strides. Set to 0 if prefetch hints should be issued only for strides that
11057 are known to be constant and below @option{prefetch-minimum-stride}.
11058
11059 @item prefetch-minimum-stride
11060 Minimum constant stride, in bytes, to start using prefetch hints for. If
11061 the stride is less than this threshold, prefetch hints will not be issued.
11062
11063 This setting is useful for processors that have hardware prefetchers, in
11064 which case there may be conflicts between the hardware prefetchers and
11065 the software prefetchers. If the hardware prefetchers have a maximum
11066 stride they can handle, it should be used here to improve the use of
11067 software prefetchers.
11068
11069 A value of -1, the default, means we don't have a threshold and therefore
11070 prefetch hints can be issued for any constant stride.
11071
11072 This setting is only useful for strides that are known and constant.
11073
11074 @item loop-interchange-max-num-stmts
11075 The maximum number of stmts in a loop to be interchanged.
11076
11077 @item loop-interchange-stride-ratio
11078 The minimum ratio between stride of two loops for interchange to be profitable.
11079
11080 @item min-insn-to-prefetch-ratio
11081 The minimum ratio between the number of instructions and the
11082 number of prefetches to enable prefetching in a loop.
11083
11084 @item prefetch-min-insn-to-mem-ratio
11085 The minimum ratio between the number of instructions and the
11086 number of memory references to enable prefetching in a loop.
11087
11088 @item use-canonical-types
11089 Whether the compiler should use the ``canonical'' type system. By
11090 default, this should always be 1, which uses a more efficient internal
11091 mechanism for comparing types in C++ and Objective-C++. However, if
11092 bugs in the canonical type system are causing compilation failures,
11093 set this value to 0 to disable canonical types.
11094
11095 @item switch-conversion-max-branch-ratio
11096 Switch initialization conversion refuses to create arrays that are
11097 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11098 branches in the switch.
11099
11100 @item max-partial-antic-length
11101 Maximum length of the partial antic set computed during the tree
11102 partial redundancy elimination optimization (@option{-ftree-pre}) when
11103 optimizing at @option{-O3} and above. For some sorts of source code
11104 the enhanced partial redundancy elimination optimization can run away,
11105 consuming all of the memory available on the host machine. This
11106 parameter sets a limit on the length of the sets that are computed,
11107 which prevents the runaway behavior. Setting a value of 0 for
11108 this parameter allows an unlimited set length.
11109
11110 @item rpo-vn-max-loop-depth
11111 Maximum loop depth that is value-numbered optimistically. The default
11112 maximum loop depth is three. When the limit hits the innermost
11113 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11114 loop nest are value-numbered optimistically and the remaining ones not.
11115 The default maximum loop depth is seven.
11116
11117 @item sccvn-max-alias-queries-per-access
11118 Maximum number of alias-oracle queries we perform when looking for
11119 redundancies for loads and stores. If this limit is hit the search
11120 is aborted and the load or store is not considered redundant. The
11121 number of queries is algorithmically limited to the number of
11122 stores on all paths from the load to the function entry.
11123 The default maximum number of queries is 1000.
11124
11125 @item ira-max-loops-num
11126 IRA uses regional register allocation by default. If a function
11127 contains more loops than the number given by this parameter, only at most
11128 the given number of the most frequently-executed loops form regions
11129 for regional register allocation. The default value of the
11130 parameter is 100.
11131
11132 @item ira-max-conflict-table-size
11133 Although IRA uses a sophisticated algorithm to compress the conflict
11134 table, the table can still require excessive amounts of memory for
11135 huge functions. If the conflict table for a function could be more
11136 than the size in MB given by this parameter, the register allocator
11137 instead uses a faster, simpler, and lower-quality
11138 algorithm that does not require building a pseudo-register conflict table.
11139 The default value of the parameter is 2000.
11140
11141 @item ira-loop-reserved-regs
11142 IRA can be used to evaluate more accurate register pressure in loops
11143 for decisions to move loop invariants (see @option{-O3}). The number
11144 of available registers reserved for some other purposes is given
11145 by this parameter. The default value of the parameter is 2, which is
11146 the minimal number of registers needed by typical instructions.
11147 This value is the best found from numerous experiments.
11148
11149 @item lra-inheritance-ebb-probability-cutoff
11150 LRA tries to reuse values reloaded in registers in subsequent insns.
11151 This optimization is called inheritance. EBB is used as a region to
11152 do this optimization. The parameter defines a minimal fall-through
11153 edge probability in percentage used to add BB to inheritance EBB in
11154 LRA. The default value of the parameter is 40. The value was chosen
11155 from numerous runs of SPEC2000 on x86-64.
11156
11157 @item loop-invariant-max-bbs-in-loop
11158 Loop invariant motion can be very expensive, both in compilation time and
11159 in amount of needed compile-time memory, with very large loops. Loops
11160 with more basic blocks than this parameter won't have loop invariant
11161 motion optimization performed on them. The default value of the
11162 parameter is 1000 for @option{-O1} and 10000 for @option{-O2} and above.
11163
11164 @item loop-max-datarefs-for-datadeps
11165 Building data dependencies is expensive for very large loops. This
11166 parameter limits the number of data references in loops that are
11167 considered for data dependence analysis. These large loops are no
11168 handled by the optimizations using loop data dependencies.
11169 The default value is 1000.
11170
11171 @item max-vartrack-size
11172 Sets a maximum number of hash table slots to use during variable
11173 tracking dataflow analysis of any function. If this limit is exceeded
11174 with variable tracking at assignments enabled, analysis for that
11175 function is retried without it, after removing all debug insns from
11176 the function. If the limit is exceeded even without debug insns, var
11177 tracking analysis is completely disabled for the function. Setting
11178 the parameter to zero makes it unlimited.
11179
11180 @item max-vartrack-expr-depth
11181 Sets a maximum number of recursion levels when attempting to map
11182 variable names or debug temporaries to value expressions. This trades
11183 compilation time for more complete debug information. If this is set too
11184 low, value expressions that are available and could be represented in
11185 debug information may end up not being used; setting this higher may
11186 enable the compiler to find more complex debug expressions, but compile
11187 time and memory use may grow. The default is 12.
11188
11189 @item max-debug-marker-count
11190 Sets a threshold on the number of debug markers (e.g. begin stmt
11191 markers) to avoid complexity explosion at inlining or expanding to RTL.
11192 If a function has more such gimple stmts than the set limit, such stmts
11193 will be dropped from the inlined copy of a function, and from its RTL
11194 expansion. The default is 100000.
11195
11196 @item min-nondebug-insn-uid
11197 Use uids starting at this parameter for nondebug insns. The range below
11198 the parameter is reserved exclusively for debug insns created by
11199 @option{-fvar-tracking-assignments}, but debug insns may get
11200 (non-overlapping) uids above it if the reserved range is exhausted.
11201
11202 @item ipa-sra-ptr-growth-factor
11203 IPA-SRA replaces a pointer to an aggregate with one or more new
11204 parameters only when their cumulative size is less or equal to
11205 @option{ipa-sra-ptr-growth-factor} times the size of the original
11206 pointer parameter.
11207
11208 @item sra-max-scalarization-size-Ospeed
11209 @itemx sra-max-scalarization-size-Osize
11210 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11211 replace scalar parts of aggregates with uses of independent scalar
11212 variables. These parameters control the maximum size, in storage units,
11213 of aggregate which is considered for replacement when compiling for
11214 speed
11215 (@option{sra-max-scalarization-size-Ospeed}) or size
11216 (@option{sra-max-scalarization-size-Osize}) respectively.
11217
11218 @item tm-max-aggregate-size
11219 When making copies of thread-local variables in a transaction, this
11220 parameter specifies the size in bytes after which variables are
11221 saved with the logging functions as opposed to save/restore code
11222 sequence pairs. This option only applies when using
11223 @option{-fgnu-tm}.
11224
11225 @item graphite-max-nb-scop-params
11226 To avoid exponential effects in the Graphite loop transforms, the
11227 number of parameters in a Static Control Part (SCoP) is bounded. The
11228 default value is 10 parameters, a value of zero can be used to lift
11229 the bound. A variable whose value is unknown at compilation time and
11230 defined outside a SCoP is a parameter of the SCoP.
11231
11232 @item loop-block-tile-size
11233 Loop blocking or strip mining transforms, enabled with
11234 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11235 loop in the loop nest by a given number of iterations. The strip
11236 length can be changed using the @option{loop-block-tile-size}
11237 parameter. The default value is 51 iterations.
11238
11239 @item loop-unroll-jam-size
11240 Specify the unroll factor for the @option{-floop-unroll-and-jam} option. The
11241 default value is 4.
11242
11243 @item loop-unroll-jam-depth
11244 Specify the dimension to be unrolled (counting from the most inner loop)
11245 for the @option{-floop-unroll-and-jam}. The default value is 2.
11246
11247 @item ipa-cp-value-list-size
11248 IPA-CP attempts to track all possible values and types passed to a function's
11249 parameter in order to propagate them and perform devirtualization.
11250 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11251 stores per one formal parameter of a function.
11252
11253 @item ipa-cp-eval-threshold
11254 IPA-CP calculates its own score of cloning profitability heuristics
11255 and performs those cloning opportunities with scores that exceed
11256 @option{ipa-cp-eval-threshold}.
11257
11258 @item ipa-cp-recursion-penalty
11259 Percentage penalty the recursive functions will receive when they
11260 are evaluated for cloning.
11261
11262 @item ipa-cp-single-call-penalty
11263 Percentage penalty functions containing a single call to another
11264 function will receive when they are evaluated for cloning.
11265
11266
11267 @item ipa-max-agg-items
11268 IPA-CP is also capable to propagate a number of scalar values passed
11269 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11270 number of such values per one parameter.
11271
11272 @item ipa-cp-loop-hint-bonus
11273 When IPA-CP determines that a cloning candidate would make the number
11274 of iterations of a loop known, it adds a bonus of
11275 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11276 the candidate.
11277
11278 @item ipa-cp-array-index-hint-bonus
11279 When IPA-CP determines that a cloning candidate would make the index of
11280 an array access known, it adds a bonus of
11281 @option{ipa-cp-array-index-hint-bonus} to the profitability
11282 score of the candidate.
11283
11284 @item ipa-max-aa-steps
11285 During its analysis of function bodies, IPA-CP employs alias analysis
11286 in order to track values pointed to by function parameters. In order
11287 not spend too much time analyzing huge functions, it gives up and
11288 consider all memory clobbered after examining
11289 @option{ipa-max-aa-steps} statements modifying memory.
11290
11291 @item lto-partitions
11292 Specify desired number of partitions produced during WHOPR compilation.
11293 The number of partitions should exceed the number of CPUs used for compilation.
11294 The default value is 32.
11295
11296 @item lto-min-partition
11297 Size of minimal partition for WHOPR (in estimated instructions).
11298 This prevents expenses of splitting very small programs into too many
11299 partitions.
11300
11301 @item lto-max-partition
11302 Size of max partition for WHOPR (in estimated instructions).
11303 to provide an upper bound for individual size of partition.
11304 Meant to be used only with balanced partitioning.
11305
11306 @item cxx-max-namespaces-for-diagnostic-help
11307 The maximum number of namespaces to consult for suggestions when C++
11308 name lookup fails for an identifier. The default is 1000.
11309
11310 @item sink-frequency-threshold
11311 The maximum relative execution frequency (in percents) of the target block
11312 relative to a statement's original block to allow statement sinking of a
11313 statement. Larger numbers result in more aggressive statement sinking.
11314 The default value is 75. A small positive adjustment is applied for
11315 statements with memory operands as those are even more profitable so sink.
11316
11317 @item max-stores-to-sink
11318 The maximum number of conditional store pairs that can be sunk. Set to 0
11319 if either vectorization (@option{-ftree-vectorize}) or if-conversion
11320 (@option{-ftree-loop-if-convert}) is disabled. The default is 2.
11321
11322 @item allow-store-data-races
11323 Allow optimizers to introduce new data races on stores.
11324 Set to 1 to allow, otherwise to 0. This option is enabled by default
11325 at optimization level @option{-Ofast}.
11326
11327 @item case-values-threshold
11328 The smallest number of different values for which it is best to use a
11329 jump-table instead of a tree of conditional branches. If the value is
11330 0, use the default for the machine. The default is 0.
11331
11332 @item tree-reassoc-width
11333 Set the maximum number of instructions executed in parallel in
11334 reassociated tree. This parameter overrides target dependent
11335 heuristics used by default if has non zero value.
11336
11337 @item sched-pressure-algorithm
11338 Choose between the two available implementations of
11339 @option{-fsched-pressure}. Algorithm 1 is the original implementation
11340 and is the more likely to prevent instructions from being reordered.
11341 Algorithm 2 was designed to be a compromise between the relatively
11342 conservative approach taken by algorithm 1 and the rather aggressive
11343 approach taken by the default scheduler. It relies more heavily on
11344 having a regular register file and accurate register pressure classes.
11345 See @file{haifa-sched.c} in the GCC sources for more details.
11346
11347 The default choice depends on the target.
11348
11349 @item max-slsr-cand-scan
11350 Set the maximum number of existing candidates that are considered when
11351 seeking a basis for a new straight-line strength reduction candidate.
11352
11353 @item asan-globals
11354 Enable buffer overflow detection for global objects. This kind
11355 of protection is enabled by default if you are using
11356 @option{-fsanitize=address} option.
11357 To disable global objects protection use @option{--param asan-globals=0}.
11358
11359 @item asan-stack
11360 Enable buffer overflow detection for stack objects. This kind of
11361 protection is enabled by default when using @option{-fsanitize=address}.
11362 To disable stack protection use @option{--param asan-stack=0} option.
11363
11364 @item asan-instrument-reads
11365 Enable buffer overflow detection for memory reads. This kind of
11366 protection is enabled by default when using @option{-fsanitize=address}.
11367 To disable memory reads protection use
11368 @option{--param asan-instrument-reads=0}.
11369
11370 @item asan-instrument-writes
11371 Enable buffer overflow detection for memory writes. This kind of
11372 protection is enabled by default when using @option{-fsanitize=address}.
11373 To disable memory writes protection use
11374 @option{--param asan-instrument-writes=0} option.
11375
11376 @item asan-memintrin
11377 Enable detection for built-in functions. This kind of protection
11378 is enabled by default when using @option{-fsanitize=address}.
11379 To disable built-in functions protection use
11380 @option{--param asan-memintrin=0}.
11381
11382 @item asan-use-after-return
11383 Enable detection of use-after-return. This kind of protection
11384 is enabled by default when using the @option{-fsanitize=address} option.
11385 To disable it use @option{--param asan-use-after-return=0}.
11386
11387 Note: By default the check is disabled at run time. To enable it,
11388 add @code{detect_stack_use_after_return=1} to the environment variable
11389 @env{ASAN_OPTIONS}.
11390
11391 @item asan-instrumentation-with-call-threshold
11392 If number of memory accesses in function being instrumented
11393 is greater or equal to this number, use callbacks instead of inline checks.
11394 E.g. to disable inline code use
11395 @option{--param asan-instrumentation-with-call-threshold=0}.
11396
11397 @item use-after-scope-direct-emission-threshold
11398 If the size of a local variable in bytes is smaller or equal to this
11399 number, directly poison (or unpoison) shadow memory instead of using
11400 run-time callbacks. The default value is 256.
11401
11402 @item max-fsm-thread-path-insns
11403 Maximum number of instructions to copy when duplicating blocks on a
11404 finite state automaton jump thread path. The default is 100.
11405
11406 @item max-fsm-thread-length
11407 Maximum number of basic blocks on a finite state automaton jump thread
11408 path. The default is 10.
11409
11410 @item max-fsm-thread-paths
11411 Maximum number of new jump thread paths to create for a finite state
11412 automaton. The default is 50.
11413
11414 @item parloops-chunk-size
11415 Chunk size of omp schedule for loops parallelized by parloops. The default
11416 is 0.
11417
11418 @item parloops-schedule
11419 Schedule type of omp schedule for loops parallelized by parloops (static,
11420 dynamic, guided, auto, runtime). The default is static.
11421
11422 @item parloops-min-per-thread
11423 The minimum number of iterations per thread of an innermost parallelized
11424 loop for which the parallelized variant is prefered over the single threaded
11425 one. The default is 100. Note that for a parallelized loop nest the
11426 minimum number of iterations of the outermost loop per thread is two.
11427
11428 @item max-ssa-name-query-depth
11429 Maximum depth of recursion when querying properties of SSA names in things
11430 like fold routines. One level of recursion corresponds to following a
11431 use-def chain.
11432
11433 @item hsa-gen-debug-stores
11434 Enable emission of special debug stores within HSA kernels which are
11435 then read and reported by libgomp plugin. Generation of these stores
11436 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
11437 enable it.
11438
11439 @item max-speculative-devirt-maydefs
11440 The maximum number of may-defs we analyze when looking for a must-def
11441 specifying the dynamic type of an object that invokes a virtual call
11442 we may be able to devirtualize speculatively.
11443
11444 @item max-vrp-switch-assertions
11445 The maximum number of assertions to add along the default edge of a switch
11446 statement during VRP. The default is 10.
11447
11448 @item unroll-jam-min-percent
11449 The minimum percentage of memory references that must be optimized
11450 away for the unroll-and-jam transformation to be considered profitable.
11451
11452 @item unroll-jam-max-unroll
11453 The maximum number of times the outer loop should be unrolled by
11454 the unroll-and-jam transformation.
11455 @end table
11456 @end table
11457
11458 @node Instrumentation Options
11459 @section Program Instrumentation Options
11460 @cindex instrumentation options
11461 @cindex program instrumentation options
11462 @cindex run-time error checking options
11463 @cindex profiling options
11464 @cindex options, program instrumentation
11465 @cindex options, run-time error checking
11466 @cindex options, profiling
11467
11468 GCC supports a number of command-line options that control adding
11469 run-time instrumentation to the code it normally generates.
11470 For example, one purpose of instrumentation is collect profiling
11471 statistics for use in finding program hot spots, code coverage
11472 analysis, or profile-guided optimizations.
11473 Another class of program instrumentation is adding run-time checking
11474 to detect programming errors like invalid pointer
11475 dereferences or out-of-bounds array accesses, as well as deliberately
11476 hostile attacks such as stack smashing or C++ vtable hijacking.
11477 There is also a general hook which can be used to implement other
11478 forms of tracing or function-level instrumentation for debug or
11479 program analysis purposes.
11480
11481 @table @gcctabopt
11482 @cindex @command{prof}
11483 @item -p
11484 @opindex p
11485 Generate extra code to write profile information suitable for the
11486 analysis program @command{prof}. You must use this option when compiling
11487 the source files you want data about, and you must also use it when
11488 linking.
11489
11490 @cindex @command{gprof}
11491 @item -pg
11492 @opindex pg
11493 Generate extra code to write profile information suitable for the
11494 analysis program @command{gprof}. You must use this option when compiling
11495 the source files you want data about, and you must also use it when
11496 linking.
11497
11498 @item -fprofile-arcs
11499 @opindex fprofile-arcs
11500 Add code so that program flow @dfn{arcs} are instrumented. During
11501 execution the program records how many times each branch and call is
11502 executed and how many times it is taken or returns. On targets that support
11503 constructors with priority support, profiling properly handles constructors,
11504 destructors and C++ constructors (and destructors) of classes which are used
11505 as a type of a global variable.
11506
11507 When the compiled
11508 program exits it saves this data to a file called
11509 @file{@var{auxname}.gcda} for each source file. The data may be used for
11510 profile-directed optimizations (@option{-fbranch-probabilities}), or for
11511 test coverage analysis (@option{-ftest-coverage}). Each object file's
11512 @var{auxname} is generated from the name of the output file, if
11513 explicitly specified and it is not the final executable, otherwise it is
11514 the basename of the source file. In both cases any suffix is removed
11515 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
11516 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
11517 @xref{Cross-profiling}.
11518
11519 @cindex @command{gcov}
11520 @item --coverage
11521 @opindex coverage
11522
11523 This option is used to compile and link code instrumented for coverage
11524 analysis. The option is a synonym for @option{-fprofile-arcs}
11525 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
11526 linking). See the documentation for those options for more details.
11527
11528 @itemize
11529
11530 @item
11531 Compile the source files with @option{-fprofile-arcs} plus optimization
11532 and code generation options. For test coverage analysis, use the
11533 additional @option{-ftest-coverage} option. You do not need to profile
11534 every source file in a program.
11535
11536 @item
11537 Compile the source files additionally with @option{-fprofile-abs-path}
11538 to create absolute path names in the @file{.gcno} files. This allows
11539 @command{gcov} to find the correct sources in projects where compilations
11540 occur with different working directories.
11541
11542 @item
11543 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
11544 (the latter implies the former).
11545
11546 @item
11547 Run the program on a representative workload to generate the arc profile
11548 information. This may be repeated any number of times. You can run
11549 concurrent instances of your program, and provided that the file system
11550 supports locking, the data files will be correctly updated. Unless
11551 a strict ISO C dialect option is in effect, @code{fork} calls are
11552 detected and correctly handled without double counting.
11553
11554 @item
11555 For profile-directed optimizations, compile the source files again with
11556 the same optimization and code generation options plus
11557 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
11558 Control Optimization}).
11559
11560 @item
11561 For test coverage analysis, use @command{gcov} to produce human readable
11562 information from the @file{.gcno} and @file{.gcda} files. Refer to the
11563 @command{gcov} documentation for further information.
11564
11565 @end itemize
11566
11567 With @option{-fprofile-arcs}, for each function of your program GCC
11568 creates a program flow graph, then finds a spanning tree for the graph.
11569 Only arcs that are not on the spanning tree have to be instrumented: the
11570 compiler adds code to count the number of times that these arcs are
11571 executed. When an arc is the only exit or only entrance to a block, the
11572 instrumentation code can be added to the block; otherwise, a new basic
11573 block must be created to hold the instrumentation code.
11574
11575 @need 2000
11576 @item -ftest-coverage
11577 @opindex ftest-coverage
11578 Produce a notes file that the @command{gcov} code-coverage utility
11579 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
11580 show program coverage. Each source file's note file is called
11581 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
11582 above for a description of @var{auxname} and instructions on how to
11583 generate test coverage data. Coverage data matches the source files
11584 more closely if you do not optimize.
11585
11586 @item -fprofile-abs-path
11587 @opindex fprofile-abs-path
11588 Automatically convert relative source file names to absolute path names
11589 in the @file{.gcno} files. This allows @command{gcov} to find the correct
11590 sources in projects where compilations occur with different working
11591 directories.
11592
11593 @item -fprofile-dir=@var{path}
11594 @opindex fprofile-dir
11595
11596 Set the directory to search for the profile data files in to @var{path}.
11597 This option affects only the profile data generated by
11598 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
11599 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
11600 and its related options. Both absolute and relative paths can be used.
11601 By default, GCC uses the current directory as @var{path}, thus the
11602 profile data file appears in the same directory as the object file.
11603 In order to prevent the file name clashing, if the object file name is
11604 not an absolute path, we mangle the absolute path of the
11605 @file{@var{sourcename}.gcda} file and use it as the file name of a
11606 @file{.gcda} file.
11607
11608 When an executable is run in a massive parallel environment, it is recommended
11609 to save profile to different folders. That can be done with variables
11610 in @var{path} that are exported during run-time:
11611
11612 @table @gcctabopt
11613
11614 @item %p
11615 process ID.
11616
11617 @item %q@{VAR@}
11618 value of environment variable @var{VAR}
11619
11620 @end table
11621
11622 @item -fprofile-generate
11623 @itemx -fprofile-generate=@var{path}
11624 @opindex fprofile-generate
11625
11626 Enable options usually used for instrumenting application to produce
11627 profile useful for later recompilation with profile feedback based
11628 optimization. You must use @option{-fprofile-generate} both when
11629 compiling and when linking your program.
11630
11631 The following options are enabled: @option{-fprofile-arcs}, @option{-fprofile-values}, @option{-fvpt}.
11632
11633 If @var{path} is specified, GCC looks at the @var{path} to find
11634 the profile feedback data files. See @option{-fprofile-dir}.
11635
11636 To optimize the program based on the collected profile information, use
11637 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
11638
11639 @item -fprofile-update=@var{method}
11640 @opindex fprofile-update
11641
11642 Alter the update method for an application instrumented for profile
11643 feedback based optimization. The @var{method} argument should be one of
11644 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
11645 The first one is useful for single-threaded applications,
11646 while the second one prevents profile corruption by emitting thread-safe code.
11647
11648 @strong{Warning:} When an application does not properly join all threads
11649 (or creates an detached thread), a profile file can be still corrupted.
11650
11651 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
11652 when supported by a target, or to @samp{single} otherwise. The GCC driver
11653 automatically selects @samp{prefer-atomic} when @option{-pthread}
11654 is present in the command line.
11655
11656 @item -fsanitize=address
11657 @opindex fsanitize=address
11658 Enable AddressSanitizer, a fast memory error detector.
11659 Memory access instructions are instrumented to detect
11660 out-of-bounds and use-after-free bugs.
11661 The option enables @option{-fsanitize-address-use-after-scope}.
11662 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
11663 more details. The run-time behavior can be influenced using the
11664 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
11665 the available options are shown at startup of the instrumented program. See
11666 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
11667 for a list of supported options.
11668 The option cannot be combined with @option{-fsanitize=thread}.
11669
11670 @item -fsanitize=kernel-address
11671 @opindex fsanitize=kernel-address
11672 Enable AddressSanitizer for Linux kernel.
11673 See @uref{https://github.com/google/kasan/wiki} for more details.
11674
11675 @item -fsanitize=pointer-compare
11676 @opindex fsanitize=pointer-compare
11677 Instrument comparison operation (<, <=, >, >=) with pointer operands.
11678 The option must be combined with either @option{-fsanitize=kernel-address} or
11679 @option{-fsanitize=address}
11680 The option cannot be combined with @option{-fsanitize=thread}.
11681 Note: By default the check is disabled at run time. To enable it,
11682 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11683 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11684 invalid operation only when both pointers are non-null.
11685
11686 @item -fsanitize=pointer-subtract
11687 @opindex fsanitize=pointer-subtract
11688 Instrument subtraction with pointer operands.
11689 The option must be combined with either @option{-fsanitize=kernel-address} or
11690 @option{-fsanitize=address}
11691 The option cannot be combined with @option{-fsanitize=thread}.
11692 Note: By default the check is disabled at run time. To enable it,
11693 add @code{detect_invalid_pointer_pairs=2} to the environment variable
11694 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
11695 invalid operation only when both pointers are non-null.
11696
11697 @item -fsanitize=thread
11698 @opindex fsanitize=thread
11699 Enable ThreadSanitizer, a fast data race detector.
11700 Memory access instructions are instrumented to detect
11701 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
11702 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
11703 environment variable; see
11704 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
11705 supported options.
11706 The option cannot be combined with @option{-fsanitize=address},
11707 @option{-fsanitize=leak}.
11708
11709 Note that sanitized atomic builtins cannot throw exceptions when
11710 operating on invalid memory addresses with non-call exceptions
11711 (@option{-fnon-call-exceptions}).
11712
11713 @item -fsanitize=leak
11714 @opindex fsanitize=leak
11715 Enable LeakSanitizer, a memory leak detector.
11716 This option only matters for linking of executables and
11717 the executable is linked against a library that overrides @code{malloc}
11718 and other allocator functions. See
11719 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
11720 details. The run-time behavior can be influenced using the
11721 @env{LSAN_OPTIONS} environment variable.
11722 The option cannot be combined with @option{-fsanitize=thread}.
11723
11724 @item -fsanitize=undefined
11725 @opindex fsanitize=undefined
11726 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
11727 Various computations are instrumented to detect undefined behavior
11728 at runtime. Current suboptions are:
11729
11730 @table @gcctabopt
11731
11732 @item -fsanitize=shift
11733 @opindex fsanitize=shift
11734 This option enables checking that the result of a shift operation is
11735 not undefined. Note that what exactly is considered undefined differs
11736 slightly between C and C++, as well as between ISO C90 and C99, etc.
11737 This option has two suboptions, @option{-fsanitize=shift-base} and
11738 @option{-fsanitize=shift-exponent}.
11739
11740 @item -fsanitize=shift-exponent
11741 @opindex fsanitize=shift-exponent
11742 This option enables checking that the second argument of a shift operation
11743 is not negative and is smaller than the precision of the promoted first
11744 argument.
11745
11746 @item -fsanitize=shift-base
11747 @opindex fsanitize=shift-base
11748 If the second argument of a shift operation is within range, check that the
11749 result of a shift operation is not undefined. Note that what exactly is
11750 considered undefined differs slightly between C and C++, as well as between
11751 ISO C90 and C99, etc.
11752
11753 @item -fsanitize=integer-divide-by-zero
11754 @opindex fsanitize=integer-divide-by-zero
11755 Detect integer division by zero as well as @code{INT_MIN / -1} division.
11756
11757 @item -fsanitize=unreachable
11758 @opindex fsanitize=unreachable
11759 With this option, the compiler turns the @code{__builtin_unreachable}
11760 call into a diagnostics message call instead. When reaching the
11761 @code{__builtin_unreachable} call, the behavior is undefined.
11762
11763 @item -fsanitize=vla-bound
11764 @opindex fsanitize=vla-bound
11765 This option instructs the compiler to check that the size of a variable
11766 length array is positive.
11767
11768 @item -fsanitize=null
11769 @opindex fsanitize=null
11770 This option enables pointer checking. Particularly, the application
11771 built with this option turned on will issue an error message when it
11772 tries to dereference a NULL pointer, or if a reference (possibly an
11773 rvalue reference) is bound to a NULL pointer, or if a method is invoked
11774 on an object pointed by a NULL pointer.
11775
11776 @item -fsanitize=return
11777 @opindex fsanitize=return
11778 This option enables return statement checking. Programs
11779 built with this option turned on will issue an error message
11780 when the end of a non-void function is reached without actually
11781 returning a value. This option works in C++ only.
11782
11783 @item -fsanitize=signed-integer-overflow
11784 @opindex fsanitize=signed-integer-overflow
11785 This option enables signed integer overflow checking. We check that
11786 the result of @code{+}, @code{*}, and both unary and binary @code{-}
11787 does not overflow in the signed arithmetics. Note, integer promotion
11788 rules must be taken into account. That is, the following is not an
11789 overflow:
11790 @smallexample
11791 signed char a = SCHAR_MAX;
11792 a++;
11793 @end smallexample
11794
11795 @item -fsanitize=bounds
11796 @opindex fsanitize=bounds
11797 This option enables instrumentation of array bounds. Various out of bounds
11798 accesses are detected. Flexible array members, flexible array member-like
11799 arrays, and initializers of variables with static storage are not instrumented.
11800
11801 @item -fsanitize=bounds-strict
11802 @opindex fsanitize=bounds-strict
11803 This option enables strict instrumentation of array bounds. Most out of bounds
11804 accesses are detected, including flexible array members and flexible array
11805 member-like arrays. Initializers of variables with static storage are not
11806 instrumented.
11807
11808 @item -fsanitize=alignment
11809 @opindex fsanitize=alignment
11810
11811 This option enables checking of alignment of pointers when they are
11812 dereferenced, or when a reference is bound to insufficiently aligned target,
11813 or when a method or constructor is invoked on insufficiently aligned object.
11814
11815 @item -fsanitize=object-size
11816 @opindex fsanitize=object-size
11817 This option enables instrumentation of memory references using the
11818 @code{__builtin_object_size} function. Various out of bounds pointer
11819 accesses are detected.
11820
11821 @item -fsanitize=float-divide-by-zero
11822 @opindex fsanitize=float-divide-by-zero
11823 Detect floating-point division by zero. Unlike other similar options,
11824 @option{-fsanitize=float-divide-by-zero} is not enabled by
11825 @option{-fsanitize=undefined}, since floating-point division by zero can
11826 be a legitimate way of obtaining infinities and NaNs.
11827
11828 @item -fsanitize=float-cast-overflow
11829 @opindex fsanitize=float-cast-overflow
11830 This option enables floating-point type to integer conversion checking.
11831 We check that the result of the conversion does not overflow.
11832 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
11833 not enabled by @option{-fsanitize=undefined}.
11834 This option does not work well with @code{FE_INVALID} exceptions enabled.
11835
11836 @item -fsanitize=nonnull-attribute
11837 @opindex fsanitize=nonnull-attribute
11838
11839 This option enables instrumentation of calls, checking whether null values
11840 are not passed to arguments marked as requiring a non-null value by the
11841 @code{nonnull} function attribute.
11842
11843 @item -fsanitize=returns-nonnull-attribute
11844 @opindex fsanitize=returns-nonnull-attribute
11845
11846 This option enables instrumentation of return statements in functions
11847 marked with @code{returns_nonnull} function attribute, to detect returning
11848 of null values from such functions.
11849
11850 @item -fsanitize=bool
11851 @opindex fsanitize=bool
11852
11853 This option enables instrumentation of loads from bool. If a value other
11854 than 0/1 is loaded, a run-time error is issued.
11855
11856 @item -fsanitize=enum
11857 @opindex fsanitize=enum
11858
11859 This option enables instrumentation of loads from an enum type. If
11860 a value outside the range of values for the enum type is loaded,
11861 a run-time error is issued.
11862
11863 @item -fsanitize=vptr
11864 @opindex fsanitize=vptr
11865
11866 This option enables instrumentation of C++ member function calls, member
11867 accesses and some conversions between pointers to base and derived classes,
11868 to verify the referenced object has the correct dynamic type.
11869
11870 @item -fsanitize=pointer-overflow
11871 @opindex fsanitize=pointer-overflow
11872
11873 This option enables instrumentation of pointer arithmetics. If the pointer
11874 arithmetics overflows, a run-time error is issued.
11875
11876 @item -fsanitize=builtin
11877 @opindex fsanitize=builtin
11878
11879 This option enables instrumentation of arguments to selected builtin
11880 functions. If an invalid value is passed to such arguments, a run-time
11881 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
11882 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
11883 by this option.
11884
11885 @end table
11886
11887 While @option{-ftrapv} causes traps for signed overflows to be emitted,
11888 @option{-fsanitize=undefined} gives a diagnostic message.
11889 This currently works only for the C family of languages.
11890
11891 @item -fno-sanitize=all
11892 @opindex fno-sanitize=all
11893
11894 This option disables all previously enabled sanitizers.
11895 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
11896 together.
11897
11898 @item -fasan-shadow-offset=@var{number}
11899 @opindex fasan-shadow-offset
11900 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
11901 It is useful for experimenting with different shadow memory layouts in
11902 Kernel AddressSanitizer.
11903
11904 @item -fsanitize-sections=@var{s1},@var{s2},...
11905 @opindex fsanitize-sections
11906 Sanitize global variables in selected user-defined sections. @var{si} may
11907 contain wildcards.
11908
11909 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
11910 @opindex fsanitize-recover
11911 @opindex fno-sanitize-recover
11912 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
11913 mentioned in comma-separated list of @var{opts}. Enabling this option
11914 for a sanitizer component causes it to attempt to continue
11915 running the program as if no error happened. This means multiple
11916 runtime errors can be reported in a single program run, and the exit
11917 code of the program may indicate success even when errors
11918 have been reported. The @option{-fno-sanitize-recover=} option
11919 can be used to alter
11920 this behavior: only the first detected error is reported
11921 and program then exits with a non-zero exit code.
11922
11923 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
11924 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
11925 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
11926 @option{-fsanitize=bounds-strict},
11927 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
11928 For these sanitizers error recovery is turned on by default,
11929 except @option{-fsanitize=address}, for which this feature is experimental.
11930 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
11931 accepted, the former enables recovery for all sanitizers that support it,
11932 the latter disables recovery for all sanitizers that support it.
11933
11934 Even if a recovery mode is turned on the compiler side, it needs to be also
11935 enabled on the runtime library side, otherwise the failures are still fatal.
11936 The runtime library defaults to @code{halt_on_error=0} for
11937 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
11938 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
11939 setting the @code{halt_on_error} flag in the corresponding environment variable.
11940
11941 Syntax without an explicit @var{opts} parameter is deprecated. It is
11942 equivalent to specifying an @var{opts} list of:
11943
11944 @smallexample
11945 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
11946 @end smallexample
11947
11948 @item -fsanitize-address-use-after-scope
11949 @opindex fsanitize-address-use-after-scope
11950 Enable sanitization of local variables to detect use-after-scope bugs.
11951 The option sets @option{-fstack-reuse} to @samp{none}.
11952
11953 @item -fsanitize-undefined-trap-on-error
11954 @opindex fsanitize-undefined-trap-on-error
11955 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
11956 report undefined behavior using @code{__builtin_trap} rather than
11957 a @code{libubsan} library routine. The advantage of this is that the
11958 @code{libubsan} library is not needed and is not linked in, so this
11959 is usable even in freestanding environments.
11960
11961 @item -fsanitize-coverage=trace-pc
11962 @opindex fsanitize-coverage=trace-pc
11963 Enable coverage-guided fuzzing code instrumentation.
11964 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
11965
11966 @item -fsanitize-coverage=trace-cmp
11967 @opindex fsanitize-coverage=trace-cmp
11968 Enable dataflow guided fuzzing code instrumentation.
11969 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
11970 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
11971 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
11972 variable or @code{__sanitizer_cov_trace_const_cmp1},
11973 @code{__sanitizer_cov_trace_const_cmp2},
11974 @code{__sanitizer_cov_trace_const_cmp4} or
11975 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
11976 operand constant, @code{__sanitizer_cov_trace_cmpf} or
11977 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
11978 @code{__sanitizer_cov_trace_switch} for switch statements.
11979
11980 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
11981 @opindex fcf-protection
11982 Enable code instrumentation of control-flow transfers to increase
11983 program security by checking that target addresses of control-flow
11984 transfer instructions (such as indirect function call, function return,
11985 indirect jump) are valid. This prevents diverting the flow of control
11986 to an unexpected target. This is intended to protect against such
11987 threats as Return-oriented Programming (ROP), and similarly
11988 call/jmp-oriented programming (COP/JOP).
11989
11990 The value @code{branch} tells the compiler to implement checking of
11991 validity of control-flow transfer at the point of indirect branch
11992 instructions, i.e. call/jmp instructions. The value @code{return}
11993 implements checking of validity at the point of returning from a
11994 function. The value @code{full} is an alias for specifying both
11995 @code{branch} and @code{return}. The value @code{none} turns off
11996 instrumentation.
11997
11998 The macro @code{__CET__} is defined when @option{-fcf-protection} is
11999 used. The first bit of @code{__CET__} is set to 1 for the value
12000 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12001 the @code{return}.
12002
12003 You can also use the @code{nocf_check} attribute to identify
12004 which functions and calls should be skipped from instrumentation
12005 (@pxref{Function Attributes}).
12006
12007 Currently the x86 GNU/Linux target provides an implementation based
12008 on Intel Control-flow Enforcement Technology (CET).
12009
12010 @item -fstack-protector
12011 @opindex fstack-protector
12012 Emit extra code to check for buffer overflows, such as stack smashing
12013 attacks. This is done by adding a guard variable to functions with
12014 vulnerable objects. This includes functions that call @code{alloca}, and
12015 functions with buffers larger than 8 bytes. The guards are initialized
12016 when a function is entered and then checked when the function exits.
12017 If a guard check fails, an error message is printed and the program exits.
12018
12019 @item -fstack-protector-all
12020 @opindex fstack-protector-all
12021 Like @option{-fstack-protector} except that all functions are protected.
12022
12023 @item -fstack-protector-strong
12024 @opindex fstack-protector-strong
12025 Like @option{-fstack-protector} but includes additional functions to
12026 be protected --- those that have local array definitions, or have
12027 references to local frame addresses.
12028
12029 @item -fstack-protector-explicit
12030 @opindex fstack-protector-explicit
12031 Like @option{-fstack-protector} but only protects those functions which
12032 have the @code{stack_protect} attribute.
12033
12034 @item -fstack-check
12035 @opindex fstack-check
12036 Generate code to verify that you do not go beyond the boundary of the
12037 stack. You should specify this flag if you are running in an
12038 environment with multiple threads, but you only rarely need to specify it in
12039 a single-threaded environment since stack overflow is automatically
12040 detected on nearly all systems if there is only one stack.
12041
12042 Note that this switch does not actually cause checking to be done; the
12043 operating system or the language runtime must do that. The switch causes
12044 generation of code to ensure that they see the stack being extended.
12045
12046 You can additionally specify a string parameter: @samp{no} means no
12047 checking, @samp{generic} means force the use of old-style checking,
12048 @samp{specific} means use the best checking method and is equivalent
12049 to bare @option{-fstack-check}.
12050
12051 Old-style checking is a generic mechanism that requires no specific
12052 target support in the compiler but comes with the following drawbacks:
12053
12054 @enumerate
12055 @item
12056 Modified allocation strategy for large objects: they are always
12057 allocated dynamically if their size exceeds a fixed threshold. Note this
12058 may change the semantics of some code.
12059
12060 @item
12061 Fixed limit on the size of the static frame of functions: when it is
12062 topped by a particular function, stack checking is not reliable and
12063 a warning is issued by the compiler.
12064
12065 @item
12066 Inefficiency: because of both the modified allocation strategy and the
12067 generic implementation, code performance is hampered.
12068 @end enumerate
12069
12070 Note that old-style stack checking is also the fallback method for
12071 @samp{specific} if no target support has been added in the compiler.
12072
12073 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12074 and stack overflows. @samp{specific} is an excellent choice when compiling
12075 Ada code. It is not generally sufficient to protect against stack-clash
12076 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12077
12078 @item -fstack-clash-protection
12079 @opindex fstack-clash-protection
12080 Generate code to prevent stack clash style attacks. When this option is
12081 enabled, the compiler will only allocate one page of stack space at a time
12082 and each page is accessed immediately after allocation. Thus, it prevents
12083 allocations from jumping over any stack guard page provided by the
12084 operating system.
12085
12086 Most targets do not fully support stack clash protection. However, on
12087 those targets @option{-fstack-clash-protection} will protect dynamic stack
12088 allocations. @option{-fstack-clash-protection} may also provide limited
12089 protection for static stack allocations if the target supports
12090 @option{-fstack-check=specific}.
12091
12092 @item -fstack-limit-register=@var{reg}
12093 @itemx -fstack-limit-symbol=@var{sym}
12094 @itemx -fno-stack-limit
12095 @opindex fstack-limit-register
12096 @opindex fstack-limit-symbol
12097 @opindex fno-stack-limit
12098 Generate code to ensure that the stack does not grow beyond a certain value,
12099 either the value of a register or the address of a symbol. If a larger
12100 stack is required, a signal is raised at run time. For most targets,
12101 the signal is raised before the stack overruns the boundary, so
12102 it is possible to catch the signal without taking special precautions.
12103
12104 For instance, if the stack starts at absolute address @samp{0x80000000}
12105 and grows downwards, you can use the flags
12106 @option{-fstack-limit-symbol=__stack_limit} and
12107 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12108 of 128KB@. Note that this may only work with the GNU linker.
12109
12110 You can locally override stack limit checking by using the
12111 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12112
12113 @item -fsplit-stack
12114 @opindex fsplit-stack
12115 Generate code to automatically split the stack before it overflows.
12116 The resulting program has a discontiguous stack which can only
12117 overflow if the program is unable to allocate any more memory. This
12118 is most useful when running threaded programs, as it is no longer
12119 necessary to calculate a good stack size to use for each thread. This
12120 is currently only implemented for the x86 targets running
12121 GNU/Linux.
12122
12123 When code compiled with @option{-fsplit-stack} calls code compiled
12124 without @option{-fsplit-stack}, there may not be much stack space
12125 available for the latter code to run. If compiling all code,
12126 including library code, with @option{-fsplit-stack} is not an option,
12127 then the linker can fix up these calls so that the code compiled
12128 without @option{-fsplit-stack} always has a large stack. Support for
12129 this is implemented in the gold linker in GNU binutils release 2.21
12130 and later.
12131
12132 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12133 @opindex fvtable-verify
12134 This option is only available when compiling C++ code.
12135 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12136 feature that verifies at run time, for every virtual call, that
12137 the vtable pointer through which the call is made is valid for the type of
12138 the object, and has not been corrupted or overwritten. If an invalid vtable
12139 pointer is detected at run time, an error is reported and execution of the
12140 program is immediately halted.
12141
12142 This option causes run-time data structures to be built at program startup,
12143 which are used for verifying the vtable pointers.
12144 The options @samp{std} and @samp{preinit}
12145 control the timing of when these data structures are built. In both cases the
12146 data structures are built before execution reaches @code{main}. Using
12147 @option{-fvtable-verify=std} causes the data structures to be built after
12148 shared libraries have been loaded and initialized.
12149 @option{-fvtable-verify=preinit} causes them to be built before shared
12150 libraries have been loaded and initialized.
12151
12152 If this option appears multiple times in the command line with different
12153 values specified, @samp{none} takes highest priority over both @samp{std} and
12154 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
12155
12156 @item -fvtv-debug
12157 @opindex fvtv-debug
12158 When used in conjunction with @option{-fvtable-verify=std} or
12159 @option{-fvtable-verify=preinit}, causes debug versions of the
12160 runtime functions for the vtable verification feature to be called.
12161 This flag also causes the compiler to log information about which
12162 vtable pointers it finds for each class.
12163 This information is written to a file named @file{vtv_set_ptr_data.log}
12164 in the directory named by the environment variable @env{VTV_LOGS_DIR}
12165 if that is defined or the current working directory otherwise.
12166
12167 Note: This feature @emph{appends} data to the log file. If you want a fresh log
12168 file, be sure to delete any existing one.
12169
12170 @item -fvtv-counts
12171 @opindex fvtv-counts
12172 This is a debugging flag. When used in conjunction with
12173 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
12174 causes the compiler to keep track of the total number of virtual calls
12175 it encounters and the number of verifications it inserts. It also
12176 counts the number of calls to certain run-time library functions
12177 that it inserts and logs this information for each compilation unit.
12178 The compiler writes this information to a file named
12179 @file{vtv_count_data.log} in the directory named by the environment
12180 variable @env{VTV_LOGS_DIR} if that is defined or the current working
12181 directory otherwise. It also counts the size of the vtable pointer sets
12182 for each class, and writes this information to @file{vtv_class_set_sizes.log}
12183 in the same directory.
12184
12185 Note: This feature @emph{appends} data to the log files. To get fresh log
12186 files, be sure to delete any existing ones.
12187
12188 @item -finstrument-functions
12189 @opindex finstrument-functions
12190 Generate instrumentation calls for entry and exit to functions. Just
12191 after function entry and just before function exit, the following
12192 profiling functions are called with the address of the current
12193 function and its call site. (On some platforms,
12194 @code{__builtin_return_address} does not work beyond the current
12195 function, so the call site information may not be available to the
12196 profiling functions otherwise.)
12197
12198 @smallexample
12199 void __cyg_profile_func_enter (void *this_fn,
12200 void *call_site);
12201 void __cyg_profile_func_exit (void *this_fn,
12202 void *call_site);
12203 @end smallexample
12204
12205 The first argument is the address of the start of the current function,
12206 which may be looked up exactly in the symbol table.
12207
12208 This instrumentation is also done for functions expanded inline in other
12209 functions. The profiling calls indicate where, conceptually, the
12210 inline function is entered and exited. This means that addressable
12211 versions of such functions must be available. If all your uses of a
12212 function are expanded inline, this may mean an additional expansion of
12213 code size. If you use @code{extern inline} in your C code, an
12214 addressable version of such functions must be provided. (This is
12215 normally the case anyway, but if you get lucky and the optimizer always
12216 expands the functions inline, you might have gotten away without
12217 providing static copies.)
12218
12219 A function may be given the attribute @code{no_instrument_function}, in
12220 which case this instrumentation is not done. This can be used, for
12221 example, for the profiling functions listed above, high-priority
12222 interrupt routines, and any functions from which the profiling functions
12223 cannot safely be called (perhaps signal handlers, if the profiling
12224 routines generate output or allocate memory).
12225
12226 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
12227 @opindex finstrument-functions-exclude-file-list
12228
12229 Set the list of functions that are excluded from instrumentation (see
12230 the description of @option{-finstrument-functions}). If the file that
12231 contains a function definition matches with one of @var{file}, then
12232 that function is not instrumented. The match is done on substrings:
12233 if the @var{file} parameter is a substring of the file name, it is
12234 considered to be a match.
12235
12236 For example:
12237
12238 @smallexample
12239 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
12240 @end smallexample
12241
12242 @noindent
12243 excludes any inline function defined in files whose pathnames
12244 contain @file{/bits/stl} or @file{include/sys}.
12245
12246 If, for some reason, you want to include letter @samp{,} in one of
12247 @var{sym}, write @samp{\,}. For example,
12248 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
12249 (note the single quote surrounding the option).
12250
12251 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
12252 @opindex finstrument-functions-exclude-function-list
12253
12254 This is similar to @option{-finstrument-functions-exclude-file-list},
12255 but this option sets the list of function names to be excluded from
12256 instrumentation. The function name to be matched is its user-visible
12257 name, such as @code{vector<int> blah(const vector<int> &)}, not the
12258 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
12259 match is done on substrings: if the @var{sym} parameter is a substring
12260 of the function name, it is considered to be a match. For C99 and C++
12261 extended identifiers, the function name must be given in UTF-8, not
12262 using universal character names.
12263
12264 @item -fpatchable-function-entry=@var{N}[,@var{M}]
12265 @opindex fpatchable-function-entry
12266 Generate @var{N} NOPs right at the beginning
12267 of each function, with the function entry point before the @var{M}th NOP.
12268 If @var{M} is omitted, it defaults to @code{0} so the
12269 function entry points to the address just at the first NOP.
12270 The NOP instructions reserve extra space which can be used to patch in
12271 any desired instrumentation at run time, provided that the code segment
12272 is writable. The amount of space is controllable indirectly via
12273 the number of NOPs; the NOP instruction used corresponds to the instruction
12274 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
12275 is target-specific and may also depend on the architecture variant and/or
12276 other compilation options.
12277
12278 For run-time identification, the starting addresses of these areas,
12279 which correspond to their respective function entries minus @var{M},
12280 are additionally collected in the @code{__patchable_function_entries}
12281 section of the resulting binary.
12282
12283 Note that the value of @code{__attribute__ ((patchable_function_entry
12284 (N,M)))} takes precedence over command-line option
12285 @option{-fpatchable-function-entry=N,M}. This can be used to increase
12286 the area size or to remove it completely on a single function.
12287 If @code{N=0}, no pad location is recorded.
12288
12289 The NOP instructions are inserted at---and maybe before, depending on
12290 @var{M}---the function entry address, even before the prologue.
12291
12292 @end table
12293
12294
12295 @node Preprocessor Options
12296 @section Options Controlling the Preprocessor
12297 @cindex preprocessor options
12298 @cindex options, preprocessor
12299
12300 These options control the C preprocessor, which is run on each C source
12301 file before actual compilation.
12302
12303 If you use the @option{-E} option, nothing is done except preprocessing.
12304 Some of these options make sense only together with @option{-E} because
12305 they cause the preprocessor output to be unsuitable for actual
12306 compilation.
12307
12308 In addition to the options listed here, there are a number of options
12309 to control search paths for include files documented in
12310 @ref{Directory Options}.
12311 Options to control preprocessor diagnostics are listed in
12312 @ref{Warning Options}.
12313
12314 @table @gcctabopt
12315 @include cppopts.texi
12316
12317 @item -Wp,@var{option}
12318 @opindex Wp
12319 You can use @option{-Wp,@var{option}} to bypass the compiler driver
12320 and pass @var{option} directly through to the preprocessor. If
12321 @var{option} contains commas, it is split into multiple options at the
12322 commas. However, many options are modified, translated or interpreted
12323 by the compiler driver before being passed to the preprocessor, and
12324 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
12325 interface is undocumented and subject to change, so whenever possible
12326 you should avoid using @option{-Wp} and let the driver handle the
12327 options instead.
12328
12329 @item -Xpreprocessor @var{option}
12330 @opindex Xpreprocessor
12331 Pass @var{option} as an option to the preprocessor. You can use this to
12332 supply system-specific preprocessor options that GCC does not
12333 recognize.
12334
12335 If you want to pass an option that takes an argument, you must use
12336 @option{-Xpreprocessor} twice, once for the option and once for the argument.
12337
12338 @item -no-integrated-cpp
12339 @opindex no-integrated-cpp
12340 Perform preprocessing as a separate pass before compilation.
12341 By default, GCC performs preprocessing as an integrated part of
12342 input tokenization and parsing.
12343 If this option is provided, the appropriate language front end
12344 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
12345 and Objective-C, respectively) is instead invoked twice,
12346 once for preprocessing only and once for actual compilation
12347 of the preprocessed input.
12348 This option may be useful in conjunction with the @option{-B} or
12349 @option{-wrapper} options to specify an alternate preprocessor or
12350 perform additional processing of the program source between
12351 normal preprocessing and compilation.
12352
12353 @end table
12354
12355 @node Assembler Options
12356 @section Passing Options to the Assembler
12357
12358 @c prevent bad page break with this line
12359 You can pass options to the assembler.
12360
12361 @table @gcctabopt
12362 @item -Wa,@var{option}
12363 @opindex Wa
12364 Pass @var{option} as an option to the assembler. If @var{option}
12365 contains commas, it is split into multiple options at the commas.
12366
12367 @item -Xassembler @var{option}
12368 @opindex Xassembler
12369 Pass @var{option} as an option to the assembler. You can use this to
12370 supply system-specific assembler options that GCC does not
12371 recognize.
12372
12373 If you want to pass an option that takes an argument, you must use
12374 @option{-Xassembler} twice, once for the option and once for the argument.
12375
12376 @end table
12377
12378 @node Link Options
12379 @section Options for Linking
12380 @cindex link options
12381 @cindex options, linking
12382
12383 These options come into play when the compiler links object files into
12384 an executable output file. They are meaningless if the compiler is
12385 not doing a link step.
12386
12387 @table @gcctabopt
12388 @cindex file names
12389 @item @var{object-file-name}
12390 A file name that does not end in a special recognized suffix is
12391 considered to name an object file or library. (Object files are
12392 distinguished from libraries by the linker according to the file
12393 contents.) If linking is done, these object files are used as input
12394 to the linker.
12395
12396 @item -c
12397 @itemx -S
12398 @itemx -E
12399 @opindex c
12400 @opindex S
12401 @opindex E
12402 If any of these options is used, then the linker is not run, and
12403 object file names should not be used as arguments. @xref{Overall
12404 Options}.
12405
12406 @item -flinker-output=@var{type}
12407 @opindex -flinker-output
12408 This option controls the code generation of the link time optimizer. By
12409 default the linker output is determined by the linker plugin automatically. For
12410 debugging the compiler and in the case of incremental linking to non-lto object
12411 file is desired, it may be useful to control the type manually.
12412
12413 If @var{type} is @samp{exec} the code generation is configured to produce static
12414 binary. In this case @option{-fpic} and @option{-fpie} are both disabled.
12415
12416 If @var{type} is @samp{dyn} the code generation is configured to produce shared
12417 library. In this case @option{-fpic} or @option{-fPIC} is preserved, but not
12418 enabled automatically. This makes it possible to build shared libraries without
12419 position independent code on architectures this is possible, i.e. on x86.
12420
12421 If @var{type} is @samp{pie} the code generation is configured to produce
12422 @option{-fpie} executable. This result in similar optimizations as @samp{exec}
12423 except that @option{-fpie} is not disabled if specified at compilation time.
12424
12425 If @var{type} is @samp{rel} the compiler assumes that incremental linking is
12426 done. The sections containing intermediate code for link-time optimization are
12427 merged, pre-optimized, and output to the resulting object file. In addition, if
12428 @option{-ffat-lto-objects} is specified the binary code is produced for future
12429 non-lto linking. The object file produced by incremental linking will be smaller
12430 than a static library produced from the same object files. At link-time the
12431 result of incremental linking will also load faster to compiler than a static
12432 library assuming that majority of objects in the library are used.
12433
12434 Finally @samp{nolto-rel} configure compiler to for incremental linking where
12435 code generation is forced, final binary is produced and the intermediate code
12436 for later link-time optimization is stripped. When multiple object files are
12437 linked together the resulting code will be optimized better than with link time
12438 optimizations disabled (for example, the cross-module inlining will happen),
12439 most of benefits of whole program optimizations are however lost.
12440
12441 During the incremental link (by @option{-r}) the linker plugin will default to
12442 @option{rel}. With current interfaces to GNU Binutils it is however not
12443 possible to link incrementally LTO objects and non-LTO objects into a single
12444 mixed object file. In the case any of object files in incremental link can not
12445 be used for link-time optimization the linker plugin will output warning and
12446 use @samp{nolto-rel}. To maintain the whole program optimization it is
12447 recommended to link such objects into static library instead. Alternatively it
12448 is possible to use H.J. Lu's binutils with support for mixed objects.
12449
12450 @item -fuse-ld=bfd
12451 @opindex fuse-ld=bfd
12452 Use the @command{bfd} linker instead of the default linker.
12453
12454 @item -fuse-ld=gold
12455 @opindex fuse-ld=gold
12456 Use the @command{gold} linker instead of the default linker.
12457
12458 @cindex Libraries
12459 @item -l@var{library}
12460 @itemx -l @var{library}
12461 @opindex l
12462 Search the library named @var{library} when linking. (The second
12463 alternative with the library as a separate argument is only for
12464 POSIX compliance and is not recommended.)
12465
12466 It makes a difference where in the command you write this option; the
12467 linker searches and processes libraries and object files in the order they
12468 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
12469 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
12470 to functions in @samp{z}, those functions may not be loaded.
12471
12472 The linker searches a standard list of directories for the library,
12473 which is actually a file named @file{lib@var{library}.a}. The linker
12474 then uses this file as if it had been specified precisely by name.
12475
12476 The directories searched include several standard system directories
12477 plus any that you specify with @option{-L}.
12478
12479 Normally the files found this way are library files---archive files
12480 whose members are object files. The linker handles an archive file by
12481 scanning through it for members which define symbols that have so far
12482 been referenced but not defined. But if the file that is found is an
12483 ordinary object file, it is linked in the usual fashion. The only
12484 difference between using an @option{-l} option and specifying a file name
12485 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
12486 and searches several directories.
12487
12488 @item -lobjc
12489 @opindex lobjc
12490 You need this special case of the @option{-l} option in order to
12491 link an Objective-C or Objective-C++ program.
12492
12493 @item -nostartfiles
12494 @opindex nostartfiles
12495 Do not use the standard system startup files when linking.
12496 The standard system libraries are used normally, unless @option{-nostdlib},
12497 @option{-nolibc}, or @option{-nodefaultlibs} is used.
12498
12499 @item -nodefaultlibs
12500 @opindex nodefaultlibs
12501 Do not use the standard system libraries when linking.
12502 Only the libraries you specify are passed to the linker, and options
12503 specifying linkage of the system libraries, such as @option{-static-libgcc}
12504 or @option{-shared-libgcc}, are ignored.
12505 The standard startup files are used normally, unless @option{-nostartfiles}
12506 is used.
12507
12508 The compiler may generate calls to @code{memcmp},
12509 @code{memset}, @code{memcpy} and @code{memmove}.
12510 These entries are usually resolved by entries in
12511 libc. These entry points should be supplied through some other
12512 mechanism when this option is specified.
12513
12514 @item -nolibc
12515 @opindex nolibc
12516 Do not use the C library or system libraries tightly coupled with it when
12517 linking. Still link with the startup files, @file{libgcc} or toolchain
12518 provided language support libraries such as @file{libgnat}, @file{libgfortran}
12519 or @file{libstdc++} unless options preventing their inclusion are used as
12520 well. This typically removes @option{-lc} from the link command line, as well
12521 as system libraries that normally go with it and become meaningless when
12522 absence of a C library is assumed, for example @option{-lpthread} or
12523 @option{-lm} in some configurations. This is intended for bare-board
12524 targets when there is indeed no C library available.
12525
12526 @item -nostdlib
12527 @opindex nostdlib
12528 Do not use the standard system startup files or libraries when linking.
12529 No startup files and only the libraries you specify are passed to
12530 the linker, and options specifying linkage of the system libraries, such as
12531 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
12532
12533 The compiler may generate calls to @code{memcmp}, @code{memset},
12534 @code{memcpy} and @code{memmove}.
12535 These entries are usually resolved by entries in
12536 libc. These entry points should be supplied through some other
12537 mechanism when this option is specified.
12538
12539 @cindex @option{-lgcc}, use with @option{-nostdlib}
12540 @cindex @option{-nostdlib} and unresolved references
12541 @cindex unresolved references and @option{-nostdlib}
12542 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
12543 @cindex @option{-nodefaultlibs} and unresolved references
12544 @cindex unresolved references and @option{-nodefaultlibs}
12545 One of the standard libraries bypassed by @option{-nostdlib} and
12546 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
12547 which GCC uses to overcome shortcomings of particular machines, or special
12548 needs for some languages.
12549 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
12550 Collection (GCC) Internals},
12551 for more discussion of @file{libgcc.a}.)
12552 In most cases, you need @file{libgcc.a} even when you want to avoid
12553 other standard libraries. In other words, when you specify @option{-nostdlib}
12554 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
12555 This ensures that you have no unresolved references to internal GCC
12556 library subroutines.
12557 (An example of such an internal subroutine is @code{__main}, used to ensure C++
12558 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
12559 GNU Compiler Collection (GCC) Internals}.)
12560
12561 @item -pie
12562 @opindex pie
12563 Produce a dynamically linked position independent executable on targets
12564 that support it. For predictable results, you must also specify the same
12565 set of options used for compilation (@option{-fpie}, @option{-fPIE},
12566 or model suboptions) when you specify this linker option.
12567
12568 @item -no-pie
12569 @opindex no-pie
12570 Don't produce a dynamically linked position independent executable.
12571
12572 @item -static-pie
12573 @opindex static-pie
12574 Produce a static position independent executable on targets that support
12575 it. A static position independent executable is similar to a static
12576 executable, but can be loaded at any address without a dynamic linker.
12577 For predictable results, you must also specify the same set of options
12578 used for compilation (@option{-fpie}, @option{-fPIE}, or model
12579 suboptions) when you specify this linker option.
12580
12581 @item -pthread
12582 @opindex pthread
12583 Link with the POSIX threads library. This option is supported on
12584 GNU/Linux targets, most other Unix derivatives, and also on
12585 x86 Cygwin and MinGW targets. On some targets this option also sets
12586 flags for the preprocessor, so it should be used consistently for both
12587 compilation and linking.
12588
12589 @item -r
12590 @opindex r
12591 Produce a relocatable object as output. This is also known as partial
12592 linking.
12593
12594 @item -rdynamic
12595 @opindex rdynamic
12596 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
12597 that support it. This instructs the linker to add all symbols, not
12598 only used ones, to the dynamic symbol table. This option is needed
12599 for some uses of @code{dlopen} or to allow obtaining backtraces
12600 from within a program.
12601
12602 @item -s
12603 @opindex s
12604 Remove all symbol table and relocation information from the executable.
12605
12606 @item -static
12607 @opindex static
12608 On systems that support dynamic linking, this overrides @option{-pie}
12609 and prevents linking with the shared libraries. On other systems, this
12610 option has no effect.
12611
12612 @item -shared
12613 @opindex shared
12614 Produce a shared object which can then be linked with other objects to
12615 form an executable. Not all systems support this option. For predictable
12616 results, you must also specify the same set of options used for compilation
12617 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
12618 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
12619 needs to build supplementary stub code for constructors to work. On
12620 multi-libbed systems, @samp{gcc -shared} must select the correct support
12621 libraries to link against. Failing to supply the correct flags may lead
12622 to subtle defects. Supplying them in cases where they are not necessary
12623 is innocuous.}
12624
12625 @item -shared-libgcc
12626 @itemx -static-libgcc
12627 @opindex shared-libgcc
12628 @opindex static-libgcc
12629 On systems that provide @file{libgcc} as a shared library, these options
12630 force the use of either the shared or static version, respectively.
12631 If no shared version of @file{libgcc} was built when the compiler was
12632 configured, these options have no effect.
12633
12634 There are several situations in which an application should use the
12635 shared @file{libgcc} instead of the static version. The most common
12636 of these is when the application wishes to throw and catch exceptions
12637 across different shared libraries. In that case, each of the libraries
12638 as well as the application itself should use the shared @file{libgcc}.
12639
12640 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
12641 whenever you build a shared library or a main executable, because C++
12642 programs typically use exceptions, so this is the right thing to do.
12643
12644 If, instead, you use the GCC driver to create shared libraries, you may
12645 find that they are not always linked with the shared @file{libgcc}.
12646 If GCC finds, at its configuration time, that you have a non-GNU linker
12647 or a GNU linker that does not support option @option{--eh-frame-hdr},
12648 it links the shared version of @file{libgcc} into shared libraries
12649 by default. Otherwise, it takes advantage of the linker and optimizes
12650 away the linking with the shared version of @file{libgcc}, linking with
12651 the static version of libgcc by default. This allows exceptions to
12652 propagate through such shared libraries, without incurring relocation
12653 costs at library load time.
12654
12655 However, if a library or main executable is supposed to throw or catch
12656 exceptions, you must link it using the G++ driver, or using the option
12657 @option{-shared-libgcc}, such that it is linked with the shared
12658 @file{libgcc}.
12659
12660 @item -static-libasan
12661 @opindex static-libasan
12662 When the @option{-fsanitize=address} option is used to link a program,
12663 the GCC driver automatically links against @option{libasan}. If
12664 @file{libasan} is available as a shared library, and the @option{-static}
12665 option is not used, then this links against the shared version of
12666 @file{libasan}. The @option{-static-libasan} option directs the GCC
12667 driver to link @file{libasan} statically, without necessarily linking
12668 other libraries statically.
12669
12670 @item -static-libtsan
12671 @opindex static-libtsan
12672 When the @option{-fsanitize=thread} option is used to link a program,
12673 the GCC driver automatically links against @option{libtsan}. If
12674 @file{libtsan} is available as a shared library, and the @option{-static}
12675 option is not used, then this links against the shared version of
12676 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
12677 driver to link @file{libtsan} statically, without necessarily linking
12678 other libraries statically.
12679
12680 @item -static-liblsan
12681 @opindex static-liblsan
12682 When the @option{-fsanitize=leak} option is used to link a program,
12683 the GCC driver automatically links against @option{liblsan}. If
12684 @file{liblsan} is available as a shared library, and the @option{-static}
12685 option is not used, then this links against the shared version of
12686 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
12687 driver to link @file{liblsan} statically, without necessarily linking
12688 other libraries statically.
12689
12690 @item -static-libubsan
12691 @opindex static-libubsan
12692 When the @option{-fsanitize=undefined} option is used to link a program,
12693 the GCC driver automatically links against @option{libubsan}. If
12694 @file{libubsan} is available as a shared library, and the @option{-static}
12695 option is not used, then this links against the shared version of
12696 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
12697 driver to link @file{libubsan} statically, without necessarily linking
12698 other libraries statically.
12699
12700 @item -static-libstdc++
12701 @opindex static-libstdc++
12702 When the @command{g++} program is used to link a C++ program, it
12703 normally automatically links against @option{libstdc++}. If
12704 @file{libstdc++} is available as a shared library, and the
12705 @option{-static} option is not used, then this links against the
12706 shared version of @file{libstdc++}. That is normally fine. However, it
12707 is sometimes useful to freeze the version of @file{libstdc++} used by
12708 the program without going all the way to a fully static link. The
12709 @option{-static-libstdc++} option directs the @command{g++} driver to
12710 link @file{libstdc++} statically, without necessarily linking other
12711 libraries statically.
12712
12713 @item -symbolic
12714 @opindex symbolic
12715 Bind references to global symbols when building a shared object. Warn
12716 about any unresolved references (unless overridden by the link editor
12717 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
12718 this option.
12719
12720 @item -T @var{script}
12721 @opindex T
12722 @cindex linker script
12723 Use @var{script} as the linker script. This option is supported by most
12724 systems using the GNU linker. On some targets, such as bare-board
12725 targets without an operating system, the @option{-T} option may be required
12726 when linking to avoid references to undefined symbols.
12727
12728 @item -Xlinker @var{option}
12729 @opindex Xlinker
12730 Pass @var{option} as an option to the linker. You can use this to
12731 supply system-specific linker options that GCC does not recognize.
12732
12733 If you want to pass an option that takes a separate argument, you must use
12734 @option{-Xlinker} twice, once for the option and once for the argument.
12735 For example, to pass @option{-assert definitions}, you must write
12736 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
12737 @option{-Xlinker "-assert definitions"}, because this passes the entire
12738 string as a single argument, which is not what the linker expects.
12739
12740 When using the GNU linker, it is usually more convenient to pass
12741 arguments to linker options using the @option{@var{option}=@var{value}}
12742 syntax than as separate arguments. For example, you can specify
12743 @option{-Xlinker -Map=output.map} rather than
12744 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
12745 this syntax for command-line options.
12746
12747 @item -Wl,@var{option}
12748 @opindex Wl
12749 Pass @var{option} as an option to the linker. If @var{option} contains
12750 commas, it is split into multiple options at the commas. You can use this
12751 syntax to pass an argument to the option.
12752 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
12753 linker. When using the GNU linker, you can also get the same effect with
12754 @option{-Wl,-Map=output.map}.
12755
12756 @item -u @var{symbol}
12757 @opindex u
12758 Pretend the symbol @var{symbol} is undefined, to force linking of
12759 library modules to define it. You can use @option{-u} multiple times with
12760 different symbols to force loading of additional library modules.
12761
12762 @item -z @var{keyword}
12763 @opindex z
12764 @option{-z} is passed directly on to the linker along with the keyword
12765 @var{keyword}. See the section in the documentation of your linker for
12766 permitted values and their meanings.
12767 @end table
12768
12769 @node Directory Options
12770 @section Options for Directory Search
12771 @cindex directory options
12772 @cindex options, directory search
12773 @cindex search path
12774
12775 These options specify directories to search for header files, for
12776 libraries and for parts of the compiler:
12777
12778 @table @gcctabopt
12779 @include cppdiropts.texi
12780
12781 @item -iplugindir=@var{dir}
12782 @opindex iplugindir=
12783 Set the directory to search for plugins that are passed
12784 by @option{-fplugin=@var{name}} instead of
12785 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
12786 to be used by the user, but only passed by the driver.
12787
12788 @item -L@var{dir}
12789 @opindex L
12790 Add directory @var{dir} to the list of directories to be searched
12791 for @option{-l}.
12792
12793 @item -B@var{prefix}
12794 @opindex B
12795 This option specifies where to find the executables, libraries,
12796 include files, and data files of the compiler itself.
12797
12798 The compiler driver program runs one or more of the subprograms
12799 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
12800 @var{prefix} as a prefix for each program it tries to run, both with and
12801 without @samp{@var{machine}/@var{version}/} for the corresponding target
12802 machine and compiler version.
12803
12804 For each subprogram to be run, the compiler driver first tries the
12805 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
12806 is not specified, the driver tries two standard prefixes,
12807 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
12808 those results in a file name that is found, the unmodified program
12809 name is searched for using the directories specified in your
12810 @env{PATH} environment variable.
12811
12812 The compiler checks to see if the path provided by @option{-B}
12813 refers to a directory, and if necessary it adds a directory
12814 separator character at the end of the path.
12815
12816 @option{-B} prefixes that effectively specify directory names also apply
12817 to libraries in the linker, because the compiler translates these
12818 options into @option{-L} options for the linker. They also apply to
12819 include files in the preprocessor, because the compiler translates these
12820 options into @option{-isystem} options for the preprocessor. In this case,
12821 the compiler appends @samp{include} to the prefix.
12822
12823 The runtime support file @file{libgcc.a} can also be searched for using
12824 the @option{-B} prefix, if needed. If it is not found there, the two
12825 standard prefixes above are tried, and that is all. The file is left
12826 out of the link if it is not found by those means.
12827
12828 Another way to specify a prefix much like the @option{-B} prefix is to use
12829 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
12830 Variables}.
12831
12832 As a special kludge, if the path provided by @option{-B} is
12833 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
12834 9, then it is replaced by @file{[dir/]include}. This is to help
12835 with boot-strapping the compiler.
12836
12837 @item -no-canonical-prefixes
12838 @opindex no-canonical-prefixes
12839 Do not expand any symbolic links, resolve references to @samp{/../}
12840 or @samp{/./}, or make the path absolute when generating a relative
12841 prefix.
12842
12843 @item --sysroot=@var{dir}
12844 @opindex sysroot
12845 Use @var{dir} as the logical root directory for headers and libraries.
12846 For example, if the compiler normally searches for headers in
12847 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
12848 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
12849
12850 If you use both this option and the @option{-isysroot} option, then
12851 the @option{--sysroot} option applies to libraries, but the
12852 @option{-isysroot} option applies to header files.
12853
12854 The GNU linker (beginning with version 2.16) has the necessary support
12855 for this option. If your linker does not support this option, the
12856 header file aspect of @option{--sysroot} still works, but the
12857 library aspect does not.
12858
12859 @item --no-sysroot-suffix
12860 @opindex no-sysroot-suffix
12861 For some targets, a suffix is added to the root directory specified
12862 with @option{--sysroot}, depending on the other options used, so that
12863 headers may for example be found in
12864 @file{@var{dir}/@var{suffix}/usr/include} instead of
12865 @file{@var{dir}/usr/include}. This option disables the addition of
12866 such a suffix.
12867
12868 @end table
12869
12870 @node Code Gen Options
12871 @section Options for Code Generation Conventions
12872 @cindex code generation conventions
12873 @cindex options, code generation
12874 @cindex run-time options
12875
12876 These machine-independent options control the interface conventions
12877 used in code generation.
12878
12879 Most of them have both positive and negative forms; the negative form
12880 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
12881 one of the forms is listed---the one that is not the default. You
12882 can figure out the other form by either removing @samp{no-} or adding
12883 it.
12884
12885 @table @gcctabopt
12886 @item -fstack-reuse=@var{reuse-level}
12887 @opindex fstack_reuse
12888 This option controls stack space reuse for user declared local/auto variables
12889 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
12890 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
12891 local variables and temporaries, @samp{named_vars} enables the reuse only for
12892 user defined local variables with names, and @samp{none} disables stack reuse
12893 completely. The default value is @samp{all}. The option is needed when the
12894 program extends the lifetime of a scoped local variable or a compiler generated
12895 temporary beyond the end point defined by the language. When a lifetime of
12896 a variable ends, and if the variable lives in memory, the optimizing compiler
12897 has the freedom to reuse its stack space with other temporaries or scoped
12898 local variables whose live range does not overlap with it. Legacy code extending
12899 local lifetime is likely to break with the stack reuse optimization.
12900
12901 For example,
12902
12903 @smallexample
12904 int *p;
12905 @{
12906 int local1;
12907
12908 p = &local1;
12909 local1 = 10;
12910 ....
12911 @}
12912 @{
12913 int local2;
12914 local2 = 20;
12915 ...
12916 @}
12917
12918 if (*p == 10) // out of scope use of local1
12919 @{
12920
12921 @}
12922 @end smallexample
12923
12924 Another example:
12925 @smallexample
12926
12927 struct A
12928 @{
12929 A(int k) : i(k), j(k) @{ @}
12930 int i;
12931 int j;
12932 @};
12933
12934 A *ap;
12935
12936 void foo(const A& ar)
12937 @{
12938 ap = &ar;
12939 @}
12940
12941 void bar()
12942 @{
12943 foo(A(10)); // temp object's lifetime ends when foo returns
12944
12945 @{
12946 A a(20);
12947 ....
12948 @}
12949 ap->i+= 10; // ap references out of scope temp whose space
12950 // is reused with a. What is the value of ap->i?
12951 @}
12952
12953 @end smallexample
12954
12955 The lifetime of a compiler generated temporary is well defined by the C++
12956 standard. When a lifetime of a temporary ends, and if the temporary lives
12957 in memory, the optimizing compiler has the freedom to reuse its stack
12958 space with other temporaries or scoped local variables whose live range
12959 does not overlap with it. However some of the legacy code relies on
12960 the behavior of older compilers in which temporaries' stack space is
12961 not reused, the aggressive stack reuse can lead to runtime errors. This
12962 option is used to control the temporary stack reuse optimization.
12963
12964 @item -ftrapv
12965 @opindex ftrapv
12966 This option generates traps for signed overflow on addition, subtraction,
12967 multiplication operations.
12968 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12969 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12970 @option{-fwrapv} being effective. Note that only active options override, so
12971 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12972 results in @option{-ftrapv} being effective.
12973
12974 @item -fwrapv
12975 @opindex fwrapv
12976 This option instructs the compiler to assume that signed arithmetic
12977 overflow of addition, subtraction and multiplication wraps around
12978 using twos-complement representation. This flag enables some optimizations
12979 and disables others.
12980 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
12981 @option{-ftrapv} @option{-fwrapv} on the command-line results in
12982 @option{-fwrapv} being effective. Note that only active options override, so
12983 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
12984 results in @option{-ftrapv} being effective.
12985
12986 @item -fwrapv-pointer
12987 @opindex fwrapv-pointer
12988 This option instructs the compiler to assume that pointer arithmetic
12989 overflow on addition and subtraction wraps around using twos-complement
12990 representation. This flag disables some optimizations which assume
12991 pointer overflow is invalid.
12992
12993 @item -fstrict-overflow
12994 @opindex fstrict-overflow
12995 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
12996 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
12997
12998 @item -fexceptions
12999 @opindex fexceptions
13000 Enable exception handling. Generates extra code needed to propagate
13001 exceptions. For some targets, this implies GCC generates frame
13002 unwind information for all functions, which can produce significant data
13003 size overhead, although it does not affect execution. If you do not
13004 specify this option, GCC enables it by default for languages like
13005 C++ that normally require exception handling, and disables it for
13006 languages like C that do not normally require it. However, you may need
13007 to enable this option when compiling C code that needs to interoperate
13008 properly with exception handlers written in C++. You may also wish to
13009 disable this option if you are compiling older C++ programs that don't
13010 use exception handling.
13011
13012 @item -fnon-call-exceptions
13013 @opindex fnon-call-exceptions
13014 Generate code that allows trapping instructions to throw exceptions.
13015 Note that this requires platform-specific runtime support that does
13016 not exist everywhere. Moreover, it only allows @emph{trapping}
13017 instructions to throw exceptions, i.e.@: memory references or floating-point
13018 instructions. It does not allow exceptions to be thrown from
13019 arbitrary signal handlers such as @code{SIGALRM}.
13020
13021 @item -fdelete-dead-exceptions
13022 @opindex fdelete-dead-exceptions
13023 Consider that instructions that may throw exceptions but don't otherwise
13024 contribute to the execution of the program can be optimized away.
13025 This option is enabled by default for the Ada front end, as permitted by
13026 the Ada language specification.
13027 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13028
13029 @item -funwind-tables
13030 @opindex funwind-tables
13031 Similar to @option{-fexceptions}, except that it just generates any needed
13032 static data, but does not affect the generated code in any other way.
13033 You normally do not need to enable this option; instead, a language processor
13034 that needs this handling enables it on your behalf.
13035
13036 @item -fasynchronous-unwind-tables
13037 @opindex fasynchronous-unwind-tables
13038 Generate unwind table in DWARF format, if supported by target machine. The
13039 table is exact at each instruction boundary, so it can be used for stack
13040 unwinding from asynchronous events (such as debugger or garbage collector).
13041
13042 @item -fno-gnu-unique
13043 @opindex fno-gnu-unique
13044 On systems with recent GNU assembler and C library, the C++ compiler
13045 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13046 of template static data members and static local variables in inline
13047 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13048 is necessary to avoid problems with a library used by two different
13049 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13050 therefore disagreeing with the other one about the binding of the
13051 symbol. But this causes @code{dlclose} to be ignored for affected
13052 DSOs; if your program relies on reinitialization of a DSO via
13053 @code{dlclose} and @code{dlopen}, you can use
13054 @option{-fno-gnu-unique}.
13055
13056 @item -fpcc-struct-return
13057 @opindex fpcc-struct-return
13058 Return ``short'' @code{struct} and @code{union} values in memory like
13059 longer ones, rather than in registers. This convention is less
13060 efficient, but it has the advantage of allowing intercallability between
13061 GCC-compiled files and files compiled with other compilers, particularly
13062 the Portable C Compiler (pcc).
13063
13064 The precise convention for returning structures in memory depends
13065 on the target configuration macros.
13066
13067 Short structures and unions are those whose size and alignment match
13068 that of some integer type.
13069
13070 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13071 switch is not binary compatible with code compiled with the
13072 @option{-freg-struct-return} switch.
13073 Use it to conform to a non-default application binary interface.
13074
13075 @item -freg-struct-return
13076 @opindex freg-struct-return
13077 Return @code{struct} and @code{union} values in registers when possible.
13078 This is more efficient for small structures than
13079 @option{-fpcc-struct-return}.
13080
13081 If you specify neither @option{-fpcc-struct-return} nor
13082 @option{-freg-struct-return}, GCC defaults to whichever convention is
13083 standard for the target. If there is no standard convention, GCC
13084 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13085 the principal compiler. In those cases, we can choose the standard, and
13086 we chose the more efficient register return alternative.
13087
13088 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13089 switch is not binary compatible with code compiled with the
13090 @option{-fpcc-struct-return} switch.
13091 Use it to conform to a non-default application binary interface.
13092
13093 @item -fshort-enums
13094 @opindex fshort-enums
13095 Allocate to an @code{enum} type only as many bytes as it needs for the
13096 declared range of possible values. Specifically, the @code{enum} type
13097 is equivalent to the smallest integer type that has enough room.
13098
13099 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13100 code that is not binary compatible with code generated without that switch.
13101 Use it to conform to a non-default application binary interface.
13102
13103 @item -fshort-wchar
13104 @opindex fshort-wchar
13105 Override the underlying type for @code{wchar_t} to be @code{short
13106 unsigned int} instead of the default for the target. This option is
13107 useful for building programs to run under WINE@.
13108
13109 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13110 code that is not binary compatible with code generated without that switch.
13111 Use it to conform to a non-default application binary interface.
13112
13113 @item -fno-common
13114 @opindex fno-common
13115 @cindex tentative definitions
13116 In C code, this option controls the placement of global variables
13117 defined without an initializer, known as @dfn{tentative definitions}
13118 in the C standard. Tentative definitions are distinct from declarations
13119 of a variable with the @code{extern} keyword, which do not allocate storage.
13120
13121 Unix C compilers have traditionally allocated storage for
13122 uninitialized global variables in a common block. This allows the
13123 linker to resolve all tentative definitions of the same variable
13124 in different compilation units to the same object, or to a non-tentative
13125 definition.
13126 This is the behavior specified by @option{-fcommon}, and is the default for
13127 GCC on most targets.
13128 On the other hand, this behavior is not required by ISO
13129 C, and on some targets may carry a speed or code size penalty on
13130 variable references.
13131
13132 The @option{-fno-common} option specifies that the compiler should instead
13133 place uninitialized global variables in the data section of the object file.
13134 This inhibits the merging of tentative definitions by the linker so
13135 you get a multiple-definition error if the same
13136 variable is defined in more than one compilation unit.
13137 Compiling with @option{-fno-common} is useful on targets for which
13138 it provides better performance, or if you wish to verify that the
13139 program will work on other systems that always treat uninitialized
13140 variable definitions this way.
13141
13142 @item -fno-ident
13143 @opindex fno-ident
13144 Ignore the @code{#ident} directive.
13145
13146 @item -finhibit-size-directive
13147 @opindex finhibit-size-directive
13148 Don't output a @code{.size} assembler directive, or anything else that
13149 would cause trouble if the function is split in the middle, and the
13150 two halves are placed at locations far apart in memory. This option is
13151 used when compiling @file{crtstuff.c}; you should not need to use it
13152 for anything else.
13153
13154 @item -fverbose-asm
13155 @opindex fverbose-asm
13156 Put extra commentary information in the generated assembly code to
13157 make it more readable. This option is generally only of use to those
13158 who actually need to read the generated assembly code (perhaps while
13159 debugging the compiler itself).
13160
13161 @option{-fno-verbose-asm}, the default, causes the
13162 extra information to be omitted and is useful when comparing two assembler
13163 files.
13164
13165 The added comments include:
13166
13167 @itemize @bullet
13168
13169 @item
13170 information on the compiler version and command-line options,
13171
13172 @item
13173 the source code lines associated with the assembly instructions,
13174 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
13175
13176 @item
13177 hints on which high-level expressions correspond to
13178 the various assembly instruction operands.
13179
13180 @end itemize
13181
13182 For example, given this C source file:
13183
13184 @smallexample
13185 int test (int n)
13186 @{
13187 int i;
13188 int total = 0;
13189
13190 for (i = 0; i < n; i++)
13191 total += i * i;
13192
13193 return total;
13194 @}
13195 @end smallexample
13196
13197 compiling to (x86_64) assembly via @option{-S} and emitting the result
13198 direct to stdout via @option{-o} @option{-}
13199
13200 @smallexample
13201 gcc -S test.c -fverbose-asm -Os -o -
13202 @end smallexample
13203
13204 gives output similar to this:
13205
13206 @smallexample
13207 .file "test.c"
13208 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
13209 [...snip...]
13210 # options passed:
13211 [...snip...]
13212
13213 .text
13214 .globl test
13215 .type test, @@function
13216 test:
13217 .LFB0:
13218 .cfi_startproc
13219 # test.c:4: int total = 0;
13220 xorl %eax, %eax # <retval>
13221 # test.c:6: for (i = 0; i < n; i++)
13222 xorl %edx, %edx # i
13223 .L2:
13224 # test.c:6: for (i = 0; i < n; i++)
13225 cmpl %edi, %edx # n, i
13226 jge .L5 #,
13227 # test.c:7: total += i * i;
13228 movl %edx, %ecx # i, tmp92
13229 imull %edx, %ecx # i, tmp92
13230 # test.c:6: for (i = 0; i < n; i++)
13231 incl %edx # i
13232 # test.c:7: total += i * i;
13233 addl %ecx, %eax # tmp92, <retval>
13234 jmp .L2 #
13235 .L5:
13236 # test.c:10: @}
13237 ret
13238 .cfi_endproc
13239 .LFE0:
13240 .size test, .-test
13241 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
13242 .section .note.GNU-stack,"",@@progbits
13243 @end smallexample
13244
13245 The comments are intended for humans rather than machines and hence the
13246 precise format of the comments is subject to change.
13247
13248 @item -frecord-gcc-switches
13249 @opindex frecord-gcc-switches
13250 This switch causes the command line used to invoke the
13251 compiler to be recorded into the object file that is being created.
13252 This switch is only implemented on some targets and the exact format
13253 of the recording is target and binary file format dependent, but it
13254 usually takes the form of a section containing ASCII text. This
13255 switch is related to the @option{-fverbose-asm} switch, but that
13256 switch only records information in the assembler output file as
13257 comments, so it never reaches the object file.
13258 See also @option{-grecord-gcc-switches} for another
13259 way of storing compiler options into the object file.
13260
13261 @item -fpic
13262 @opindex fpic
13263 @cindex global offset table
13264 @cindex PIC
13265 Generate position-independent code (PIC) suitable for use in a shared
13266 library, if supported for the target machine. Such code accesses all
13267 constant addresses through a global offset table (GOT)@. The dynamic
13268 loader resolves the GOT entries when the program starts (the dynamic
13269 loader is not part of GCC; it is part of the operating system). If
13270 the GOT size for the linked executable exceeds a machine-specific
13271 maximum size, you get an error message from the linker indicating that
13272 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
13273 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
13274 on the m68k and RS/6000. The x86 has no such limit.)
13275
13276 Position-independent code requires special support, and therefore works
13277 only on certain machines. For the x86, GCC supports PIC for System V
13278 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
13279 position-independent.
13280
13281 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13282 are defined to 1.
13283
13284 @item -fPIC
13285 @opindex fPIC
13286 If supported for the target machine, emit position-independent code,
13287 suitable for dynamic linking and avoiding any limit on the size of the
13288 global offset table. This option makes a difference on AArch64, m68k,
13289 PowerPC and SPARC@.
13290
13291 Position-independent code requires special support, and therefore works
13292 only on certain machines.
13293
13294 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
13295 are defined to 2.
13296
13297 @item -fpie
13298 @itemx -fPIE
13299 @opindex fpie
13300 @opindex fPIE
13301 These options are similar to @option{-fpic} and @option{-fPIC}, but the
13302 generated position-independent code can be only linked into executables.
13303 Usually these options are used to compile code that will be linked using
13304 the @option{-pie} GCC option.
13305
13306 @option{-fpie} and @option{-fPIE} both define the macros
13307 @code{__pie__} and @code{__PIE__}. The macros have the value 1
13308 for @option{-fpie} and 2 for @option{-fPIE}.
13309
13310 @item -fno-plt
13311 @opindex fno-plt
13312 Do not use the PLT for external function calls in position-independent code.
13313 Instead, load the callee address at call sites from the GOT and branch to it.
13314 This leads to more efficient code by eliminating PLT stubs and exposing
13315 GOT loads to optimizations. On architectures such as 32-bit x86 where
13316 PLT stubs expect the GOT pointer in a specific register, this gives more
13317 register allocation freedom to the compiler.
13318 Lazy binding requires use of the PLT;
13319 with @option{-fno-plt} all external symbols are resolved at load time.
13320
13321 Alternatively, the function attribute @code{noplt} can be used to avoid calls
13322 through the PLT for specific external functions.
13323
13324 In position-dependent code, a few targets also convert calls to
13325 functions that are marked to not use the PLT to use the GOT instead.
13326
13327 @item -fno-jump-tables
13328 @opindex fno-jump-tables
13329 Do not use jump tables for switch statements even where it would be
13330 more efficient than other code generation strategies. This option is
13331 of use in conjunction with @option{-fpic} or @option{-fPIC} for
13332 building code that forms part of a dynamic linker and cannot
13333 reference the address of a jump table. On some targets, jump tables
13334 do not require a GOT and this option is not needed.
13335
13336 @item -ffixed-@var{reg}
13337 @opindex ffixed
13338 Treat the register named @var{reg} as a fixed register; generated code
13339 should never refer to it (except perhaps as a stack pointer, frame
13340 pointer or in some other fixed role).
13341
13342 @var{reg} must be the name of a register. The register names accepted
13343 are machine-specific and are defined in the @code{REGISTER_NAMES}
13344 macro in the machine description macro file.
13345
13346 This flag does not have a negative form, because it specifies a
13347 three-way choice.
13348
13349 @item -fcall-used-@var{reg}
13350 @opindex fcall-used
13351 Treat the register named @var{reg} as an allocable register that is
13352 clobbered by function calls. It may be allocated for temporaries or
13353 variables that do not live across a call. Functions compiled this way
13354 do not save and restore the register @var{reg}.
13355
13356 It is an error to use this flag with the frame pointer or stack pointer.
13357 Use of this flag for other registers that have fixed pervasive roles in
13358 the machine's execution model produces disastrous results.
13359
13360 This flag does not have a negative form, because it specifies a
13361 three-way choice.
13362
13363 @item -fcall-saved-@var{reg}
13364 @opindex fcall-saved
13365 Treat the register named @var{reg} as an allocable register saved by
13366 functions. It may be allocated even for temporaries or variables that
13367 live across a call. Functions compiled this way save and restore
13368 the register @var{reg} if they use it.
13369
13370 It is an error to use this flag with the frame pointer or stack pointer.
13371 Use of this flag for other registers that have fixed pervasive roles in
13372 the machine's execution model produces disastrous results.
13373
13374 A different sort of disaster results from the use of this flag for
13375 a register in which function values may be returned.
13376
13377 This flag does not have a negative form, because it specifies a
13378 three-way choice.
13379
13380 @item -fpack-struct[=@var{n}]
13381 @opindex fpack-struct
13382 Without a value specified, pack all structure members together without
13383 holes. When a value is specified (which must be a small power of two), pack
13384 structure members according to this value, representing the maximum
13385 alignment (that is, objects with default alignment requirements larger than
13386 this are output potentially unaligned at the next fitting location.
13387
13388 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
13389 code that is not binary compatible with code generated without that switch.
13390 Additionally, it makes the code suboptimal.
13391 Use it to conform to a non-default application binary interface.
13392
13393 @item -fleading-underscore
13394 @opindex fleading-underscore
13395 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
13396 change the way C symbols are represented in the object file. One use
13397 is to help link with legacy assembly code.
13398
13399 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
13400 generate code that is not binary compatible with code generated without that
13401 switch. Use it to conform to a non-default application binary interface.
13402 Not all targets provide complete support for this switch.
13403
13404 @item -ftls-model=@var{model}
13405 @opindex ftls-model
13406 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
13407 The @var{model} argument should be one of @samp{global-dynamic},
13408 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
13409 Note that the choice is subject to optimization: the compiler may use
13410 a more efficient model for symbols not visible outside of the translation
13411 unit, or if @option{-fpic} is not given on the command line.
13412
13413 The default without @option{-fpic} is @samp{initial-exec}; with
13414 @option{-fpic} the default is @samp{global-dynamic}.
13415
13416 @item -ftrampolines
13417 @opindex ftrampolines
13418 For targets that normally need trampolines for nested functions, always
13419 generate them instead of using descriptors. Otherwise, for targets that
13420 do not need them, like for example HP-PA or IA-64, do nothing.
13421
13422 A trampoline is a small piece of code that is created at run time on the
13423 stack when the address of a nested function is taken, and is used to call
13424 the nested function indirectly. Therefore, it requires the stack to be
13425 made executable in order for the program to work properly.
13426
13427 @option{-fno-trampolines} is enabled by default on a language by language
13428 basis to let the compiler avoid generating them, if it computes that this
13429 is safe, and replace them with descriptors. Descriptors are made up of data
13430 only, but the generated code must be prepared to deal with them. As of this
13431 writing, @option{-fno-trampolines} is enabled by default only for Ada.
13432
13433 Moreover, code compiled with @option{-ftrampolines} and code compiled with
13434 @option{-fno-trampolines} are not binary compatible if nested functions are
13435 present. This option must therefore be used on a program-wide basis and be
13436 manipulated with extreme care.
13437
13438 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
13439 @opindex fvisibility
13440 Set the default ELF image symbol visibility to the specified option---all
13441 symbols are marked with this unless overridden within the code.
13442 Using this feature can very substantially improve linking and
13443 load times of shared object libraries, produce more optimized
13444 code, provide near-perfect API export and prevent symbol clashes.
13445 It is @strong{strongly} recommended that you use this in any shared objects
13446 you distribute.
13447
13448 Despite the nomenclature, @samp{default} always means public; i.e.,
13449 available to be linked against from outside the shared object.
13450 @samp{protected} and @samp{internal} are pretty useless in real-world
13451 usage so the only other commonly used option is @samp{hidden}.
13452 The default if @option{-fvisibility} isn't specified is
13453 @samp{default}, i.e., make every symbol public.
13454
13455 A good explanation of the benefits offered by ensuring ELF
13456 symbols have the correct visibility is given by ``How To Write
13457 Shared Libraries'' by Ulrich Drepper (which can be found at
13458 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
13459 solution made possible by this option to marking things hidden when
13460 the default is public is to make the default hidden and mark things
13461 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
13462 and @code{__attribute__ ((visibility("default")))} instead of
13463 @code{__declspec(dllexport)} you get almost identical semantics with
13464 identical syntax. This is a great boon to those working with
13465 cross-platform projects.
13466
13467 For those adding visibility support to existing code, you may find
13468 @code{#pragma GCC visibility} of use. This works by you enclosing
13469 the declarations you wish to set visibility for with (for example)
13470 @code{#pragma GCC visibility push(hidden)} and
13471 @code{#pragma GCC visibility pop}.
13472 Bear in mind that symbol visibility should be viewed @strong{as
13473 part of the API interface contract} and thus all new code should
13474 always specify visibility when it is not the default; i.e., declarations
13475 only for use within the local DSO should @strong{always} be marked explicitly
13476 as hidden as so to avoid PLT indirection overheads---making this
13477 abundantly clear also aids readability and self-documentation of the code.
13478 Note that due to ISO C++ specification requirements, @code{operator new} and
13479 @code{operator delete} must always be of default visibility.
13480
13481 Be aware that headers from outside your project, in particular system
13482 headers and headers from any other library you use, may not be
13483 expecting to be compiled with visibility other than the default. You
13484 may need to explicitly say @code{#pragma GCC visibility push(default)}
13485 before including any such headers.
13486
13487 @code{extern} declarations are not affected by @option{-fvisibility}, so
13488 a lot of code can be recompiled with @option{-fvisibility=hidden} with
13489 no modifications. However, this means that calls to @code{extern}
13490 functions with no explicit visibility use the PLT, so it is more
13491 effective to use @code{__attribute ((visibility))} and/or
13492 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
13493 declarations should be treated as hidden.
13494
13495 Note that @option{-fvisibility} does affect C++ vague linkage
13496 entities. This means that, for instance, an exception class that is
13497 be thrown between DSOs must be explicitly marked with default
13498 visibility so that the @samp{type_info} nodes are unified between
13499 the DSOs.
13500
13501 An overview of these techniques, their benefits and how to use them
13502 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
13503
13504 @item -fstrict-volatile-bitfields
13505 @opindex fstrict-volatile-bitfields
13506 This option should be used if accesses to volatile bit-fields (or other
13507 structure fields, although the compiler usually honors those types
13508 anyway) should use a single access of the width of the
13509 field's type, aligned to a natural alignment if possible. For
13510 example, targets with memory-mapped peripheral registers might require
13511 all such accesses to be 16 bits wide; with this flag you can
13512 declare all peripheral bit-fields as @code{unsigned short} (assuming short
13513 is 16 bits on these targets) to force GCC to use 16-bit accesses
13514 instead of, perhaps, a more efficient 32-bit access.
13515
13516 If this option is disabled, the compiler uses the most efficient
13517 instruction. In the previous example, that might be a 32-bit load
13518 instruction, even though that accesses bytes that do not contain
13519 any portion of the bit-field, or memory-mapped registers unrelated to
13520 the one being updated.
13521
13522 In some cases, such as when the @code{packed} attribute is applied to a
13523 structure field, it may not be possible to access the field with a single
13524 read or write that is correctly aligned for the target machine. In this
13525 case GCC falls back to generating multiple accesses rather than code that
13526 will fault or truncate the result at run time.
13527
13528 Note: Due to restrictions of the C/C++11 memory model, write accesses are
13529 not allowed to touch non bit-field members. It is therefore recommended
13530 to define all bits of the field's type as bit-field members.
13531
13532 The default value of this option is determined by the application binary
13533 interface for the target processor.
13534
13535 @item -fsync-libcalls
13536 @opindex fsync-libcalls
13537 This option controls whether any out-of-line instance of the @code{__sync}
13538 family of functions may be used to implement the C++11 @code{__atomic}
13539 family of functions.
13540
13541 The default value of this option is enabled, thus the only useful form
13542 of the option is @option{-fno-sync-libcalls}. This option is used in
13543 the implementation of the @file{libatomic} runtime library.
13544
13545 @end table
13546
13547 @node Developer Options
13548 @section GCC Developer Options
13549 @cindex developer options
13550 @cindex debugging GCC
13551 @cindex debug dump options
13552 @cindex dump options
13553 @cindex compilation statistics
13554
13555 This section describes command-line options that are primarily of
13556 interest to GCC developers, including options to support compiler
13557 testing and investigation of compiler bugs and compile-time
13558 performance problems. This includes options that produce debug dumps
13559 at various points in the compilation; that print statistics such as
13560 memory use and execution time; and that print information about GCC's
13561 configuration, such as where it searches for libraries. You should
13562 rarely need to use any of these options for ordinary compilation and
13563 linking tasks.
13564
13565 Many developer options that cause GCC to dump output to a file take an
13566 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
13567 or @samp{-} to dump to standard output, and @samp{stderr} for standard
13568 error.
13569
13570 If @samp{=@var{filename}} is omitted, a default dump file name is
13571 constructed by concatenating the base dump file name, a pass number,
13572 phase letter, and pass name. The base dump file name is the name of
13573 output file produced by the compiler if explicitly specified and not
13574 an executable; otherwise it is the source file name.
13575 The pass number is determined by the order passes are registered with
13576 the compiler's pass manager.
13577 This is generally the same as the order of execution, but passes
13578 registered by plugins, target-specific passes, or passes that are
13579 otherwise registered late are numbered higher than the pass named
13580 @samp{final}, even if they are executed earlier. The phase letter is
13581 one of @samp{i} (inter-procedural analysis), @samp{l}
13582 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
13583 The files are created in the directory of the output file.
13584
13585 @table @gcctabopt
13586
13587 @item -d@var{letters}
13588 @itemx -fdump-rtl-@var{pass}
13589 @itemx -fdump-rtl-@var{pass}=@var{filename}
13590 @opindex d
13591 @opindex fdump-rtl-@var{pass}
13592 Says to make debugging dumps during compilation at times specified by
13593 @var{letters}. This is used for debugging the RTL-based passes of the
13594 compiler.
13595
13596 Some @option{-d@var{letters}} switches have different meaning when
13597 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
13598 for information about preprocessor-specific dump options.
13599
13600 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
13601 @option{-d} option @var{letters}. Here are the possible
13602 letters for use in @var{pass} and @var{letters}, and their meanings:
13603
13604 @table @gcctabopt
13605
13606 @item -fdump-rtl-alignments
13607 @opindex fdump-rtl-alignments
13608 Dump after branch alignments have been computed.
13609
13610 @item -fdump-rtl-asmcons
13611 @opindex fdump-rtl-asmcons
13612 Dump after fixing rtl statements that have unsatisfied in/out constraints.
13613
13614 @item -fdump-rtl-auto_inc_dec
13615 @opindex fdump-rtl-auto_inc_dec
13616 Dump after auto-inc-dec discovery. This pass is only run on
13617 architectures that have auto inc or auto dec instructions.
13618
13619 @item -fdump-rtl-barriers
13620 @opindex fdump-rtl-barriers
13621 Dump after cleaning up the barrier instructions.
13622
13623 @item -fdump-rtl-bbpart
13624 @opindex fdump-rtl-bbpart
13625 Dump after partitioning hot and cold basic blocks.
13626
13627 @item -fdump-rtl-bbro
13628 @opindex fdump-rtl-bbro
13629 Dump after block reordering.
13630
13631 @item -fdump-rtl-btl1
13632 @itemx -fdump-rtl-btl2
13633 @opindex fdump-rtl-btl2
13634 @opindex fdump-rtl-btl2
13635 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
13636 after the two branch
13637 target load optimization passes.
13638
13639 @item -fdump-rtl-bypass
13640 @opindex fdump-rtl-bypass
13641 Dump after jump bypassing and control flow optimizations.
13642
13643 @item -fdump-rtl-combine
13644 @opindex fdump-rtl-combine
13645 Dump after the RTL instruction combination pass.
13646
13647 @item -fdump-rtl-compgotos
13648 @opindex fdump-rtl-compgotos
13649 Dump after duplicating the computed gotos.
13650
13651 @item -fdump-rtl-ce1
13652 @itemx -fdump-rtl-ce2
13653 @itemx -fdump-rtl-ce3
13654 @opindex fdump-rtl-ce1
13655 @opindex fdump-rtl-ce2
13656 @opindex fdump-rtl-ce3
13657 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
13658 @option{-fdump-rtl-ce3} enable dumping after the three
13659 if conversion passes.
13660
13661 @item -fdump-rtl-cprop_hardreg
13662 @opindex fdump-rtl-cprop_hardreg
13663 Dump after hard register copy propagation.
13664
13665 @item -fdump-rtl-csa
13666 @opindex fdump-rtl-csa
13667 Dump after combining stack adjustments.
13668
13669 @item -fdump-rtl-cse1
13670 @itemx -fdump-rtl-cse2
13671 @opindex fdump-rtl-cse1
13672 @opindex fdump-rtl-cse2
13673 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
13674 the two common subexpression elimination passes.
13675
13676 @item -fdump-rtl-dce
13677 @opindex fdump-rtl-dce
13678 Dump after the standalone dead code elimination passes.
13679
13680 @item -fdump-rtl-dbr
13681 @opindex fdump-rtl-dbr
13682 Dump after delayed branch scheduling.
13683
13684 @item -fdump-rtl-dce1
13685 @itemx -fdump-rtl-dce2
13686 @opindex fdump-rtl-dce1
13687 @opindex fdump-rtl-dce2
13688 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
13689 the two dead store elimination passes.
13690
13691 @item -fdump-rtl-eh
13692 @opindex fdump-rtl-eh
13693 Dump after finalization of EH handling code.
13694
13695 @item -fdump-rtl-eh_ranges
13696 @opindex fdump-rtl-eh_ranges
13697 Dump after conversion of EH handling range regions.
13698
13699 @item -fdump-rtl-expand
13700 @opindex fdump-rtl-expand
13701 Dump after RTL generation.
13702
13703 @item -fdump-rtl-fwprop1
13704 @itemx -fdump-rtl-fwprop2
13705 @opindex fdump-rtl-fwprop1
13706 @opindex fdump-rtl-fwprop2
13707 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
13708 dumping after the two forward propagation passes.
13709
13710 @item -fdump-rtl-gcse1
13711 @itemx -fdump-rtl-gcse2
13712 @opindex fdump-rtl-gcse1
13713 @opindex fdump-rtl-gcse2
13714 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
13715 after global common subexpression elimination.
13716
13717 @item -fdump-rtl-init-regs
13718 @opindex fdump-rtl-init-regs
13719 Dump after the initialization of the registers.
13720
13721 @item -fdump-rtl-initvals
13722 @opindex fdump-rtl-initvals
13723 Dump after the computation of the initial value sets.
13724
13725 @item -fdump-rtl-into_cfglayout
13726 @opindex fdump-rtl-into_cfglayout
13727 Dump after converting to cfglayout mode.
13728
13729 @item -fdump-rtl-ira
13730 @opindex fdump-rtl-ira
13731 Dump after iterated register allocation.
13732
13733 @item -fdump-rtl-jump
13734 @opindex fdump-rtl-jump
13735 Dump after the second jump optimization.
13736
13737 @item -fdump-rtl-loop2
13738 @opindex fdump-rtl-loop2
13739 @option{-fdump-rtl-loop2} enables dumping after the rtl
13740 loop optimization passes.
13741
13742 @item -fdump-rtl-mach
13743 @opindex fdump-rtl-mach
13744 Dump after performing the machine dependent reorganization pass, if that
13745 pass exists.
13746
13747 @item -fdump-rtl-mode_sw
13748 @opindex fdump-rtl-mode_sw
13749 Dump after removing redundant mode switches.
13750
13751 @item -fdump-rtl-rnreg
13752 @opindex fdump-rtl-rnreg
13753 Dump after register renumbering.
13754
13755 @item -fdump-rtl-outof_cfglayout
13756 @opindex fdump-rtl-outof_cfglayout
13757 Dump after converting from cfglayout mode.
13758
13759 @item -fdump-rtl-peephole2
13760 @opindex fdump-rtl-peephole2
13761 Dump after the peephole pass.
13762
13763 @item -fdump-rtl-postreload
13764 @opindex fdump-rtl-postreload
13765 Dump after post-reload optimizations.
13766
13767 @item -fdump-rtl-pro_and_epilogue
13768 @opindex fdump-rtl-pro_and_epilogue
13769 Dump after generating the function prologues and epilogues.
13770
13771 @item -fdump-rtl-sched1
13772 @itemx -fdump-rtl-sched2
13773 @opindex fdump-rtl-sched1
13774 @opindex fdump-rtl-sched2
13775 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
13776 after the basic block scheduling passes.
13777
13778 @item -fdump-rtl-ree
13779 @opindex fdump-rtl-ree
13780 Dump after sign/zero extension elimination.
13781
13782 @item -fdump-rtl-seqabstr
13783 @opindex fdump-rtl-seqabstr
13784 Dump after common sequence discovery.
13785
13786 @item -fdump-rtl-shorten
13787 @opindex fdump-rtl-shorten
13788 Dump after shortening branches.
13789
13790 @item -fdump-rtl-sibling
13791 @opindex fdump-rtl-sibling
13792 Dump after sibling call optimizations.
13793
13794 @item -fdump-rtl-split1
13795 @itemx -fdump-rtl-split2
13796 @itemx -fdump-rtl-split3
13797 @itemx -fdump-rtl-split4
13798 @itemx -fdump-rtl-split5
13799 @opindex fdump-rtl-split1
13800 @opindex fdump-rtl-split2
13801 @opindex fdump-rtl-split3
13802 @opindex fdump-rtl-split4
13803 @opindex fdump-rtl-split5
13804 These options enable dumping after five rounds of
13805 instruction splitting.
13806
13807 @item -fdump-rtl-sms
13808 @opindex fdump-rtl-sms
13809 Dump after modulo scheduling. This pass is only run on some
13810 architectures.
13811
13812 @item -fdump-rtl-stack
13813 @opindex fdump-rtl-stack
13814 Dump after conversion from GCC's ``flat register file'' registers to the
13815 x87's stack-like registers. This pass is only run on x86 variants.
13816
13817 @item -fdump-rtl-subreg1
13818 @itemx -fdump-rtl-subreg2
13819 @opindex fdump-rtl-subreg1
13820 @opindex fdump-rtl-subreg2
13821 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
13822 the two subreg expansion passes.
13823
13824 @item -fdump-rtl-unshare
13825 @opindex fdump-rtl-unshare
13826 Dump after all rtl has been unshared.
13827
13828 @item -fdump-rtl-vartrack
13829 @opindex fdump-rtl-vartrack
13830 Dump after variable tracking.
13831
13832 @item -fdump-rtl-vregs
13833 @opindex fdump-rtl-vregs
13834 Dump after converting virtual registers to hard registers.
13835
13836 @item -fdump-rtl-web
13837 @opindex fdump-rtl-web
13838 Dump after live range splitting.
13839
13840 @item -fdump-rtl-regclass
13841 @itemx -fdump-rtl-subregs_of_mode_init
13842 @itemx -fdump-rtl-subregs_of_mode_finish
13843 @itemx -fdump-rtl-dfinit
13844 @itemx -fdump-rtl-dfinish
13845 @opindex fdump-rtl-regclass
13846 @opindex fdump-rtl-subregs_of_mode_init
13847 @opindex fdump-rtl-subregs_of_mode_finish
13848 @opindex fdump-rtl-dfinit
13849 @opindex fdump-rtl-dfinish
13850 These dumps are defined but always produce empty files.
13851
13852 @item -da
13853 @itemx -fdump-rtl-all
13854 @opindex da
13855 @opindex fdump-rtl-all
13856 Produce all the dumps listed above.
13857
13858 @item -dA
13859 @opindex dA
13860 Annotate the assembler output with miscellaneous debugging information.
13861
13862 @item -dD
13863 @opindex dD
13864 Dump all macro definitions, at the end of preprocessing, in addition to
13865 normal output.
13866
13867 @item -dH
13868 @opindex dH
13869 Produce a core dump whenever an error occurs.
13870
13871 @item -dp
13872 @opindex dp
13873 Annotate the assembler output with a comment indicating which
13874 pattern and alternative is used. The length and cost of each instruction are
13875 also printed.
13876
13877 @item -dP
13878 @opindex dP
13879 Dump the RTL in the assembler output as a comment before each instruction.
13880 Also turns on @option{-dp} annotation.
13881
13882 @item -dx
13883 @opindex dx
13884 Just generate RTL for a function instead of compiling it. Usually used
13885 with @option{-fdump-rtl-expand}.
13886 @end table
13887
13888 @item -fdump-debug
13889 @opindex fdump-debug
13890 Dump debugging information generated during the debug
13891 generation phase.
13892
13893 @item -fdump-earlydebug
13894 @opindex fdump-earlydebug
13895 Dump debugging information generated during the early debug
13896 generation phase.
13897
13898 @item -fdump-noaddr
13899 @opindex fdump-noaddr
13900 When doing debugging dumps, suppress address output. This makes it more
13901 feasible to use diff on debugging dumps for compiler invocations with
13902 different compiler binaries and/or different
13903 text / bss / data / heap / stack / dso start locations.
13904
13905 @item -freport-bug
13906 @opindex freport-bug
13907 Collect and dump debug information into a temporary file if an
13908 internal compiler error (ICE) occurs.
13909
13910 @item -fdump-unnumbered
13911 @opindex fdump-unnumbered
13912 When doing debugging dumps, suppress instruction numbers and address output.
13913 This makes it more feasible to use diff on debugging dumps for compiler
13914 invocations with different options, in particular with and without
13915 @option{-g}.
13916
13917 @item -fdump-unnumbered-links
13918 @opindex fdump-unnumbered-links
13919 When doing debugging dumps (see @option{-d} option above), suppress
13920 instruction numbers for the links to the previous and next instructions
13921 in a sequence.
13922
13923 @item -fdump-ipa-@var{switch}
13924 @opindex fdump-ipa
13925 Control the dumping at various stages of inter-procedural analysis
13926 language tree to a file. The file name is generated by appending a
13927 switch specific suffix to the source file name, and the file is created
13928 in the same directory as the output file. The following dumps are
13929 possible:
13930
13931 @table @samp
13932 @item all
13933 Enables all inter-procedural analysis dumps.
13934
13935 @item cgraph
13936 Dumps information about call-graph optimization, unused function removal,
13937 and inlining decisions.
13938
13939 @item inline
13940 Dump after function inlining.
13941
13942 @end table
13943
13944 @item -fdump-lang-all
13945 @itemx -fdump-lang-@var{switch}
13946 @itemx -fdump-lang-@var{switch}-@var{options}
13947 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
13948 @opindex fdump-lang-all
13949 @opindex fdump-lang
13950 Control the dumping of language-specific information. The @var{options}
13951 and @var{filename} portions behave as described in the
13952 @option{-fdump-tree} option. The following @var{switch} values are
13953 accepted:
13954
13955 @table @samp
13956 @item all
13957
13958 Enable all language-specific dumps.
13959
13960 @item class
13961 Dump class hierarchy information. Virtual table information is emitted
13962 unless '@option{slim}' is specified. This option is applicable to C++ only.
13963
13964 @item raw
13965 Dump the raw internal tree data. This option is applicable to C++ only.
13966
13967 @end table
13968
13969 @item -fdump-passes
13970 @opindex fdump-passes
13971 Print on @file{stderr} the list of optimization passes that are turned
13972 on and off by the current command-line options.
13973
13974 @item -fdump-statistics-@var{option}
13975 @opindex fdump-statistics
13976 Enable and control dumping of pass statistics in a separate file. The
13977 file name is generated by appending a suffix ending in
13978 @samp{.statistics} to the source file name, and the file is created in
13979 the same directory as the output file. If the @samp{-@var{option}}
13980 form is used, @samp{-stats} causes counters to be summed over the
13981 whole compilation unit while @samp{-details} dumps every event as
13982 the passes generate them. The default with no option is to sum
13983 counters for each function compiled.
13984
13985 @item -fdump-tree-all
13986 @itemx -fdump-tree-@var{switch}
13987 @itemx -fdump-tree-@var{switch}-@var{options}
13988 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
13989 @opindex fdump-tree-all
13990 @opindex fdump-tree
13991 Control the dumping at various stages of processing the intermediate
13992 language tree to a file. If the @samp{-@var{options}}
13993 form is used, @var{options} is a list of @samp{-} separated options
13994 which control the details of the dump. Not all options are applicable
13995 to all dumps; those that are not meaningful are ignored. The
13996 following options are available
13997
13998 @table @samp
13999 @item address
14000 Print the address of each node. Usually this is not meaningful as it
14001 changes according to the environment and source file. Its primary use
14002 is for tying up a dump file with a debug environment.
14003 @item asmname
14004 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14005 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14006 use working backward from mangled names in the assembly file.
14007 @item slim
14008 When dumping front-end intermediate representations, inhibit dumping
14009 of members of a scope or body of a function merely because that scope
14010 has been reached. Only dump such items when they are directly reachable
14011 by some other path.
14012
14013 When dumping pretty-printed trees, this option inhibits dumping the
14014 bodies of control structures.
14015
14016 When dumping RTL, print the RTL in slim (condensed) form instead of
14017 the default LISP-like representation.
14018 @item raw
14019 Print a raw representation of the tree. By default, trees are
14020 pretty-printed into a C-like representation.
14021 @item details
14022 Enable more detailed dumps (not honored by every dump option). Also
14023 include information from the optimization passes.
14024 @item stats
14025 Enable dumping various statistics about the pass (not honored by every dump
14026 option).
14027 @item blocks
14028 Enable showing basic block boundaries (disabled in raw dumps).
14029 @item graph
14030 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14031 dump a representation of the control flow graph suitable for viewing with
14032 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14033 the file is pretty-printed as a subgraph, so that GraphViz can render them
14034 all in a single plot.
14035
14036 This option currently only works for RTL dumps, and the RTL is always
14037 dumped in slim form.
14038 @item vops
14039 Enable showing virtual operands for every statement.
14040 @item lineno
14041 Enable showing line numbers for statements.
14042 @item uid
14043 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14044 @item verbose
14045 Enable showing the tree dump for each statement.
14046 @item eh
14047 Enable showing the EH region number holding each statement.
14048 @item scev
14049 Enable showing scalar evolution analysis details.
14050 @item optimized
14051 Enable showing optimization information (only available in certain
14052 passes).
14053 @item missed
14054 Enable showing missed optimization information (only available in certain
14055 passes).
14056 @item note
14057 Enable other detailed optimization information (only available in
14058 certain passes).
14059 @item all
14060 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14061 and @option{lineno}.
14062 @item optall
14063 Turn on all optimization options, i.e., @option{optimized},
14064 @option{missed}, and @option{note}.
14065 @end table
14066
14067 To determine what tree dumps are available or find the dump for a pass
14068 of interest follow the steps below.
14069
14070 @enumerate
14071 @item
14072 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14073 look for a code that corresponds to the pass you are interested in.
14074 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14075 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14076 The number at the end distinguishes distinct invocations of the same pass.
14077 @item
14078 To enable the creation of the dump file, append the pass code to
14079 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14080 to enable the dump from the Early Value Range Propagation pass, invoke
14081 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14082 specify the name of the dump file. If you don't specify one, GCC
14083 creates as described below.
14084 @item
14085 Find the pass dump in a file whose name is composed of three components
14086 separated by a period: the name of the source file GCC was invoked to
14087 compile, a numeric suffix indicating the pass number followed by the
14088 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14089 and finally the pass code. For example, the Early VRP pass dump might
14090 be in a file named @file{myfile.c.038t.evrp} in the current working
14091 directory. Note that the numeric codes are not stable and may change
14092 from one version of GCC to another.
14093 @end enumerate
14094
14095 @item -fopt-info
14096 @itemx -fopt-info-@var{options}
14097 @itemx -fopt-info-@var{options}=@var{filename}
14098 @opindex fopt-info
14099 Controls optimization dumps from various optimization passes. If the
14100 @samp{-@var{options}} form is used, @var{options} is a list of
14101 @samp{-} separated option keywords to select the dump details and
14102 optimizations.
14103
14104 The @var{options} can be divided into two groups: options describing the
14105 verbosity of the dump, and options describing which optimizations
14106 should be included. The options from both the groups can be freely
14107 mixed as they are non-overlapping. However, in case of any conflicts,
14108 the later options override the earlier options on the command
14109 line.
14110
14111 The following options control the dump verbosity:
14112
14113 @table @samp
14114 @item optimized
14115 Print information when an optimization is successfully applied. It is
14116 up to a pass to decide which information is relevant. For example, the
14117 vectorizer passes print the source location of loops which are
14118 successfully vectorized.
14119 @item missed
14120 Print information about missed optimizations. Individual passes
14121 control which information to include in the output.
14122 @item note
14123 Print verbose information about optimizations, such as certain
14124 transformations, more detailed messages about decisions etc.
14125 @item all
14126 Print detailed optimization information. This includes
14127 @samp{optimized}, @samp{missed}, and @samp{note}.
14128 @end table
14129
14130 One or more of the following option keywords can be used to describe a
14131 group of optimizations:
14132
14133 @table @samp
14134 @item ipa
14135 Enable dumps from all interprocedural optimizations.
14136 @item loop
14137 Enable dumps from all loop optimizations.
14138 @item inline
14139 Enable dumps from all inlining optimizations.
14140 @item omp
14141 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
14142 @item vec
14143 Enable dumps from all vectorization optimizations.
14144 @item optall
14145 Enable dumps from all optimizations. This is a superset of
14146 the optimization groups listed above.
14147 @end table
14148
14149 If @var{options} is
14150 omitted, it defaults to @samp{optimized-optall}, which means to dump all
14151 info about successful optimizations from all the passes.
14152
14153 If the @var{filename} is provided, then the dumps from all the
14154 applicable optimizations are concatenated into the @var{filename}.
14155 Otherwise the dump is output onto @file{stderr}. Though multiple
14156 @option{-fopt-info} options are accepted, only one of them can include
14157 a @var{filename}. If other filenames are provided then all but the
14158 first such option are ignored.
14159
14160 Note that the output @var{filename} is overwritten
14161 in case of multiple translation units. If a combined output from
14162 multiple translation units is desired, @file{stderr} should be used
14163 instead.
14164
14165 In the following example, the optimization info is output to
14166 @file{stderr}:
14167
14168 @smallexample
14169 gcc -O3 -fopt-info
14170 @end smallexample
14171
14172 This example:
14173 @smallexample
14174 gcc -O3 -fopt-info-missed=missed.all
14175 @end smallexample
14176
14177 @noindent
14178 outputs missed optimization report from all the passes into
14179 @file{missed.all}, and this one:
14180
14181 @smallexample
14182 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
14183 @end smallexample
14184
14185 @noindent
14186 prints information about missed optimization opportunities from
14187 vectorization passes on @file{stderr}.
14188 Note that @option{-fopt-info-vec-missed} is equivalent to
14189 @option{-fopt-info-missed-vec}. The order of the optimization group
14190 names and message types listed after @option{-fopt-info} does not matter.
14191
14192 As another example,
14193 @smallexample
14194 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
14195 @end smallexample
14196
14197 @noindent
14198 outputs information about missed optimizations as well as
14199 optimized locations from all the inlining passes into
14200 @file{inline.txt}.
14201
14202 Finally, consider:
14203
14204 @smallexample
14205 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
14206 @end smallexample
14207
14208 @noindent
14209 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
14210 in conflict since only one output file is allowed. In this case, only
14211 the first option takes effect and the subsequent options are
14212 ignored. Thus only @file{vec.miss} is produced which contains
14213 dumps from the vectorizer about missed opportunities.
14214
14215 @item -fsave-optimization-record
14216 @opindex fsave-optimization-record
14217 Write a SRCFILE.opt-record.json file detailing what optimizations
14218 were performed, for those optimizations that support @option{-fopt-info}.
14219
14220 This option is experimental and the format of the data within the JSON
14221 file is subject to change.
14222
14223 It is roughly equivalent to a machine-readable version of
14224 @option{-fopt-info-all}, as a collection of messages with source file,
14225 line number and column number, with the following additional data for
14226 each message:
14227
14228 @itemize @bullet
14229
14230 @item
14231 the execution count of the code being optimized, along with metadata about
14232 whether this was from actual profile data, or just an estimate, allowing
14233 consumers to prioritize messages by code hotness,
14234
14235 @item
14236 the function name of the code being optimized, where applicable,
14237
14238 @item
14239 the ``inlining chain'' for the code being optimized, so that when
14240 a function is inlined into several different places (which might
14241 themselves be inlined), the reader can distinguish between the copies,
14242
14243 @item
14244 objects identifying those parts of the message that refer to expressions,
14245 statements or symbol-table nodes, which of these categories they are, and,
14246 when available, their source code location,
14247
14248 @item
14249 the GCC pass that emitted the message, and
14250
14251 @item
14252 the location in GCC's own code from which the message was emitted
14253
14254 @end itemize
14255
14256 Additionally, some messages are logically nested within other
14257 messages, reflecting implementation details of the optimization
14258 passes.
14259
14260 @item -fsched-verbose=@var{n}
14261 @opindex fsched-verbose
14262 On targets that use instruction scheduling, this option controls the
14263 amount of debugging output the scheduler prints to the dump files.
14264
14265 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
14266 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
14267 For @var{n} greater than one, it also output basic block probabilities,
14268 detailed ready list information and unit/insn info. For @var{n} greater
14269 than two, it includes RTL at abort point, control-flow and regions info.
14270 And for @var{n} over four, @option{-fsched-verbose} also includes
14271 dependence info.
14272
14273
14274
14275 @item -fenable-@var{kind}-@var{pass}
14276 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
14277 @opindex fdisable-
14278 @opindex fenable-
14279
14280 This is a set of options that are used to explicitly disable/enable
14281 optimization passes. These options are intended for use for debugging GCC.
14282 Compiler users should use regular options for enabling/disabling
14283 passes instead.
14284
14285 @table @gcctabopt
14286
14287 @item -fdisable-ipa-@var{pass}
14288 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14289 statically invoked in the compiler multiple times, the pass name should be
14290 appended with a sequential number starting from 1.
14291
14292 @item -fdisable-rtl-@var{pass}
14293 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
14294 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
14295 statically invoked in the compiler multiple times, the pass name should be
14296 appended with a sequential number starting from 1. @var{range-list} is a
14297 comma-separated list of function ranges or assembler names. Each range is a number
14298 pair separated by a colon. The range is inclusive in both ends. If the range
14299 is trivial, the number pair can be simplified as a single number. If the
14300 function's call graph node's @var{uid} falls within one of the specified ranges,
14301 the @var{pass} is disabled for that function. The @var{uid} is shown in the
14302 function header of a dump file, and the pass names can be dumped by using
14303 option @option{-fdump-passes}.
14304
14305 @item -fdisable-tree-@var{pass}
14306 @itemx -fdisable-tree-@var{pass}=@var{range-list}
14307 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
14308 option arguments.
14309
14310 @item -fenable-ipa-@var{pass}
14311 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
14312 statically invoked in the compiler multiple times, the pass name should be
14313 appended with a sequential number starting from 1.
14314
14315 @item -fenable-rtl-@var{pass}
14316 @itemx -fenable-rtl-@var{pass}=@var{range-list}
14317 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
14318 description and examples.
14319
14320 @item -fenable-tree-@var{pass}
14321 @itemx -fenable-tree-@var{pass}=@var{range-list}
14322 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
14323 of option arguments.
14324
14325 @end table
14326
14327 Here are some examples showing uses of these options.
14328
14329 @smallexample
14330
14331 # disable ccp1 for all functions
14332 -fdisable-tree-ccp1
14333 # disable complete unroll for function whose cgraph node uid is 1
14334 -fenable-tree-cunroll=1
14335 # disable gcse2 for functions at the following ranges [1,1],
14336 # [300,400], and [400,1000]
14337 # disable gcse2 for functions foo and foo2
14338 -fdisable-rtl-gcse2=foo,foo2
14339 # disable early inlining
14340 -fdisable-tree-einline
14341 # disable ipa inlining
14342 -fdisable-ipa-inline
14343 # enable tree full unroll
14344 -fenable-tree-unroll
14345
14346 @end smallexample
14347
14348 @item -fchecking
14349 @itemx -fchecking=@var{n}
14350 @opindex fchecking
14351 @opindex fno-checking
14352 Enable internal consistency checking. The default depends on
14353 the compiler configuration. @option{-fchecking=2} enables further
14354 internal consistency checking that might affect code generation.
14355
14356 @item -frandom-seed=@var{string}
14357 @opindex frandom-seed
14358 This option provides a seed that GCC uses in place of
14359 random numbers in generating certain symbol names
14360 that have to be different in every compiled file. It is also used to
14361 place unique stamps in coverage data files and the object files that
14362 produce them. You can use the @option{-frandom-seed} option to produce
14363 reproducibly identical object files.
14364
14365 The @var{string} can either be a number (decimal, octal or hex) or an
14366 arbitrary string (in which case it's converted to a number by
14367 computing CRC32).
14368
14369 The @var{string} should be different for every file you compile.
14370
14371 @item -save-temps
14372 @itemx -save-temps=cwd
14373 @opindex save-temps
14374 Store the usual ``temporary'' intermediate files permanently; place them
14375 in the current directory and name them based on the source file. Thus,
14376 compiling @file{foo.c} with @option{-c -save-temps} produces files
14377 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
14378 preprocessed @file{foo.i} output file even though the compiler now
14379 normally uses an integrated preprocessor.
14380
14381 When used in combination with the @option{-x} command-line option,
14382 @option{-save-temps} is sensible enough to avoid over writing an
14383 input source file with the same extension as an intermediate file.
14384 The corresponding intermediate file may be obtained by renaming the
14385 source file before using @option{-save-temps}.
14386
14387 If you invoke GCC in parallel, compiling several different source
14388 files that share a common base name in different subdirectories or the
14389 same source file compiled for multiple output destinations, it is
14390 likely that the different parallel compilers will interfere with each
14391 other, and overwrite the temporary files. For instance:
14392
14393 @smallexample
14394 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
14395 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
14396 @end smallexample
14397
14398 may result in @file{foo.i} and @file{foo.o} being written to
14399 simultaneously by both compilers.
14400
14401 @item -save-temps=obj
14402 @opindex save-temps=obj
14403 Store the usual ``temporary'' intermediate files permanently. If the
14404 @option{-o} option is used, the temporary files are based on the
14405 object file. If the @option{-o} option is not used, the
14406 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
14407
14408 For example:
14409
14410 @smallexample
14411 gcc -save-temps=obj -c foo.c
14412 gcc -save-temps=obj -c bar.c -o dir/xbar.o
14413 gcc -save-temps=obj foobar.c -o dir2/yfoobar
14414 @end smallexample
14415
14416 @noindent
14417 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
14418 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
14419 @file{dir2/yfoobar.o}.
14420
14421 @item -time@r{[}=@var{file}@r{]}
14422 @opindex time
14423 Report the CPU time taken by each subprocess in the compilation
14424 sequence. For C source files, this is the compiler proper and assembler
14425 (plus the linker if linking is done).
14426
14427 Without the specification of an output file, the output looks like this:
14428
14429 @smallexample
14430 # cc1 0.12 0.01
14431 # as 0.00 0.01
14432 @end smallexample
14433
14434 The first number on each line is the ``user time'', that is time spent
14435 executing the program itself. The second number is ``system time'',
14436 time spent executing operating system routines on behalf of the program.
14437 Both numbers are in seconds.
14438
14439 With the specification of an output file, the output is appended to the
14440 named file, and it looks like this:
14441
14442 @smallexample
14443 0.12 0.01 cc1 @var{options}
14444 0.00 0.01 as @var{options}
14445 @end smallexample
14446
14447 The ``user time'' and the ``system time'' are moved before the program
14448 name, and the options passed to the program are displayed, so that one
14449 can later tell what file was being compiled, and with which options.
14450
14451 @item -fdump-final-insns@r{[}=@var{file}@r{]}
14452 @opindex fdump-final-insns
14453 Dump the final internal representation (RTL) to @var{file}. If the
14454 optional argument is omitted (or if @var{file} is @code{.}), the name
14455 of the dump file is determined by appending @code{.gkd} to the
14456 compilation output file name.
14457
14458 @item -fcompare-debug@r{[}=@var{opts}@r{]}
14459 @opindex fcompare-debug
14460 @opindex fno-compare-debug
14461 If no error occurs during compilation, run the compiler a second time,
14462 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
14463 passed to the second compilation. Dump the final internal
14464 representation in both compilations, and print an error if they differ.
14465
14466 If the equal sign is omitted, the default @option{-gtoggle} is used.
14467
14468 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
14469 and nonzero, implicitly enables @option{-fcompare-debug}. If
14470 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
14471 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
14472 is used.
14473
14474 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
14475 is equivalent to @option{-fno-compare-debug}, which disables the dumping
14476 of the final representation and the second compilation, preventing even
14477 @env{GCC_COMPARE_DEBUG} from taking effect.
14478
14479 To verify full coverage during @option{-fcompare-debug} testing, set
14480 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
14481 which GCC rejects as an invalid option in any actual compilation
14482 (rather than preprocessing, assembly or linking). To get just a
14483 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
14484 not overridden} will do.
14485
14486 @item -fcompare-debug-second
14487 @opindex fcompare-debug-second
14488 This option is implicitly passed to the compiler for the second
14489 compilation requested by @option{-fcompare-debug}, along with options to
14490 silence warnings, and omitting other options that would cause the compiler
14491 to produce output to files or to standard output as a side effect. Dump
14492 files and preserved temporary files are renamed so as to contain the
14493 @code{.gk} additional extension during the second compilation, to avoid
14494 overwriting those generated by the first.
14495
14496 When this option is passed to the compiler driver, it causes the
14497 @emph{first} compilation to be skipped, which makes it useful for little
14498 other than debugging the compiler proper.
14499
14500 @item -gtoggle
14501 @opindex gtoggle
14502 Turn off generation of debug info, if leaving out this option
14503 generates it, or turn it on at level 2 otherwise. The position of this
14504 argument in the command line does not matter; it takes effect after all
14505 other options are processed, and it does so only once, no matter how
14506 many times it is given. This is mainly intended to be used with
14507 @option{-fcompare-debug}.
14508
14509 @item -fvar-tracking-assignments-toggle
14510 @opindex fvar-tracking-assignments-toggle
14511 @opindex fno-var-tracking-assignments-toggle
14512 Toggle @option{-fvar-tracking-assignments}, in the same way that
14513 @option{-gtoggle} toggles @option{-g}.
14514
14515 @item -Q
14516 @opindex Q
14517 Makes the compiler print out each function name as it is compiled, and
14518 print some statistics about each pass when it finishes.
14519
14520 @item -ftime-report
14521 @opindex ftime-report
14522 Makes the compiler print some statistics about the time consumed by each
14523 pass when it finishes.
14524
14525 @item -ftime-report-details
14526 @opindex ftime-report-details
14527 Record the time consumed by infrastructure parts separately for each pass.
14528
14529 @item -fira-verbose=@var{n}
14530 @opindex fira-verbose
14531 Control the verbosity of the dump file for the integrated register allocator.
14532 The default value is 5. If the value @var{n} is greater or equal to 10,
14533 the dump output is sent to stderr using the same format as @var{n} minus 10.
14534
14535 @item -flto-report
14536 @opindex flto-report
14537 Prints a report with internal details on the workings of the link-time
14538 optimizer. The contents of this report vary from version to version.
14539 It is meant to be useful to GCC developers when processing object
14540 files in LTO mode (via @option{-flto}).
14541
14542 Disabled by default.
14543
14544 @item -flto-report-wpa
14545 @opindex flto-report-wpa
14546 Like @option{-flto-report}, but only print for the WPA phase of Link
14547 Time Optimization.
14548
14549 @item -fmem-report
14550 @opindex fmem-report
14551 Makes the compiler print some statistics about permanent memory
14552 allocation when it finishes.
14553
14554 @item -fmem-report-wpa
14555 @opindex fmem-report-wpa
14556 Makes the compiler print some statistics about permanent memory
14557 allocation for the WPA phase only.
14558
14559 @item -fpre-ipa-mem-report
14560 @opindex fpre-ipa-mem-report
14561 @item -fpost-ipa-mem-report
14562 @opindex fpost-ipa-mem-report
14563 Makes the compiler print some statistics about permanent memory
14564 allocation before or after interprocedural optimization.
14565
14566 @item -fprofile-report
14567 @opindex fprofile-report
14568 Makes the compiler print some statistics about consistency of the
14569 (estimated) profile and effect of individual passes.
14570
14571 @item -fstack-usage
14572 @opindex fstack-usage
14573 Makes the compiler output stack usage information for the program, on a
14574 per-function basis. The filename for the dump is made by appending
14575 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
14576 the output file, if explicitly specified and it is not an executable,
14577 otherwise it is the basename of the source file. An entry is made up
14578 of three fields:
14579
14580 @itemize
14581 @item
14582 The name of the function.
14583 @item
14584 A number of bytes.
14585 @item
14586 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
14587 @end itemize
14588
14589 The qualifier @code{static} means that the function manipulates the stack
14590 statically: a fixed number of bytes are allocated for the frame on function
14591 entry and released on function exit; no stack adjustments are otherwise made
14592 in the function. The second field is this fixed number of bytes.
14593
14594 The qualifier @code{dynamic} means that the function manipulates the stack
14595 dynamically: in addition to the static allocation described above, stack
14596 adjustments are made in the body of the function, for example to push/pop
14597 arguments around function calls. If the qualifier @code{bounded} is also
14598 present, the amount of these adjustments is bounded at compile time and
14599 the second field is an upper bound of the total amount of stack used by
14600 the function. If it is not present, the amount of these adjustments is
14601 not bounded at compile time and the second field only represents the
14602 bounded part.
14603
14604 @item -fstats
14605 @opindex fstats
14606 Emit statistics about front-end processing at the end of the compilation.
14607 This option is supported only by the C++ front end, and
14608 the information is generally only useful to the G++ development team.
14609
14610 @item -fdbg-cnt-list
14611 @opindex fdbg-cnt-list
14612 Print the name and the counter upper bound for all debug counters.
14613
14614
14615 @item -fdbg-cnt=@var{counter-value-list}
14616 @opindex fdbg-cnt
14617 Set the internal debug counter lower and upper bound. @var{counter-value-list}
14618 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
14619 tuples which sets the lower and the upper bound of each debug
14620 counter @var{name}. The @var{lower_bound} is optional and is zero
14621 initialized if not set.
14622 All debug counters have the initial upper bound of @code{UINT_MAX};
14623 thus @code{dbg_cnt} returns true always unless the upper bound
14624 is set by this option.
14625 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
14626 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
14627 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
14628
14629 @item -print-file-name=@var{library}
14630 @opindex print-file-name
14631 Print the full absolute name of the library file @var{library} that
14632 would be used when linking---and don't do anything else. With this
14633 option, GCC does not compile or link anything; it just prints the
14634 file name.
14635
14636 @item -print-multi-directory
14637 @opindex print-multi-directory
14638 Print the directory name corresponding to the multilib selected by any
14639 other switches present in the command line. This directory is supposed
14640 to exist in @env{GCC_EXEC_PREFIX}.
14641
14642 @item -print-multi-lib
14643 @opindex print-multi-lib
14644 Print the mapping from multilib directory names to compiler switches
14645 that enable them. The directory name is separated from the switches by
14646 @samp{;}, and each switch starts with an @samp{@@} instead of the
14647 @samp{-}, without spaces between multiple switches. This is supposed to
14648 ease shell processing.
14649
14650 @item -print-multi-os-directory
14651 @opindex print-multi-os-directory
14652 Print the path to OS libraries for the selected
14653 multilib, relative to some @file{lib} subdirectory. If OS libraries are
14654 present in the @file{lib} subdirectory and no multilibs are used, this is
14655 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
14656 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
14657 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
14658 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
14659
14660 @item -print-multiarch
14661 @opindex print-multiarch
14662 Print the path to OS libraries for the selected multiarch,
14663 relative to some @file{lib} subdirectory.
14664
14665 @item -print-prog-name=@var{program}
14666 @opindex print-prog-name
14667 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
14668
14669 @item -print-libgcc-file-name
14670 @opindex print-libgcc-file-name
14671 Same as @option{-print-file-name=libgcc.a}.
14672
14673 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
14674 but you do want to link with @file{libgcc.a}. You can do:
14675
14676 @smallexample
14677 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
14678 @end smallexample
14679
14680 @item -print-search-dirs
14681 @opindex print-search-dirs
14682 Print the name of the configured installation directory and a list of
14683 program and library directories @command{gcc} searches---and don't do anything else.
14684
14685 This is useful when @command{gcc} prints the error message
14686 @samp{installation problem, cannot exec cpp0: No such file or directory}.
14687 To resolve this you either need to put @file{cpp0} and the other compiler
14688 components where @command{gcc} expects to find them, or you can set the environment
14689 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
14690 Don't forget the trailing @samp{/}.
14691 @xref{Environment Variables}.
14692
14693 @item -print-sysroot
14694 @opindex print-sysroot
14695 Print the target sysroot directory that is used during
14696 compilation. This is the target sysroot specified either at configure
14697 time or using the @option{--sysroot} option, possibly with an extra
14698 suffix that depends on compilation options. If no target sysroot is
14699 specified, the option prints nothing.
14700
14701 @item -print-sysroot-headers-suffix
14702 @opindex print-sysroot-headers-suffix
14703 Print the suffix added to the target sysroot when searching for
14704 headers, or give an error if the compiler is not configured with such
14705 a suffix---and don't do anything else.
14706
14707 @item -dumpmachine
14708 @opindex dumpmachine
14709 Print the compiler's target machine (for example,
14710 @samp{i686-pc-linux-gnu})---and don't do anything else.
14711
14712 @item -dumpversion
14713 @opindex dumpversion
14714 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
14715 anything else. This is the compiler version used in filesystem paths,
14716 specs, can be depending on how the compiler has been configured just
14717 a single number (major version), two numbers separated by dot (major and
14718 minor version) or three numbers separated by dots (major, minor and patchlevel
14719 version).
14720
14721 @item -dumpfullversion
14722 @opindex dumpfullversion
14723 Print the full compiler version, always 3 numbers separated by dots,
14724 major, minor and patchlevel version.
14725
14726 @item -dumpspecs
14727 @opindex dumpspecs
14728 Print the compiler's built-in specs---and don't do anything else. (This
14729 is used when GCC itself is being built.) @xref{Spec Files}.
14730 @end table
14731
14732 @node Submodel Options
14733 @section Machine-Dependent Options
14734 @cindex submodel options
14735 @cindex specifying hardware config
14736 @cindex hardware models and configurations, specifying
14737 @cindex target-dependent options
14738 @cindex machine-dependent options
14739
14740 Each target machine supported by GCC can have its own options---for
14741 example, to allow you to compile for a particular processor variant or
14742 ABI, or to control optimizations specific to that machine. By
14743 convention, the names of machine-specific options start with
14744 @samp{-m}.
14745
14746 Some configurations of the compiler also support additional target-specific
14747 options, usually for compatibility with other compilers on the same
14748 platform.
14749
14750 @c This list is ordered alphanumerically by subsection name.
14751 @c It should be the same order and spelling as these options are listed
14752 @c in Machine Dependent Options
14753
14754 @menu
14755 * AArch64 Options::
14756 * Adapteva Epiphany Options::
14757 * ARC Options::
14758 * ARM Options::
14759 * AVR Options::
14760 * Blackfin Options::
14761 * C6X Options::
14762 * CRIS Options::
14763 * CR16 Options::
14764 * C-SKY Options::
14765 * Darwin Options::
14766 * DEC Alpha Options::
14767 * FR30 Options::
14768 * FT32 Options::
14769 * FRV Options::
14770 * GNU/Linux Options::
14771 * H8/300 Options::
14772 * HPPA Options::
14773 * IA-64 Options::
14774 * LM32 Options::
14775 * M32C Options::
14776 * M32R/D Options::
14777 * M680x0 Options::
14778 * MCore Options::
14779 * MeP Options::
14780 * MicroBlaze Options::
14781 * MIPS Options::
14782 * MMIX Options::
14783 * MN10300 Options::
14784 * Moxie Options::
14785 * MSP430 Options::
14786 * NDS32 Options::
14787 * Nios II Options::
14788 * Nvidia PTX Options::
14789 * PDP-11 Options::
14790 * picoChip Options::
14791 * PowerPC Options::
14792 * PowerPC SPE Options::
14793 * RISC-V Options::
14794 * RL78 Options::
14795 * RS/6000 and PowerPC Options::
14796 * RX Options::
14797 * S/390 and zSeries Options::
14798 * Score Options::
14799 * SH Options::
14800 * Solaris 2 Options::
14801 * SPARC Options::
14802 * SPU Options::
14803 * System V Options::
14804 * TILE-Gx Options::
14805 * TILEPro Options::
14806 * V850 Options::
14807 * VAX Options::
14808 * Visium Options::
14809 * VMS Options::
14810 * VxWorks Options::
14811 * x86 Options::
14812 * x86 Windows Options::
14813 * Xstormy16 Options::
14814 * Xtensa Options::
14815 * zSeries Options::
14816 @end menu
14817
14818 @node AArch64 Options
14819 @subsection AArch64 Options
14820 @cindex AArch64 Options
14821
14822 These options are defined for AArch64 implementations:
14823
14824 @table @gcctabopt
14825
14826 @item -mabi=@var{name}
14827 @opindex mabi
14828 Generate code for the specified data model. Permissible values
14829 are @samp{ilp32} for SysV-like data model where int, long int and pointers
14830 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
14831 but long int and pointers are 64 bits.
14832
14833 The default depends on the specific target configuration. Note that
14834 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
14835 entire program with the same ABI, and link with a compatible set of libraries.
14836
14837 @item -mbig-endian
14838 @opindex mbig-endian
14839 Generate big-endian code. This is the default when GCC is configured for an
14840 @samp{aarch64_be-*-*} target.
14841
14842 @item -mgeneral-regs-only
14843 @opindex mgeneral-regs-only
14844 Generate code which uses only the general-purpose registers. This will prevent
14845 the compiler from using floating-point and Advanced SIMD registers but will not
14846 impose any restrictions on the assembler.
14847
14848 @item -mlittle-endian
14849 @opindex mlittle-endian
14850 Generate little-endian code. This is the default when GCC is configured for an
14851 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
14852
14853 @item -mcmodel=tiny
14854 @opindex mcmodel=tiny
14855 Generate code for the tiny code model. The program and its statically defined
14856 symbols must be within 1MB of each other. Programs can be statically or
14857 dynamically linked.
14858
14859 @item -mcmodel=small
14860 @opindex mcmodel=small
14861 Generate code for the small code model. The program and its statically defined
14862 symbols must be within 4GB of each other. Programs can be statically or
14863 dynamically linked. This is the default code model.
14864
14865 @item -mcmodel=large
14866 @opindex mcmodel=large
14867 Generate code for the large code model. This makes no assumptions about
14868 addresses and sizes of sections. Programs can be statically linked only.
14869
14870 @item -mstrict-align
14871 @itemx -mno-strict-align
14872 @opindex mstrict-align
14873 @opindex mno-strict-align
14874 Avoid or allow generating memory accesses that may not be aligned on a natural
14875 object boundary as described in the architecture specification.
14876
14877 @item -momit-leaf-frame-pointer
14878 @itemx -mno-omit-leaf-frame-pointer
14879 @opindex momit-leaf-frame-pointer
14880 @opindex mno-omit-leaf-frame-pointer
14881 Omit or keep the frame pointer in leaf functions. The former behavior is the
14882 default.
14883
14884 @item -mtls-dialect=desc
14885 @opindex mtls-dialect=desc
14886 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
14887 of TLS variables. This is the default.
14888
14889 @item -mtls-dialect=traditional
14890 @opindex mtls-dialect=traditional
14891 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
14892 of TLS variables.
14893
14894 @item -mtls-size=@var{size}
14895 @opindex mtls-size
14896 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
14897 This option requires binutils 2.26 or newer.
14898
14899 @item -mfix-cortex-a53-835769
14900 @itemx -mno-fix-cortex-a53-835769
14901 @opindex mfix-cortex-a53-835769
14902 @opindex mno-fix-cortex-a53-835769
14903 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
14904 This involves inserting a NOP instruction between memory instructions and
14905 64-bit integer multiply-accumulate instructions.
14906
14907 @item -mfix-cortex-a53-843419
14908 @itemx -mno-fix-cortex-a53-843419
14909 @opindex mfix-cortex-a53-843419
14910 @opindex mno-fix-cortex-a53-843419
14911 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
14912 This erratum workaround is made at link time and this will only pass the
14913 corresponding flag to the linker.
14914
14915 @item -mlow-precision-recip-sqrt
14916 @itemx -mno-low-precision-recip-sqrt
14917 @opindex mlow-precision-recip-sqrt
14918 @opindex mno-low-precision-recip-sqrt
14919 Enable or disable the reciprocal square root approximation.
14920 This option only has an effect if @option{-ffast-math} or
14921 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14922 precision of reciprocal square root results to about 16 bits for
14923 single precision and to 32 bits for double precision.
14924
14925 @item -mlow-precision-sqrt
14926 @itemx -mno-low-precision-sqrt
14927 @opindex -mlow-precision-sqrt
14928 @opindex -mno-low-precision-sqrt
14929 Enable or disable the square root approximation.
14930 This option only has an effect if @option{-ffast-math} or
14931 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14932 precision of square root results to about 16 bits for
14933 single precision and to 32 bits for double precision.
14934 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
14935
14936 @item -mlow-precision-div
14937 @itemx -mno-low-precision-div
14938 @opindex -mlow-precision-div
14939 @opindex -mno-low-precision-div
14940 Enable or disable the division approximation.
14941 This option only has an effect if @option{-ffast-math} or
14942 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
14943 precision of division results to about 16 bits for
14944 single precision and to 32 bits for double precision.
14945
14946 @item -mtrack-speculation
14947 @itemx -mno-track-speculation
14948 Enable or disable generation of additional code to track speculative
14949 execution through conditional branches. The tracking state can then
14950 be used by the compiler when expanding calls to
14951 @code{__builtin_speculation_safe_copy} to permit a more efficient code
14952 sequence to be generated.
14953
14954 @item -march=@var{name}
14955 @opindex march
14956 Specify the name of the target architecture and, optionally, one or
14957 more feature modifiers. This option has the form
14958 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
14959
14960 The permissible values for @var{arch} are @samp{armv8-a},
14961 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a} or @samp{armv8.4-a}
14962 or @var{native}.
14963
14964 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
14965 support for the ARMv8.4-A architecture extensions.
14966
14967 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
14968 support for the ARMv8.3-A architecture extensions.
14969
14970 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
14971 support for the ARMv8.2-A architecture extensions.
14972
14973 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
14974 support for the ARMv8.1-A architecture extension. In particular, it
14975 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
14976
14977 The value @samp{native} is available on native AArch64 GNU/Linux and
14978 causes the compiler to pick the architecture of the host system. This
14979 option has no effect if the compiler is unable to recognize the
14980 architecture of the host system,
14981
14982 The permissible values for @var{feature} are listed in the sub-section
14983 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
14984 Feature Modifiers}. Where conflicting feature modifiers are
14985 specified, the right-most feature is used.
14986
14987 GCC uses @var{name} to determine what kind of instructions it can emit
14988 when generating assembly code. If @option{-march} is specified
14989 without either of @option{-mtune} or @option{-mcpu} also being
14990 specified, the code is tuned to perform well across a range of target
14991 processors implementing the target architecture.
14992
14993 @item -mtune=@var{name}
14994 @opindex mtune
14995 Specify the name of the target processor for which GCC should tune the
14996 performance of the code. Permissible values for this option are:
14997 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
14998 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
14999 @samp{cortex-a76}, @samp{exynos-m1}, @samp{falkor}, @samp{qdf24xx},
15000 @samp{saphira}, @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
15001 @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
15002 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
15003 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
15004 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
15005 @samp{cortex-a76.cortex-a55}
15006 @samp{native}.
15007
15008 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15009 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15010 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15011 should tune for a big.LITTLE system.
15012
15013 Additionally on native AArch64 GNU/Linux systems the value
15014 @samp{native} tunes performance to the host system. This option has no effect
15015 if the compiler is unable to recognize the processor of the host system.
15016
15017 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15018 are specified, the code is tuned to perform well across a range
15019 of target processors.
15020
15021 This option cannot be suffixed by feature modifiers.
15022
15023 @item -mcpu=@var{name}
15024 @opindex mcpu
15025 Specify the name of the target processor, optionally suffixed by one
15026 or more feature modifiers. This option has the form
15027 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15028 the permissible values for @var{cpu} are the same as those available
15029 for @option{-mtune}. The permissible values for @var{feature} are
15030 documented in the sub-section on
15031 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15032 Feature Modifiers}. Where conflicting feature modifiers are
15033 specified, the right-most feature is used.
15034
15035 GCC uses @var{name} to determine what kind of instructions it can emit when
15036 generating assembly code (as if by @option{-march}) and to determine
15037 the target processor for which to tune for performance (as if
15038 by @option{-mtune}). Where this option is used in conjunction
15039 with @option{-march} or @option{-mtune}, those options take precedence
15040 over the appropriate part of this option.
15041
15042 @item -moverride=@var{string}
15043 @opindex moverride
15044 Override tuning decisions made by the back-end in response to a
15045 @option{-mtune=} switch. The syntax, semantics, and accepted values
15046 for @var{string} in this option are not guaranteed to be consistent
15047 across releases.
15048
15049 This option is only intended to be useful when developing GCC.
15050
15051 @item -mverbose-cost-dump
15052 @opindex mverbose-cost-dump
15053 Enable verbose cost model dumping in the debug dump files. This option is
15054 provided for use in debugging the compiler.
15055
15056 @item -mpc-relative-literal-loads
15057 @itemx -mno-pc-relative-literal-loads
15058 @opindex mpc-relative-literal-loads
15059 @opindex mno-pc-relative-literal-loads
15060 Enable or disable PC-relative literal loads. With this option literal pools are
15061 accessed using a single instruction and emitted after each function. This
15062 limits the maximum size of functions to 1MB. This is enabled by default for
15063 @option{-mcmodel=tiny}.
15064
15065 @item -msign-return-address=@var{scope}
15066 @opindex msign-return-address
15067 Select the function scope on which return address signing will be applied.
15068 Permissible values are @samp{none}, which disables return address signing,
15069 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
15070 functions, and @samp{all}, which enables pointer signing for all functions. The
15071 default value is @samp{none}.
15072
15073 @item -msve-vector-bits=@var{bits}
15074 @opindex msve-vector-bits
15075 Specify the number of bits in an SVE vector register. This option only has
15076 an effect when SVE is enabled.
15077
15078 GCC supports two forms of SVE code generation: ``vector-length
15079 agnostic'' output that works with any size of vector register and
15080 ``vector-length specific'' output that only works when the vector
15081 registers are a particular size. Replacing @var{bits} with
15082 @samp{scalable} selects vector-length agnostic output while
15083 replacing it with a number selects vector-length specific output.
15084 The possible lengths in the latter case are: 128, 256, 512, 1024
15085 and 2048. @samp{scalable} is the default.
15086
15087 At present, @samp{-msve-vector-bits=128} produces the same output
15088 as @samp{-msve-vector-bits=scalable}.
15089
15090 @end table
15091
15092 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
15093 @anchor{aarch64-feature-modifiers}
15094 @cindex @option{-march} feature modifiers
15095 @cindex @option{-mcpu} feature modifiers
15096 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
15097 the following and their inverses @option{no@var{feature}}:
15098
15099 @table @samp
15100 @item crc
15101 Enable CRC extension. This is on by default for
15102 @option{-march=armv8.1-a}.
15103 @item crypto
15104 Enable Crypto extension. This also enables Advanced SIMD and floating-point
15105 instructions.
15106 @item fp
15107 Enable floating-point instructions. This is on by default for all possible
15108 values for options @option{-march} and @option{-mcpu}.
15109 @item simd
15110 Enable Advanced SIMD instructions. This also enables floating-point
15111 instructions. This is on by default for all possible values for options
15112 @option{-march} and @option{-mcpu}.
15113 @item sve
15114 Enable Scalable Vector Extension instructions. This also enables Advanced
15115 SIMD and floating-point instructions.
15116 @item lse
15117 Enable Large System Extension instructions. This is on by default for
15118 @option{-march=armv8.1-a}.
15119 @item rdma
15120 Enable Round Double Multiply Accumulate instructions. This is on by default
15121 for @option{-march=armv8.1-a}.
15122 @item fp16
15123 Enable FP16 extension. This also enables floating-point instructions.
15124 @item fp16fml
15125 Enable FP16 fmla extension. This also enables FP16 extensions and
15126 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.
15127
15128 @item rcpc
15129 Enable the RcPc extension. This does not change code generation from GCC,
15130 but is passed on to the assembler, enabling inline asm statements to use
15131 instructions from the RcPc extension.
15132 @item dotprod
15133 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
15134 @item aes
15135 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
15136 SIMD instructions.
15137 @item sha2
15138 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
15139 @item sha3
15140 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
15141 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
15142 @item sm4
15143 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
15144 Use of this option with architectures prior to Armv8.2-A is not supported.
15145 @item profile
15146 Enable the Statistical Profiling extension. This option is only to enable the
15147 extension at the assembler level and does not affect code generation.
15148
15149 @end table
15150
15151 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
15152 which implies @option{fp}.
15153 Conversely, @option{nofp} implies @option{nosimd}, which implies
15154 @option{nocrypto}, @option{noaes} and @option{nosha2}.
15155
15156 @node Adapteva Epiphany Options
15157 @subsection Adapteva Epiphany Options
15158
15159 These @samp{-m} options are defined for Adapteva Epiphany:
15160
15161 @table @gcctabopt
15162 @item -mhalf-reg-file
15163 @opindex mhalf-reg-file
15164 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
15165 That allows code to run on hardware variants that lack these registers.
15166
15167 @item -mprefer-short-insn-regs
15168 @opindex mprefer-short-insn-regs
15169 Preferentially allocate registers that allow short instruction generation.
15170 This can result in increased instruction count, so this may either reduce or
15171 increase overall code size.
15172
15173 @item -mbranch-cost=@var{num}
15174 @opindex mbranch-cost
15175 Set the cost of branches to roughly @var{num} ``simple'' instructions.
15176 This cost is only a heuristic and is not guaranteed to produce
15177 consistent results across releases.
15178
15179 @item -mcmove
15180 @opindex mcmove
15181 Enable the generation of conditional moves.
15182
15183 @item -mnops=@var{num}
15184 @opindex mnops
15185 Emit @var{num} NOPs before every other generated instruction.
15186
15187 @item -mno-soft-cmpsf
15188 @opindex mno-soft-cmpsf
15189 For single-precision floating-point comparisons, emit an @code{fsub} instruction
15190 and test the flags. This is faster than a software comparison, but can
15191 get incorrect results in the presence of NaNs, or when two different small
15192 numbers are compared such that their difference is calculated as zero.
15193 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
15194 software comparisons.
15195
15196 @item -mstack-offset=@var{num}
15197 @opindex mstack-offset
15198 Set the offset between the top of the stack and the stack pointer.
15199 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
15200 can be used by leaf functions without stack allocation.
15201 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
15202 Note also that this option changes the ABI; compiling a program with a
15203 different stack offset than the libraries have been compiled with
15204 generally does not work.
15205 This option can be useful if you want to evaluate if a different stack
15206 offset would give you better code, but to actually use a different stack
15207 offset to build working programs, it is recommended to configure the
15208 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
15209
15210 @item -mno-round-nearest
15211 @opindex mno-round-nearest
15212 Make the scheduler assume that the rounding mode has been set to
15213 truncating. The default is @option{-mround-nearest}.
15214
15215 @item -mlong-calls
15216 @opindex mlong-calls
15217 If not otherwise specified by an attribute, assume all calls might be beyond
15218 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
15219 function address into a register before performing a (otherwise direct) call.
15220 This is the default.
15221
15222 @item -mshort-calls
15223 @opindex short-calls
15224 If not otherwise specified by an attribute, assume all direct calls are
15225 in the range of the @code{b} / @code{bl} instructions, so use these instructions
15226 for direct calls. The default is @option{-mlong-calls}.
15227
15228 @item -msmall16
15229 @opindex msmall16
15230 Assume addresses can be loaded as 16-bit unsigned values. This does not
15231 apply to function addresses for which @option{-mlong-calls} semantics
15232 are in effect.
15233
15234 @item -mfp-mode=@var{mode}
15235 @opindex mfp-mode
15236 Set the prevailing mode of the floating-point unit.
15237 This determines the floating-point mode that is provided and expected
15238 at function call and return time. Making this mode match the mode you
15239 predominantly need at function start can make your programs smaller and
15240 faster by avoiding unnecessary mode switches.
15241
15242 @var{mode} can be set to one the following values:
15243
15244 @table @samp
15245 @item caller
15246 Any mode at function entry is valid, and retained or restored when
15247 the function returns, and when it calls other functions.
15248 This mode is useful for compiling libraries or other compilation units
15249 you might want to incorporate into different programs with different
15250 prevailing FPU modes, and the convenience of being able to use a single
15251 object file outweighs the size and speed overhead for any extra
15252 mode switching that might be needed, compared with what would be needed
15253 with a more specific choice of prevailing FPU mode.
15254
15255 @item truncate
15256 This is the mode used for floating-point calculations with
15257 truncating (i.e.@: round towards zero) rounding mode. That includes
15258 conversion from floating point to integer.
15259
15260 @item round-nearest
15261 This is the mode used for floating-point calculations with
15262 round-to-nearest-or-even rounding mode.
15263
15264 @item int
15265 This is the mode used to perform integer calculations in the FPU, e.g.@:
15266 integer multiply, or integer multiply-and-accumulate.
15267 @end table
15268
15269 The default is @option{-mfp-mode=caller}
15270
15271 @item -mnosplit-lohi
15272 @itemx -mno-postinc
15273 @itemx -mno-postmodify
15274 @opindex mnosplit-lohi
15275 @opindex mno-postinc
15276 @opindex mno-postmodify
15277 Code generation tweaks that disable, respectively, splitting of 32-bit
15278 loads, generation of post-increment addresses, and generation of
15279 post-modify addresses. The defaults are @option{msplit-lohi},
15280 @option{-mpost-inc}, and @option{-mpost-modify}.
15281
15282 @item -mnovect-double
15283 @opindex mno-vect-double
15284 Change the preferred SIMD mode to SImode. The default is
15285 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
15286
15287 @item -max-vect-align=@var{num}
15288 @opindex max-vect-align
15289 The maximum alignment for SIMD vector mode types.
15290 @var{num} may be 4 or 8. The default is 8.
15291 Note that this is an ABI change, even though many library function
15292 interfaces are unaffected if they don't use SIMD vector modes
15293 in places that affect size and/or alignment of relevant types.
15294
15295 @item -msplit-vecmove-early
15296 @opindex msplit-vecmove-early
15297 Split vector moves into single word moves before reload. In theory this
15298 can give better register allocation, but so far the reverse seems to be
15299 generally the case.
15300
15301 @item -m1reg-@var{reg}
15302 @opindex m1reg-
15303 Specify a register to hold the constant @minus{}1, which makes loading small negative
15304 constants and certain bitmasks faster.
15305 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
15306 which specify use of that register as a fixed register,
15307 and @samp{none}, which means that no register is used for this
15308 purpose. The default is @option{-m1reg-none}.
15309
15310 @end table
15311
15312 @node ARC Options
15313 @subsection ARC Options
15314 @cindex ARC options
15315
15316 The following options control the architecture variant for which code
15317 is being compiled:
15318
15319 @c architecture variants
15320 @table @gcctabopt
15321
15322 @item -mbarrel-shifter
15323 @opindex mbarrel-shifter
15324 Generate instructions supported by barrel shifter. This is the default
15325 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
15326
15327 @item -mjli-always
15328 @opindex mjli-alawys
15329 Force to call a function using jli_s instruction. This option is
15330 valid only for ARCv2 architecture.
15331
15332 @item -mcpu=@var{cpu}
15333 @opindex mcpu
15334 Set architecture type, register usage, and instruction scheduling
15335 parameters for @var{cpu}. There are also shortcut alias options
15336 available for backward compatibility and convenience. Supported
15337 values for @var{cpu} are
15338
15339 @table @samp
15340 @opindex mA6
15341 @opindex mARC600
15342 @item arc600
15343 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
15344
15345 @item arc601
15346 @opindex mARC601
15347 Compile for ARC601. Alias: @option{-mARC601}.
15348
15349 @item arc700
15350 @opindex mA7
15351 @opindex mARC700
15352 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
15353 This is the default when configured with @option{--with-cpu=arc700}@.
15354
15355 @item arcem
15356 Compile for ARC EM.
15357
15358 @item archs
15359 Compile for ARC HS.
15360
15361 @item em
15362 Compile for ARC EM CPU with no hardware extensions.
15363
15364 @item em4
15365 Compile for ARC EM4 CPU.
15366
15367 @item em4_dmips
15368 Compile for ARC EM4 DMIPS CPU.
15369
15370 @item em4_fpus
15371 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
15372 extension.
15373
15374 @item em4_fpuda
15375 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
15376 double assist instructions.
15377
15378 @item hs
15379 Compile for ARC HS CPU with no hardware extensions except the atomic
15380 instructions.
15381
15382 @item hs34
15383 Compile for ARC HS34 CPU.
15384
15385 @item hs38
15386 Compile for ARC HS38 CPU.
15387
15388 @item hs38_linux
15389 Compile for ARC HS38 CPU with all hardware extensions on.
15390
15391 @item arc600_norm
15392 Compile for ARC 600 CPU with @code{norm} instructions enabled.
15393
15394 @item arc600_mul32x16
15395 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
15396 instructions enabled.
15397
15398 @item arc600_mul64
15399 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
15400 instructions enabled.
15401
15402 @item arc601_norm
15403 Compile for ARC 601 CPU with @code{norm} instructions enabled.
15404
15405 @item arc601_mul32x16
15406 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
15407 instructions enabled.
15408
15409 @item arc601_mul64
15410 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
15411 instructions enabled.
15412
15413 @item nps400
15414 Compile for ARC 700 on NPS400 chip.
15415
15416 @item em_mini
15417 Compile for ARC EM minimalist configuration featuring reduced register
15418 set.
15419
15420 @end table
15421
15422 @item -mdpfp
15423 @opindex mdpfp
15424 @itemx -mdpfp-compact
15425 @opindex mdpfp-compact
15426 Generate double-precision FPX instructions, tuned for the compact
15427 implementation.
15428
15429 @item -mdpfp-fast
15430 @opindex mdpfp-fast
15431 Generate double-precision FPX instructions, tuned for the fast
15432 implementation.
15433
15434 @item -mno-dpfp-lrsr
15435 @opindex mno-dpfp-lrsr
15436 Disable @code{lr} and @code{sr} instructions from using FPX extension
15437 aux registers.
15438
15439 @item -mea
15440 @opindex mea
15441 Generate extended arithmetic instructions. Currently only
15442 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
15443 supported. This is always enabled for @option{-mcpu=ARC700}.
15444
15445 @item -mno-mpy
15446 @opindex mno-mpy
15447 Do not generate @code{mpy}-family instructions for ARC700. This option is
15448 deprecated.
15449
15450 @item -mmul32x16
15451 @opindex mmul32x16
15452 Generate 32x16-bit multiply and multiply-accumulate instructions.
15453
15454 @item -mmul64
15455 @opindex mmul64
15456 Generate @code{mul64} and @code{mulu64} instructions.
15457 Only valid for @option{-mcpu=ARC600}.
15458
15459 @item -mnorm
15460 @opindex mnorm
15461 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
15462 is in effect.
15463
15464 @item -mspfp
15465 @opindex mspfp
15466 @itemx -mspfp-compact
15467 @opindex mspfp-compact
15468 Generate single-precision FPX instructions, tuned for the compact
15469 implementation.
15470
15471 @item -mspfp-fast
15472 @opindex mspfp-fast
15473 Generate single-precision FPX instructions, tuned for the fast
15474 implementation.
15475
15476 @item -msimd
15477 @opindex msimd
15478 Enable generation of ARC SIMD instructions via target-specific
15479 builtins. Only valid for @option{-mcpu=ARC700}.
15480
15481 @item -msoft-float
15482 @opindex msoft-float
15483 This option ignored; it is provided for compatibility purposes only.
15484 Software floating-point code is emitted by default, and this default
15485 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
15486 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
15487 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
15488
15489 @item -mswap
15490 @opindex mswap
15491 Generate @code{swap} instructions.
15492
15493 @item -matomic
15494 @opindex matomic
15495 This enables use of the locked load/store conditional extension to implement
15496 atomic memory built-in functions. Not available for ARC 6xx or ARC
15497 EM cores.
15498
15499 @item -mdiv-rem
15500 @opindex mdiv-rem
15501 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
15502
15503 @item -mcode-density
15504 @opindex mcode-density
15505 Enable code density instructions for ARC EM.
15506 This option is on by default for ARC HS.
15507
15508 @item -mll64
15509 @opindex mll64
15510 Enable double load/store operations for ARC HS cores.
15511
15512 @item -mtp-regno=@var{regno}
15513 @opindex mtp-regno
15514 Specify thread pointer register number.
15515
15516 @item -mmpy-option=@var{multo}
15517 @opindex mmpy-option
15518 Compile ARCv2 code with a multiplier design option. You can specify
15519 the option using either a string or numeric value for @var{multo}.
15520 @samp{wlh1} is the default value. The recognized values are:
15521
15522 @table @samp
15523 @item 0
15524 @itemx none
15525 No multiplier available.
15526
15527 @item 1
15528 @itemx w
15529 16x16 multiplier, fully pipelined.
15530 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
15531
15532 @item 2
15533 @itemx wlh1
15534 32x32 multiplier, fully
15535 pipelined (1 stage). The following instructions are additionally
15536 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15537
15538 @item 3
15539 @itemx wlh2
15540 32x32 multiplier, fully pipelined
15541 (2 stages). The following instructions are additionally enabled: @code{mpy},
15542 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15543
15544 @item 4
15545 @itemx wlh3
15546 Two 16x16 multipliers, blocking,
15547 sequential. The following instructions are additionally enabled: @code{mpy},
15548 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15549
15550 @item 5
15551 @itemx wlh4
15552 One 16x16 multiplier, blocking,
15553 sequential. The following instructions are additionally enabled: @code{mpy},
15554 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15555
15556 @item 6
15557 @itemx wlh5
15558 One 32x4 multiplier, blocking,
15559 sequential. The following instructions are additionally enabled: @code{mpy},
15560 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
15561
15562 @item 7
15563 @itemx plus_dmpy
15564 ARC HS SIMD support.
15565
15566 @item 8
15567 @itemx plus_macd
15568 ARC HS SIMD support.
15569
15570 @item 9
15571 @itemx plus_qmacw
15572 ARC HS SIMD support.
15573
15574 @end table
15575
15576 This option is only available for ARCv2 cores@.
15577
15578 @item -mfpu=@var{fpu}
15579 @opindex mfpu
15580 Enables support for specific floating-point hardware extensions for ARCv2
15581 cores. Supported values for @var{fpu} are:
15582
15583 @table @samp
15584
15585 @item fpus
15586 Enables support for single-precision floating-point hardware
15587 extensions@.
15588
15589 @item fpud
15590 Enables support for double-precision floating-point hardware
15591 extensions. The single-precision floating-point extension is also
15592 enabled. Not available for ARC EM@.
15593
15594 @item fpuda
15595 Enables support for double-precision floating-point hardware
15596 extensions using double-precision assist instructions. The single-precision
15597 floating-point extension is also enabled. This option is
15598 only available for ARC EM@.
15599
15600 @item fpuda_div
15601 Enables support for double-precision floating-point hardware
15602 extensions using double-precision assist instructions.
15603 The single-precision floating-point, square-root, and divide
15604 extensions are also enabled. This option is
15605 only available for ARC EM@.
15606
15607 @item fpuda_fma
15608 Enables support for double-precision floating-point hardware
15609 extensions using double-precision assist instructions.
15610 The single-precision floating-point and fused multiply and add
15611 hardware extensions are also enabled. This option is
15612 only available for ARC EM@.
15613
15614 @item fpuda_all
15615 Enables support for double-precision floating-point hardware
15616 extensions using double-precision assist instructions.
15617 All single-precision floating-point hardware extensions are also
15618 enabled. This option is only available for ARC EM@.
15619
15620 @item fpus_div
15621 Enables support for single-precision floating-point, square-root and divide
15622 hardware extensions@.
15623
15624 @item fpud_div
15625 Enables support for double-precision floating-point, square-root and divide
15626 hardware extensions. This option
15627 includes option @samp{fpus_div}. Not available for ARC EM@.
15628
15629 @item fpus_fma
15630 Enables support for single-precision floating-point and
15631 fused multiply and add hardware extensions@.
15632
15633 @item fpud_fma
15634 Enables support for double-precision floating-point and
15635 fused multiply and add hardware extensions. This option
15636 includes option @samp{fpus_fma}. Not available for ARC EM@.
15637
15638 @item fpus_all
15639 Enables support for all single-precision floating-point hardware
15640 extensions@.
15641
15642 @item fpud_all
15643 Enables support for all single- and double-precision floating-point
15644 hardware extensions. Not available for ARC EM@.
15645
15646 @end table
15647
15648 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
15649 @opindex mirq-ctrl-saved
15650 Specifies general-purposes registers that the processor automatically
15651 saves/restores on interrupt entry and exit. @var{register-range} is
15652 specified as two registers separated by a dash. The register range
15653 always starts with @code{r0}, the upper limit is @code{fp} register.
15654 @var{blink} and @var{lp_count} are optional. This option is only
15655 valid for ARC EM and ARC HS cores.
15656
15657 @item -mrgf-banked-regs=@var{number}
15658 @opindex mrgf-banked-regs
15659 Specifies the number of registers replicated in second register bank
15660 on entry to fast interrupt. Fast interrupts are interrupts with the
15661 highest priority level P0. These interrupts save only PC and STATUS32
15662 registers to avoid memory transactions during interrupt entry and exit
15663 sequences. Use this option when you are using fast interrupts in an
15664 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
15665
15666 @item -mlpc-width=@var{width}
15667 @opindex mlpc-width
15668 Specify the width of the @code{lp_count} register. Valid values for
15669 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
15670 fixed to 32 bits. If the width is less than 32, the compiler does not
15671 attempt to transform loops in your program to use the zero-delay loop
15672 mechanism unless it is known that the @code{lp_count} register can
15673 hold the required loop-counter value. Depending on the width
15674 specified, the compiler and run-time library might continue to use the
15675 loop mechanism for various needs. This option defines macro
15676 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
15677
15678 @item -mrf16
15679 @opindex mrf16
15680 This option instructs the compiler to generate code for a 16-entry
15681 register file. This option defines the @code{__ARC_RF16__}
15682 preprocessor macro.
15683
15684 @end table
15685
15686 The following options are passed through to the assembler, and also
15687 define preprocessor macro symbols.
15688
15689 @c Flags used by the assembler, but for which we define preprocessor
15690 @c macro symbols as well.
15691 @table @gcctabopt
15692 @item -mdsp-packa
15693 @opindex mdsp-packa
15694 Passed down to the assembler to enable the DSP Pack A extensions.
15695 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
15696 deprecated.
15697
15698 @item -mdvbf
15699 @opindex mdvbf
15700 Passed down to the assembler to enable the dual Viterbi butterfly
15701 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
15702 option is deprecated.
15703
15704 @c ARC700 4.10 extension instruction
15705 @item -mlock
15706 @opindex mlock
15707 Passed down to the assembler to enable the locked load/store
15708 conditional extension. Also sets the preprocessor symbol
15709 @code{__Xlock}.
15710
15711 @item -mmac-d16
15712 @opindex mmac-d16
15713 Passed down to the assembler. Also sets the preprocessor symbol
15714 @code{__Xxmac_d16}. This option is deprecated.
15715
15716 @item -mmac-24
15717 @opindex mmac-24
15718 Passed down to the assembler. Also sets the preprocessor symbol
15719 @code{__Xxmac_24}. This option is deprecated.
15720
15721 @c ARC700 4.10 extension instruction
15722 @item -mrtsc
15723 @opindex mrtsc
15724 Passed down to the assembler to enable the 64-bit time-stamp counter
15725 extension instruction. Also sets the preprocessor symbol
15726 @code{__Xrtsc}. This option is deprecated.
15727
15728 @c ARC700 4.10 extension instruction
15729 @item -mswape
15730 @opindex mswape
15731 Passed down to the assembler to enable the swap byte ordering
15732 extension instruction. Also sets the preprocessor symbol
15733 @code{__Xswape}.
15734
15735 @item -mtelephony
15736 @opindex mtelephony
15737 Passed down to the assembler to enable dual- and single-operand
15738 instructions for telephony. Also sets the preprocessor symbol
15739 @code{__Xtelephony}. This option is deprecated.
15740
15741 @item -mxy
15742 @opindex mxy
15743 Passed down to the assembler to enable the XY memory extension. Also
15744 sets the preprocessor symbol @code{__Xxy}.
15745
15746 @end table
15747
15748 The following options control how the assembly code is annotated:
15749
15750 @c Assembly annotation options
15751 @table @gcctabopt
15752 @item -misize
15753 @opindex misize
15754 Annotate assembler instructions with estimated addresses.
15755
15756 @item -mannotate-align
15757 @opindex mannotate-align
15758 Explain what alignment considerations lead to the decision to make an
15759 instruction short or long.
15760
15761 @end table
15762
15763 The following options are passed through to the linker:
15764
15765 @c options passed through to the linker
15766 @table @gcctabopt
15767 @item -marclinux
15768 @opindex marclinux
15769 Passed through to the linker, to specify use of the @code{arclinux} emulation.
15770 This option is enabled by default in tool chains built for
15771 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
15772 when profiling is not requested.
15773
15774 @item -marclinux_prof
15775 @opindex marclinux_prof
15776 Passed through to the linker, to specify use of the
15777 @code{arclinux_prof} emulation. This option is enabled by default in
15778 tool chains built for @w{@code{arc-linux-uclibc}} and
15779 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
15780
15781 @end table
15782
15783 The following options control the semantics of generated code:
15784
15785 @c semantically relevant code generation options
15786 @table @gcctabopt
15787 @item -mlong-calls
15788 @opindex mlong-calls
15789 Generate calls as register indirect calls, thus providing access
15790 to the full 32-bit address range.
15791
15792 @item -mmedium-calls
15793 @opindex mmedium-calls
15794 Don't use less than 25-bit addressing range for calls, which is the
15795 offset available for an unconditional branch-and-link
15796 instruction. Conditional execution of function calls is suppressed, to
15797 allow use of the 25-bit range, rather than the 21-bit range with
15798 conditional branch-and-link. This is the default for tool chains built
15799 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
15800
15801 @item -G @var{num}
15802 @opindex G
15803 Put definitions of externally-visible data in a small data section if
15804 that data is no bigger than @var{num} bytes. The default value of
15805 @var{num} is 4 for any ARC configuration, or 8 when we have double
15806 load/store operations.
15807
15808 @item -mno-sdata
15809 @opindex mno-sdata
15810 Do not generate sdata references. This is the default for tool chains
15811 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
15812 targets.
15813
15814 @item -mvolatile-cache
15815 @opindex mvolatile-cache
15816 Use ordinarily cached memory accesses for volatile references. This is the
15817 default.
15818
15819 @item -mno-volatile-cache
15820 @opindex mno-volatile-cache
15821 Enable cache bypass for volatile references.
15822
15823 @end table
15824
15825 The following options fine tune code generation:
15826 @c code generation tuning options
15827 @table @gcctabopt
15828 @item -malign-call
15829 @opindex malign-call
15830 Do alignment optimizations for call instructions.
15831
15832 @item -mauto-modify-reg
15833 @opindex mauto-modify-reg
15834 Enable the use of pre/post modify with register displacement.
15835
15836 @item -mbbit-peephole
15837 @opindex mbbit-peephole
15838 Enable bbit peephole2.
15839
15840 @item -mno-brcc
15841 @opindex mno-brcc
15842 This option disables a target-specific pass in @file{arc_reorg} to
15843 generate compare-and-branch (@code{br@var{cc}}) instructions.
15844 It has no effect on
15845 generation of these instructions driven by the combiner pass.
15846
15847 @item -mcase-vector-pcrel
15848 @opindex mcase-vector-pcrel
15849 Use PC-relative switch case tables to enable case table shortening.
15850 This is the default for @option{-Os}.
15851
15852 @item -mcompact-casesi
15853 @opindex mcompact-casesi
15854 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
15855 and only available for ARCv1 cores.
15856
15857 @item -mno-cond-exec
15858 @opindex mno-cond-exec
15859 Disable the ARCompact-specific pass to generate conditional
15860 execution instructions.
15861
15862 Due to delay slot scheduling and interactions between operand numbers,
15863 literal sizes, instruction lengths, and the support for conditional execution,
15864 the target-independent pass to generate conditional execution is often lacking,
15865 so the ARC port has kept a special pass around that tries to find more
15866 conditional execution generation opportunities after register allocation,
15867 branch shortening, and delay slot scheduling have been done. This pass
15868 generally, but not always, improves performance and code size, at the cost of
15869 extra compilation time, which is why there is an option to switch it off.
15870 If you have a problem with call instructions exceeding their allowable
15871 offset range because they are conditionalized, you should consider using
15872 @option{-mmedium-calls} instead.
15873
15874 @item -mearly-cbranchsi
15875 @opindex mearly-cbranchsi
15876 Enable pre-reload use of the @code{cbranchsi} pattern.
15877
15878 @item -mexpand-adddi
15879 @opindex mexpand-adddi
15880 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
15881 @code{add.f}, @code{adc} etc. This option is deprecated.
15882
15883 @item -mindexed-loads
15884 @opindex mindexed-loads
15885 Enable the use of indexed loads. This can be problematic because some
15886 optimizers then assume that indexed stores exist, which is not
15887 the case.
15888
15889 @item -mlra
15890 @opindex mlra
15891 Enable Local Register Allocation. This is still experimental for ARC,
15892 so by default the compiler uses standard reload
15893 (i.e. @option{-mno-lra}).
15894
15895 @item -mlra-priority-none
15896 @opindex mlra-priority-none
15897 Don't indicate any priority for target registers.
15898
15899 @item -mlra-priority-compact
15900 @opindex mlra-priority-compact
15901 Indicate target register priority for r0..r3 / r12..r15.
15902
15903 @item -mlra-priority-noncompact
15904 @opindex mlra-priority-noncompact
15905 Reduce target register priority for r0..r3 / r12..r15.
15906
15907 @item -mno-millicode
15908 @opindex mno-millicode
15909 When optimizing for size (using @option{-Os}), prologues and epilogues
15910 that have to save or restore a large number of registers are often
15911 shortened by using call to a special function in libgcc; this is
15912 referred to as a @emph{millicode} call. As these calls can pose
15913 performance issues, and/or cause linking issues when linking in a
15914 nonstandard way, this option is provided to turn off millicode call
15915 generation.
15916
15917 @item -mmixed-code
15918 @opindex mmixed-code
15919 Tweak register allocation to help 16-bit instruction generation.
15920 This generally has the effect of decreasing the average instruction size
15921 while increasing the instruction count.
15922
15923 @item -mq-class
15924 @opindex mq-class
15925 Enable @samp{q} instruction alternatives.
15926 This is the default for @option{-Os}.
15927
15928 @item -mRcq
15929 @opindex mRcq
15930 Enable @samp{Rcq} constraint handling.
15931 Most short code generation depends on this.
15932 This is the default.
15933
15934 @item -mRcw
15935 @opindex mRcw
15936 Enable @samp{Rcw} constraint handling.
15937 Most ccfsm condexec mostly depends on this.
15938 This is the default.
15939
15940 @item -msize-level=@var{level}
15941 @opindex msize-level
15942 Fine-tune size optimization with regards to instruction lengths and alignment.
15943 The recognized values for @var{level} are:
15944 @table @samp
15945 @item 0
15946 No size optimization. This level is deprecated and treated like @samp{1}.
15947
15948 @item 1
15949 Short instructions are used opportunistically.
15950
15951 @item 2
15952 In addition, alignment of loops and of code after barriers are dropped.
15953
15954 @item 3
15955 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
15956
15957 @end table
15958
15959 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
15960 the behavior when this is not set is equivalent to level @samp{1}.
15961
15962 @item -mtune=@var{cpu}
15963 @opindex mtune
15964 Set instruction scheduling parameters for @var{cpu}, overriding any implied
15965 by @option{-mcpu=}.
15966
15967 Supported values for @var{cpu} are
15968
15969 @table @samp
15970 @item ARC600
15971 Tune for ARC600 CPU.
15972
15973 @item ARC601
15974 Tune for ARC601 CPU.
15975
15976 @item ARC700
15977 Tune for ARC700 CPU with standard multiplier block.
15978
15979 @item ARC700-xmac
15980 Tune for ARC700 CPU with XMAC block.
15981
15982 @item ARC725D
15983 Tune for ARC725D CPU.
15984
15985 @item ARC750D
15986 Tune for ARC750D CPU.
15987
15988 @end table
15989
15990 @item -mmultcost=@var{num}
15991 @opindex mmultcost
15992 Cost to assume for a multiply instruction, with @samp{4} being equal to a
15993 normal instruction.
15994
15995 @item -munalign-prob-threshold=@var{probability}
15996 @opindex munalign-prob-threshold
15997 Set probability threshold for unaligning branches.
15998 When tuning for @samp{ARC700} and optimizing for speed, branches without
15999 filled delay slot are preferably emitted unaligned and long, unless
16000 profiling indicates that the probability for the branch to be taken
16001 is below @var{probability}. @xref{Cross-profiling}.
16002 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
16003
16004 @end table
16005
16006 The following options are maintained for backward compatibility, but
16007 are now deprecated and will be removed in a future release:
16008
16009 @c Deprecated options
16010 @table @gcctabopt
16011
16012 @item -margonaut
16013 @opindex margonaut
16014 Obsolete FPX.
16015
16016 @item -mbig-endian
16017 @opindex mbig-endian
16018 @itemx -EB
16019 @opindex EB
16020 Compile code for big-endian targets. Use of these options is now
16021 deprecated. Big-endian code is supported by configuring GCC to build
16022 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
16023 for which big endian is the default.
16024
16025 @item -mlittle-endian
16026 @opindex mlittle-endian
16027 @itemx -EL
16028 @opindex EL
16029 Compile code for little-endian targets. Use of these options is now
16030 deprecated. Little-endian code is supported by configuring GCC to build
16031 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
16032 for which little endian is the default.
16033
16034 @item -mbarrel_shifter
16035 @opindex mbarrel_shifter
16036 Replaced by @option{-mbarrel-shifter}.
16037
16038 @item -mdpfp_compact
16039 @opindex mdpfp_compact
16040 Replaced by @option{-mdpfp-compact}.
16041
16042 @item -mdpfp_fast
16043 @opindex mdpfp_fast
16044 Replaced by @option{-mdpfp-fast}.
16045
16046 @item -mdsp_packa
16047 @opindex mdsp_packa
16048 Replaced by @option{-mdsp-packa}.
16049
16050 @item -mEA
16051 @opindex mEA
16052 Replaced by @option{-mea}.
16053
16054 @item -mmac_24
16055 @opindex mmac_24
16056 Replaced by @option{-mmac-24}.
16057
16058 @item -mmac_d16
16059 @opindex mmac_d16
16060 Replaced by @option{-mmac-d16}.
16061
16062 @item -mspfp_compact
16063 @opindex mspfp_compact
16064 Replaced by @option{-mspfp-compact}.
16065
16066 @item -mspfp_fast
16067 @opindex mspfp_fast
16068 Replaced by @option{-mspfp-fast}.
16069
16070 @item -mtune=@var{cpu}
16071 @opindex mtune
16072 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
16073 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
16074 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
16075
16076 @item -multcost=@var{num}
16077 @opindex multcost
16078 Replaced by @option{-mmultcost}.
16079
16080 @end table
16081
16082 @node ARM Options
16083 @subsection ARM Options
16084 @cindex ARM options
16085
16086 These @samp{-m} options are defined for the ARM port:
16087
16088 @table @gcctabopt
16089 @item -mabi=@var{name}
16090 @opindex mabi
16091 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
16092 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
16093
16094 @item -mapcs-frame
16095 @opindex mapcs-frame
16096 Generate a stack frame that is compliant with the ARM Procedure Call
16097 Standard for all functions, even if this is not strictly necessary for
16098 correct execution of the code. Specifying @option{-fomit-frame-pointer}
16099 with this option causes the stack frames not to be generated for
16100 leaf functions. The default is @option{-mno-apcs-frame}.
16101 This option is deprecated.
16102
16103 @item -mapcs
16104 @opindex mapcs
16105 This is a synonym for @option{-mapcs-frame} and is deprecated.
16106
16107 @ignore
16108 @c not currently implemented
16109 @item -mapcs-stack-check
16110 @opindex mapcs-stack-check
16111 Generate code to check the amount of stack space available upon entry to
16112 every function (that actually uses some stack space). If there is
16113 insufficient space available then either the function
16114 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
16115 called, depending upon the amount of stack space required. The runtime
16116 system is required to provide these functions. The default is
16117 @option{-mno-apcs-stack-check}, since this produces smaller code.
16118
16119 @c not currently implemented
16120 @item -mapcs-reentrant
16121 @opindex mapcs-reentrant
16122 Generate reentrant, position-independent code. The default is
16123 @option{-mno-apcs-reentrant}.
16124 @end ignore
16125
16126 @item -mthumb-interwork
16127 @opindex mthumb-interwork
16128 Generate code that supports calling between the ARM and Thumb
16129 instruction sets. Without this option, on pre-v5 architectures, the
16130 two instruction sets cannot be reliably used inside one program. The
16131 default is @option{-mno-thumb-interwork}, since slightly larger code
16132 is generated when @option{-mthumb-interwork} is specified. In AAPCS
16133 configurations this option is meaningless.
16134
16135 @item -mno-sched-prolog
16136 @opindex mno-sched-prolog
16137 Prevent the reordering of instructions in the function prologue, or the
16138 merging of those instruction with the instructions in the function's
16139 body. This means that all functions start with a recognizable set
16140 of instructions (or in fact one of a choice from a small set of
16141 different function prologues), and this information can be used to
16142 locate the start of functions inside an executable piece of code. The
16143 default is @option{-msched-prolog}.
16144
16145 @item -mfloat-abi=@var{name}
16146 @opindex mfloat-abi
16147 Specifies which floating-point ABI to use. Permissible values
16148 are: @samp{soft}, @samp{softfp} and @samp{hard}.
16149
16150 Specifying @samp{soft} causes GCC to generate output containing
16151 library calls for floating-point operations.
16152 @samp{softfp} allows the generation of code using hardware floating-point
16153 instructions, but still uses the soft-float calling conventions.
16154 @samp{hard} allows generation of floating-point instructions
16155 and uses FPU-specific calling conventions.
16156
16157 The default depends on the specific target configuration. Note that
16158 the hard-float and soft-float ABIs are not link-compatible; you must
16159 compile your entire program with the same ABI, and link with a
16160 compatible set of libraries.
16161
16162 @item -mlittle-endian
16163 @opindex mlittle-endian
16164 Generate code for a processor running in little-endian mode. This is
16165 the default for all standard configurations.
16166
16167 @item -mbig-endian
16168 @opindex mbig-endian
16169 Generate code for a processor running in big-endian mode; the default is
16170 to compile code for a little-endian processor.
16171
16172 @item -mbe8
16173 @itemx -mbe32
16174 @opindex mbe8
16175 When linking a big-endian image select between BE8 and BE32 formats.
16176 The option has no effect for little-endian images and is ignored. The
16177 default is dependent on the selected target architecture. For ARMv6
16178 and later architectures the default is BE8, for older architectures
16179 the default is BE32. BE32 format has been deprecated by ARM.
16180
16181 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
16182 @opindex march
16183 This specifies the name of the target ARM architecture. GCC uses this
16184 name to determine what kind of instructions it can emit when generating
16185 assembly code. This option can be used in conjunction with or instead
16186 of the @option{-mcpu=} option.
16187
16188 Permissible names are:
16189 @samp{armv4t},
16190 @samp{armv5t}, @samp{armv5te},
16191 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
16192 @samp{armv6z}, @samp{armv6zk},
16193 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
16194 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
16195 @samp{armv8.4-a},
16196 @samp{armv7-r},
16197 @samp{armv8-r},
16198 @samp{armv6-m}, @samp{armv6s-m},
16199 @samp{armv7-m}, @samp{armv7e-m},
16200 @samp{armv8-m.base}, @samp{armv8-m.main},
16201 @samp{iwmmxt} and @samp{iwmmxt2}.
16202
16203 Additionally, the following architectures, which lack support for the
16204 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
16205
16206 Many of the architectures support extensions. These can be added by
16207 appending @samp{+@var{extension}} to the architecture name. Extension
16208 options are processed in order and capabilities accumulate. An extension
16209 will also enable any necessary base extensions
16210 upon which it depends. For example, the @samp{+crypto} extension
16211 will always enable the @samp{+simd} extension. The exception to the
16212 additive construction is for extensions that are prefixed with
16213 @samp{+no@dots{}}: these extensions disable the specified option and
16214 any other extensions that may depend on the presence of that
16215 extension.
16216
16217 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
16218 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
16219 entirely disabled by the @samp{+nofp} option that follows it.
16220
16221 Most extension names are generically named, but have an effect that is
16222 dependent upon the architecture to which it is applied. For example,
16223 the @samp{+simd} option can be applied to both @samp{armv7-a} and
16224 @samp{armv8-a} architectures, but will enable the original ARMv7-A
16225 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
16226 variant for @samp{armv8-a}.
16227
16228 The table below lists the supported extensions for each architecture.
16229 Architectures not mentioned do not support any extensions.
16230
16231 @table @samp
16232 @item armv5te
16233 @itemx armv6
16234 @itemx armv6j
16235 @itemx armv6k
16236 @itemx armv6kz
16237 @itemx armv6t2
16238 @itemx armv6z
16239 @itemx armv6zk
16240 @table @samp
16241 @item +fp
16242 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
16243 used as an alias for this extension.
16244
16245 @item +nofp
16246 Disable the floating-point instructions.
16247 @end table
16248
16249 @item armv7
16250 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
16251 @table @samp
16252 @item +fp
16253 The VFPv3 floating-point instructions, with 16 double-precision
16254 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16255 for this extension. Note that floating-point is not supported by the
16256 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
16257 ARMv7-R architectures.
16258
16259 @item +nofp
16260 Disable the floating-point instructions.
16261 @end table
16262
16263 @item armv7-a
16264 @table @samp
16265 @item +fp
16266 The VFPv3 floating-point instructions, with 16 double-precision
16267 registers. The extension @samp{+vfpv3-d16} can be used as an alias
16268 for this extension.
16269
16270 @item +simd
16271 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16272 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
16273 for this extension.
16274
16275 @item +vfpv3
16276 The VFPv3 floating-point instructions, with 32 double-precision
16277 registers.
16278
16279 @item +vfpv3-d16-fp16
16280 The VFPv3 floating-point instructions, with 16 double-precision
16281 registers and the half-precision floating-point conversion operations.
16282
16283 @item +vfpv3-fp16
16284 The VFPv3 floating-point instructions, with 32 double-precision
16285 registers and the half-precision floating-point conversion operations.
16286
16287 @item +vfpv4-d16
16288 The VFPv4 floating-point instructions, with 16 double-precision
16289 registers.
16290
16291 @item +vfpv4
16292 The VFPv4 floating-point instructions, with 32 double-precision
16293 registers.
16294
16295 @item +neon-fp16
16296 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16297 the half-precision floating-point conversion operations.
16298
16299 @item +neon-vfpv4
16300 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
16301
16302 @item +nosimd
16303 Disable the Advanced SIMD instructions (does not disable floating point).
16304
16305 @item +nofp
16306 Disable the floating-point and Advanced SIMD instructions.
16307 @end table
16308
16309 @item armv7ve
16310 The extended version of the ARMv7-A architecture with support for
16311 virtualization.
16312 @table @samp
16313 @item +fp
16314 The VFPv4 floating-point instructions, with 16 double-precision registers.
16315 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
16316
16317 @item +simd
16318 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
16319 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
16320
16321 @item +vfpv3-d16
16322 The VFPv3 floating-point instructions, with 16 double-precision
16323 registers.
16324
16325 @item +vfpv3
16326 The VFPv3 floating-point instructions, with 32 double-precision
16327 registers.
16328
16329 @item +vfpv3-d16-fp16
16330 The VFPv3 floating-point instructions, with 16 double-precision
16331 registers and the half-precision floating-point conversion operations.
16332
16333 @item +vfpv3-fp16
16334 The VFPv3 floating-point instructions, with 32 double-precision
16335 registers and the half-precision floating-point conversion operations.
16336
16337 @item +vfpv4-d16
16338 The VFPv4 floating-point instructions, with 16 double-precision
16339 registers.
16340
16341 @item +vfpv4
16342 The VFPv4 floating-point instructions, with 32 double-precision
16343 registers.
16344
16345 @item +neon
16346 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
16347 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
16348
16349 @item +neon-fp16
16350 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
16351 the half-precision floating-point conversion operations.
16352
16353 @item +nosimd
16354 Disable the Advanced SIMD instructions (does not disable floating point).
16355
16356 @item +nofp
16357 Disable the floating-point and Advanced SIMD instructions.
16358 @end table
16359
16360 @item armv8-a
16361 @table @samp
16362 @item +crc
16363 The Cyclic Redundancy Check (CRC) instructions.
16364 @item +simd
16365 The ARMv8-A Advanced SIMD and floating-point instructions.
16366 @item +crypto
16367 The cryptographic instructions.
16368 @item +nocrypto
16369 Disable the cryptographic instructions.
16370 @item +nofp
16371 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16372 @end table
16373
16374 @item armv8.1-a
16375 @table @samp
16376 @item +simd
16377 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16378
16379 @item +crypto
16380 The cryptographic instructions. This also enables the Advanced SIMD and
16381 floating-point instructions.
16382
16383 @item +nocrypto
16384 Disable the cryptographic instructions.
16385
16386 @item +nofp
16387 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16388 @end table
16389
16390 @item armv8.2-a
16391 @itemx armv8.3-a
16392 @table @samp
16393 @item +fp16
16394 The half-precision floating-point data processing instructions.
16395 This also enables the Advanced SIMD and floating-point instructions.
16396
16397 @item +fp16fml
16398 The half-precision floating-point fmla extension. This also enables
16399 the half-precision floating-point extension and Advanced SIMD and
16400 floating-point instructions.
16401
16402 @item +simd
16403 The ARMv8.1-A Advanced SIMD and floating-point instructions.
16404
16405 @item +crypto
16406 The cryptographic instructions. This also enables the Advanced SIMD and
16407 floating-point instructions.
16408
16409 @item +dotprod
16410 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16411
16412 @item +nocrypto
16413 Disable the cryptographic extension.
16414
16415 @item +nofp
16416 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16417 @end table
16418
16419 @item armv8.4-a
16420 @table @samp
16421 @item +fp16
16422 The half-precision floating-point data processing instructions.
16423 This also enables the Advanced SIMD and floating-point instructions as well
16424 as the Dot Product extension and the half-precision floating-point fmla
16425 extension.
16426
16427 @item +simd
16428 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
16429 Dot Product extension.
16430
16431 @item +crypto
16432 The cryptographic instructions. This also enables the Advanced SIMD and
16433 floating-point instructions as well as the Dot Product extension.
16434
16435 @item +nocrypto
16436 Disable the cryptographic extension.
16437
16438 @item +nofp
16439 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16440 @end table
16441
16442 @item armv7-r
16443 @table @samp
16444 @item +fp.sp
16445 The single-precision VFPv3 floating-point instructions. The extension
16446 @samp{+vfpv3xd} can be used as an alias for this extension.
16447
16448 @item +fp
16449 The VFPv3 floating-point instructions with 16 double-precision registers.
16450 The extension +vfpv3-d16 can be used as an alias for this extension.
16451
16452 @item +nofp
16453 Disable the floating-point extension.
16454
16455 @item +idiv
16456 The ARM-state integer division instructions.
16457
16458 @item +noidiv
16459 Disable the ARM-state integer division extension.
16460 @end table
16461
16462 @item armv7e-m
16463 @table @samp
16464 @item +fp
16465 The single-precision VFPv4 floating-point instructions.
16466
16467 @item +fpv5
16468 The single-precision FPv5 floating-point instructions.
16469
16470 @item +fp.dp
16471 The single- and double-precision FPv5 floating-point instructions.
16472
16473 @item +nofp
16474 Disable the floating-point extensions.
16475 @end table
16476
16477 @item armv8-m.main
16478 @table @samp
16479 @item +dsp
16480 The DSP instructions.
16481
16482 @item +nodsp
16483 Disable the DSP extension.
16484
16485 @item +fp
16486 The single-precision floating-point instructions.
16487
16488 @item +fp.dp
16489 The single- and double-precision floating-point instructions.
16490
16491 @item +nofp
16492 Disable the floating-point extension.
16493 @end table
16494
16495 @item armv8-r
16496 @table @samp
16497 @item +crc
16498 The Cyclic Redundancy Check (CRC) instructions.
16499 @item +fp.sp
16500 The single-precision FPv5 floating-point instructions.
16501 @item +simd
16502 The ARMv8-A Advanced SIMD and floating-point instructions.
16503 @item +crypto
16504 The cryptographic instructions.
16505 @item +nocrypto
16506 Disable the cryptographic instructions.
16507 @item +nofp
16508 Disable the floating-point, Advanced SIMD and cryptographic instructions.
16509 @end table
16510
16511 @end table
16512
16513 @option{-march=native} causes the compiler to auto-detect the architecture
16514 of the build computer. At present, this feature is only supported on
16515 GNU/Linux, and not all architectures are recognized. If the auto-detect
16516 is unsuccessful the option has no effect.
16517
16518 @item -mtune=@var{name}
16519 @opindex mtune
16520 This option specifies the name of the target ARM processor for
16521 which GCC should tune the performance of the code.
16522 For some ARM implementations better performance can be obtained by using
16523 this option.
16524 Permissible names are: @samp{arm2}, @samp{arm250},
16525 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
16526 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
16527 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
16528 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
16529 @samp{arm720},
16530 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
16531 @samp{arm710t}, @samp{arm720t}, @samp{arm740t},
16532 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
16533 @samp{strongarm1110},
16534 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
16535 @samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
16536 @samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
16537 @samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
16538 @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
16539 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
16540 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
16541 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
16542 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
16543 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16544 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16545 @samp{cortex-a76}, @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-r5},
16546 @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
16547 @samp{cortex-m33},
16548 @samp{cortex-m23},
16549 @samp{cortex-m7},
16550 @samp{cortex-m4},
16551 @samp{cortex-m3},
16552 @samp{cortex-m1},
16553 @samp{cortex-m0},
16554 @samp{cortex-m0plus},
16555 @samp{cortex-m1.small-multiply},
16556 @samp{cortex-m0.small-multiply},
16557 @samp{cortex-m0plus.small-multiply},
16558 @samp{exynos-m1},
16559 @samp{marvell-pj4},
16560 @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
16561 @samp{fa526}, @samp{fa626},
16562 @samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te},
16563 @samp{xgene1}.
16564
16565 Additionally, this option can specify that GCC should tune the performance
16566 of the code for a big.LITTLE system. Permissible names are:
16567 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
16568 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16569 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
16570 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
16571
16572 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
16573 performance for a blend of processors within architecture @var{arch}.
16574 The aim is to generate code that run well on the current most popular
16575 processors, balancing between optimizations that benefit some CPUs in the
16576 range, and avoiding performance pitfalls of other CPUs. The effects of
16577 this option may change in future GCC versions as CPU models come and go.
16578
16579 @option{-mtune} permits the same extension options as @option{-mcpu}, but
16580 the extension options do not affect the tuning of the generated code.
16581
16582 @option{-mtune=native} causes the compiler to auto-detect the CPU
16583 of the build computer. At present, this feature is only supported on
16584 GNU/Linux, and not all architectures are recognized. If the auto-detect is
16585 unsuccessful the option has no effect.
16586
16587 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
16588 @opindex mcpu
16589 This specifies the name of the target ARM processor. GCC uses this name
16590 to derive the name of the target ARM architecture (as if specified
16591 by @option{-march}) and the ARM processor type for which to tune for
16592 performance (as if specified by @option{-mtune}). Where this option
16593 is used in conjunction with @option{-march} or @option{-mtune},
16594 those options take precedence over the appropriate part of this option.
16595
16596 Many of the supported CPUs implement optional architectural
16597 extensions. Where this is so the architectural extensions are
16598 normally enabled by default. If implementations that lack the
16599 extension exist, then the extension syntax can be used to disable
16600 those extensions that have been omitted. For floating-point and
16601 Advanced SIMD (Neon) instructions, the settings of the options
16602 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
16603 floating-point and Advanced SIMD instructions will only be used if
16604 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
16605 @option{-mfpu} other than @samp{auto} will override the available
16606 floating-point and SIMD extension instructions.
16607
16608 For example, @samp{cortex-a9} can be found in three major
16609 configurations: integer only, with just a floating-point unit or with
16610 floating-point and Advanced SIMD. The default is to enable all the
16611 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
16612 be used to disable just the SIMD or both the SIMD and floating-point
16613 instructions respectively.
16614
16615 Permissible names for this option are the same as those for
16616 @option{-mtune}.
16617
16618 The following extension options are common to the listed CPUs:
16619
16620 @table @samp
16621 @item +nodsp
16622 Disable the DSP instructions on @samp{cortex-m33}.
16623
16624 @item +nofp
16625 Disables the floating-point instructions on @samp{arm9e},
16626 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
16627 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
16628 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
16629 @samp{cortex-m4}, @samp{cortex-m7} and @samp{cortex-m33}.
16630 Disables the floating-point and SIMD instructions on
16631 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
16632 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
16633 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
16634 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
16635 @samp{cortex-a53} and @samp{cortex-a55}.
16636
16637 @item +nofp.dp
16638 Disables the double-precision component of the floating-point instructions
16639 on @samp{cortex-r5}, @samp{cortex-r52} and @samp{cortex-m7}.
16640
16641 @item +nosimd
16642 Disables the SIMD (but not floating-point) instructions on
16643 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
16644 and @samp{cortex-a9}.
16645
16646 @item +crypto
16647 Enables the cryptographic instructions on @samp{cortex-a32},
16648 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
16649 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
16650 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16651 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
16652 @samp{cortex-a75.cortex-a55}.
16653 @end table
16654
16655 Additionally the @samp{generic-armv7-a} pseudo target defaults to
16656 VFPv3 with 16 double-precision registers. It supports the following
16657 extension options: @samp{vfpv3-d16}, @samp{vfpv3},
16658 @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16}, @samp{vfpv4-d16},
16659 @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3}, @samp{neon-fp16},
16660 @samp{neon-vfpv4}. The meanings are the same as for the extensions to
16661 @option{-march=armv7-a}.
16662
16663 @option{-mcpu=generic-@var{arch}} is also permissible, and is
16664 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
16665 See @option{-mtune} for more information.
16666
16667 @option{-mcpu=native} causes the compiler to auto-detect the CPU
16668 of the build computer. At present, this feature is only supported on
16669 GNU/Linux, and not all architectures are recognized. If the auto-detect
16670 is unsuccessful the option has no effect.
16671
16672 @item -mfpu=@var{name}
16673 @opindex mfpu
16674 This specifies what floating-point hardware (or hardware emulation) is
16675 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
16676 @samp{vfpv3},
16677 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
16678 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
16679 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
16680 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
16681 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
16682 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
16683 is an alias for @samp{vfpv2}.
16684
16685 The setting @samp{auto} is the default and is special. It causes the
16686 compiler to select the floating-point and Advanced SIMD instructions
16687 based on the settings of @option{-mcpu} and @option{-march}.
16688
16689 If the selected floating-point hardware includes the NEON extension
16690 (e.g. @option{-mfpu=neon}), note that floating-point
16691 operations are not generated by GCC's auto-vectorization pass unless
16692 @option{-funsafe-math-optimizations} is also specified. This is
16693 because NEON hardware does not fully implement the IEEE 754 standard for
16694 floating-point arithmetic (in particular denormal values are treated as
16695 zero), so the use of NEON instructions may lead to a loss of precision.
16696
16697 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}).
16698
16699 @item -mfp16-format=@var{name}
16700 @opindex mfp16-format
16701 Specify the format of the @code{__fp16} half-precision floating-point type.
16702 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
16703 the default is @samp{none}, in which case the @code{__fp16} type is not
16704 defined. @xref{Half-Precision}, for more information.
16705
16706 @item -mstructure-size-boundary=@var{n}
16707 @opindex mstructure-size-boundary
16708 The sizes of all structures and unions are rounded up to a multiple
16709 of the number of bits set by this option. Permissible values are 8, 32
16710 and 64. The default value varies for different toolchains. For the COFF
16711 targeted toolchain the default value is 8. A value of 64 is only allowed
16712 if the underlying ABI supports it.
16713
16714 Specifying a larger number can produce faster, more efficient code, but
16715 can also increase the size of the program. Different values are potentially
16716 incompatible. Code compiled with one value cannot necessarily expect to
16717 work with code or libraries compiled with another value, if they exchange
16718 information using structures or unions.
16719
16720 This option is deprecated.
16721
16722 @item -mabort-on-noreturn
16723 @opindex mabort-on-noreturn
16724 Generate a call to the function @code{abort} at the end of a
16725 @code{noreturn} function. It is executed if the function tries to
16726 return.
16727
16728 @item -mlong-calls
16729 @itemx -mno-long-calls
16730 @opindex mlong-calls
16731 @opindex mno-long-calls
16732 Tells the compiler to perform function calls by first loading the
16733 address of the function into a register and then performing a subroutine
16734 call on this register. This switch is needed if the target function
16735 lies outside of the 64-megabyte addressing range of the offset-based
16736 version of subroutine call instruction.
16737
16738 Even if this switch is enabled, not all function calls are turned
16739 into long calls. The heuristic is that static functions, functions
16740 that have the @code{short_call} attribute, functions that are inside
16741 the scope of a @code{#pragma no_long_calls} directive, and functions whose
16742 definitions have already been compiled within the current compilation
16743 unit are not turned into long calls. The exceptions to this rule are
16744 that weak function definitions, functions with the @code{long_call}
16745 attribute or the @code{section} attribute, and functions that are within
16746 the scope of a @code{#pragma long_calls} directive are always
16747 turned into long calls.
16748
16749 This feature is not enabled by default. Specifying
16750 @option{-mno-long-calls} restores the default behavior, as does
16751 placing the function calls within the scope of a @code{#pragma
16752 long_calls_off} directive. Note these switches have no effect on how
16753 the compiler generates code to handle function calls via function
16754 pointers.
16755
16756 @item -msingle-pic-base
16757 @opindex msingle-pic-base
16758 Treat the register used for PIC addressing as read-only, rather than
16759 loading it in the prologue for each function. The runtime system is
16760 responsible for initializing this register with an appropriate value
16761 before execution begins.
16762
16763 @item -mpic-register=@var{reg}
16764 @opindex mpic-register
16765 Specify the register to be used for PIC addressing.
16766 For standard PIC base case, the default is any suitable register
16767 determined by compiler. For single PIC base case, the default is
16768 @samp{R9} if target is EABI based or stack-checking is enabled,
16769 otherwise the default is @samp{R10}.
16770
16771 @item -mpic-data-is-text-relative
16772 @opindex mpic-data-is-text-relative
16773 Assume that the displacement between the text and data segments is fixed
16774 at static link time. This permits using PC-relative addressing
16775 operations to access data known to be in the data segment. For
16776 non-VxWorks RTP targets, this option is enabled by default. When
16777 disabled on such targets, it will enable @option{-msingle-pic-base} by
16778 default.
16779
16780 @item -mpoke-function-name
16781 @opindex mpoke-function-name
16782 Write the name of each function into the text section, directly
16783 preceding the function prologue. The generated code is similar to this:
16784
16785 @smallexample
16786 t0
16787 .ascii "arm_poke_function_name", 0
16788 .align
16789 t1
16790 .word 0xff000000 + (t1 - t0)
16791 arm_poke_function_name
16792 mov ip, sp
16793 stmfd sp!, @{fp, ip, lr, pc@}
16794 sub fp, ip, #4
16795 @end smallexample
16796
16797 When performing a stack backtrace, code can inspect the value of
16798 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
16799 location @code{pc - 12} and the top 8 bits are set, then we know that
16800 there is a function name embedded immediately preceding this location
16801 and has length @code{((pc[-3]) & 0xff000000)}.
16802
16803 @item -mthumb
16804 @itemx -marm
16805 @opindex marm
16806 @opindex mthumb
16807
16808 Select between generating code that executes in ARM and Thumb
16809 states. The default for most configurations is to generate code
16810 that executes in ARM state, but the default can be changed by
16811 configuring GCC with the @option{--with-mode=}@var{state}
16812 configure option.
16813
16814 You can also override the ARM and Thumb mode for each function
16815 by using the @code{target("thumb")} and @code{target("arm")} function attributes
16816 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
16817
16818 @item -mflip-thumb
16819 @opindex mflip-thumb
16820 Switch ARM/Thumb modes on alternating functions.
16821 This option is provided for regression testing of mixed Thumb/ARM code
16822 generation, and is not intended for ordinary use in compiling code.
16823
16824 @item -mtpcs-frame
16825 @opindex mtpcs-frame
16826 Generate a stack frame that is compliant with the Thumb Procedure Call
16827 Standard for all non-leaf functions. (A leaf function is one that does
16828 not call any other functions.) The default is @option{-mno-tpcs-frame}.
16829
16830 @item -mtpcs-leaf-frame
16831 @opindex mtpcs-leaf-frame
16832 Generate a stack frame that is compliant with the Thumb Procedure Call
16833 Standard for all leaf functions. (A leaf function is one that does
16834 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
16835
16836 @item -mcallee-super-interworking
16837 @opindex mcallee-super-interworking
16838 Gives all externally visible functions in the file being compiled an ARM
16839 instruction set header which switches to Thumb mode before executing the
16840 rest of the function. This allows these functions to be called from
16841 non-interworking code. This option is not valid in AAPCS configurations
16842 because interworking is enabled by default.
16843
16844 @item -mcaller-super-interworking
16845 @opindex mcaller-super-interworking
16846 Allows calls via function pointers (including virtual functions) to
16847 execute correctly regardless of whether the target code has been
16848 compiled for interworking or not. There is a small overhead in the cost
16849 of executing a function pointer if this option is enabled. This option
16850 is not valid in AAPCS configurations because interworking is enabled
16851 by default.
16852
16853 @item -mtp=@var{name}
16854 @opindex mtp
16855 Specify the access model for the thread local storage pointer. The valid
16856 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
16857 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
16858 (supported in the arm6k architecture), and @samp{auto}, which uses the
16859 best available method for the selected processor. The default setting is
16860 @samp{auto}.
16861
16862 @item -mtls-dialect=@var{dialect}
16863 @opindex mtls-dialect
16864 Specify the dialect to use for accessing thread local storage. Two
16865 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
16866 @samp{gnu} dialect selects the original GNU scheme for supporting
16867 local and global dynamic TLS models. The @samp{gnu2} dialect
16868 selects the GNU descriptor scheme, which provides better performance
16869 for shared libraries. The GNU descriptor scheme is compatible with
16870 the original scheme, but does require new assembler, linker and
16871 library support. Initial and local exec TLS models are unaffected by
16872 this option and always use the original scheme.
16873
16874 @item -mword-relocations
16875 @opindex mword-relocations
16876 Only generate absolute relocations on word-sized values (i.e. R_ARM_ABS32).
16877 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
16878 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
16879 is specified.
16880
16881 @item -mfix-cortex-m3-ldrd
16882 @opindex mfix-cortex-m3-ldrd
16883 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
16884 with overlapping destination and base registers are used. This option avoids
16885 generating these instructions. This option is enabled by default when
16886 @option{-mcpu=cortex-m3} is specified.
16887
16888 @item -munaligned-access
16889 @itemx -mno-unaligned-access
16890 @opindex munaligned-access
16891 @opindex mno-unaligned-access
16892 Enables (or disables) reading and writing of 16- and 32- bit values
16893 from addresses that are not 16- or 32- bit aligned. By default
16894 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
16895 ARMv8-M Baseline architectures, and enabled for all other
16896 architectures. If unaligned access is not enabled then words in packed
16897 data structures are accessed a byte at a time.
16898
16899 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
16900 generated object file to either true or false, depending upon the
16901 setting of this option. If unaligned access is enabled then the
16902 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
16903 defined.
16904
16905 @item -mneon-for-64bits
16906 @opindex mneon-for-64bits
16907 Enables using Neon to handle scalar 64-bits operations. This is
16908 disabled by default since the cost of moving data from core registers
16909 to Neon is high.
16910
16911 @item -mslow-flash-data
16912 @opindex mslow-flash-data
16913 Assume loading data from flash is slower than fetching instruction.
16914 Therefore literal load is minimized for better performance.
16915 This option is only supported when compiling for ARMv7 M-profile and
16916 off by default.
16917
16918 @item -masm-syntax-unified
16919 @opindex masm-syntax-unified
16920 Assume inline assembler is using unified asm syntax. The default is
16921 currently off which implies divided syntax. This option has no impact
16922 on Thumb2. However, this may change in future releases of GCC.
16923 Divided syntax should be considered deprecated.
16924
16925 @item -mrestrict-it
16926 @opindex mrestrict-it
16927 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
16928 IT blocks can only contain a single 16-bit instruction from a select
16929 set of instructions. This option is on by default for ARMv8-A Thumb mode.
16930
16931 @item -mprint-tune-info
16932 @opindex mprint-tune-info
16933 Print CPU tuning information as comment in assembler file. This is
16934 an option used only for regression testing of the compiler and not
16935 intended for ordinary use in compiling code. This option is disabled
16936 by default.
16937
16938 @item -mverbose-cost-dump
16939 @opindex mverbose-cost-dump
16940 Enable verbose cost model dumping in the debug dump files. This option is
16941 provided for use in debugging the compiler.
16942
16943 @item -mpure-code
16944 @opindex mpure-code
16945 Do not allow constant data to be placed in code sections.
16946 Additionally, when compiling for ELF object format give all text sections the
16947 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
16948 is only available when generating non-pic code for M-profile targets with the
16949 MOVT instruction.
16950
16951 @item -mcmse
16952 @opindex mcmse
16953 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
16954 Development Tools Engineering Specification", which can be found on
16955 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
16956 @end table
16957
16958 @node AVR Options
16959 @subsection AVR Options
16960 @cindex AVR Options
16961
16962 These options are defined for AVR implementations:
16963
16964 @table @gcctabopt
16965 @item -mmcu=@var{mcu}
16966 @opindex mmcu
16967 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
16968
16969 The default for this option is@tie{}@samp{avr2}.
16970
16971 GCC supports the following AVR devices and ISAs:
16972
16973 @include avr-mmcu.texi
16974
16975 @item -mabsdata
16976 @opindex mabsdata
16977
16978 Assume that all data in static storage can be accessed by LDS / STS
16979 instructions. This option has only an effect on reduced Tiny devices like
16980 ATtiny40. See also the @code{absdata}
16981 @ref{AVR Variable Attributes,variable attribute}.
16982
16983 @item -maccumulate-args
16984 @opindex maccumulate-args
16985 Accumulate outgoing function arguments and acquire/release the needed
16986 stack space for outgoing function arguments once in function
16987 prologue/epilogue. Without this option, outgoing arguments are pushed
16988 before calling a function and popped afterwards.
16989
16990 Popping the arguments after the function call can be expensive on
16991 AVR so that accumulating the stack space might lead to smaller
16992 executables because arguments need not be removed from the
16993 stack after such a function call.
16994
16995 This option can lead to reduced code size for functions that perform
16996 several calls to functions that get their arguments on the stack like
16997 calls to printf-like functions.
16998
16999 @item -mbranch-cost=@var{cost}
17000 @opindex mbranch-cost
17001 Set the branch costs for conditional branch instructions to
17002 @var{cost}. Reasonable values for @var{cost} are small, non-negative
17003 integers. The default branch cost is 0.
17004
17005 @item -mcall-prologues
17006 @opindex mcall-prologues
17007 Functions prologues/epilogues are expanded as calls to appropriate
17008 subroutines. Code size is smaller.
17009
17010 @item -mgas-isr-prologues
17011 @opindex mgas-isr-prologues
17012 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
17013 instruction supported by GNU Binutils.
17014 If this option is on, the feature can still be disabled for individual
17015 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
17016 function attribute. This feature is activated per default
17017 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
17018 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
17019
17020 @item -mint8
17021 @opindex mint8
17022 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
17023 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
17024 and @code{long long} is 4 bytes. Please note that this option does not
17025 conform to the C standards, but it results in smaller code
17026 size.
17027
17028 @item -mmain-is-OS_task
17029 @opindex mmain-is-OS_task
17030 Do not save registers in @code{main}. The effect is the same like
17031 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
17032 to @code{main}. It is activated per default if optimization is on.
17033
17034 @item -mn-flash=@var{num}
17035 @opindex mn-flash
17036 Assume that the flash memory has a size of
17037 @var{num} times 64@tie{}KiB.
17038
17039 @item -mno-interrupts
17040 @opindex mno-interrupts
17041 Generated code is not compatible with hardware interrupts.
17042 Code size is smaller.
17043
17044 @item -mrelax
17045 @opindex mrelax
17046 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
17047 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
17048 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
17049 the assembler's command line and the @option{--relax} option to the
17050 linker's command line.
17051
17052 Jump relaxing is performed by the linker because jump offsets are not
17053 known before code is located. Therefore, the assembler code generated by the
17054 compiler is the same, but the instructions in the executable may
17055 differ from instructions in the assembler code.
17056
17057 Relaxing must be turned on if linker stubs are needed, see the
17058 section on @code{EIND} and linker stubs below.
17059
17060 @item -mrmw
17061 @opindex mrmw
17062 Assume that the device supports the Read-Modify-Write
17063 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
17064
17065 @item -mshort-calls
17066 @opindex mshort-calls
17067
17068 Assume that @code{RJMP} and @code{RCALL} can target the whole
17069 program memory.
17070
17071 This option is used internally for multilib selection. It is
17072 not an optimization option, and you don't need to set it by hand.
17073
17074 @item -msp8
17075 @opindex msp8
17076 Treat the stack pointer register as an 8-bit register,
17077 i.e.@: assume the high byte of the stack pointer is zero.
17078 In general, you don't need to set this option by hand.
17079
17080 This option is used internally by the compiler to select and
17081 build multilibs for architectures @code{avr2} and @code{avr25}.
17082 These architectures mix devices with and without @code{SPH}.
17083 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
17084 the compiler driver adds or removes this option from the compiler
17085 proper's command line, because the compiler then knows if the device
17086 or architecture has an 8-bit stack pointer and thus no @code{SPH}
17087 register or not.
17088
17089 @item -mstrict-X
17090 @opindex mstrict-X
17091 Use address register @code{X} in a way proposed by the hardware. This means
17092 that @code{X} is only used in indirect, post-increment or
17093 pre-decrement addressing.
17094
17095 Without this option, the @code{X} register may be used in the same way
17096 as @code{Y} or @code{Z} which then is emulated by additional
17097 instructions.
17098 For example, loading a value with @code{X+const} addressing with a
17099 small non-negative @code{const < 64} to a register @var{Rn} is
17100 performed as
17101
17102 @example
17103 adiw r26, const ; X += const
17104 ld @var{Rn}, X ; @var{Rn} = *X
17105 sbiw r26, const ; X -= const
17106 @end example
17107
17108 @item -mtiny-stack
17109 @opindex mtiny-stack
17110 Only change the lower 8@tie{}bits of the stack pointer.
17111
17112 @item -mfract-convert-truncate
17113 @opindex mfract-convert-truncate
17114 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
17115
17116 @item -nodevicelib
17117 @opindex nodevicelib
17118 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
17119
17120 @item -Waddr-space-convert
17121 @opindex Waddr-space-convert
17122 @opindex Wno-addr-space-convert
17123 Warn about conversions between address spaces in the case where the
17124 resulting address space is not contained in the incoming address space.
17125
17126 @item -Wmisspelled-isr
17127 @opindex Wmisspelled-isr
17128 @opindex Wno-misspelled-isr
17129 Warn if the ISR is misspelled, i.e. without __vector prefix.
17130 Enabled by default.
17131 @end table
17132
17133 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
17134 @cindex @code{EIND}
17135 Pointers in the implementation are 16@tie{}bits wide.
17136 The address of a function or label is represented as word address so
17137 that indirect jumps and calls can target any code address in the
17138 range of 64@tie{}Ki words.
17139
17140 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
17141 bytes of program memory space, there is a special function register called
17142 @code{EIND} that serves as most significant part of the target address
17143 when @code{EICALL} or @code{EIJMP} instructions are used.
17144
17145 Indirect jumps and calls on these devices are handled as follows by
17146 the compiler and are subject to some limitations:
17147
17148 @itemize @bullet
17149
17150 @item
17151 The compiler never sets @code{EIND}.
17152
17153 @item
17154 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
17155 instructions or might read @code{EIND} directly in order to emulate an
17156 indirect call/jump by means of a @code{RET} instruction.
17157
17158 @item
17159 The compiler assumes that @code{EIND} never changes during the startup
17160 code or during the application. In particular, @code{EIND} is not
17161 saved/restored in function or interrupt service routine
17162 prologue/epilogue.
17163
17164 @item
17165 For indirect calls to functions and computed goto, the linker
17166 generates @emph{stubs}. Stubs are jump pads sometimes also called
17167 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
17168 The stub contains a direct jump to the desired address.
17169
17170 @item
17171 Linker relaxation must be turned on so that the linker generates
17172 the stubs correctly in all situations. See the compiler option
17173 @option{-mrelax} and the linker option @option{--relax}.
17174 There are corner cases where the linker is supposed to generate stubs
17175 but aborts without relaxation and without a helpful error message.
17176
17177 @item
17178 The default linker script is arranged for code with @code{EIND = 0}.
17179 If code is supposed to work for a setup with @code{EIND != 0}, a custom
17180 linker script has to be used in order to place the sections whose
17181 name start with @code{.trampolines} into the segment where @code{EIND}
17182 points to.
17183
17184 @item
17185 The startup code from libgcc never sets @code{EIND}.
17186 Notice that startup code is a blend of code from libgcc and AVR-LibC.
17187 For the impact of AVR-LibC on @code{EIND}, see the
17188 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
17189
17190 @item
17191 It is legitimate for user-specific startup code to set up @code{EIND}
17192 early, for example by means of initialization code located in
17193 section @code{.init3}. Such code runs prior to general startup code
17194 that initializes RAM and calls constructors, but after the bit
17195 of startup code from AVR-LibC that sets @code{EIND} to the segment
17196 where the vector table is located.
17197 @example
17198 #include <avr/io.h>
17199
17200 static void
17201 __attribute__((section(".init3"),naked,used,no_instrument_function))
17202 init3_set_eind (void)
17203 @{
17204 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
17205 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
17206 @}
17207 @end example
17208
17209 @noindent
17210 The @code{__trampolines_start} symbol is defined in the linker script.
17211
17212 @item
17213 Stubs are generated automatically by the linker if
17214 the following two conditions are met:
17215 @itemize @minus
17216
17217 @item The address of a label is taken by means of the @code{gs} modifier
17218 (short for @emph{generate stubs}) like so:
17219 @example
17220 LDI r24, lo8(gs(@var{func}))
17221 LDI r25, hi8(gs(@var{func}))
17222 @end example
17223 @item The final location of that label is in a code segment
17224 @emph{outside} the segment where the stubs are located.
17225 @end itemize
17226
17227 @item
17228 The compiler emits such @code{gs} modifiers for code labels in the
17229 following situations:
17230 @itemize @minus
17231 @item Taking address of a function or code label.
17232 @item Computed goto.
17233 @item If prologue-save function is used, see @option{-mcall-prologues}
17234 command-line option.
17235 @item Switch/case dispatch tables. If you do not want such dispatch
17236 tables you can specify the @option{-fno-jump-tables} command-line option.
17237 @item C and C++ constructors/destructors called during startup/shutdown.
17238 @item If the tools hit a @code{gs()} modifier explained above.
17239 @end itemize
17240
17241 @item
17242 Jumping to non-symbolic addresses like so is @emph{not} supported:
17243
17244 @example
17245 int main (void)
17246 @{
17247 /* Call function at word address 0x2 */
17248 return ((int(*)(void)) 0x2)();
17249 @}
17250 @end example
17251
17252 Instead, a stub has to be set up, i.e.@: the function has to be called
17253 through a symbol (@code{func_4} in the example):
17254
17255 @example
17256 int main (void)
17257 @{
17258 extern int func_4 (void);
17259
17260 /* Call function at byte address 0x4 */
17261 return func_4();
17262 @}
17263 @end example
17264
17265 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
17266 Alternatively, @code{func_4} can be defined in the linker script.
17267 @end itemize
17268
17269 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
17270 @cindex @code{RAMPD}
17271 @cindex @code{RAMPX}
17272 @cindex @code{RAMPY}
17273 @cindex @code{RAMPZ}
17274 Some AVR devices support memories larger than the 64@tie{}KiB range
17275 that can be accessed with 16-bit pointers. To access memory locations
17276 outside this 64@tie{}KiB range, the content of a @code{RAMP}
17277 register is used as high part of the address:
17278 The @code{X}, @code{Y}, @code{Z} address register is concatenated
17279 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
17280 register, respectively, to get a wide address. Similarly,
17281 @code{RAMPD} is used together with direct addressing.
17282
17283 @itemize
17284 @item
17285 The startup code initializes the @code{RAMP} special function
17286 registers with zero.
17287
17288 @item
17289 If a @ref{AVR Named Address Spaces,named address space} other than
17290 generic or @code{__flash} is used, then @code{RAMPZ} is set
17291 as needed before the operation.
17292
17293 @item
17294 If the device supports RAM larger than 64@tie{}KiB and the compiler
17295 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
17296 is reset to zero after the operation.
17297
17298 @item
17299 If the device comes with a specific @code{RAMP} register, the ISR
17300 prologue/epilogue saves/restores that SFR and initializes it with
17301 zero in case the ISR code might (implicitly) use it.
17302
17303 @item
17304 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
17305 If you use inline assembler to read from locations outside the
17306 16-bit address range and change one of the @code{RAMP} registers,
17307 you must reset it to zero after the access.
17308
17309 @end itemize
17310
17311 @subsubsection AVR Built-in Macros
17312
17313 GCC defines several built-in macros so that the user code can test
17314 for the presence or absence of features. Almost any of the following
17315 built-in macros are deduced from device capabilities and thus
17316 triggered by the @option{-mmcu=} command-line option.
17317
17318 For even more AVR-specific built-in macros see
17319 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
17320
17321 @table @code
17322
17323 @item __AVR_ARCH__
17324 Build-in macro that resolves to a decimal number that identifies the
17325 architecture and depends on the @option{-mmcu=@var{mcu}} option.
17326 Possible values are:
17327
17328 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
17329 @code{4}, @code{5}, @code{51}, @code{6}
17330
17331 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
17332 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
17333
17334 respectively and
17335
17336 @code{100},
17337 @code{102}, @code{103}, @code{104},
17338 @code{105}, @code{106}, @code{107}
17339
17340 for @var{mcu}=@code{avrtiny},
17341 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
17342 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
17343 If @var{mcu} specifies a device, this built-in macro is set
17344 accordingly. For example, with @option{-mmcu=atmega8} the macro is
17345 defined to @code{4}.
17346
17347 @item __AVR_@var{Device}__
17348 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
17349 the device's name. For example, @option{-mmcu=atmega8} defines the
17350 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
17351 @code{__AVR_ATtiny261A__}, etc.
17352
17353 The built-in macros' names follow
17354 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
17355 the device name as from the AVR user manual. The difference between
17356 @var{Device} in the built-in macro and @var{device} in
17357 @option{-mmcu=@var{device}} is that the latter is always lowercase.
17358
17359 If @var{device} is not a device but only a core architecture like
17360 @samp{avr51}, this macro is not defined.
17361
17362 @item __AVR_DEVICE_NAME__
17363 Setting @option{-mmcu=@var{device}} defines this built-in macro to
17364 the device's name. For example, with @option{-mmcu=atmega8} the macro
17365 is defined to @code{atmega8}.
17366
17367 If @var{device} is not a device but only a core architecture like
17368 @samp{avr51}, this macro is not defined.
17369
17370 @item __AVR_XMEGA__
17371 The device / architecture belongs to the XMEGA family of devices.
17372
17373 @item __AVR_HAVE_ELPM__
17374 The device has the @code{ELPM} instruction.
17375
17376 @item __AVR_HAVE_ELPMX__
17377 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
17378 R@var{n},Z+} instructions.
17379
17380 @item __AVR_HAVE_MOVW__
17381 The device has the @code{MOVW} instruction to perform 16-bit
17382 register-register moves.
17383
17384 @item __AVR_HAVE_LPMX__
17385 The device has the @code{LPM R@var{n},Z} and
17386 @code{LPM R@var{n},Z+} instructions.
17387
17388 @item __AVR_HAVE_MUL__
17389 The device has a hardware multiplier.
17390
17391 @item __AVR_HAVE_JMP_CALL__
17392 The device has the @code{JMP} and @code{CALL} instructions.
17393 This is the case for devices with more than 8@tie{}KiB of program
17394 memory.
17395
17396 @item __AVR_HAVE_EIJMP_EICALL__
17397 @itemx __AVR_3_BYTE_PC__
17398 The device has the @code{EIJMP} and @code{EICALL} instructions.
17399 This is the case for devices with more than 128@tie{}KiB of program memory.
17400 This also means that the program counter
17401 (PC) is 3@tie{}bytes wide.
17402
17403 @item __AVR_2_BYTE_PC__
17404 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
17405 with up to 128@tie{}KiB of program memory.
17406
17407 @item __AVR_HAVE_8BIT_SP__
17408 @itemx __AVR_HAVE_16BIT_SP__
17409 The stack pointer (SP) register is treated as 8-bit respectively
17410 16-bit register by the compiler.
17411 The definition of these macros is affected by @option{-mtiny-stack}.
17412
17413 @item __AVR_HAVE_SPH__
17414 @itemx __AVR_SP8__
17415 The device has the SPH (high part of stack pointer) special function
17416 register or has an 8-bit stack pointer, respectively.
17417 The definition of these macros is affected by @option{-mmcu=} and
17418 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
17419 by @option{-msp8}.
17420
17421 @item __AVR_HAVE_RAMPD__
17422 @itemx __AVR_HAVE_RAMPX__
17423 @itemx __AVR_HAVE_RAMPY__
17424 @itemx __AVR_HAVE_RAMPZ__
17425 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
17426 @code{RAMPZ} special function register, respectively.
17427
17428 @item __NO_INTERRUPTS__
17429 This macro reflects the @option{-mno-interrupts} command-line option.
17430
17431 @item __AVR_ERRATA_SKIP__
17432 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
17433 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
17434 instructions because of a hardware erratum. Skip instructions are
17435 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
17436 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
17437 set.
17438
17439 @item __AVR_ISA_RMW__
17440 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
17441
17442 @item __AVR_SFR_OFFSET__=@var{offset}
17443 Instructions that can address I/O special function registers directly
17444 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
17445 address as if addressed by an instruction to access RAM like @code{LD}
17446 or @code{STS}. This offset depends on the device architecture and has
17447 to be subtracted from the RAM address in order to get the
17448 respective I/O@tie{}address.
17449
17450 @item __AVR_SHORT_CALLS__
17451 The @option{-mshort-calls} command line option is set.
17452
17453 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
17454 Some devices support reading from flash memory by means of @code{LD*}
17455 instructions. The flash memory is seen in the data address space
17456 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
17457 is not defined, this feature is not available. If defined,
17458 the address space is linear and there is no need to put
17459 @code{.rodata} into RAM. This is handled by the default linker
17460 description file, and is currently available for
17461 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
17462 there is no need to use address spaces like @code{__flash} or
17463 features like attribute @code{progmem} and @code{pgm_read_*}.
17464
17465 @item __WITH_AVRLIBC__
17466 The compiler is configured to be used together with AVR-Libc.
17467 See the @option{--with-avrlibc} configure option.
17468
17469 @end table
17470
17471 @node Blackfin Options
17472 @subsection Blackfin Options
17473 @cindex Blackfin Options
17474
17475 @table @gcctabopt
17476 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
17477 @opindex mcpu=
17478 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
17479 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
17480 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
17481 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
17482 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
17483 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
17484 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
17485 @samp{bf561}, @samp{bf592}.
17486
17487 The optional @var{sirevision} specifies the silicon revision of the target
17488 Blackfin processor. Any workarounds available for the targeted silicon revision
17489 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
17490 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
17491 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
17492 hexadecimal digits representing the major and minor numbers in the silicon
17493 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
17494 is not defined. If @var{sirevision} is @samp{any}, the
17495 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
17496 If this optional @var{sirevision} is not used, GCC assumes the latest known
17497 silicon revision of the targeted Blackfin processor.
17498
17499 GCC defines a preprocessor macro for the specified @var{cpu}.
17500 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
17501 provided by libgloss to be linked in if @option{-msim} is not given.
17502
17503 Without this option, @samp{bf532} is used as the processor by default.
17504
17505 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
17506 only the preprocessor macro is defined.
17507
17508 @item -msim
17509 @opindex msim
17510 Specifies that the program will be run on the simulator. This causes
17511 the simulator BSP provided by libgloss to be linked in. This option
17512 has effect only for @samp{bfin-elf} toolchain.
17513 Certain other options, such as @option{-mid-shared-library} and
17514 @option{-mfdpic}, imply @option{-msim}.
17515
17516 @item -momit-leaf-frame-pointer
17517 @opindex momit-leaf-frame-pointer
17518 Don't keep the frame pointer in a register for leaf functions. This
17519 avoids the instructions to save, set up and restore frame pointers and
17520 makes an extra register available in leaf functions.
17521
17522 @item -mspecld-anomaly
17523 @opindex mspecld-anomaly
17524 When enabled, the compiler ensures that the generated code does not
17525 contain speculative loads after jump instructions. If this option is used,
17526 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
17527
17528 @item -mno-specld-anomaly
17529 @opindex mno-specld-anomaly
17530 Don't generate extra code to prevent speculative loads from occurring.
17531
17532 @item -mcsync-anomaly
17533 @opindex mcsync-anomaly
17534 When enabled, the compiler ensures that the generated code does not
17535 contain CSYNC or SSYNC instructions too soon after conditional branches.
17536 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
17537
17538 @item -mno-csync-anomaly
17539 @opindex mno-csync-anomaly
17540 Don't generate extra code to prevent CSYNC or SSYNC instructions from
17541 occurring too soon after a conditional branch.
17542
17543 @item -mlow-64k
17544 @opindex mlow-64k
17545 When enabled, the compiler is free to take advantage of the knowledge that
17546 the entire program fits into the low 64k of memory.
17547
17548 @item -mno-low-64k
17549 @opindex mno-low-64k
17550 Assume that the program is arbitrarily large. This is the default.
17551
17552 @item -mstack-check-l1
17553 @opindex mstack-check-l1
17554 Do stack checking using information placed into L1 scratchpad memory by the
17555 uClinux kernel.
17556
17557 @item -mid-shared-library
17558 @opindex mid-shared-library
17559 Generate code that supports shared libraries via the library ID method.
17560 This allows for execute in place and shared libraries in an environment
17561 without virtual memory management. This option implies @option{-fPIC}.
17562 With a @samp{bfin-elf} target, this option implies @option{-msim}.
17563
17564 @item -mno-id-shared-library
17565 @opindex mno-id-shared-library
17566 Generate code that doesn't assume ID-based shared libraries are being used.
17567 This is the default.
17568
17569 @item -mleaf-id-shared-library
17570 @opindex mleaf-id-shared-library
17571 Generate code that supports shared libraries via the library ID method,
17572 but assumes that this library or executable won't link against any other
17573 ID shared libraries. That allows the compiler to use faster code for jumps
17574 and calls.
17575
17576 @item -mno-leaf-id-shared-library
17577 @opindex mno-leaf-id-shared-library
17578 Do not assume that the code being compiled won't link against any ID shared
17579 libraries. Slower code is generated for jump and call insns.
17580
17581 @item -mshared-library-id=n
17582 @opindex mshared-library-id
17583 Specifies the identification number of the ID-based shared library being
17584 compiled. Specifying a value of 0 generates more compact code; specifying
17585 other values forces the allocation of that number to the current
17586 library but is no more space- or time-efficient than omitting this option.
17587
17588 @item -msep-data
17589 @opindex msep-data
17590 Generate code that allows the data segment to be located in a different
17591 area of memory from the text segment. This allows for execute in place in
17592 an environment without virtual memory management by eliminating relocations
17593 against the text section.
17594
17595 @item -mno-sep-data
17596 @opindex mno-sep-data
17597 Generate code that assumes that the data segment follows the text segment.
17598 This is the default.
17599
17600 @item -mlong-calls
17601 @itemx -mno-long-calls
17602 @opindex mlong-calls
17603 @opindex mno-long-calls
17604 Tells the compiler to perform function calls by first loading the
17605 address of the function into a register and then performing a subroutine
17606 call on this register. This switch is needed if the target function
17607 lies outside of the 24-bit addressing range of the offset-based
17608 version of subroutine call instruction.
17609
17610 This feature is not enabled by default. Specifying
17611 @option{-mno-long-calls} restores the default behavior. Note these
17612 switches have no effect on how the compiler generates code to handle
17613 function calls via function pointers.
17614
17615 @item -mfast-fp
17616 @opindex mfast-fp
17617 Link with the fast floating-point library. This library relaxes some of
17618 the IEEE floating-point standard's rules for checking inputs against
17619 Not-a-Number (NAN), in the interest of performance.
17620
17621 @item -minline-plt
17622 @opindex minline-plt
17623 Enable inlining of PLT entries in function calls to functions that are
17624 not known to bind locally. It has no effect without @option{-mfdpic}.
17625
17626 @item -mmulticore
17627 @opindex mmulticore
17628 Build a standalone application for multicore Blackfin processors.
17629 This option causes proper start files and link scripts supporting
17630 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
17631 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
17632
17633 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
17634 selects the one-application-per-core programming model. Without
17635 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
17636 programming model is used. In this model, the main function of Core B
17637 should be named as @code{coreb_main}.
17638
17639 If this option is not used, the single-core application programming
17640 model is used.
17641
17642 @item -mcorea
17643 @opindex mcorea
17644 Build a standalone application for Core A of BF561 when using
17645 the one-application-per-core programming model. Proper start files
17646 and link scripts are used to support Core A, and the macro
17647 @code{__BFIN_COREA} is defined.
17648 This option can only be used in conjunction with @option{-mmulticore}.
17649
17650 @item -mcoreb
17651 @opindex mcoreb
17652 Build a standalone application for Core B of BF561 when using
17653 the one-application-per-core programming model. Proper start files
17654 and link scripts are used to support Core B, and the macro
17655 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
17656 should be used instead of @code{main}.
17657 This option can only be used in conjunction with @option{-mmulticore}.
17658
17659 @item -msdram
17660 @opindex msdram
17661 Build a standalone application for SDRAM. Proper start files and
17662 link scripts are used to put the application into SDRAM, and the macro
17663 @code{__BFIN_SDRAM} is defined.
17664 The loader should initialize SDRAM before loading the application.
17665
17666 @item -micplb
17667 @opindex micplb
17668 Assume that ICPLBs are enabled at run time. This has an effect on certain
17669 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
17670 are enabled; for standalone applications the default is off.
17671 @end table
17672
17673 @node C6X Options
17674 @subsection C6X Options
17675 @cindex C6X Options
17676
17677 @table @gcctabopt
17678 @item -march=@var{name}
17679 @opindex march
17680 This specifies the name of the target architecture. GCC uses this
17681 name to determine what kind of instructions it can emit when generating
17682 assembly code. Permissible names are: @samp{c62x},
17683 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
17684
17685 @item -mbig-endian
17686 @opindex mbig-endian
17687 Generate code for a big-endian target.
17688
17689 @item -mlittle-endian
17690 @opindex mlittle-endian
17691 Generate code for a little-endian target. This is the default.
17692
17693 @item -msim
17694 @opindex msim
17695 Choose startup files and linker script suitable for the simulator.
17696
17697 @item -msdata=default
17698 @opindex msdata=default
17699 Put small global and static data in the @code{.neardata} section,
17700 which is pointed to by register @code{B14}. Put small uninitialized
17701 global and static data in the @code{.bss} section, which is adjacent
17702 to the @code{.neardata} section. Put small read-only data into the
17703 @code{.rodata} section. The corresponding sections used for large
17704 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
17705
17706 @item -msdata=all
17707 @opindex msdata=all
17708 Put all data, not just small objects, into the sections reserved for
17709 small data, and use addressing relative to the @code{B14} register to
17710 access them.
17711
17712 @item -msdata=none
17713 @opindex msdata=none
17714 Make no use of the sections reserved for small data, and use absolute
17715 addresses to access all data. Put all initialized global and static
17716 data in the @code{.fardata} section, and all uninitialized data in the
17717 @code{.far} section. Put all constant data into the @code{.const}
17718 section.
17719 @end table
17720
17721 @node CRIS Options
17722 @subsection CRIS Options
17723 @cindex CRIS Options
17724
17725 These options are defined specifically for the CRIS ports.
17726
17727 @table @gcctabopt
17728 @item -march=@var{architecture-type}
17729 @itemx -mcpu=@var{architecture-type}
17730 @opindex march
17731 @opindex mcpu
17732 Generate code for the specified architecture. The choices for
17733 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
17734 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
17735 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
17736 @samp{v10}.
17737
17738 @item -mtune=@var{architecture-type}
17739 @opindex mtune
17740 Tune to @var{architecture-type} everything applicable about the generated
17741 code, except for the ABI and the set of available instructions. The
17742 choices for @var{architecture-type} are the same as for
17743 @option{-march=@var{architecture-type}}.
17744
17745 @item -mmax-stack-frame=@var{n}
17746 @opindex mmax-stack-frame
17747 Warn when the stack frame of a function exceeds @var{n} bytes.
17748
17749 @item -metrax4
17750 @itemx -metrax100
17751 @opindex metrax4
17752 @opindex metrax100
17753 The options @option{-metrax4} and @option{-metrax100} are synonyms for
17754 @option{-march=v3} and @option{-march=v8} respectively.
17755
17756 @item -mmul-bug-workaround
17757 @itemx -mno-mul-bug-workaround
17758 @opindex mmul-bug-workaround
17759 @opindex mno-mul-bug-workaround
17760 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
17761 models where it applies. This option is active by default.
17762
17763 @item -mpdebug
17764 @opindex mpdebug
17765 Enable CRIS-specific verbose debug-related information in the assembly
17766 code. This option also has the effect of turning off the @samp{#NO_APP}
17767 formatted-code indicator to the assembler at the beginning of the
17768 assembly file.
17769
17770 @item -mcc-init
17771 @opindex mcc-init
17772 Do not use condition-code results from previous instruction; always emit
17773 compare and test instructions before use of condition codes.
17774
17775 @item -mno-side-effects
17776 @opindex mno-side-effects
17777 Do not emit instructions with side effects in addressing modes other than
17778 post-increment.
17779
17780 @item -mstack-align
17781 @itemx -mno-stack-align
17782 @itemx -mdata-align
17783 @itemx -mno-data-align
17784 @itemx -mconst-align
17785 @itemx -mno-const-align
17786 @opindex mstack-align
17787 @opindex mno-stack-align
17788 @opindex mdata-align
17789 @opindex mno-data-align
17790 @opindex mconst-align
17791 @opindex mno-const-align
17792 These options (@samp{no-} options) arrange (eliminate arrangements) for the
17793 stack frame, individual data and constants to be aligned for the maximum
17794 single data access size for the chosen CPU model. The default is to
17795 arrange for 32-bit alignment. ABI details such as structure layout are
17796 not affected by these options.
17797
17798 @item -m32-bit
17799 @itemx -m16-bit
17800 @itemx -m8-bit
17801 @opindex m32-bit
17802 @opindex m16-bit
17803 @opindex m8-bit
17804 Similar to the stack- data- and const-align options above, these options
17805 arrange for stack frame, writable data and constants to all be 32-bit,
17806 16-bit or 8-bit aligned. The default is 32-bit alignment.
17807
17808 @item -mno-prologue-epilogue
17809 @itemx -mprologue-epilogue
17810 @opindex mno-prologue-epilogue
17811 @opindex mprologue-epilogue
17812 With @option{-mno-prologue-epilogue}, the normal function prologue and
17813 epilogue which set up the stack frame are omitted and no return
17814 instructions or return sequences are generated in the code. Use this
17815 option only together with visual inspection of the compiled code: no
17816 warnings or errors are generated when call-saved registers must be saved,
17817 or storage for local variables needs to be allocated.
17818
17819 @item -mno-gotplt
17820 @itemx -mgotplt
17821 @opindex mno-gotplt
17822 @opindex mgotplt
17823 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
17824 instruction sequences that load addresses for functions from the PLT part
17825 of the GOT rather than (traditional on other architectures) calls to the
17826 PLT@. The default is @option{-mgotplt}.
17827
17828 @item -melf
17829 @opindex melf
17830 Legacy no-op option only recognized with the cris-axis-elf and
17831 cris-axis-linux-gnu targets.
17832
17833 @item -mlinux
17834 @opindex mlinux
17835 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
17836
17837 @item -sim
17838 @opindex sim
17839 This option, recognized for the cris-axis-elf, arranges
17840 to link with input-output functions from a simulator library. Code,
17841 initialized data and zero-initialized data are allocated consecutively.
17842
17843 @item -sim2
17844 @opindex sim2
17845 Like @option{-sim}, but pass linker options to locate initialized data at
17846 0x40000000 and zero-initialized data at 0x80000000.
17847 @end table
17848
17849 @node CR16 Options
17850 @subsection CR16 Options
17851 @cindex CR16 Options
17852
17853 These options are defined specifically for the CR16 ports.
17854
17855 @table @gcctabopt
17856
17857 @item -mmac
17858 @opindex mmac
17859 Enable the use of multiply-accumulate instructions. Disabled by default.
17860
17861 @item -mcr16cplus
17862 @itemx -mcr16c
17863 @opindex mcr16cplus
17864 @opindex mcr16c
17865 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
17866 is default.
17867
17868 @item -msim
17869 @opindex msim
17870 Links the library libsim.a which is in compatible with simulator. Applicable
17871 to ELF compiler only.
17872
17873 @item -mint32
17874 @opindex mint32
17875 Choose integer type as 32-bit wide.
17876
17877 @item -mbit-ops
17878 @opindex mbit-ops
17879 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
17880
17881 @item -mdata-model=@var{model}
17882 @opindex mdata-model
17883 Choose a data model. The choices for @var{model} are @samp{near},
17884 @samp{far} or @samp{medium}. @samp{medium} is default.
17885 However, @samp{far} is not valid with @option{-mcr16c}, as the
17886 CR16C architecture does not support the far data model.
17887 @end table
17888
17889 @node C-SKY Options
17890 @subsection C-SKY Options
17891 @cindex C-SKY Options
17892
17893 GCC supports these options when compiling for C-SKY V2 processors.
17894
17895 @table @gcctabopt
17896
17897 @item -march=@var{arch}
17898 @opindex march=
17899 Specify the C-SKY target architecture. Valid values for @var{arch} are:
17900 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
17901 The default is @samp{ck810}.
17902
17903 @item -mcpu=@var{cpu}
17904 @opindex mcpu=
17905 Specify the C-SKY target processor. Valid values for @var{cpu} are:
17906 @samp{ck801}, @samp{ck801t},
17907 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
17908 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
17909 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
17910 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
17911 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
17912 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
17913 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
17914 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
17915 @samp{ck803eftr1}, @samp{ck803efhtr1},
17916 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
17917 @samp{ck803sef}, @samp{ck803seft},
17918 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
17919 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
17920 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
17921 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
17922
17923 @item -mbig-endian
17924 @opindex mbig-endian
17925 @itemx -EB
17926 @opindex -EB
17927 @itemx -mlittle-endian
17928 @opindex mlittle-endian
17929 @itemx -EL
17930 @opindex -EL
17931
17932 Select big- or little-endian code. The default is little-endian.
17933
17934 @item -mhard-float
17935 @opindex mhard-float
17936 @itemx -msoft-float
17937 @opindex msoft-float
17938
17939 Select hardware or software floating-point implementations.
17940 The default is soft float.
17941
17942 @item -mdouble-float
17943 @itemx -mno-double-float
17944 @opindex mdouble-float
17945 When @option{-mhard-float} is in effect, enable generation of
17946 double-precision float instructions. This is the default except
17947 when compiling for CK803.
17948
17949 @item -mfdivdu
17950 @itemx -mno-fdivdu
17951 @opindex mfdivdu
17952 When @option{-mhard-float} is in effect, enable generation of
17953 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
17954 This is the default except when compiling for CK803.
17955
17956 @item -mfpu=@var{fpu}
17957 @opindex mfpu=
17958 Select the floating-point processor. This option can only be used with
17959 @option{-mhard-float}.
17960 Values for @var{fpu} are
17961 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
17962 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
17963 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
17964
17965 @item -melrw
17966 @itemx -mno-elrw
17967 @opindex melrw
17968 Enable the extended @code{lrw} instruction. This option defaults to on
17969 for CK801 and off otherwise.
17970
17971 @item -mistack
17972 @itemx -mno-istack
17973 @opindex mistack
17974 Enable interrupt stack instructions; the default is off.
17975
17976 The @option{-mistack} option is required to handle the
17977 @code{interrupt} and @code{isr} function attributes
17978 (@pxref{C-SKY Function Attributes}).
17979
17980 @item -mmp
17981 @opindex mmp
17982 Enable multiprocessor instructions; the default is off.
17983
17984 @item -mcp
17985 @opindex mcp
17986 Enable coprocessor instructions; the default is off.
17987
17988 @item -mcache
17989 @opindex mcache
17990 Enable coprocessor instructions; the default is off.
17991
17992 @item -msecurity
17993 @opindex msecurity
17994 Enable C-SKY security instructions; the default is off.
17995
17996 @item -mtrust
17997 @opindex mtrust
17998 Enable C-SKY trust instructions; the default is off.
17999
18000 @item -mdsp
18001 @opindex mdsp
18002 @itemx -medsp
18003 @opindex medsp
18004 @itemx -mvdsp
18005 @opindex mvdsp
18006 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
18007 All of these options default to off.
18008
18009 @item -mdiv
18010 @itemx -mno-div
18011 @opindex mdiv
18012 Generate divide instructions. Default is off.
18013
18014 @item -msmart
18015 @itemx -mno-smart
18016 @opindex msmart
18017 Generate code for Smart Mode, using only registers numbered 0-7 to allow
18018 use of 16-bit instructions. This option is ignored for CK801 where this
18019 is the required behavior, and it defaults to on for CK802.
18020 For other targets, the default is off.
18021
18022 @item -mhigh-registers
18023 @itemx -mno-high-registers
18024 @opindex mhigh-registers
18025 Generate code using the high registers numbered 16-31. This option
18026 is not supported on CK801, CK802, or CK803, and is enabled by default
18027 for other processors.
18028
18029 @item -manchor
18030 @itemx -mno-anchor
18031 @opindex manchor
18032 Generate code using global anchor symbol addresses.
18033
18034 @item -mpushpop
18035 @itemx -mno-pushpop
18036 @opindex mpushpop
18037 Generate code using @code{push} and @code{pop} instructions. This option
18038 defaults to on.
18039
18040 @item -mmultiple-stld
18041 @itemx -mstm
18042 @itemx -mno-multiple-stld
18043 @itemx -mno-stm
18044 @opindex mmultiple-stld
18045 Generate code using @code{stm} and @code{ldm} instructions. This option
18046 isn't supported on CK801 but is enabled by default on other processors.
18047
18048 @item -mconstpool
18049 @itemx -mno-constpool
18050 @opindex mconstpool
18051 Create constant pools in the compiler instead of deferring it to the
18052 assembler. This option is the default and required for correct code
18053 generation on CK801 and CK802, and is optional on other processors.
18054
18055 @item -mstack-size
18056 @item -mno-stack-size
18057 @opindex mstack-size
18058 Emit @code{.stack_size} directives for each function in the assembly
18059 output. This option defaults to off.
18060
18061 @item -mccrt
18062 @itemx -mno-ccrt
18063 @opindex mccrt
18064 Generate code for the C-SKY compiler runtime instead of libgcc. This
18065 option defaults to off.
18066
18067 @item -mbranch-cost=@var{n}
18068 @opindex mbranch-cost=
18069 Set the branch costs to roughly @code{n} instructions. The default is 1.
18070
18071 @item -msched-prolog
18072 @itemx -mno-sched-prolog
18073 @opindex msched-prolog
18074 Permit scheduling of function prologue and epilogue sequences. Using
18075 this option can result in code that is not compliant with the C-SKY V2 ABI
18076 prologue requirements and that cannot be debugged or backtraced.
18077 It is disabled by default.
18078
18079 @end table
18080
18081 @node Darwin Options
18082 @subsection Darwin Options
18083 @cindex Darwin options
18084
18085 These options are defined for all architectures running the Darwin operating
18086 system.
18087
18088 FSF GCC on Darwin does not create ``fat'' object files; it creates
18089 an object file for the single architecture that GCC was built to
18090 target. Apple's GCC on Darwin does create ``fat'' files if multiple
18091 @option{-arch} options are used; it does so by running the compiler or
18092 linker multiple times and joining the results together with
18093 @file{lipo}.
18094
18095 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
18096 @samp{i686}) is determined by the flags that specify the ISA
18097 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
18098 @option{-force_cpusubtype_ALL} option can be used to override this.
18099
18100 The Darwin tools vary in their behavior when presented with an ISA
18101 mismatch. The assembler, @file{as}, only permits instructions to
18102 be used that are valid for the subtype of the file it is generating,
18103 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
18104 The linker for shared libraries, @file{/usr/bin/libtool}, fails
18105 and prints an error if asked to create a shared library with a less
18106 restrictive subtype than its input files (for instance, trying to put
18107 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
18108 for executables, @command{ld}, quietly gives the executable the most
18109 restrictive subtype of any of its input files.
18110
18111 @table @gcctabopt
18112 @item -F@var{dir}
18113 @opindex F
18114 Add the framework directory @var{dir} to the head of the list of
18115 directories to be searched for header files. These directories are
18116 interleaved with those specified by @option{-I} options and are
18117 scanned in a left-to-right order.
18118
18119 A framework directory is a directory with frameworks in it. A
18120 framework is a directory with a @file{Headers} and/or
18121 @file{PrivateHeaders} directory contained directly in it that ends
18122 in @file{.framework}. The name of a framework is the name of this
18123 directory excluding the @file{.framework}. Headers associated with
18124 the framework are found in one of those two directories, with
18125 @file{Headers} being searched first. A subframework is a framework
18126 directory that is in a framework's @file{Frameworks} directory.
18127 Includes of subframework headers can only appear in a header of a
18128 framework that contains the subframework, or in a sibling subframework
18129 header. Two subframeworks are siblings if they occur in the same
18130 framework. A subframework should not have the same name as a
18131 framework; a warning is issued if this is violated. Currently a
18132 subframework cannot have subframeworks; in the future, the mechanism
18133 may be extended to support this. The standard frameworks can be found
18134 in @file{/System/Library/Frameworks} and
18135 @file{/Library/Frameworks}. An example include looks like
18136 @code{#include <Framework/header.h>}, where @file{Framework} denotes
18137 the name of the framework and @file{header.h} is found in the
18138 @file{PrivateHeaders} or @file{Headers} directory.
18139
18140 @item -iframework@var{dir}
18141 @opindex iframework
18142 Like @option{-F} except the directory is a treated as a system
18143 directory. The main difference between this @option{-iframework} and
18144 @option{-F} is that with @option{-iframework} the compiler does not
18145 warn about constructs contained within header files found via
18146 @var{dir}. This option is valid only for the C family of languages.
18147
18148 @item -gused
18149 @opindex gused
18150 Emit debugging information for symbols that are used. For stabs
18151 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
18152 This is by default ON@.
18153
18154 @item -gfull
18155 @opindex gfull
18156 Emit debugging information for all symbols and types.
18157
18158 @item -mmacosx-version-min=@var{version}
18159 The earliest version of MacOS X that this executable will run on
18160 is @var{version}. Typical values of @var{version} include @code{10.1},
18161 @code{10.2}, and @code{10.3.9}.
18162
18163 If the compiler was built to use the system's headers by default,
18164 then the default for this option is the system version on which the
18165 compiler is running, otherwise the default is to make choices that
18166 are compatible with as many systems and code bases as possible.
18167
18168 @item -mkernel
18169 @opindex mkernel
18170 Enable kernel development mode. The @option{-mkernel} option sets
18171 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
18172 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
18173 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
18174 applicable. This mode also sets @option{-mno-altivec},
18175 @option{-msoft-float}, @option{-fno-builtin} and
18176 @option{-mlong-branch} for PowerPC targets.
18177
18178 @item -mone-byte-bool
18179 @opindex mone-byte-bool
18180 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
18181 By default @code{sizeof(bool)} is @code{4} when compiling for
18182 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
18183 option has no effect on x86.
18184
18185 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
18186 to generate code that is not binary compatible with code generated
18187 without that switch. Using this switch may require recompiling all
18188 other modules in a program, including system libraries. Use this
18189 switch to conform to a non-default data model.
18190
18191 @item -mfix-and-continue
18192 @itemx -ffix-and-continue
18193 @itemx -findirect-data
18194 @opindex mfix-and-continue
18195 @opindex ffix-and-continue
18196 @opindex findirect-data
18197 Generate code suitable for fast turnaround development, such as to
18198 allow GDB to dynamically load @file{.o} files into already-running
18199 programs. @option{-findirect-data} and @option{-ffix-and-continue}
18200 are provided for backwards compatibility.
18201
18202 @item -all_load
18203 @opindex all_load
18204 Loads all members of static archive libraries.
18205 See man ld(1) for more information.
18206
18207 @item -arch_errors_fatal
18208 @opindex arch_errors_fatal
18209 Cause the errors having to do with files that have the wrong architecture
18210 to be fatal.
18211
18212 @item -bind_at_load
18213 @opindex bind_at_load
18214 Causes the output file to be marked such that the dynamic linker will
18215 bind all undefined references when the file is loaded or launched.
18216
18217 @item -bundle
18218 @opindex bundle
18219 Produce a Mach-o bundle format file.
18220 See man ld(1) for more information.
18221
18222 @item -bundle_loader @var{executable}
18223 @opindex bundle_loader
18224 This option specifies the @var{executable} that will load the build
18225 output file being linked. See man ld(1) for more information.
18226
18227 @item -dynamiclib
18228 @opindex dynamiclib
18229 When passed this option, GCC produces a dynamic library instead of
18230 an executable when linking, using the Darwin @file{libtool} command.
18231
18232 @item -force_cpusubtype_ALL
18233 @opindex force_cpusubtype_ALL
18234 This causes GCC's output file to have the @samp{ALL} subtype, instead of
18235 one controlled by the @option{-mcpu} or @option{-march} option.
18236
18237 @item -allowable_client @var{client_name}
18238 @itemx -client_name
18239 @itemx -compatibility_version
18240 @itemx -current_version
18241 @itemx -dead_strip
18242 @itemx -dependency-file
18243 @itemx -dylib_file
18244 @itemx -dylinker_install_name
18245 @itemx -dynamic
18246 @itemx -exported_symbols_list
18247 @itemx -filelist
18248 @need 800
18249 @itemx -flat_namespace
18250 @itemx -force_flat_namespace
18251 @itemx -headerpad_max_install_names
18252 @itemx -image_base
18253 @itemx -init
18254 @itemx -install_name
18255 @itemx -keep_private_externs
18256 @itemx -multi_module
18257 @itemx -multiply_defined
18258 @itemx -multiply_defined_unused
18259 @need 800
18260 @itemx -noall_load
18261 @itemx -no_dead_strip_inits_and_terms
18262 @itemx -nofixprebinding
18263 @itemx -nomultidefs
18264 @itemx -noprebind
18265 @itemx -noseglinkedit
18266 @itemx -pagezero_size
18267 @itemx -prebind
18268 @itemx -prebind_all_twolevel_modules
18269 @itemx -private_bundle
18270 @need 800
18271 @itemx -read_only_relocs
18272 @itemx -sectalign
18273 @itemx -sectobjectsymbols
18274 @itemx -whyload
18275 @itemx -seg1addr
18276 @itemx -sectcreate
18277 @itemx -sectobjectsymbols
18278 @itemx -sectorder
18279 @itemx -segaddr
18280 @itemx -segs_read_only_addr
18281 @need 800
18282 @itemx -segs_read_write_addr
18283 @itemx -seg_addr_table
18284 @itemx -seg_addr_table_filename
18285 @itemx -seglinkedit
18286 @itemx -segprot
18287 @itemx -segs_read_only_addr
18288 @itemx -segs_read_write_addr
18289 @itemx -single_module
18290 @itemx -static
18291 @itemx -sub_library
18292 @need 800
18293 @itemx -sub_umbrella
18294 @itemx -twolevel_namespace
18295 @itemx -umbrella
18296 @itemx -undefined
18297 @itemx -unexported_symbols_list
18298 @itemx -weak_reference_mismatches
18299 @itemx -whatsloaded
18300 @opindex allowable_client
18301 @opindex client_name
18302 @opindex compatibility_version
18303 @opindex current_version
18304 @opindex dead_strip
18305 @opindex dependency-file
18306 @opindex dylib_file
18307 @opindex dylinker_install_name
18308 @opindex dynamic
18309 @opindex exported_symbols_list
18310 @opindex filelist
18311 @opindex flat_namespace
18312 @opindex force_flat_namespace
18313 @opindex headerpad_max_install_names
18314 @opindex image_base
18315 @opindex init
18316 @opindex install_name
18317 @opindex keep_private_externs
18318 @opindex multi_module
18319 @opindex multiply_defined
18320 @opindex multiply_defined_unused
18321 @opindex noall_load
18322 @opindex no_dead_strip_inits_and_terms
18323 @opindex nofixprebinding
18324 @opindex nomultidefs
18325 @opindex noprebind
18326 @opindex noseglinkedit
18327 @opindex pagezero_size
18328 @opindex prebind
18329 @opindex prebind_all_twolevel_modules
18330 @opindex private_bundle
18331 @opindex read_only_relocs
18332 @opindex sectalign
18333 @opindex sectobjectsymbols
18334 @opindex whyload
18335 @opindex seg1addr
18336 @opindex sectcreate
18337 @opindex sectobjectsymbols
18338 @opindex sectorder
18339 @opindex segaddr
18340 @opindex segs_read_only_addr
18341 @opindex segs_read_write_addr
18342 @opindex seg_addr_table
18343 @opindex seg_addr_table_filename
18344 @opindex seglinkedit
18345 @opindex segprot
18346 @opindex segs_read_only_addr
18347 @opindex segs_read_write_addr
18348 @opindex single_module
18349 @opindex static
18350 @opindex sub_library
18351 @opindex sub_umbrella
18352 @opindex twolevel_namespace
18353 @opindex umbrella
18354 @opindex undefined
18355 @opindex unexported_symbols_list
18356 @opindex weak_reference_mismatches
18357 @opindex whatsloaded
18358 These options are passed to the Darwin linker. The Darwin linker man page
18359 describes them in detail.
18360 @end table
18361
18362 @node DEC Alpha Options
18363 @subsection DEC Alpha Options
18364
18365 These @samp{-m} options are defined for the DEC Alpha implementations:
18366
18367 @table @gcctabopt
18368 @item -mno-soft-float
18369 @itemx -msoft-float
18370 @opindex mno-soft-float
18371 @opindex msoft-float
18372 Use (do not use) the hardware floating-point instructions for
18373 floating-point operations. When @option{-msoft-float} is specified,
18374 functions in @file{libgcc.a} are used to perform floating-point
18375 operations. Unless they are replaced by routines that emulate the
18376 floating-point operations, or compiled in such a way as to call such
18377 emulations routines, these routines issue floating-point
18378 operations. If you are compiling for an Alpha without floating-point
18379 operations, you must ensure that the library is built so as not to call
18380 them.
18381
18382 Note that Alpha implementations without floating-point operations are
18383 required to have floating-point registers.
18384
18385 @item -mfp-reg
18386 @itemx -mno-fp-regs
18387 @opindex mfp-reg
18388 @opindex mno-fp-regs
18389 Generate code that uses (does not use) the floating-point register set.
18390 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
18391 register set is not used, floating-point operands are passed in integer
18392 registers as if they were integers and floating-point results are passed
18393 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
18394 so any function with a floating-point argument or return value called by code
18395 compiled with @option{-mno-fp-regs} must also be compiled with that
18396 option.
18397
18398 A typical use of this option is building a kernel that does not use,
18399 and hence need not save and restore, any floating-point registers.
18400
18401 @item -mieee
18402 @opindex mieee
18403 The Alpha architecture implements floating-point hardware optimized for
18404 maximum performance. It is mostly compliant with the IEEE floating-point
18405 standard. However, for full compliance, software assistance is
18406 required. This option generates code fully IEEE-compliant code
18407 @emph{except} that the @var{inexact-flag} is not maintained (see below).
18408 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
18409 defined during compilation. The resulting code is less efficient but is
18410 able to correctly support denormalized numbers and exceptional IEEE
18411 values such as not-a-number and plus/minus infinity. Other Alpha
18412 compilers call this option @option{-ieee_with_no_inexact}.
18413
18414 @item -mieee-with-inexact
18415 @opindex mieee-with-inexact
18416 This is like @option{-mieee} except the generated code also maintains
18417 the IEEE @var{inexact-flag}. Turning on this option causes the
18418 generated code to implement fully-compliant IEEE math. In addition to
18419 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
18420 macro. On some Alpha implementations the resulting code may execute
18421 significantly slower than the code generated by default. Since there is
18422 very little code that depends on the @var{inexact-flag}, you should
18423 normally not specify this option. Other Alpha compilers call this
18424 option @option{-ieee_with_inexact}.
18425
18426 @item -mfp-trap-mode=@var{trap-mode}
18427 @opindex mfp-trap-mode
18428 This option controls what floating-point related traps are enabled.
18429 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
18430 The trap mode can be set to one of four values:
18431
18432 @table @samp
18433 @item n
18434 This is the default (normal) setting. The only traps that are enabled
18435 are the ones that cannot be disabled in software (e.g., division by zero
18436 trap).
18437
18438 @item u
18439 In addition to the traps enabled by @samp{n}, underflow traps are enabled
18440 as well.
18441
18442 @item su
18443 Like @samp{u}, but the instructions are marked to be safe for software
18444 completion (see Alpha architecture manual for details).
18445
18446 @item sui
18447 Like @samp{su}, but inexact traps are enabled as well.
18448 @end table
18449
18450 @item -mfp-rounding-mode=@var{rounding-mode}
18451 @opindex mfp-rounding-mode
18452 Selects the IEEE rounding mode. Other Alpha compilers call this option
18453 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
18454 of:
18455
18456 @table @samp
18457 @item n
18458 Normal IEEE rounding mode. Floating-point numbers are rounded towards
18459 the nearest machine number or towards the even machine number in case
18460 of a tie.
18461
18462 @item m
18463 Round towards minus infinity.
18464
18465 @item c
18466 Chopped rounding mode. Floating-point numbers are rounded towards zero.
18467
18468 @item d
18469 Dynamic rounding mode. A field in the floating-point control register
18470 (@var{fpcr}, see Alpha architecture reference manual) controls the
18471 rounding mode in effect. The C library initializes this register for
18472 rounding towards plus infinity. Thus, unless your program modifies the
18473 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
18474 @end table
18475
18476 @item -mtrap-precision=@var{trap-precision}
18477 @opindex mtrap-precision
18478 In the Alpha architecture, floating-point traps are imprecise. This
18479 means without software assistance it is impossible to recover from a
18480 floating trap and program execution normally needs to be terminated.
18481 GCC can generate code that can assist operating system trap handlers
18482 in determining the exact location that caused a floating-point trap.
18483 Depending on the requirements of an application, different levels of
18484 precisions can be selected:
18485
18486 @table @samp
18487 @item p
18488 Program precision. This option is the default and means a trap handler
18489 can only identify which program caused a floating-point exception.
18490
18491 @item f
18492 Function precision. The trap handler can determine the function that
18493 caused a floating-point exception.
18494
18495 @item i
18496 Instruction precision. The trap handler can determine the exact
18497 instruction that caused a floating-point exception.
18498 @end table
18499
18500 Other Alpha compilers provide the equivalent options called
18501 @option{-scope_safe} and @option{-resumption_safe}.
18502
18503 @item -mieee-conformant
18504 @opindex mieee-conformant
18505 This option marks the generated code as IEEE conformant. You must not
18506 use this option unless you also specify @option{-mtrap-precision=i} and either
18507 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
18508 is to emit the line @samp{.eflag 48} in the function prologue of the
18509 generated assembly file.
18510
18511 @item -mbuild-constants
18512 @opindex mbuild-constants
18513 Normally GCC examines a 32- or 64-bit integer constant to
18514 see if it can construct it from smaller constants in two or three
18515 instructions. If it cannot, it outputs the constant as a literal and
18516 generates code to load it from the data segment at run time.
18517
18518 Use this option to require GCC to construct @emph{all} integer constants
18519 using code, even if it takes more instructions (the maximum is six).
18520
18521 You typically use this option to build a shared library dynamic
18522 loader. Itself a shared library, it must relocate itself in memory
18523 before it can find the variables and constants in its own data segment.
18524
18525 @item -mbwx
18526 @itemx -mno-bwx
18527 @itemx -mcix
18528 @itemx -mno-cix
18529 @itemx -mfix
18530 @itemx -mno-fix
18531 @itemx -mmax
18532 @itemx -mno-max
18533 @opindex mbwx
18534 @opindex mno-bwx
18535 @opindex mcix
18536 @opindex mno-cix
18537 @opindex mfix
18538 @opindex mno-fix
18539 @opindex mmax
18540 @opindex mno-max
18541 Indicate whether GCC should generate code to use the optional BWX,
18542 CIX, FIX and MAX instruction sets. The default is to use the instruction
18543 sets supported by the CPU type specified via @option{-mcpu=} option or that
18544 of the CPU on which GCC was built if none is specified.
18545
18546 @item -mfloat-vax
18547 @itemx -mfloat-ieee
18548 @opindex mfloat-vax
18549 @opindex mfloat-ieee
18550 Generate code that uses (does not use) VAX F and G floating-point
18551 arithmetic instead of IEEE single and double precision.
18552
18553 @item -mexplicit-relocs
18554 @itemx -mno-explicit-relocs
18555 @opindex mexplicit-relocs
18556 @opindex mno-explicit-relocs
18557 Older Alpha assemblers provided no way to generate symbol relocations
18558 except via assembler macros. Use of these macros does not allow
18559 optimal instruction scheduling. GNU binutils as of version 2.12
18560 supports a new syntax that allows the compiler to explicitly mark
18561 which relocations should apply to which instructions. This option
18562 is mostly useful for debugging, as GCC detects the capabilities of
18563 the assembler when it is built and sets the default accordingly.
18564
18565 @item -msmall-data
18566 @itemx -mlarge-data
18567 @opindex msmall-data
18568 @opindex mlarge-data
18569 When @option{-mexplicit-relocs} is in effect, static data is
18570 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
18571 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
18572 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
18573 16-bit relocations off of the @code{$gp} register. This limits the
18574 size of the small data area to 64KB, but allows the variables to be
18575 directly accessed via a single instruction.
18576
18577 The default is @option{-mlarge-data}. With this option the data area
18578 is limited to just below 2GB@. Programs that require more than 2GB of
18579 data must use @code{malloc} or @code{mmap} to allocate the data in the
18580 heap instead of in the program's data segment.
18581
18582 When generating code for shared libraries, @option{-fpic} implies
18583 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
18584
18585 @item -msmall-text
18586 @itemx -mlarge-text
18587 @opindex msmall-text
18588 @opindex mlarge-text
18589 When @option{-msmall-text} is used, the compiler assumes that the
18590 code of the entire program (or shared library) fits in 4MB, and is
18591 thus reachable with a branch instruction. When @option{-msmall-data}
18592 is used, the compiler can assume that all local symbols share the
18593 same @code{$gp} value, and thus reduce the number of instructions
18594 required for a function call from 4 to 1.
18595
18596 The default is @option{-mlarge-text}.
18597
18598 @item -mcpu=@var{cpu_type}
18599 @opindex mcpu
18600 Set the instruction set and instruction scheduling parameters for
18601 machine type @var{cpu_type}. You can specify either the @samp{EV}
18602 style name or the corresponding chip number. GCC supports scheduling
18603 parameters for the EV4, EV5 and EV6 family of processors and
18604 chooses the default values for the instruction set from the processor
18605 you specify. If you do not specify a processor type, GCC defaults
18606 to the processor on which the compiler was built.
18607
18608 Supported values for @var{cpu_type} are
18609
18610 @table @samp
18611 @item ev4
18612 @itemx ev45
18613 @itemx 21064
18614 Schedules as an EV4 and has no instruction set extensions.
18615
18616 @item ev5
18617 @itemx 21164
18618 Schedules as an EV5 and has no instruction set extensions.
18619
18620 @item ev56
18621 @itemx 21164a
18622 Schedules as an EV5 and supports the BWX extension.
18623
18624 @item pca56
18625 @itemx 21164pc
18626 @itemx 21164PC
18627 Schedules as an EV5 and supports the BWX and MAX extensions.
18628
18629 @item ev6
18630 @itemx 21264
18631 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
18632
18633 @item ev67
18634 @itemx 21264a
18635 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
18636 @end table
18637
18638 Native toolchains also support the value @samp{native},
18639 which selects the best architecture option for the host processor.
18640 @option{-mcpu=native} has no effect if GCC does not recognize
18641 the processor.
18642
18643 @item -mtune=@var{cpu_type}
18644 @opindex mtune
18645 Set only the instruction scheduling parameters for machine type
18646 @var{cpu_type}. The instruction set is not changed.
18647
18648 Native toolchains also support the value @samp{native},
18649 which selects the best architecture option for the host processor.
18650 @option{-mtune=native} has no effect if GCC does not recognize
18651 the processor.
18652
18653 @item -mmemory-latency=@var{time}
18654 @opindex mmemory-latency
18655 Sets the latency the scheduler should assume for typical memory
18656 references as seen by the application. This number is highly
18657 dependent on the memory access patterns used by the application
18658 and the size of the external cache on the machine.
18659
18660 Valid options for @var{time} are
18661
18662 @table @samp
18663 @item @var{number}
18664 A decimal number representing clock cycles.
18665
18666 @item L1
18667 @itemx L2
18668 @itemx L3
18669 @itemx main
18670 The compiler contains estimates of the number of clock cycles for
18671 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
18672 (also called Dcache, Scache, and Bcache), as well as to main memory.
18673 Note that L3 is only valid for EV5.
18674
18675 @end table
18676 @end table
18677
18678 @node FR30 Options
18679 @subsection FR30 Options
18680 @cindex FR30 Options
18681
18682 These options are defined specifically for the FR30 port.
18683
18684 @table @gcctabopt
18685
18686 @item -msmall-model
18687 @opindex msmall-model
18688 Use the small address space model. This can produce smaller code, but
18689 it does assume that all symbolic values and addresses fit into a
18690 20-bit range.
18691
18692 @item -mno-lsim
18693 @opindex mno-lsim
18694 Assume that runtime support has been provided and so there is no need
18695 to include the simulator library (@file{libsim.a}) on the linker
18696 command line.
18697
18698 @end table
18699
18700 @node FT32 Options
18701 @subsection FT32 Options
18702 @cindex FT32 Options
18703
18704 These options are defined specifically for the FT32 port.
18705
18706 @table @gcctabopt
18707
18708 @item -msim
18709 @opindex msim
18710 Specifies that the program will be run on the simulator. This causes
18711 an alternate runtime startup and library to be linked.
18712 You must not use this option when generating programs that will run on
18713 real hardware; you must provide your own runtime library for whatever
18714 I/O functions are needed.
18715
18716 @item -mlra
18717 @opindex mlra
18718 Enable Local Register Allocation. This is still experimental for FT32,
18719 so by default the compiler uses standard reload.
18720
18721 @item -mnodiv
18722 @opindex mnodiv
18723 Do not use div and mod instructions.
18724
18725 @item -mft32b
18726 @opindex mft32b
18727 Enable use of the extended instructions of the FT32B processor.
18728
18729 @item -mcompress
18730 @opindex mcompress
18731 Compress all code using the Ft32B code compression scheme.
18732
18733 @item -mnopm
18734 @opindex mnopm
18735 Do not generate code that reads program memory.
18736
18737 @end table
18738
18739 @node FRV Options
18740 @subsection FRV Options
18741 @cindex FRV Options
18742
18743 @table @gcctabopt
18744 @item -mgpr-32
18745 @opindex mgpr-32
18746
18747 Only use the first 32 general-purpose registers.
18748
18749 @item -mgpr-64
18750 @opindex mgpr-64
18751
18752 Use all 64 general-purpose registers.
18753
18754 @item -mfpr-32
18755 @opindex mfpr-32
18756
18757 Use only the first 32 floating-point registers.
18758
18759 @item -mfpr-64
18760 @opindex mfpr-64
18761
18762 Use all 64 floating-point registers.
18763
18764 @item -mhard-float
18765 @opindex mhard-float
18766
18767 Use hardware instructions for floating-point operations.
18768
18769 @item -msoft-float
18770 @opindex msoft-float
18771
18772 Use library routines for floating-point operations.
18773
18774 @item -malloc-cc
18775 @opindex malloc-cc
18776
18777 Dynamically allocate condition code registers.
18778
18779 @item -mfixed-cc
18780 @opindex mfixed-cc
18781
18782 Do not try to dynamically allocate condition code registers, only
18783 use @code{icc0} and @code{fcc0}.
18784
18785 @item -mdword
18786 @opindex mdword
18787
18788 Change ABI to use double word insns.
18789
18790 @item -mno-dword
18791 @opindex mno-dword
18792
18793 Do not use double word instructions.
18794
18795 @item -mdouble
18796 @opindex mdouble
18797
18798 Use floating-point double instructions.
18799
18800 @item -mno-double
18801 @opindex mno-double
18802
18803 Do not use floating-point double instructions.
18804
18805 @item -mmedia
18806 @opindex mmedia
18807
18808 Use media instructions.
18809
18810 @item -mno-media
18811 @opindex mno-media
18812
18813 Do not use media instructions.
18814
18815 @item -mmuladd
18816 @opindex mmuladd
18817
18818 Use multiply and add/subtract instructions.
18819
18820 @item -mno-muladd
18821 @opindex mno-muladd
18822
18823 Do not use multiply and add/subtract instructions.
18824
18825 @item -mfdpic
18826 @opindex mfdpic
18827
18828 Select the FDPIC ABI, which uses function descriptors to represent
18829 pointers to functions. Without any PIC/PIE-related options, it
18830 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
18831 assumes GOT entries and small data are within a 12-bit range from the
18832 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
18833 are computed with 32 bits.
18834 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18835
18836 @item -minline-plt
18837 @opindex minline-plt
18838
18839 Enable inlining of PLT entries in function calls to functions that are
18840 not known to bind locally. It has no effect without @option{-mfdpic}.
18841 It's enabled by default if optimizing for speed and compiling for
18842 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
18843 optimization option such as @option{-O3} or above is present in the
18844 command line.
18845
18846 @item -mTLS
18847 @opindex mTLS
18848
18849 Assume a large TLS segment when generating thread-local code.
18850
18851 @item -mtls
18852 @opindex mtls
18853
18854 Do not assume a large TLS segment when generating thread-local code.
18855
18856 @item -mgprel-ro
18857 @opindex mgprel-ro
18858
18859 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
18860 that is known to be in read-only sections. It's enabled by default,
18861 except for @option{-fpic} or @option{-fpie}: even though it may help
18862 make the global offset table smaller, it trades 1 instruction for 4.
18863 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
18864 one of which may be shared by multiple symbols, and it avoids the need
18865 for a GOT entry for the referenced symbol, so it's more likely to be a
18866 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
18867
18868 @item -multilib-library-pic
18869 @opindex multilib-library-pic
18870
18871 Link with the (library, not FD) pic libraries. It's implied by
18872 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
18873 @option{-fpic} without @option{-mfdpic}. You should never have to use
18874 it explicitly.
18875
18876 @item -mlinked-fp
18877 @opindex mlinked-fp
18878
18879 Follow the EABI requirement of always creating a frame pointer whenever
18880 a stack frame is allocated. This option is enabled by default and can
18881 be disabled with @option{-mno-linked-fp}.
18882
18883 @item -mlong-calls
18884 @opindex mlong-calls
18885
18886 Use indirect addressing to call functions outside the current
18887 compilation unit. This allows the functions to be placed anywhere
18888 within the 32-bit address space.
18889
18890 @item -malign-labels
18891 @opindex malign-labels
18892
18893 Try to align labels to an 8-byte boundary by inserting NOPs into the
18894 previous packet. This option only has an effect when VLIW packing
18895 is enabled. It doesn't create new packets; it merely adds NOPs to
18896 existing ones.
18897
18898 @item -mlibrary-pic
18899 @opindex mlibrary-pic
18900
18901 Generate position-independent EABI code.
18902
18903 @item -macc-4
18904 @opindex macc-4
18905
18906 Use only the first four media accumulator registers.
18907
18908 @item -macc-8
18909 @opindex macc-8
18910
18911 Use all eight media accumulator registers.
18912
18913 @item -mpack
18914 @opindex mpack
18915
18916 Pack VLIW instructions.
18917
18918 @item -mno-pack
18919 @opindex mno-pack
18920
18921 Do not pack VLIW instructions.
18922
18923 @item -mno-eflags
18924 @opindex mno-eflags
18925
18926 Do not mark ABI switches in e_flags.
18927
18928 @item -mcond-move
18929 @opindex mcond-move
18930
18931 Enable the use of conditional-move instructions (default).
18932
18933 This switch is mainly for debugging the compiler and will likely be removed
18934 in a future version.
18935
18936 @item -mno-cond-move
18937 @opindex mno-cond-move
18938
18939 Disable the use of conditional-move instructions.
18940
18941 This switch is mainly for debugging the compiler and will likely be removed
18942 in a future version.
18943
18944 @item -mscc
18945 @opindex mscc
18946
18947 Enable the use of conditional set instructions (default).
18948
18949 This switch is mainly for debugging the compiler and will likely be removed
18950 in a future version.
18951
18952 @item -mno-scc
18953 @opindex mno-scc
18954
18955 Disable the use of conditional set instructions.
18956
18957 This switch is mainly for debugging the compiler and will likely be removed
18958 in a future version.
18959
18960 @item -mcond-exec
18961 @opindex mcond-exec
18962
18963 Enable the use of conditional execution (default).
18964
18965 This switch is mainly for debugging the compiler and will likely be removed
18966 in a future version.
18967
18968 @item -mno-cond-exec
18969 @opindex mno-cond-exec
18970
18971 Disable the use of conditional execution.
18972
18973 This switch is mainly for debugging the compiler and will likely be removed
18974 in a future version.
18975
18976 @item -mvliw-branch
18977 @opindex mvliw-branch
18978
18979 Run a pass to pack branches into VLIW instructions (default).
18980
18981 This switch is mainly for debugging the compiler and will likely be removed
18982 in a future version.
18983
18984 @item -mno-vliw-branch
18985 @opindex mno-vliw-branch
18986
18987 Do not run a pass to pack branches into VLIW instructions.
18988
18989 This switch is mainly for debugging the compiler and will likely be removed
18990 in a future version.
18991
18992 @item -mmulti-cond-exec
18993 @opindex mmulti-cond-exec
18994
18995 Enable optimization of @code{&&} and @code{||} in conditional execution
18996 (default).
18997
18998 This switch is mainly for debugging the compiler and will likely be removed
18999 in a future version.
19000
19001 @item -mno-multi-cond-exec
19002 @opindex mno-multi-cond-exec
19003
19004 Disable optimization of @code{&&} and @code{||} in conditional execution.
19005
19006 This switch is mainly for debugging the compiler and will likely be removed
19007 in a future version.
19008
19009 @item -mnested-cond-exec
19010 @opindex mnested-cond-exec
19011
19012 Enable nested conditional execution optimizations (default).
19013
19014 This switch is mainly for debugging the compiler and will likely be removed
19015 in a future version.
19016
19017 @item -mno-nested-cond-exec
19018 @opindex mno-nested-cond-exec
19019
19020 Disable nested conditional execution optimizations.
19021
19022 This switch is mainly for debugging the compiler and will likely be removed
19023 in a future version.
19024
19025 @item -moptimize-membar
19026 @opindex moptimize-membar
19027
19028 This switch removes redundant @code{membar} instructions from the
19029 compiler-generated code. It is enabled by default.
19030
19031 @item -mno-optimize-membar
19032 @opindex mno-optimize-membar
19033
19034 This switch disables the automatic removal of redundant @code{membar}
19035 instructions from the generated code.
19036
19037 @item -mtomcat-stats
19038 @opindex mtomcat-stats
19039
19040 Cause gas to print out tomcat statistics.
19041
19042 @item -mcpu=@var{cpu}
19043 @opindex mcpu
19044
19045 Select the processor type for which to generate code. Possible values are
19046 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
19047 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
19048
19049 @end table
19050
19051 @node GNU/Linux Options
19052 @subsection GNU/Linux Options
19053
19054 These @samp{-m} options are defined for GNU/Linux targets:
19055
19056 @table @gcctabopt
19057 @item -mglibc
19058 @opindex mglibc
19059 Use the GNU C library. This is the default except
19060 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
19061 @samp{*-*-linux-*android*} targets.
19062
19063 @item -muclibc
19064 @opindex muclibc
19065 Use uClibc C library. This is the default on
19066 @samp{*-*-linux-*uclibc*} targets.
19067
19068 @item -mmusl
19069 @opindex mmusl
19070 Use the musl C library. This is the default on
19071 @samp{*-*-linux-*musl*} targets.
19072
19073 @item -mbionic
19074 @opindex mbionic
19075 Use Bionic C library. This is the default on
19076 @samp{*-*-linux-*android*} targets.
19077
19078 @item -mandroid
19079 @opindex mandroid
19080 Compile code compatible with Android platform. This is the default on
19081 @samp{*-*-linux-*android*} targets.
19082
19083 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
19084 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
19085 this option makes the GCC driver pass Android-specific options to the linker.
19086 Finally, this option causes the preprocessor macro @code{__ANDROID__}
19087 to be defined.
19088
19089 @item -tno-android-cc
19090 @opindex tno-android-cc
19091 Disable compilation effects of @option{-mandroid}, i.e., do not enable
19092 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
19093 @option{-fno-rtti} by default.
19094
19095 @item -tno-android-ld
19096 @opindex tno-android-ld
19097 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
19098 linking options to the linker.
19099
19100 @end table
19101
19102 @node H8/300 Options
19103 @subsection H8/300 Options
19104
19105 These @samp{-m} options are defined for the H8/300 implementations:
19106
19107 @table @gcctabopt
19108 @item -mrelax
19109 @opindex mrelax
19110 Shorten some address references at link time, when possible; uses the
19111 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
19112 ld, Using ld}, for a fuller description.
19113
19114 @item -mh
19115 @opindex mh
19116 Generate code for the H8/300H@.
19117
19118 @item -ms
19119 @opindex ms
19120 Generate code for the H8S@.
19121
19122 @item -mn
19123 @opindex mn
19124 Generate code for the H8S and H8/300H in the normal mode. This switch
19125 must be used either with @option{-mh} or @option{-ms}.
19126
19127 @item -ms2600
19128 @opindex ms2600
19129 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
19130
19131 @item -mexr
19132 @opindex mexr
19133 Extended registers are stored on stack before execution of function
19134 with monitor attribute. Default option is @option{-mexr}.
19135 This option is valid only for H8S targets.
19136
19137 @item -mno-exr
19138 @opindex mno-exr
19139 Extended registers are not stored on stack before execution of function
19140 with monitor attribute. Default option is @option{-mno-exr}.
19141 This option is valid only for H8S targets.
19142
19143 @item -mint32
19144 @opindex mint32
19145 Make @code{int} data 32 bits by default.
19146
19147 @item -malign-300
19148 @opindex malign-300
19149 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
19150 The default for the H8/300H and H8S is to align longs and floats on
19151 4-byte boundaries.
19152 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
19153 This option has no effect on the H8/300.
19154 @end table
19155
19156 @node HPPA Options
19157 @subsection HPPA Options
19158 @cindex HPPA Options
19159
19160 These @samp{-m} options are defined for the HPPA family of computers:
19161
19162 @table @gcctabopt
19163 @item -march=@var{architecture-type}
19164 @opindex march
19165 Generate code for the specified architecture. The choices for
19166 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
19167 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
19168 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
19169 architecture option for your machine. Code compiled for lower numbered
19170 architectures runs on higher numbered architectures, but not the
19171 other way around.
19172
19173 @item -mpa-risc-1-0
19174 @itemx -mpa-risc-1-1
19175 @itemx -mpa-risc-2-0
19176 @opindex mpa-risc-1-0
19177 @opindex mpa-risc-1-1
19178 @opindex mpa-risc-2-0
19179 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
19180
19181 @item -mcaller-copies
19182 @opindex mcaller-copies
19183 The caller copies function arguments passed by hidden reference. This
19184 option should be used with care as it is not compatible with the default
19185 32-bit runtime. However, only aggregates larger than eight bytes are
19186 passed by hidden reference and the option provides better compatibility
19187 with OpenMP.
19188
19189 @item -mjump-in-delay
19190 @opindex mjump-in-delay
19191 This option is ignored and provided for compatibility purposes only.
19192
19193 @item -mdisable-fpregs
19194 @opindex mdisable-fpregs
19195 Prevent floating-point registers from being used in any manner. This is
19196 necessary for compiling kernels that perform lazy context switching of
19197 floating-point registers. If you use this option and attempt to perform
19198 floating-point operations, the compiler aborts.
19199
19200 @item -mdisable-indexing
19201 @opindex mdisable-indexing
19202 Prevent the compiler from using indexing address modes. This avoids some
19203 rather obscure problems when compiling MIG generated code under MACH@.
19204
19205 @item -mno-space-regs
19206 @opindex mno-space-regs
19207 Generate code that assumes the target has no space registers. This allows
19208 GCC to generate faster indirect calls and use unscaled index address modes.
19209
19210 Such code is suitable for level 0 PA systems and kernels.
19211
19212 @item -mfast-indirect-calls
19213 @opindex mfast-indirect-calls
19214 Generate code that assumes calls never cross space boundaries. This
19215 allows GCC to emit code that performs faster indirect calls.
19216
19217 This option does not work in the presence of shared libraries or nested
19218 functions.
19219
19220 @item -mfixed-range=@var{register-range}
19221 @opindex mfixed-range
19222 Generate code treating the given register range as fixed registers.
19223 A fixed register is one that the register allocator cannot use. This is
19224 useful when compiling kernel code. A register range is specified as
19225 two registers separated by a dash. Multiple register ranges can be
19226 specified separated by a comma.
19227
19228 @item -mlong-load-store
19229 @opindex mlong-load-store
19230 Generate 3-instruction load and store sequences as sometimes required by
19231 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
19232 the HP compilers.
19233
19234 @item -mportable-runtime
19235 @opindex mportable-runtime
19236 Use the portable calling conventions proposed by HP for ELF systems.
19237
19238 @item -mgas
19239 @opindex mgas
19240 Enable the use of assembler directives only GAS understands.
19241
19242 @item -mschedule=@var{cpu-type}
19243 @opindex mschedule
19244 Schedule code according to the constraints for the machine type
19245 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
19246 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
19247 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
19248 proper scheduling option for your machine. The default scheduling is
19249 @samp{8000}.
19250
19251 @item -mlinker-opt
19252 @opindex mlinker-opt
19253 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
19254 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
19255 linkers in which they give bogus error messages when linking some programs.
19256
19257 @item -msoft-float
19258 @opindex msoft-float
19259 Generate output containing library calls for floating point.
19260 @strong{Warning:} the requisite libraries are not available for all HPPA
19261 targets. Normally the facilities of the machine's usual C compiler are
19262 used, but this cannot be done directly in cross-compilation. You must make
19263 your own arrangements to provide suitable library functions for
19264 cross-compilation.
19265
19266 @option{-msoft-float} changes the calling convention in the output file;
19267 therefore, it is only useful if you compile @emph{all} of a program with
19268 this option. In particular, you need to compile @file{libgcc.a}, the
19269 library that comes with GCC, with @option{-msoft-float} in order for
19270 this to work.
19271
19272 @item -msio
19273 @opindex msio
19274 Generate the predefine, @code{_SIO}, for server IO@. The default is
19275 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
19276 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
19277 options are available under HP-UX and HI-UX@.
19278
19279 @item -mgnu-ld
19280 @opindex mgnu-ld
19281 Use options specific to GNU @command{ld}.
19282 This passes @option{-shared} to @command{ld} when
19283 building a shared library. It is the default when GCC is configured,
19284 explicitly or implicitly, with the GNU linker. This option does not
19285 affect which @command{ld} is called; it only changes what parameters
19286 are passed to that @command{ld}.
19287 The @command{ld} that is called is determined by the
19288 @option{--with-ld} configure option, GCC's program search path, and
19289 finally by the user's @env{PATH}. The linker used by GCC can be printed
19290 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
19291 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19292
19293 @item -mhp-ld
19294 @opindex mhp-ld
19295 Use options specific to HP @command{ld}.
19296 This passes @option{-b} to @command{ld} when building
19297 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
19298 links. It is the default when GCC is configured, explicitly or
19299 implicitly, with the HP linker. This option does not affect
19300 which @command{ld} is called; it only changes what parameters are passed to that
19301 @command{ld}.
19302 The @command{ld} that is called is determined by the @option{--with-ld}
19303 configure option, GCC's program search path, and finally by the user's
19304 @env{PATH}. The linker used by GCC can be printed using @samp{which
19305 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
19306 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
19307
19308 @item -mlong-calls
19309 @opindex mno-long-calls
19310 Generate code that uses long call sequences. This ensures that a call
19311 is always able to reach linker generated stubs. The default is to generate
19312 long calls only when the distance from the call site to the beginning
19313 of the function or translation unit, as the case may be, exceeds a
19314 predefined limit set by the branch type being used. The limits for
19315 normal calls are 7,600,000 and 240,000 bytes, respectively for the
19316 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
19317 240,000 bytes.
19318
19319 Distances are measured from the beginning of functions when using the
19320 @option{-ffunction-sections} option, or when using the @option{-mgas}
19321 and @option{-mno-portable-runtime} options together under HP-UX with
19322 the SOM linker.
19323
19324 It is normally not desirable to use this option as it degrades
19325 performance. However, it may be useful in large applications,
19326 particularly when partial linking is used to build the application.
19327
19328 The types of long calls used depends on the capabilities of the
19329 assembler and linker, and the type of code being generated. The
19330 impact on systems that support long absolute calls, and long pic
19331 symbol-difference or pc-relative calls should be relatively small.
19332 However, an indirect call is used on 32-bit ELF systems in pic code
19333 and it is quite long.
19334
19335 @item -munix=@var{unix-std}
19336 @opindex march
19337 Generate compiler predefines and select a startfile for the specified
19338 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
19339 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
19340 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
19341 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
19342 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
19343 and later.
19344
19345 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
19346 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
19347 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
19348 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
19349 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
19350 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
19351
19352 It is @emph{important} to note that this option changes the interfaces
19353 for various library routines. It also affects the operational behavior
19354 of the C library. Thus, @emph{extreme} care is needed in using this
19355 option.
19356
19357 Library code that is intended to operate with more than one UNIX
19358 standard must test, set and restore the variable @code{__xpg4_extended_mask}
19359 as appropriate. Most GNU software doesn't provide this capability.
19360
19361 @item -nolibdld
19362 @opindex nolibdld
19363 Suppress the generation of link options to search libdld.sl when the
19364 @option{-static} option is specified on HP-UX 10 and later.
19365
19366 @item -static
19367 @opindex static
19368 The HP-UX implementation of setlocale in libc has a dependency on
19369 libdld.sl. There isn't an archive version of libdld.sl. Thus,
19370 when the @option{-static} option is specified, special link options
19371 are needed to resolve this dependency.
19372
19373 On HP-UX 10 and later, the GCC driver adds the necessary options to
19374 link with libdld.sl when the @option{-static} option is specified.
19375 This causes the resulting binary to be dynamic. On the 64-bit port,
19376 the linkers generate dynamic binaries by default in any case. The
19377 @option{-nolibdld} option can be used to prevent the GCC driver from
19378 adding these link options.
19379
19380 @item -threads
19381 @opindex threads
19382 Add support for multithreading with the @dfn{dce thread} library
19383 under HP-UX@. This option sets flags for both the preprocessor and
19384 linker.
19385 @end table
19386
19387 @node IA-64 Options
19388 @subsection IA-64 Options
19389 @cindex IA-64 Options
19390
19391 These are the @samp{-m} options defined for the Intel IA-64 architecture.
19392
19393 @table @gcctabopt
19394 @item -mbig-endian
19395 @opindex mbig-endian
19396 Generate code for a big-endian target. This is the default for HP-UX@.
19397
19398 @item -mlittle-endian
19399 @opindex mlittle-endian
19400 Generate code for a little-endian target. This is the default for AIX5
19401 and GNU/Linux.
19402
19403 @item -mgnu-as
19404 @itemx -mno-gnu-as
19405 @opindex mgnu-as
19406 @opindex mno-gnu-as
19407 Generate (or don't) code for the GNU assembler. This is the default.
19408 @c Also, this is the default if the configure option @option{--with-gnu-as}
19409 @c is used.
19410
19411 @item -mgnu-ld
19412 @itemx -mno-gnu-ld
19413 @opindex mgnu-ld
19414 @opindex mno-gnu-ld
19415 Generate (or don't) code for the GNU linker. This is the default.
19416 @c Also, this is the default if the configure option @option{--with-gnu-ld}
19417 @c is used.
19418
19419 @item -mno-pic
19420 @opindex mno-pic
19421 Generate code that does not use a global pointer register. The result
19422 is not position independent code, and violates the IA-64 ABI@.
19423
19424 @item -mvolatile-asm-stop
19425 @itemx -mno-volatile-asm-stop
19426 @opindex mvolatile-asm-stop
19427 @opindex mno-volatile-asm-stop
19428 Generate (or don't) a stop bit immediately before and after volatile asm
19429 statements.
19430
19431 @item -mregister-names
19432 @itemx -mno-register-names
19433 @opindex mregister-names
19434 @opindex mno-register-names
19435 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
19436 the stacked registers. This may make assembler output more readable.
19437
19438 @item -mno-sdata
19439 @itemx -msdata
19440 @opindex mno-sdata
19441 @opindex msdata
19442 Disable (or enable) optimizations that use the small data section. This may
19443 be useful for working around optimizer bugs.
19444
19445 @item -mconstant-gp
19446 @opindex mconstant-gp
19447 Generate code that uses a single constant global pointer value. This is
19448 useful when compiling kernel code.
19449
19450 @item -mauto-pic
19451 @opindex mauto-pic
19452 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
19453 This is useful when compiling firmware code.
19454
19455 @item -minline-float-divide-min-latency
19456 @opindex minline-float-divide-min-latency
19457 Generate code for inline divides of floating-point values
19458 using the minimum latency algorithm.
19459
19460 @item -minline-float-divide-max-throughput
19461 @opindex minline-float-divide-max-throughput
19462 Generate code for inline divides of floating-point values
19463 using the maximum throughput algorithm.
19464
19465 @item -mno-inline-float-divide
19466 @opindex mno-inline-float-divide
19467 Do not generate inline code for divides of floating-point values.
19468
19469 @item -minline-int-divide-min-latency
19470 @opindex minline-int-divide-min-latency
19471 Generate code for inline divides of integer values
19472 using the minimum latency algorithm.
19473
19474 @item -minline-int-divide-max-throughput
19475 @opindex minline-int-divide-max-throughput
19476 Generate code for inline divides of integer values
19477 using the maximum throughput algorithm.
19478
19479 @item -mno-inline-int-divide
19480 @opindex mno-inline-int-divide
19481 Do not generate inline code for divides of integer values.
19482
19483 @item -minline-sqrt-min-latency
19484 @opindex minline-sqrt-min-latency
19485 Generate code for inline square roots
19486 using the minimum latency algorithm.
19487
19488 @item -minline-sqrt-max-throughput
19489 @opindex minline-sqrt-max-throughput
19490 Generate code for inline square roots
19491 using the maximum throughput algorithm.
19492
19493 @item -mno-inline-sqrt
19494 @opindex mno-inline-sqrt
19495 Do not generate inline code for @code{sqrt}.
19496
19497 @item -mfused-madd
19498 @itemx -mno-fused-madd
19499 @opindex mfused-madd
19500 @opindex mno-fused-madd
19501 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
19502 instructions. The default is to use these instructions.
19503
19504 @item -mno-dwarf2-asm
19505 @itemx -mdwarf2-asm
19506 @opindex mno-dwarf2-asm
19507 @opindex mdwarf2-asm
19508 Don't (or do) generate assembler code for the DWARF line number debugging
19509 info. This may be useful when not using the GNU assembler.
19510
19511 @item -mearly-stop-bits
19512 @itemx -mno-early-stop-bits
19513 @opindex mearly-stop-bits
19514 @opindex mno-early-stop-bits
19515 Allow stop bits to be placed earlier than immediately preceding the
19516 instruction that triggered the stop bit. This can improve instruction
19517 scheduling, but does not always do so.
19518
19519 @item -mfixed-range=@var{register-range}
19520 @opindex mfixed-range
19521 Generate code treating the given register range as fixed registers.
19522 A fixed register is one that the register allocator cannot use. This is
19523 useful when compiling kernel code. A register range is specified as
19524 two registers separated by a dash. Multiple register ranges can be
19525 specified separated by a comma.
19526
19527 @item -mtls-size=@var{tls-size}
19528 @opindex mtls-size
19529 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
19530 64.
19531
19532 @item -mtune=@var{cpu-type}
19533 @opindex mtune
19534 Tune the instruction scheduling for a particular CPU, Valid values are
19535 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
19536 and @samp{mckinley}.
19537
19538 @item -milp32
19539 @itemx -mlp64
19540 @opindex milp32
19541 @opindex mlp64
19542 Generate code for a 32-bit or 64-bit environment.
19543 The 32-bit environment sets int, long and pointer to 32 bits.
19544 The 64-bit environment sets int to 32 bits and long and pointer
19545 to 64 bits. These are HP-UX specific flags.
19546
19547 @item -mno-sched-br-data-spec
19548 @itemx -msched-br-data-spec
19549 @opindex mno-sched-br-data-spec
19550 @opindex msched-br-data-spec
19551 (Dis/En)able data speculative scheduling before reload.
19552 This results in generation of @code{ld.a} instructions and
19553 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19554 The default setting is disabled.
19555
19556 @item -msched-ar-data-spec
19557 @itemx -mno-sched-ar-data-spec
19558 @opindex msched-ar-data-spec
19559 @opindex mno-sched-ar-data-spec
19560 (En/Dis)able data speculative scheduling after reload.
19561 This results in generation of @code{ld.a} instructions and
19562 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
19563 The default setting is enabled.
19564
19565 @item -mno-sched-control-spec
19566 @itemx -msched-control-spec
19567 @opindex mno-sched-control-spec
19568 @opindex msched-control-spec
19569 (Dis/En)able control speculative scheduling. This feature is
19570 available only during region scheduling (i.e.@: before reload).
19571 This results in generation of the @code{ld.s} instructions and
19572 the corresponding check instructions @code{chk.s}.
19573 The default setting is disabled.
19574
19575 @item -msched-br-in-data-spec
19576 @itemx -mno-sched-br-in-data-spec
19577 @opindex msched-br-in-data-spec
19578 @opindex mno-sched-br-in-data-spec
19579 (En/Dis)able speculative scheduling of the instructions that
19580 are dependent on the data speculative loads before reload.
19581 This is effective only with @option{-msched-br-data-spec} enabled.
19582 The default setting is enabled.
19583
19584 @item -msched-ar-in-data-spec
19585 @itemx -mno-sched-ar-in-data-spec
19586 @opindex msched-ar-in-data-spec
19587 @opindex mno-sched-ar-in-data-spec
19588 (En/Dis)able speculative scheduling of the instructions that
19589 are dependent on the data speculative loads after reload.
19590 This is effective only with @option{-msched-ar-data-spec} enabled.
19591 The default setting is enabled.
19592
19593 @item -msched-in-control-spec
19594 @itemx -mno-sched-in-control-spec
19595 @opindex msched-in-control-spec
19596 @opindex mno-sched-in-control-spec
19597 (En/Dis)able speculative scheduling of the instructions that
19598 are dependent on the control speculative loads.
19599 This is effective only with @option{-msched-control-spec} enabled.
19600 The default setting is enabled.
19601
19602 @item -mno-sched-prefer-non-data-spec-insns
19603 @itemx -msched-prefer-non-data-spec-insns
19604 @opindex mno-sched-prefer-non-data-spec-insns
19605 @opindex msched-prefer-non-data-spec-insns
19606 If enabled, data-speculative instructions are chosen for schedule
19607 only if there are no other choices at the moment. This makes
19608 the use of the data speculation much more conservative.
19609 The default setting is disabled.
19610
19611 @item -mno-sched-prefer-non-control-spec-insns
19612 @itemx -msched-prefer-non-control-spec-insns
19613 @opindex mno-sched-prefer-non-control-spec-insns
19614 @opindex msched-prefer-non-control-spec-insns
19615 If enabled, control-speculative instructions are chosen for schedule
19616 only if there are no other choices at the moment. This makes
19617 the use of the control speculation much more conservative.
19618 The default setting is disabled.
19619
19620 @item -mno-sched-count-spec-in-critical-path
19621 @itemx -msched-count-spec-in-critical-path
19622 @opindex mno-sched-count-spec-in-critical-path
19623 @opindex msched-count-spec-in-critical-path
19624 If enabled, speculative dependencies are considered during
19625 computation of the instructions priorities. This makes the use of the
19626 speculation a bit more conservative.
19627 The default setting is disabled.
19628
19629 @item -msched-spec-ldc
19630 @opindex msched-spec-ldc
19631 Use a simple data speculation check. This option is on by default.
19632
19633 @item -msched-control-spec-ldc
19634 @opindex msched-spec-ldc
19635 Use a simple check for control speculation. This option is on by default.
19636
19637 @item -msched-stop-bits-after-every-cycle
19638 @opindex msched-stop-bits-after-every-cycle
19639 Place a stop bit after every cycle when scheduling. This option is on
19640 by default.
19641
19642 @item -msched-fp-mem-deps-zero-cost
19643 @opindex msched-fp-mem-deps-zero-cost
19644 Assume that floating-point stores and loads are not likely to cause a conflict
19645 when placed into the same instruction group. This option is disabled by
19646 default.
19647
19648 @item -msel-sched-dont-check-control-spec
19649 @opindex msel-sched-dont-check-control-spec
19650 Generate checks for control speculation in selective scheduling.
19651 This flag is disabled by default.
19652
19653 @item -msched-max-memory-insns=@var{max-insns}
19654 @opindex msched-max-memory-insns
19655 Limit on the number of memory insns per instruction group, giving lower
19656 priority to subsequent memory insns attempting to schedule in the same
19657 instruction group. Frequently useful to prevent cache bank conflicts.
19658 The default value is 1.
19659
19660 @item -msched-max-memory-insns-hard-limit
19661 @opindex msched-max-memory-insns-hard-limit
19662 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
19663 disallowing more than that number in an instruction group.
19664 Otherwise, the limit is ``soft'', meaning that non-memory operations
19665 are preferred when the limit is reached, but memory operations may still
19666 be scheduled.
19667
19668 @end table
19669
19670 @node LM32 Options
19671 @subsection LM32 Options
19672 @cindex LM32 options
19673
19674 These @option{-m} options are defined for the LatticeMico32 architecture:
19675
19676 @table @gcctabopt
19677 @item -mbarrel-shift-enabled
19678 @opindex mbarrel-shift-enabled
19679 Enable barrel-shift instructions.
19680
19681 @item -mdivide-enabled
19682 @opindex mdivide-enabled
19683 Enable divide and modulus instructions.
19684
19685 @item -mmultiply-enabled
19686 @opindex multiply-enabled
19687 Enable multiply instructions.
19688
19689 @item -msign-extend-enabled
19690 @opindex msign-extend-enabled
19691 Enable sign extend instructions.
19692
19693 @item -muser-enabled
19694 @opindex muser-enabled
19695 Enable user-defined instructions.
19696
19697 @end table
19698
19699 @node M32C Options
19700 @subsection M32C Options
19701 @cindex M32C options
19702
19703 @table @gcctabopt
19704 @item -mcpu=@var{name}
19705 @opindex mcpu=
19706 Select the CPU for which code is generated. @var{name} may be one of
19707 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
19708 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
19709 the M32C/80 series.
19710
19711 @item -msim
19712 @opindex msim
19713 Specifies that the program will be run on the simulator. This causes
19714 an alternate runtime library to be linked in which supports, for
19715 example, file I/O@. You must not use this option when generating
19716 programs that will run on real hardware; you must provide your own
19717 runtime library for whatever I/O functions are needed.
19718
19719 @item -memregs=@var{number}
19720 @opindex memregs=
19721 Specifies the number of memory-based pseudo-registers GCC uses
19722 during code generation. These pseudo-registers are used like real
19723 registers, so there is a tradeoff between GCC's ability to fit the
19724 code into available registers, and the performance penalty of using
19725 memory instead of registers. Note that all modules in a program must
19726 be compiled with the same value for this option. Because of that, you
19727 must not use this option with GCC's default runtime libraries.
19728
19729 @end table
19730
19731 @node M32R/D Options
19732 @subsection M32R/D Options
19733 @cindex M32R/D options
19734
19735 These @option{-m} options are defined for Renesas M32R/D architectures:
19736
19737 @table @gcctabopt
19738 @item -m32r2
19739 @opindex m32r2
19740 Generate code for the M32R/2@.
19741
19742 @item -m32rx
19743 @opindex m32rx
19744 Generate code for the M32R/X@.
19745
19746 @item -m32r
19747 @opindex m32r
19748 Generate code for the M32R@. This is the default.
19749
19750 @item -mmodel=small
19751 @opindex mmodel=small
19752 Assume all objects live in the lower 16MB of memory (so that their addresses
19753 can be loaded with the @code{ld24} instruction), and assume all subroutines
19754 are reachable with the @code{bl} instruction.
19755 This is the default.
19756
19757 The addressability of a particular object can be set with the
19758 @code{model} attribute.
19759
19760 @item -mmodel=medium
19761 @opindex mmodel=medium
19762 Assume objects may be anywhere in the 32-bit address space (the compiler
19763 generates @code{seth/add3} instructions to load their addresses), and
19764 assume all subroutines are reachable with the @code{bl} instruction.
19765
19766 @item -mmodel=large
19767 @opindex mmodel=large
19768 Assume objects may be anywhere in the 32-bit address space (the compiler
19769 generates @code{seth/add3} instructions to load their addresses), and
19770 assume subroutines may not be reachable with the @code{bl} instruction
19771 (the compiler generates the much slower @code{seth/add3/jl}
19772 instruction sequence).
19773
19774 @item -msdata=none
19775 @opindex msdata=none
19776 Disable use of the small data area. Variables are put into
19777 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
19778 @code{section} attribute has been specified).
19779 This is the default.
19780
19781 The small data area consists of sections @code{.sdata} and @code{.sbss}.
19782 Objects may be explicitly put in the small data area with the
19783 @code{section} attribute using one of these sections.
19784
19785 @item -msdata=sdata
19786 @opindex msdata=sdata
19787 Put small global and static data in the small data area, but do not
19788 generate special code to reference them.
19789
19790 @item -msdata=use
19791 @opindex msdata=use
19792 Put small global and static data in the small data area, and generate
19793 special instructions to reference them.
19794
19795 @item -G @var{num}
19796 @opindex G
19797 @cindex smaller data references
19798 Put global and static objects less than or equal to @var{num} bytes
19799 into the small data or BSS sections instead of the normal data or BSS
19800 sections. The default value of @var{num} is 8.
19801 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
19802 for this option to have any effect.
19803
19804 All modules should be compiled with the same @option{-G @var{num}} value.
19805 Compiling with different values of @var{num} may or may not work; if it
19806 doesn't the linker gives an error message---incorrect code is not
19807 generated.
19808
19809 @item -mdebug
19810 @opindex mdebug
19811 Makes the M32R-specific code in the compiler display some statistics
19812 that might help in debugging programs.
19813
19814 @item -malign-loops
19815 @opindex malign-loops
19816 Align all loops to a 32-byte boundary.
19817
19818 @item -mno-align-loops
19819 @opindex mno-align-loops
19820 Do not enforce a 32-byte alignment for loops. This is the default.
19821
19822 @item -missue-rate=@var{number}
19823 @opindex missue-rate=@var{number}
19824 Issue @var{number} instructions per cycle. @var{number} can only be 1
19825 or 2.
19826
19827 @item -mbranch-cost=@var{number}
19828 @opindex mbranch-cost=@var{number}
19829 @var{number} can only be 1 or 2. If it is 1 then branches are
19830 preferred over conditional code, if it is 2, then the opposite applies.
19831
19832 @item -mflush-trap=@var{number}
19833 @opindex mflush-trap=@var{number}
19834 Specifies the trap number to use to flush the cache. The default is
19835 12. Valid numbers are between 0 and 15 inclusive.
19836
19837 @item -mno-flush-trap
19838 @opindex mno-flush-trap
19839 Specifies that the cache cannot be flushed by using a trap.
19840
19841 @item -mflush-func=@var{name}
19842 @opindex mflush-func=@var{name}
19843 Specifies the name of the operating system function to call to flush
19844 the cache. The default is @samp{_flush_cache}, but a function call
19845 is only used if a trap is not available.
19846
19847 @item -mno-flush-func
19848 @opindex mno-flush-func
19849 Indicates that there is no OS function for flushing the cache.
19850
19851 @end table
19852
19853 @node M680x0 Options
19854 @subsection M680x0 Options
19855 @cindex M680x0 options
19856
19857 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
19858 The default settings depend on which architecture was selected when
19859 the compiler was configured; the defaults for the most common choices
19860 are given below.
19861
19862 @table @gcctabopt
19863 @item -march=@var{arch}
19864 @opindex march
19865 Generate code for a specific M680x0 or ColdFire instruction set
19866 architecture. Permissible values of @var{arch} for M680x0
19867 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
19868 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
19869 architectures are selected according to Freescale's ISA classification
19870 and the permissible values are: @samp{isaa}, @samp{isaaplus},
19871 @samp{isab} and @samp{isac}.
19872
19873 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
19874 code for a ColdFire target. The @var{arch} in this macro is one of the
19875 @option{-march} arguments given above.
19876
19877 When used together, @option{-march} and @option{-mtune} select code
19878 that runs on a family of similar processors but that is optimized
19879 for a particular microarchitecture.
19880
19881 @item -mcpu=@var{cpu}
19882 @opindex mcpu
19883 Generate code for a specific M680x0 or ColdFire processor.
19884 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
19885 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
19886 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
19887 below, which also classifies the CPUs into families:
19888
19889 @multitable @columnfractions 0.20 0.80
19890 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
19891 @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}
19892 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
19893 @item @samp{5206e} @tab @samp{5206e}
19894 @item @samp{5208} @tab @samp{5207} @samp{5208}
19895 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
19896 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
19897 @item @samp{5216} @tab @samp{5214} @samp{5216}
19898 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
19899 @item @samp{5225} @tab @samp{5224} @samp{5225}
19900 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
19901 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
19902 @item @samp{5249} @tab @samp{5249}
19903 @item @samp{5250} @tab @samp{5250}
19904 @item @samp{5271} @tab @samp{5270} @samp{5271}
19905 @item @samp{5272} @tab @samp{5272}
19906 @item @samp{5275} @tab @samp{5274} @samp{5275}
19907 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
19908 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
19909 @item @samp{5307} @tab @samp{5307}
19910 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
19911 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
19912 @item @samp{5407} @tab @samp{5407}
19913 @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}
19914 @end multitable
19915
19916 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
19917 @var{arch} is compatible with @var{cpu}. Other combinations of
19918 @option{-mcpu} and @option{-march} are rejected.
19919
19920 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
19921 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
19922 where the value of @var{family} is given by the table above.
19923
19924 @item -mtune=@var{tune}
19925 @opindex mtune
19926 Tune the code for a particular microarchitecture within the
19927 constraints set by @option{-march} and @option{-mcpu}.
19928 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
19929 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
19930 and @samp{cpu32}. The ColdFire microarchitectures
19931 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
19932
19933 You can also use @option{-mtune=68020-40} for code that needs
19934 to run relatively well on 68020, 68030 and 68040 targets.
19935 @option{-mtune=68020-60} is similar but includes 68060 targets
19936 as well. These two options select the same tuning decisions as
19937 @option{-m68020-40} and @option{-m68020-60} respectively.
19938
19939 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
19940 when tuning for 680x0 architecture @var{arch}. It also defines
19941 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
19942 option is used. If GCC is tuning for a range of architectures,
19943 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
19944 it defines the macros for every architecture in the range.
19945
19946 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
19947 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
19948 of the arguments given above.
19949
19950 @item -m68000
19951 @itemx -mc68000
19952 @opindex m68000
19953 @opindex mc68000
19954 Generate output for a 68000. This is the default
19955 when the compiler is configured for 68000-based systems.
19956 It is equivalent to @option{-march=68000}.
19957
19958 Use this option for microcontrollers with a 68000 or EC000 core,
19959 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
19960
19961 @item -m68010
19962 @opindex m68010
19963 Generate output for a 68010. This is the default
19964 when the compiler is configured for 68010-based systems.
19965 It is equivalent to @option{-march=68010}.
19966
19967 @item -m68020
19968 @itemx -mc68020
19969 @opindex m68020
19970 @opindex mc68020
19971 Generate output for a 68020. This is the default
19972 when the compiler is configured for 68020-based systems.
19973 It is equivalent to @option{-march=68020}.
19974
19975 @item -m68030
19976 @opindex m68030
19977 Generate output for a 68030. This is the default when the compiler is
19978 configured for 68030-based systems. It is equivalent to
19979 @option{-march=68030}.
19980
19981 @item -m68040
19982 @opindex m68040
19983 Generate output for a 68040. This is the default when the compiler is
19984 configured for 68040-based systems. It is equivalent to
19985 @option{-march=68040}.
19986
19987 This option inhibits the use of 68881/68882 instructions that have to be
19988 emulated by software on the 68040. Use this option if your 68040 does not
19989 have code to emulate those instructions.
19990
19991 @item -m68060
19992 @opindex m68060
19993 Generate output for a 68060. This is the default when the compiler is
19994 configured for 68060-based systems. It is equivalent to
19995 @option{-march=68060}.
19996
19997 This option inhibits the use of 68020 and 68881/68882 instructions that
19998 have to be emulated by software on the 68060. Use this option if your 68060
19999 does not have code to emulate those instructions.
20000
20001 @item -mcpu32
20002 @opindex mcpu32
20003 Generate output for a CPU32. This is the default
20004 when the compiler is configured for CPU32-based systems.
20005 It is equivalent to @option{-march=cpu32}.
20006
20007 Use this option for microcontrollers with a
20008 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
20009 68336, 68340, 68341, 68349 and 68360.
20010
20011 @item -m5200
20012 @opindex m5200
20013 Generate output for a 520X ColdFire CPU@. This is the default
20014 when the compiler is configured for 520X-based systems.
20015 It is equivalent to @option{-mcpu=5206}, and is now deprecated
20016 in favor of that option.
20017
20018 Use this option for microcontroller with a 5200 core, including
20019 the MCF5202, MCF5203, MCF5204 and MCF5206.
20020
20021 @item -m5206e
20022 @opindex m5206e
20023 Generate output for a 5206e ColdFire CPU@. The option is now
20024 deprecated in favor of the equivalent @option{-mcpu=5206e}.
20025
20026 @item -m528x
20027 @opindex m528x
20028 Generate output for a member of the ColdFire 528X family.
20029 The option is now deprecated in favor of the equivalent
20030 @option{-mcpu=528x}.
20031
20032 @item -m5307
20033 @opindex m5307
20034 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
20035 in favor of the equivalent @option{-mcpu=5307}.
20036
20037 @item -m5407
20038 @opindex m5407
20039 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
20040 in favor of the equivalent @option{-mcpu=5407}.
20041
20042 @item -mcfv4e
20043 @opindex mcfv4e
20044 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
20045 This includes use of hardware floating-point instructions.
20046 The option is equivalent to @option{-mcpu=547x}, and is now
20047 deprecated in favor of that option.
20048
20049 @item -m68020-40
20050 @opindex m68020-40
20051 Generate output for a 68040, without using any of the new instructions.
20052 This results in code that can run relatively efficiently on either a
20053 68020/68881 or a 68030 or a 68040. The generated code does use the
20054 68881 instructions that are emulated on the 68040.
20055
20056 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
20057
20058 @item -m68020-60
20059 @opindex m68020-60
20060 Generate output for a 68060, without using any of the new instructions.
20061 This results in code that can run relatively efficiently on either a
20062 68020/68881 or a 68030 or a 68040. The generated code does use the
20063 68881 instructions that are emulated on the 68060.
20064
20065 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
20066
20067 @item -mhard-float
20068 @itemx -m68881
20069 @opindex mhard-float
20070 @opindex m68881
20071 Generate floating-point instructions. This is the default for 68020
20072 and above, and for ColdFire devices that have an FPU@. It defines the
20073 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
20074 on ColdFire targets.
20075
20076 @item -msoft-float
20077 @opindex msoft-float
20078 Do not generate floating-point instructions; use library calls instead.
20079 This is the default for 68000, 68010, and 68832 targets. It is also
20080 the default for ColdFire devices that have no FPU.
20081
20082 @item -mdiv
20083 @itemx -mno-div
20084 @opindex mdiv
20085 @opindex mno-div
20086 Generate (do not generate) ColdFire hardware divide and remainder
20087 instructions. If @option{-march} is used without @option{-mcpu},
20088 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
20089 architectures. Otherwise, the default is taken from the target CPU
20090 (either the default CPU, or the one specified by @option{-mcpu}). For
20091 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
20092 @option{-mcpu=5206e}.
20093
20094 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
20095
20096 @item -mshort
20097 @opindex mshort
20098 Consider type @code{int} to be 16 bits wide, like @code{short int}.
20099 Additionally, parameters passed on the stack are also aligned to a
20100 16-bit boundary even on targets whose API mandates promotion to 32-bit.
20101
20102 @item -mno-short
20103 @opindex mno-short
20104 Do not consider type @code{int} to be 16 bits wide. This is the default.
20105
20106 @item -mnobitfield
20107 @itemx -mno-bitfield
20108 @opindex mnobitfield
20109 @opindex mno-bitfield
20110 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
20111 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
20112
20113 @item -mbitfield
20114 @opindex mbitfield
20115 Do use the bit-field instructions. The @option{-m68020} option implies
20116 @option{-mbitfield}. This is the default if you use a configuration
20117 designed for a 68020.
20118
20119 @item -mrtd
20120 @opindex mrtd
20121 Use a different function-calling convention, in which functions
20122 that take a fixed number of arguments return with the @code{rtd}
20123 instruction, which pops their arguments while returning. This
20124 saves one instruction in the caller since there is no need to pop
20125 the arguments there.
20126
20127 This calling convention is incompatible with the one normally
20128 used on Unix, so you cannot use it if you need to call libraries
20129 compiled with the Unix compiler.
20130
20131 Also, you must provide function prototypes for all functions that
20132 take variable numbers of arguments (including @code{printf});
20133 otherwise incorrect code is generated for calls to those
20134 functions.
20135
20136 In addition, seriously incorrect code results if you call a
20137 function with too many arguments. (Normally, extra arguments are
20138 harmlessly ignored.)
20139
20140 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
20141 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
20142
20143 @item -mno-rtd
20144 @opindex mno-rtd
20145 Do not use the calling conventions selected by @option{-mrtd}.
20146 This is the default.
20147
20148 @item -malign-int
20149 @itemx -mno-align-int
20150 @opindex malign-int
20151 @opindex mno-align-int
20152 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
20153 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
20154 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
20155 Aligning variables on 32-bit boundaries produces code that runs somewhat
20156 faster on processors with 32-bit busses at the expense of more memory.
20157
20158 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
20159 aligns structures containing the above types differently than
20160 most published application binary interface specifications for the m68k.
20161
20162 @item -mpcrel
20163 @opindex mpcrel
20164 Use the pc-relative addressing mode of the 68000 directly, instead of
20165 using a global offset table. At present, this option implies @option{-fpic},
20166 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
20167 not presently supported with @option{-mpcrel}, though this could be supported for
20168 68020 and higher processors.
20169
20170 @item -mno-strict-align
20171 @itemx -mstrict-align
20172 @opindex mno-strict-align
20173 @opindex mstrict-align
20174 Do not (do) assume that unaligned memory references are handled by
20175 the system.
20176
20177 @item -msep-data
20178 Generate code that allows the data segment to be located in a different
20179 area of memory from the text segment. This allows for execute-in-place in
20180 an environment without virtual memory management. This option implies
20181 @option{-fPIC}.
20182
20183 @item -mno-sep-data
20184 Generate code that assumes that the data segment follows the text segment.
20185 This is the default.
20186
20187 @item -mid-shared-library
20188 Generate code that supports shared libraries via the library ID method.
20189 This allows for execute-in-place and shared libraries in an environment
20190 without virtual memory management. This option implies @option{-fPIC}.
20191
20192 @item -mno-id-shared-library
20193 Generate code that doesn't assume ID-based shared libraries are being used.
20194 This is the default.
20195
20196 @item -mshared-library-id=n
20197 Specifies the identification number of the ID-based shared library being
20198 compiled. Specifying a value of 0 generates more compact code; specifying
20199 other values forces the allocation of that number to the current
20200 library, but is no more space- or time-efficient than omitting this option.
20201
20202 @item -mxgot
20203 @itemx -mno-xgot
20204 @opindex mxgot
20205 @opindex mno-xgot
20206 When generating position-independent code for ColdFire, generate code
20207 that works if the GOT has more than 8192 entries. This code is
20208 larger and slower than code generated without this option. On M680x0
20209 processors, this option is not needed; @option{-fPIC} suffices.
20210
20211 GCC normally uses a single instruction to load values from the GOT@.
20212 While this is relatively efficient, it only works if the GOT
20213 is smaller than about 64k. Anything larger causes the linker
20214 to report an error such as:
20215
20216 @cindex relocation truncated to fit (ColdFire)
20217 @smallexample
20218 relocation truncated to fit: R_68K_GOT16O foobar
20219 @end smallexample
20220
20221 If this happens, you should recompile your code with @option{-mxgot}.
20222 It should then work with very large GOTs. However, code generated with
20223 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
20224 the value of a global symbol.
20225
20226 Note that some linkers, including newer versions of the GNU linker,
20227 can create multiple GOTs and sort GOT entries. If you have such a linker,
20228 you should only need to use @option{-mxgot} when compiling a single
20229 object file that accesses more than 8192 GOT entries. Very few do.
20230
20231 These options have no effect unless GCC is generating
20232 position-independent code.
20233
20234 @item -mlong-jump-table-offsets
20235 @opindex mlong-jump-table-offsets
20236 Use 32-bit offsets in @code{switch} tables. The default is to use
20237 16-bit offsets.
20238
20239 @end table
20240
20241 @node MCore Options
20242 @subsection MCore Options
20243 @cindex MCore options
20244
20245 These are the @samp{-m} options defined for the Motorola M*Core
20246 processors.
20247
20248 @table @gcctabopt
20249
20250 @item -mhardlit
20251 @itemx -mno-hardlit
20252 @opindex mhardlit
20253 @opindex mno-hardlit
20254 Inline constants into the code stream if it can be done in two
20255 instructions or less.
20256
20257 @item -mdiv
20258 @itemx -mno-div
20259 @opindex mdiv
20260 @opindex mno-div
20261 Use the divide instruction. (Enabled by default).
20262
20263 @item -mrelax-immediate
20264 @itemx -mno-relax-immediate
20265 @opindex mrelax-immediate
20266 @opindex mno-relax-immediate
20267 Allow arbitrary-sized immediates in bit operations.
20268
20269 @item -mwide-bitfields
20270 @itemx -mno-wide-bitfields
20271 @opindex mwide-bitfields
20272 @opindex mno-wide-bitfields
20273 Always treat bit-fields as @code{int}-sized.
20274
20275 @item -m4byte-functions
20276 @itemx -mno-4byte-functions
20277 @opindex m4byte-functions
20278 @opindex mno-4byte-functions
20279 Force all functions to be aligned to a 4-byte boundary.
20280
20281 @item -mcallgraph-data
20282 @itemx -mno-callgraph-data
20283 @opindex mcallgraph-data
20284 @opindex mno-callgraph-data
20285 Emit callgraph information.
20286
20287 @item -mslow-bytes
20288 @itemx -mno-slow-bytes
20289 @opindex mslow-bytes
20290 @opindex mno-slow-bytes
20291 Prefer word access when reading byte quantities.
20292
20293 @item -mlittle-endian
20294 @itemx -mbig-endian
20295 @opindex mlittle-endian
20296 @opindex mbig-endian
20297 Generate code for a little-endian target.
20298
20299 @item -m210
20300 @itemx -m340
20301 @opindex m210
20302 @opindex m340
20303 Generate code for the 210 processor.
20304
20305 @item -mno-lsim
20306 @opindex mno-lsim
20307 Assume that runtime support has been provided and so omit the
20308 simulator library (@file{libsim.a)} from the linker command line.
20309
20310 @item -mstack-increment=@var{size}
20311 @opindex mstack-increment
20312 Set the maximum amount for a single stack increment operation. Large
20313 values can increase the speed of programs that contain functions
20314 that need a large amount of stack space, but they can also trigger a
20315 segmentation fault if the stack is extended too much. The default
20316 value is 0x1000.
20317
20318 @end table
20319
20320 @node MeP Options
20321 @subsection MeP Options
20322 @cindex MeP options
20323
20324 @table @gcctabopt
20325
20326 @item -mabsdiff
20327 @opindex mabsdiff
20328 Enables the @code{abs} instruction, which is the absolute difference
20329 between two registers.
20330
20331 @item -mall-opts
20332 @opindex mall-opts
20333 Enables all the optional instructions---average, multiply, divide, bit
20334 operations, leading zero, absolute difference, min/max, clip, and
20335 saturation.
20336
20337
20338 @item -maverage
20339 @opindex maverage
20340 Enables the @code{ave} instruction, which computes the average of two
20341 registers.
20342
20343 @item -mbased=@var{n}
20344 @opindex mbased=
20345 Variables of size @var{n} bytes or smaller are placed in the
20346 @code{.based} section by default. Based variables use the @code{$tp}
20347 register as a base register, and there is a 128-byte limit to the
20348 @code{.based} section.
20349
20350 @item -mbitops
20351 @opindex mbitops
20352 Enables the bit operation instructions---bit test (@code{btstm}), set
20353 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
20354 test-and-set (@code{tas}).
20355
20356 @item -mc=@var{name}
20357 @opindex mc=
20358 Selects which section constant data is placed in. @var{name} may
20359 be @samp{tiny}, @samp{near}, or @samp{far}.
20360
20361 @item -mclip
20362 @opindex mclip
20363 Enables the @code{clip} instruction. Note that @option{-mclip} is not
20364 useful unless you also provide @option{-mminmax}.
20365
20366 @item -mconfig=@var{name}
20367 @opindex mconfig=
20368 Selects one of the built-in core configurations. Each MeP chip has
20369 one or more modules in it; each module has a core CPU and a variety of
20370 coprocessors, optional instructions, and peripherals. The
20371 @code{MeP-Integrator} tool, not part of GCC, provides these
20372 configurations through this option; using this option is the same as
20373 using all the corresponding command-line options. The default
20374 configuration is @samp{default}.
20375
20376 @item -mcop
20377 @opindex mcop
20378 Enables the coprocessor instructions. By default, this is a 32-bit
20379 coprocessor. Note that the coprocessor is normally enabled via the
20380 @option{-mconfig=} option.
20381
20382 @item -mcop32
20383 @opindex mcop32
20384 Enables the 32-bit coprocessor's instructions.
20385
20386 @item -mcop64
20387 @opindex mcop64
20388 Enables the 64-bit coprocessor's instructions.
20389
20390 @item -mivc2
20391 @opindex mivc2
20392 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
20393
20394 @item -mdc
20395 @opindex mdc
20396 Causes constant variables to be placed in the @code{.near} section.
20397
20398 @item -mdiv
20399 @opindex mdiv
20400 Enables the @code{div} and @code{divu} instructions.
20401
20402 @item -meb
20403 @opindex meb
20404 Generate big-endian code.
20405
20406 @item -mel
20407 @opindex mel
20408 Generate little-endian code.
20409
20410 @item -mio-volatile
20411 @opindex mio-volatile
20412 Tells the compiler that any variable marked with the @code{io}
20413 attribute is to be considered volatile.
20414
20415 @item -ml
20416 @opindex ml
20417 Causes variables to be assigned to the @code{.far} section by default.
20418
20419 @item -mleadz
20420 @opindex mleadz
20421 Enables the @code{leadz} (leading zero) instruction.
20422
20423 @item -mm
20424 @opindex mm
20425 Causes variables to be assigned to the @code{.near} section by default.
20426
20427 @item -mminmax
20428 @opindex mminmax
20429 Enables the @code{min} and @code{max} instructions.
20430
20431 @item -mmult
20432 @opindex mmult
20433 Enables the multiplication and multiply-accumulate instructions.
20434
20435 @item -mno-opts
20436 @opindex mno-opts
20437 Disables all the optional instructions enabled by @option{-mall-opts}.
20438
20439 @item -mrepeat
20440 @opindex mrepeat
20441 Enables the @code{repeat} and @code{erepeat} instructions, used for
20442 low-overhead looping.
20443
20444 @item -ms
20445 @opindex ms
20446 Causes all variables to default to the @code{.tiny} section. Note
20447 that there is a 65536-byte limit to this section. Accesses to these
20448 variables use the @code{%gp} base register.
20449
20450 @item -msatur
20451 @opindex msatur
20452 Enables the saturation instructions. Note that the compiler does not
20453 currently generate these itself, but this option is included for
20454 compatibility with other tools, like @code{as}.
20455
20456 @item -msdram
20457 @opindex msdram
20458 Link the SDRAM-based runtime instead of the default ROM-based runtime.
20459
20460 @item -msim
20461 @opindex msim
20462 Link the simulator run-time libraries.
20463
20464 @item -msimnovec
20465 @opindex msimnovec
20466 Link the simulator runtime libraries, excluding built-in support
20467 for reset and exception vectors and tables.
20468
20469 @item -mtf
20470 @opindex mtf
20471 Causes all functions to default to the @code{.far} section. Without
20472 this option, functions default to the @code{.near} section.
20473
20474 @item -mtiny=@var{n}
20475 @opindex mtiny=
20476 Variables that are @var{n} bytes or smaller are allocated to the
20477 @code{.tiny} section. These variables use the @code{$gp} base
20478 register. The default for this option is 4, but note that there's a
20479 65536-byte limit to the @code{.tiny} section.
20480
20481 @end table
20482
20483 @node MicroBlaze Options
20484 @subsection MicroBlaze Options
20485 @cindex MicroBlaze Options
20486
20487 @table @gcctabopt
20488
20489 @item -msoft-float
20490 @opindex msoft-float
20491 Use software emulation for floating point (default).
20492
20493 @item -mhard-float
20494 @opindex mhard-float
20495 Use hardware floating-point instructions.
20496
20497 @item -mmemcpy
20498 @opindex mmemcpy
20499 Do not optimize block moves, use @code{memcpy}.
20500
20501 @item -mno-clearbss
20502 @opindex mno-clearbss
20503 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
20504
20505 @item -mcpu=@var{cpu-type}
20506 @opindex mcpu=
20507 Use features of, and schedule code for, the given CPU.
20508 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
20509 where @var{X} is a major version, @var{YY} is the minor version, and
20510 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
20511 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
20512
20513 @item -mxl-soft-mul
20514 @opindex mxl-soft-mul
20515 Use software multiply emulation (default).
20516
20517 @item -mxl-soft-div
20518 @opindex mxl-soft-div
20519 Use software emulation for divides (default).
20520
20521 @item -mxl-barrel-shift
20522 @opindex mxl-barrel-shift
20523 Use the hardware barrel shifter.
20524
20525 @item -mxl-pattern-compare
20526 @opindex mxl-pattern-compare
20527 Use pattern compare instructions.
20528
20529 @item -msmall-divides
20530 @opindex msmall-divides
20531 Use table lookup optimization for small signed integer divisions.
20532
20533 @item -mxl-stack-check
20534 @opindex mxl-stack-check
20535 This option is deprecated. Use @option{-fstack-check} instead.
20536
20537 @item -mxl-gp-opt
20538 @opindex mxl-gp-opt
20539 Use GP-relative @code{.sdata}/@code{.sbss} sections.
20540
20541 @item -mxl-multiply-high
20542 @opindex mxl-multiply-high
20543 Use multiply high instructions for high part of 32x32 multiply.
20544
20545 @item -mxl-float-convert
20546 @opindex mxl-float-convert
20547 Use hardware floating-point conversion instructions.
20548
20549 @item -mxl-float-sqrt
20550 @opindex mxl-float-sqrt
20551 Use hardware floating-point square root instruction.
20552
20553 @item -mbig-endian
20554 @opindex mbig-endian
20555 Generate code for a big-endian target.
20556
20557 @item -mlittle-endian
20558 @opindex mlittle-endian
20559 Generate code for a little-endian target.
20560
20561 @item -mxl-reorder
20562 @opindex mxl-reorder
20563 Use reorder instructions (swap and byte reversed load/store).
20564
20565 @item -mxl-mode-@var{app-model}
20566 Select application model @var{app-model}. Valid models are
20567 @table @samp
20568 @item executable
20569 normal executable (default), uses startup code @file{crt0.o}.
20570
20571 @item -mpic-data-is-text-relative
20572 @opindex mpic-data-is-text-relative
20573 Assume that the displacement between the text and data segments is fixed
20574 at static link time. This allows data to be referenced by offset from start of
20575 text address instead of GOT since PC-relative addressing is not supported.
20576
20577 @item xmdstub
20578 for use with Xilinx Microprocessor Debugger (XMD) based
20579 software intrusive debug agent called xmdstub. This uses startup file
20580 @file{crt1.o} and sets the start address of the program to 0x800.
20581
20582 @item bootstrap
20583 for applications that are loaded using a bootloader.
20584 This model uses startup file @file{crt2.o} which does not contain a processor
20585 reset vector handler. This is suitable for transferring control on a
20586 processor reset to the bootloader rather than the application.
20587
20588 @item novectors
20589 for applications that do not require any of the
20590 MicroBlaze vectors. This option may be useful for applications running
20591 within a monitoring application. This model uses @file{crt3.o} as a startup file.
20592 @end table
20593
20594 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
20595 @option{-mxl-mode-@var{app-model}}.
20596
20597 @end table
20598
20599 @node MIPS Options
20600 @subsection MIPS Options
20601 @cindex MIPS options
20602
20603 @table @gcctabopt
20604
20605 @item -EB
20606 @opindex EB
20607 Generate big-endian code.
20608
20609 @item -EL
20610 @opindex EL
20611 Generate little-endian code. This is the default for @samp{mips*el-*-*}
20612 configurations.
20613
20614 @item -march=@var{arch}
20615 @opindex march
20616 Generate code that runs on @var{arch}, which can be the name of a
20617 generic MIPS ISA, or the name of a particular processor.
20618 The ISA names are:
20619 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
20620 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
20621 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
20622 @samp{mips64r5} and @samp{mips64r6}.
20623 The processor names are:
20624 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
20625 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
20626 @samp{5kc}, @samp{5kf},
20627 @samp{20kc},
20628 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
20629 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
20630 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
20631 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
20632 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
20633 @samp{i6400}, @samp{i6500},
20634 @samp{interaptiv},
20635 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
20636 @samp{m4k},
20637 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
20638 @samp{m5100}, @samp{m5101},
20639 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
20640 @samp{orion},
20641 @samp{p5600}, @samp{p6600},
20642 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
20643 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r6000}, @samp{r8000},
20644 @samp{rm7000}, @samp{rm9000},
20645 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
20646 @samp{sb1},
20647 @samp{sr71000},
20648 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
20649 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
20650 @samp{xlr} and @samp{xlp}.
20651 The special value @samp{from-abi} selects the
20652 most compatible architecture for the selected ABI (that is,
20653 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
20654
20655 The native Linux/GNU toolchain also supports the value @samp{native},
20656 which selects the best architecture option for the host processor.
20657 @option{-march=native} has no effect if GCC does not recognize
20658 the processor.
20659
20660 In processor names, a final @samp{000} can be abbreviated as @samp{k}
20661 (for example, @option{-march=r2k}). Prefixes are optional, and
20662 @samp{vr} may be written @samp{r}.
20663
20664 Names of the form @samp{@var{n}f2_1} refer to processors with
20665 FPUs clocked at half the rate of the core, names of the form
20666 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
20667 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
20668 processors with FPUs clocked a ratio of 3:2 with respect to the core.
20669 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
20670 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
20671 accepted as synonyms for @samp{@var{n}f1_1}.
20672
20673 GCC defines two macros based on the value of this option. The first
20674 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
20675 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
20676 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
20677 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
20678 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
20679
20680 Note that the @code{_MIPS_ARCH} macro uses the processor names given
20681 above. In other words, it has the full prefix and does not
20682 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
20683 the macro names the resolved architecture (either @code{"mips1"} or
20684 @code{"mips3"}). It names the default architecture when no
20685 @option{-march} option is given.
20686
20687 @item -mtune=@var{arch}
20688 @opindex mtune
20689 Optimize for @var{arch}. Among other things, this option controls
20690 the way instructions are scheduled, and the perceived cost of arithmetic
20691 operations. The list of @var{arch} values is the same as for
20692 @option{-march}.
20693
20694 When this option is not used, GCC optimizes for the processor
20695 specified by @option{-march}. By using @option{-march} and
20696 @option{-mtune} together, it is possible to generate code that
20697 runs on a family of processors, but optimize the code for one
20698 particular member of that family.
20699
20700 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
20701 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
20702 @option{-march} ones described above.
20703
20704 @item -mips1
20705 @opindex mips1
20706 Equivalent to @option{-march=mips1}.
20707
20708 @item -mips2
20709 @opindex mips2
20710 Equivalent to @option{-march=mips2}.
20711
20712 @item -mips3
20713 @opindex mips3
20714 Equivalent to @option{-march=mips3}.
20715
20716 @item -mips4
20717 @opindex mips4
20718 Equivalent to @option{-march=mips4}.
20719
20720 @item -mips32
20721 @opindex mips32
20722 Equivalent to @option{-march=mips32}.
20723
20724 @item -mips32r3
20725 @opindex mips32r3
20726 Equivalent to @option{-march=mips32r3}.
20727
20728 @item -mips32r5
20729 @opindex mips32r5
20730 Equivalent to @option{-march=mips32r5}.
20731
20732 @item -mips32r6
20733 @opindex mips32r6
20734 Equivalent to @option{-march=mips32r6}.
20735
20736 @item -mips64
20737 @opindex mips64
20738 Equivalent to @option{-march=mips64}.
20739
20740 @item -mips64r2
20741 @opindex mips64r2
20742 Equivalent to @option{-march=mips64r2}.
20743
20744 @item -mips64r3
20745 @opindex mips64r3
20746 Equivalent to @option{-march=mips64r3}.
20747
20748 @item -mips64r5
20749 @opindex mips64r5
20750 Equivalent to @option{-march=mips64r5}.
20751
20752 @item -mips64r6
20753 @opindex mips64r6
20754 Equivalent to @option{-march=mips64r6}.
20755
20756 @item -mips16
20757 @itemx -mno-mips16
20758 @opindex mips16
20759 @opindex mno-mips16
20760 Generate (do not generate) MIPS16 code. If GCC is targeting a
20761 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
20762
20763 MIPS16 code generation can also be controlled on a per-function basis
20764 by means of @code{mips16} and @code{nomips16} attributes.
20765 @xref{Function Attributes}, for more information.
20766
20767 @item -mflip-mips16
20768 @opindex mflip-mips16
20769 Generate MIPS16 code on alternating functions. This option is provided
20770 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
20771 not intended for ordinary use in compiling user code.
20772
20773 @item -minterlink-compressed
20774 @itemx -mno-interlink-compressed
20775 @opindex minterlink-compressed
20776 @opindex mno-interlink-compressed
20777 Require (do not require) that code using the standard (uncompressed) MIPS ISA
20778 be link-compatible with MIPS16 and microMIPS code, and vice versa.
20779
20780 For example, code using the standard ISA encoding cannot jump directly
20781 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
20782 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
20783 knows that the target of the jump is not compressed.
20784
20785 @item -minterlink-mips16
20786 @itemx -mno-interlink-mips16
20787 @opindex minterlink-mips16
20788 @opindex mno-interlink-mips16
20789 Aliases of @option{-minterlink-compressed} and
20790 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
20791 and are retained for backwards compatibility.
20792
20793 @item -mabi=32
20794 @itemx -mabi=o64
20795 @itemx -mabi=n32
20796 @itemx -mabi=64
20797 @itemx -mabi=eabi
20798 @opindex mabi=32
20799 @opindex mabi=o64
20800 @opindex mabi=n32
20801 @opindex mabi=64
20802 @opindex mabi=eabi
20803 Generate code for the given ABI@.
20804
20805 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
20806 generates 64-bit code when you select a 64-bit architecture, but you
20807 can use @option{-mgp32} to get 32-bit code instead.
20808
20809 For information about the O64 ABI, see
20810 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
20811
20812 GCC supports a variant of the o32 ABI in which floating-point registers
20813 are 64 rather than 32 bits wide. You can select this combination with
20814 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
20815 and @code{mfhc1} instructions and is therefore only supported for
20816 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
20817
20818 The register assignments for arguments and return values remain the
20819 same, but each scalar value is passed in a single 64-bit register
20820 rather than a pair of 32-bit registers. For example, scalar
20821 floating-point values are returned in @samp{$f0} only, not a
20822 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
20823 remains the same in that the even-numbered double-precision registers
20824 are saved.
20825
20826 Two additional variants of the o32 ABI are supported to enable
20827 a transition from 32-bit to 64-bit registers. These are FPXX
20828 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
20829 The FPXX extension mandates that all code must execute correctly
20830 when run using 32-bit or 64-bit registers. The code can be interlinked
20831 with either FP32 or FP64, but not both.
20832 The FP64A extension is similar to the FP64 extension but forbids the
20833 use of odd-numbered single-precision registers. This can be used
20834 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
20835 processors and allows both FP32 and FP64A code to interlink and
20836 run in the same process without changing FPU modes.
20837
20838 @item -mabicalls
20839 @itemx -mno-abicalls
20840 @opindex mabicalls
20841 @opindex mno-abicalls
20842 Generate (do not generate) code that is suitable for SVR4-style
20843 dynamic objects. @option{-mabicalls} is the default for SVR4-based
20844 systems.
20845
20846 @item -mshared
20847 @itemx -mno-shared
20848 Generate (do not generate) code that is fully position-independent,
20849 and that can therefore be linked into shared libraries. This option
20850 only affects @option{-mabicalls}.
20851
20852 All @option{-mabicalls} code has traditionally been position-independent,
20853 regardless of options like @option{-fPIC} and @option{-fpic}. However,
20854 as an extension, the GNU toolchain allows executables to use absolute
20855 accesses for locally-binding symbols. It can also use shorter GP
20856 initialization sequences and generate direct calls to locally-defined
20857 functions. This mode is selected by @option{-mno-shared}.
20858
20859 @option{-mno-shared} depends on binutils 2.16 or higher and generates
20860 objects that can only be linked by the GNU linker. However, the option
20861 does not affect the ABI of the final executable; it only affects the ABI
20862 of relocatable objects. Using @option{-mno-shared} generally makes
20863 executables both smaller and quicker.
20864
20865 @option{-mshared} is the default.
20866
20867 @item -mplt
20868 @itemx -mno-plt
20869 @opindex mplt
20870 @opindex mno-plt
20871 Assume (do not assume) that the static and dynamic linkers
20872 support PLTs and copy relocations. This option only affects
20873 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
20874 has no effect without @option{-msym32}.
20875
20876 You can make @option{-mplt} the default by configuring
20877 GCC with @option{--with-mips-plt}. The default is
20878 @option{-mno-plt} otherwise.
20879
20880 @item -mxgot
20881 @itemx -mno-xgot
20882 @opindex mxgot
20883 @opindex mno-xgot
20884 Lift (do not lift) the usual restrictions on the size of the global
20885 offset table.
20886
20887 GCC normally uses a single instruction to load values from the GOT@.
20888 While this is relatively efficient, it only works if the GOT
20889 is smaller than about 64k. Anything larger causes the linker
20890 to report an error such as:
20891
20892 @cindex relocation truncated to fit (MIPS)
20893 @smallexample
20894 relocation truncated to fit: R_MIPS_GOT16 foobar
20895 @end smallexample
20896
20897 If this happens, you should recompile your code with @option{-mxgot}.
20898 This works with very large GOTs, although the code is also
20899 less efficient, since it takes three instructions to fetch the
20900 value of a global symbol.
20901
20902 Note that some linkers can create multiple GOTs. If you have such a
20903 linker, you should only need to use @option{-mxgot} when a single object
20904 file accesses more than 64k's worth of GOT entries. Very few do.
20905
20906 These options have no effect unless GCC is generating position
20907 independent code.
20908
20909 @item -mgp32
20910 @opindex mgp32
20911 Assume that general-purpose registers are 32 bits wide.
20912
20913 @item -mgp64
20914 @opindex mgp64
20915 Assume that general-purpose registers are 64 bits wide.
20916
20917 @item -mfp32
20918 @opindex mfp32
20919 Assume that floating-point registers are 32 bits wide.
20920
20921 @item -mfp64
20922 @opindex mfp64
20923 Assume that floating-point registers are 64 bits wide.
20924
20925 @item -mfpxx
20926 @opindex mfpxx
20927 Do not assume the width of floating-point registers.
20928
20929 @item -mhard-float
20930 @opindex mhard-float
20931 Use floating-point coprocessor instructions.
20932
20933 @item -msoft-float
20934 @opindex msoft-float
20935 Do not use floating-point coprocessor instructions. Implement
20936 floating-point calculations using library calls instead.
20937
20938 @item -mno-float
20939 @opindex mno-float
20940 Equivalent to @option{-msoft-float}, but additionally asserts that the
20941 program being compiled does not perform any floating-point operations.
20942 This option is presently supported only by some bare-metal MIPS
20943 configurations, where it may select a special set of libraries
20944 that lack all floating-point support (including, for example, the
20945 floating-point @code{printf} formats).
20946 If code compiled with @option{-mno-float} accidentally contains
20947 floating-point operations, it is likely to suffer a link-time
20948 or run-time failure.
20949
20950 @item -msingle-float
20951 @opindex msingle-float
20952 Assume that the floating-point coprocessor only supports single-precision
20953 operations.
20954
20955 @item -mdouble-float
20956 @opindex mdouble-float
20957 Assume that the floating-point coprocessor supports double-precision
20958 operations. This is the default.
20959
20960 @item -modd-spreg
20961 @itemx -mno-odd-spreg
20962 @opindex modd-spreg
20963 @opindex mno-odd-spreg
20964 Enable the use of odd-numbered single-precision floating-point registers
20965 for the o32 ABI. This is the default for processors that are known to
20966 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
20967 is set by default.
20968
20969 @item -mabs=2008
20970 @itemx -mabs=legacy
20971 @opindex mabs=2008
20972 @opindex mabs=legacy
20973 These options control the treatment of the special not-a-number (NaN)
20974 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
20975 @code{neg.@i{fmt}} machine instructions.
20976
20977 By default or when @option{-mabs=legacy} is used the legacy
20978 treatment is selected. In this case these instructions are considered
20979 arithmetic and avoided where correct operation is required and the
20980 input operand might be a NaN. A longer sequence of instructions that
20981 manipulate the sign bit of floating-point datum manually is used
20982 instead unless the @option{-ffinite-math-only} option has also been
20983 specified.
20984
20985 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
20986 this case these instructions are considered non-arithmetic and therefore
20987 operating correctly in all cases, including in particular where the
20988 input operand is a NaN. These instructions are therefore always used
20989 for the respective operations.
20990
20991 @item -mnan=2008
20992 @itemx -mnan=legacy
20993 @opindex mnan=2008
20994 @opindex mnan=legacy
20995 These options control the encoding of the special not-a-number (NaN)
20996 IEEE 754 floating-point data.
20997
20998 The @option{-mnan=legacy} option selects the legacy encoding. In this
20999 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
21000 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
21001 by the first bit of their trailing significand field being 1.
21002
21003 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
21004 this case qNaNs are denoted by the first bit of their trailing
21005 significand field being 1, whereas sNaNs are denoted by the first bit of
21006 their trailing significand field being 0.
21007
21008 The default is @option{-mnan=legacy} unless GCC has been configured with
21009 @option{--with-nan=2008}.
21010
21011 @item -mllsc
21012 @itemx -mno-llsc
21013 @opindex mllsc
21014 @opindex mno-llsc
21015 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
21016 implement atomic memory built-in functions. When neither option is
21017 specified, GCC uses the instructions if the target architecture
21018 supports them.
21019
21020 @option{-mllsc} is useful if the runtime environment can emulate the
21021 instructions and @option{-mno-llsc} can be useful when compiling for
21022 nonstandard ISAs. You can make either option the default by
21023 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
21024 respectively. @option{--with-llsc} is the default for some
21025 configurations; see the installation documentation for details.
21026
21027 @item -mdsp
21028 @itemx -mno-dsp
21029 @opindex mdsp
21030 @opindex mno-dsp
21031 Use (do not use) revision 1 of the MIPS DSP ASE@.
21032 @xref{MIPS DSP Built-in Functions}. This option defines the
21033 preprocessor macro @code{__mips_dsp}. It also defines
21034 @code{__mips_dsp_rev} to 1.
21035
21036 @item -mdspr2
21037 @itemx -mno-dspr2
21038 @opindex mdspr2
21039 @opindex mno-dspr2
21040 Use (do not use) revision 2 of the MIPS DSP ASE@.
21041 @xref{MIPS DSP Built-in Functions}. This option defines the
21042 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
21043 It also defines @code{__mips_dsp_rev} to 2.
21044
21045 @item -msmartmips
21046 @itemx -mno-smartmips
21047 @opindex msmartmips
21048 @opindex mno-smartmips
21049 Use (do not use) the MIPS SmartMIPS ASE.
21050
21051 @item -mpaired-single
21052 @itemx -mno-paired-single
21053 @opindex mpaired-single
21054 @opindex mno-paired-single
21055 Use (do not use) paired-single floating-point instructions.
21056 @xref{MIPS Paired-Single Support}. This option requires
21057 hardware floating-point support to be enabled.
21058
21059 @item -mdmx
21060 @itemx -mno-mdmx
21061 @opindex mdmx
21062 @opindex mno-mdmx
21063 Use (do not use) MIPS Digital Media Extension instructions.
21064 This option can only be used when generating 64-bit code and requires
21065 hardware floating-point support to be enabled.
21066
21067 @item -mips3d
21068 @itemx -mno-mips3d
21069 @opindex mips3d
21070 @opindex mno-mips3d
21071 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
21072 The option @option{-mips3d} implies @option{-mpaired-single}.
21073
21074 @item -mmicromips
21075 @itemx -mno-micromips
21076 @opindex mmicromips
21077 @opindex mno-mmicromips
21078 Generate (do not generate) microMIPS code.
21079
21080 MicroMIPS code generation can also be controlled on a per-function basis
21081 by means of @code{micromips} and @code{nomicromips} attributes.
21082 @xref{Function Attributes}, for more information.
21083
21084 @item -mmt
21085 @itemx -mno-mt
21086 @opindex mmt
21087 @opindex mno-mt
21088 Use (do not use) MT Multithreading instructions.
21089
21090 @item -mmcu
21091 @itemx -mno-mcu
21092 @opindex mmcu
21093 @opindex mno-mcu
21094 Use (do not use) the MIPS MCU ASE instructions.
21095
21096 @item -meva
21097 @itemx -mno-eva
21098 @opindex meva
21099 @opindex mno-eva
21100 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
21101
21102 @item -mvirt
21103 @itemx -mno-virt
21104 @opindex mvirt
21105 @opindex mno-virt
21106 Use (do not use) the MIPS Virtualization (VZ) instructions.
21107
21108 @item -mxpa
21109 @itemx -mno-xpa
21110 @opindex mxpa
21111 @opindex mno-xpa
21112 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
21113
21114 @item -mcrc
21115 @itemx -mno-crc
21116 @opindex mcrc
21117 @opindex mno-crc
21118 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
21119
21120 @item -mginv
21121 @itemx -mno-ginv
21122 @opindex mginv
21123 @opindex mno-ginv
21124 Use (do not use) the MIPS Global INValidate (GINV) instructions.
21125
21126 @item -mlong64
21127 @opindex mlong64
21128 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
21129 an explanation of the default and the way that the pointer size is
21130 determined.
21131
21132 @item -mlong32
21133 @opindex mlong32
21134 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
21135
21136 The default size of @code{int}s, @code{long}s and pointers depends on
21137 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
21138 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
21139 32-bit @code{long}s. Pointers are the same size as @code{long}s,
21140 or the same size as integer registers, whichever is smaller.
21141
21142 @item -msym32
21143 @itemx -mno-sym32
21144 @opindex msym32
21145 @opindex mno-sym32
21146 Assume (do not assume) that all symbols have 32-bit values, regardless
21147 of the selected ABI@. This option is useful in combination with
21148 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
21149 to generate shorter and faster references to symbolic addresses.
21150
21151 @item -G @var{num}
21152 @opindex G
21153 Put definitions of externally-visible data in a small data section
21154 if that data is no bigger than @var{num} bytes. GCC can then generate
21155 more efficient accesses to the data; see @option{-mgpopt} for details.
21156
21157 The default @option{-G} option depends on the configuration.
21158
21159 @item -mlocal-sdata
21160 @itemx -mno-local-sdata
21161 @opindex mlocal-sdata
21162 @opindex mno-local-sdata
21163 Extend (do not extend) the @option{-G} behavior to local data too,
21164 such as to static variables in C@. @option{-mlocal-sdata} is the
21165 default for all configurations.
21166
21167 If the linker complains that an application is using too much small data,
21168 you might want to try rebuilding the less performance-critical parts with
21169 @option{-mno-local-sdata}. You might also want to build large
21170 libraries with @option{-mno-local-sdata}, so that the libraries leave
21171 more room for the main program.
21172
21173 @item -mextern-sdata
21174 @itemx -mno-extern-sdata
21175 @opindex mextern-sdata
21176 @opindex mno-extern-sdata
21177 Assume (do not assume) that externally-defined data is in
21178 a small data section if the size of that data is within the @option{-G} limit.
21179 @option{-mextern-sdata} is the default for all configurations.
21180
21181 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
21182 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
21183 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
21184 is placed in a small data section. If @var{Var} is defined by another
21185 module, you must either compile that module with a high-enough
21186 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
21187 definition. If @var{Var} is common, you must link the application
21188 with a high-enough @option{-G} setting.
21189
21190 The easiest way of satisfying these restrictions is to compile
21191 and link every module with the same @option{-G} option. However,
21192 you may wish to build a library that supports several different
21193 small data limits. You can do this by compiling the library with
21194 the highest supported @option{-G} setting and additionally using
21195 @option{-mno-extern-sdata} to stop the library from making assumptions
21196 about externally-defined data.
21197
21198 @item -mgpopt
21199 @itemx -mno-gpopt
21200 @opindex mgpopt
21201 @opindex mno-gpopt
21202 Use (do not use) GP-relative accesses for symbols that are known to be
21203 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
21204 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
21205 configurations.
21206
21207 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
21208 might not hold the value of @code{_gp}. For example, if the code is
21209 part of a library that might be used in a boot monitor, programs that
21210 call boot monitor routines pass an unknown value in @code{$gp}.
21211 (In such situations, the boot monitor itself is usually compiled
21212 with @option{-G0}.)
21213
21214 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
21215 @option{-mno-extern-sdata}.
21216
21217 @item -membedded-data
21218 @itemx -mno-embedded-data
21219 @opindex membedded-data
21220 @opindex mno-embedded-data
21221 Allocate variables to the read-only data section first if possible, then
21222 next in the small data section if possible, otherwise in data. This gives
21223 slightly slower code than the default, but reduces the amount of RAM required
21224 when executing, and thus may be preferred for some embedded systems.
21225
21226 @item -muninit-const-in-rodata
21227 @itemx -mno-uninit-const-in-rodata
21228 @opindex muninit-const-in-rodata
21229 @opindex mno-uninit-const-in-rodata
21230 Put uninitialized @code{const} variables in the read-only data section.
21231 This option is only meaningful in conjunction with @option{-membedded-data}.
21232
21233 @item -mcode-readable=@var{setting}
21234 @opindex mcode-readable
21235 Specify whether GCC may generate code that reads from executable sections.
21236 There are three possible settings:
21237
21238 @table @gcctabopt
21239 @item -mcode-readable=yes
21240 Instructions may freely access executable sections. This is the
21241 default setting.
21242
21243 @item -mcode-readable=pcrel
21244 MIPS16 PC-relative load instructions can access executable sections,
21245 but other instructions must not do so. This option is useful on 4KSc
21246 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
21247 It is also useful on processors that can be configured to have a dual
21248 instruction/data SRAM interface and that, like the M4K, automatically
21249 redirect PC-relative loads to the instruction RAM.
21250
21251 @item -mcode-readable=no
21252 Instructions must not access executable sections. This option can be
21253 useful on targets that are configured to have a dual instruction/data
21254 SRAM interface but that (unlike the M4K) do not automatically redirect
21255 PC-relative loads to the instruction RAM.
21256 @end table
21257
21258 @item -msplit-addresses
21259 @itemx -mno-split-addresses
21260 @opindex msplit-addresses
21261 @opindex mno-split-addresses
21262 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
21263 relocation operators. This option has been superseded by
21264 @option{-mexplicit-relocs} but is retained for backwards compatibility.
21265
21266 @item -mexplicit-relocs
21267 @itemx -mno-explicit-relocs
21268 @opindex mexplicit-relocs
21269 @opindex mno-explicit-relocs
21270 Use (do not use) assembler relocation operators when dealing with symbolic
21271 addresses. The alternative, selected by @option{-mno-explicit-relocs},
21272 is to use assembler macros instead.
21273
21274 @option{-mexplicit-relocs} is the default if GCC was configured
21275 to use an assembler that supports relocation operators.
21276
21277 @item -mcheck-zero-division
21278 @itemx -mno-check-zero-division
21279 @opindex mcheck-zero-division
21280 @opindex mno-check-zero-division
21281 Trap (do not trap) on integer division by zero.
21282
21283 The default is @option{-mcheck-zero-division}.
21284
21285 @item -mdivide-traps
21286 @itemx -mdivide-breaks
21287 @opindex mdivide-traps
21288 @opindex mdivide-breaks
21289 MIPS systems check for division by zero by generating either a
21290 conditional trap or a break instruction. Using traps results in
21291 smaller code, but is only supported on MIPS II and later. Also, some
21292 versions of the Linux kernel have a bug that prevents trap from
21293 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
21294 allow conditional traps on architectures that support them and
21295 @option{-mdivide-breaks} to force the use of breaks.
21296
21297 The default is usually @option{-mdivide-traps}, but this can be
21298 overridden at configure time using @option{--with-divide=breaks}.
21299 Divide-by-zero checks can be completely disabled using
21300 @option{-mno-check-zero-division}.
21301
21302 @item -mload-store-pairs
21303 @itemx -mno-load-store-pairs
21304 @opindex mload-store-pairs
21305 @opindex mno-load-store-pairs
21306 Enable (disable) an optimization that pairs consecutive load or store
21307 instructions to enable load/store bonding. This option is enabled by
21308 default but only takes effect when the selected architecture is known
21309 to support bonding.
21310
21311 @item -mmemcpy
21312 @itemx -mno-memcpy
21313 @opindex mmemcpy
21314 @opindex mno-memcpy
21315 Force (do not force) the use of @code{memcpy} for non-trivial block
21316 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
21317 most constant-sized copies.
21318
21319 @item -mlong-calls
21320 @itemx -mno-long-calls
21321 @opindex mlong-calls
21322 @opindex mno-long-calls
21323 Disable (do not disable) use of the @code{jal} instruction. Calling
21324 functions using @code{jal} is more efficient but requires the caller
21325 and callee to be in the same 256 megabyte segment.
21326
21327 This option has no effect on abicalls code. The default is
21328 @option{-mno-long-calls}.
21329
21330 @item -mmad
21331 @itemx -mno-mad
21332 @opindex mmad
21333 @opindex mno-mad
21334 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
21335 instructions, as provided by the R4650 ISA@.
21336
21337 @item -mimadd
21338 @itemx -mno-imadd
21339 @opindex mimadd
21340 @opindex mno-imadd
21341 Enable (disable) use of the @code{madd} and @code{msub} integer
21342 instructions. The default is @option{-mimadd} on architectures
21343 that support @code{madd} and @code{msub} except for the 74k
21344 architecture where it was found to generate slower code.
21345
21346 @item -mfused-madd
21347 @itemx -mno-fused-madd
21348 @opindex mfused-madd
21349 @opindex mno-fused-madd
21350 Enable (disable) use of the floating-point multiply-accumulate
21351 instructions, when they are available. The default is
21352 @option{-mfused-madd}.
21353
21354 On the R8000 CPU when multiply-accumulate instructions are used,
21355 the intermediate product is calculated to infinite precision
21356 and is not subject to the FCSR Flush to Zero bit. This may be
21357 undesirable in some circumstances. On other processors the result
21358 is numerically identical to the equivalent computation using
21359 separate multiply, add, subtract and negate instructions.
21360
21361 @item -nocpp
21362 @opindex nocpp
21363 Tell the MIPS assembler to not run its preprocessor over user
21364 assembler files (with a @samp{.s} suffix) when assembling them.
21365
21366 @item -mfix-24k
21367 @itemx -mno-fix-24k
21368 @opindex mfix-24k
21369 @opindex mno-fix-24k
21370 Work around the 24K E48 (lost data on stores during refill) errata.
21371 The workarounds are implemented by the assembler rather than by GCC@.
21372
21373 @item -mfix-r4000
21374 @itemx -mno-fix-r4000
21375 @opindex mfix-r4000
21376 @opindex mno-fix-r4000
21377 Work around certain R4000 CPU errata:
21378 @itemize @minus
21379 @item
21380 A double-word or a variable shift may give an incorrect result if executed
21381 immediately after starting an integer division.
21382 @item
21383 A double-word or a variable shift may give an incorrect result if executed
21384 while an integer multiplication is in progress.
21385 @item
21386 An integer division may give an incorrect result if started in a delay slot
21387 of a taken branch or a jump.
21388 @end itemize
21389
21390 @item -mfix-r4400
21391 @itemx -mno-fix-r4400
21392 @opindex mfix-r4400
21393 @opindex mno-fix-r4400
21394 Work around certain R4400 CPU errata:
21395 @itemize @minus
21396 @item
21397 A double-word or a variable shift may give an incorrect result if executed
21398 immediately after starting an integer division.
21399 @end itemize
21400
21401 @item -mfix-r10000
21402 @itemx -mno-fix-r10000
21403 @opindex mfix-r10000
21404 @opindex mno-fix-r10000
21405 Work around certain R10000 errata:
21406 @itemize @minus
21407 @item
21408 @code{ll}/@code{sc} sequences may not behave atomically on revisions
21409 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
21410 @end itemize
21411
21412 This option can only be used if the target architecture supports
21413 branch-likely instructions. @option{-mfix-r10000} is the default when
21414 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
21415 otherwise.
21416
21417 @item -mfix-rm7000
21418 @itemx -mno-fix-rm7000
21419 @opindex mfix-rm7000
21420 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
21421 workarounds are implemented by the assembler rather than by GCC@.
21422
21423 @item -mfix-vr4120
21424 @itemx -mno-fix-vr4120
21425 @opindex mfix-vr4120
21426 Work around certain VR4120 errata:
21427 @itemize @minus
21428 @item
21429 @code{dmultu} does not always produce the correct result.
21430 @item
21431 @code{div} and @code{ddiv} do not always produce the correct result if one
21432 of the operands is negative.
21433 @end itemize
21434 The workarounds for the division errata rely on special functions in
21435 @file{libgcc.a}. At present, these functions are only provided by
21436 the @code{mips64vr*-elf} configurations.
21437
21438 Other VR4120 errata require a NOP to be inserted between certain pairs of
21439 instructions. These errata are handled by the assembler, not by GCC itself.
21440
21441 @item -mfix-vr4130
21442 @opindex mfix-vr4130
21443 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
21444 workarounds are implemented by the assembler rather than by GCC,
21445 although GCC avoids using @code{mflo} and @code{mfhi} if the
21446 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
21447 instructions are available instead.
21448
21449 @item -mfix-sb1
21450 @itemx -mno-fix-sb1
21451 @opindex mfix-sb1
21452 Work around certain SB-1 CPU core errata.
21453 (This flag currently works around the SB-1 revision 2
21454 ``F1'' and ``F2'' floating-point errata.)
21455
21456 @item -mr10k-cache-barrier=@var{setting}
21457 @opindex mr10k-cache-barrier
21458 Specify whether GCC should insert cache barriers to avoid the
21459 side effects of speculation on R10K processors.
21460
21461 In common with many processors, the R10K tries to predict the outcome
21462 of a conditional branch and speculatively executes instructions from
21463 the ``taken'' branch. It later aborts these instructions if the
21464 predicted outcome is wrong. However, on the R10K, even aborted
21465 instructions can have side effects.
21466
21467 This problem only affects kernel stores and, depending on the system,
21468 kernel loads. As an example, a speculatively-executed store may load
21469 the target memory into cache and mark the cache line as dirty, even if
21470 the store itself is later aborted. If a DMA operation writes to the
21471 same area of memory before the ``dirty'' line is flushed, the cached
21472 data overwrites the DMA-ed data. See the R10K processor manual
21473 for a full description, including other potential problems.
21474
21475 One workaround is to insert cache barrier instructions before every memory
21476 access that might be speculatively executed and that might have side
21477 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
21478 controls GCC's implementation of this workaround. It assumes that
21479 aborted accesses to any byte in the following regions does not have
21480 side effects:
21481
21482 @enumerate
21483 @item
21484 the memory occupied by the current function's stack frame;
21485
21486 @item
21487 the memory occupied by an incoming stack argument;
21488
21489 @item
21490 the memory occupied by an object with a link-time-constant address.
21491 @end enumerate
21492
21493 It is the kernel's responsibility to ensure that speculative
21494 accesses to these regions are indeed safe.
21495
21496 If the input program contains a function declaration such as:
21497
21498 @smallexample
21499 void foo (void);
21500 @end smallexample
21501
21502 then the implementation of @code{foo} must allow @code{j foo} and
21503 @code{jal foo} to be executed speculatively. GCC honors this
21504 restriction for functions it compiles itself. It expects non-GCC
21505 functions (such as hand-written assembly code) to do the same.
21506
21507 The option has three forms:
21508
21509 @table @gcctabopt
21510 @item -mr10k-cache-barrier=load-store
21511 Insert a cache barrier before a load or store that might be
21512 speculatively executed and that might have side effects even
21513 if aborted.
21514
21515 @item -mr10k-cache-barrier=store
21516 Insert a cache barrier before a store that might be speculatively
21517 executed and that might have side effects even if aborted.
21518
21519 @item -mr10k-cache-barrier=none
21520 Disable the insertion of cache barriers. This is the default setting.
21521 @end table
21522
21523 @item -mflush-func=@var{func}
21524 @itemx -mno-flush-func
21525 @opindex mflush-func
21526 Specifies the function to call to flush the I and D caches, or to not
21527 call any such function. If called, the function must take the same
21528 arguments as the common @code{_flush_func}, that is, the address of the
21529 memory range for which the cache is being flushed, the size of the
21530 memory range, and the number 3 (to flush both caches). The default
21531 depends on the target GCC was configured for, but commonly is either
21532 @code{_flush_func} or @code{__cpu_flush}.
21533
21534 @item mbranch-cost=@var{num}
21535 @opindex mbranch-cost
21536 Set the cost of branches to roughly @var{num} ``simple'' instructions.
21537 This cost is only a heuristic and is not guaranteed to produce
21538 consistent results across releases. A zero cost redundantly selects
21539 the default, which is based on the @option{-mtune} setting.
21540
21541 @item -mbranch-likely
21542 @itemx -mno-branch-likely
21543 @opindex mbranch-likely
21544 @opindex mno-branch-likely
21545 Enable or disable use of Branch Likely instructions, regardless of the
21546 default for the selected architecture. By default, Branch Likely
21547 instructions may be generated if they are supported by the selected
21548 architecture. An exception is for the MIPS32 and MIPS64 architectures
21549 and processors that implement those architectures; for those, Branch
21550 Likely instructions are not be generated by default because the MIPS32
21551 and MIPS64 architectures specifically deprecate their use.
21552
21553 @item -mcompact-branches=never
21554 @itemx -mcompact-branches=optimal
21555 @itemx -mcompact-branches=always
21556 @opindex mcompact-branches=never
21557 @opindex mcompact-branches=optimal
21558 @opindex mcompact-branches=always
21559 These options control which form of branches will be generated. The
21560 default is @option{-mcompact-branches=optimal}.
21561
21562 The @option{-mcompact-branches=never} option ensures that compact branch
21563 instructions will never be generated.
21564
21565 The @option{-mcompact-branches=always} option ensures that a compact
21566 branch instruction will be generated if available. If a compact branch
21567 instruction is not available, a delay slot form of the branch will be
21568 used instead.
21569
21570 This option is supported from MIPS Release 6 onwards.
21571
21572 The @option{-mcompact-branches=optimal} option will cause a delay slot
21573 branch to be used if one is available in the current ISA and the delay
21574 slot is successfully filled. If the delay slot is not filled, a compact
21575 branch will be chosen if one is available.
21576
21577 @item -mfp-exceptions
21578 @itemx -mno-fp-exceptions
21579 @opindex mfp-exceptions
21580 Specifies whether FP exceptions are enabled. This affects how
21581 FP instructions are scheduled for some processors.
21582 The default is that FP exceptions are
21583 enabled.
21584
21585 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
21586 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
21587 FP pipe.
21588
21589 @item -mvr4130-align
21590 @itemx -mno-vr4130-align
21591 @opindex mvr4130-align
21592 The VR4130 pipeline is two-way superscalar, but can only issue two
21593 instructions together if the first one is 8-byte aligned. When this
21594 option is enabled, GCC aligns pairs of instructions that it
21595 thinks should execute in parallel.
21596
21597 This option only has an effect when optimizing for the VR4130.
21598 It normally makes code faster, but at the expense of making it bigger.
21599 It is enabled by default at optimization level @option{-O3}.
21600
21601 @item -msynci
21602 @itemx -mno-synci
21603 @opindex msynci
21604 Enable (disable) generation of @code{synci} instructions on
21605 architectures that support it. The @code{synci} instructions (if
21606 enabled) are generated when @code{__builtin___clear_cache} is
21607 compiled.
21608
21609 This option defaults to @option{-mno-synci}, but the default can be
21610 overridden by configuring GCC with @option{--with-synci}.
21611
21612 When compiling code for single processor systems, it is generally safe
21613 to use @code{synci}. However, on many multi-core (SMP) systems, it
21614 does not invalidate the instruction caches on all cores and may lead
21615 to undefined behavior.
21616
21617 @item -mrelax-pic-calls
21618 @itemx -mno-relax-pic-calls
21619 @opindex mrelax-pic-calls
21620 Try to turn PIC calls that are normally dispatched via register
21621 @code{$25} into direct calls. This is only possible if the linker can
21622 resolve the destination at link time and if the destination is within
21623 range for a direct call.
21624
21625 @option{-mrelax-pic-calls} is the default if GCC was configured to use
21626 an assembler and a linker that support the @code{.reloc} assembly
21627 directive and @option{-mexplicit-relocs} is in effect. With
21628 @option{-mno-explicit-relocs}, this optimization can be performed by the
21629 assembler and the linker alone without help from the compiler.
21630
21631 @item -mmcount-ra-address
21632 @itemx -mno-mcount-ra-address
21633 @opindex mmcount-ra-address
21634 @opindex mno-mcount-ra-address
21635 Emit (do not emit) code that allows @code{_mcount} to modify the
21636 calling function's return address. When enabled, this option extends
21637 the usual @code{_mcount} interface with a new @var{ra-address}
21638 parameter, which has type @code{intptr_t *} and is passed in register
21639 @code{$12}. @code{_mcount} can then modify the return address by
21640 doing both of the following:
21641 @itemize
21642 @item
21643 Returning the new address in register @code{$31}.
21644 @item
21645 Storing the new address in @code{*@var{ra-address}},
21646 if @var{ra-address} is nonnull.
21647 @end itemize
21648
21649 The default is @option{-mno-mcount-ra-address}.
21650
21651 @item -mframe-header-opt
21652 @itemx -mno-frame-header-opt
21653 @opindex mframe-header-opt
21654 Enable (disable) frame header optimization in the o32 ABI. When using the
21655 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
21656 function to write out register arguments. When enabled, this optimization
21657 will suppress the allocation of the frame header if it can be determined that
21658 it is unused.
21659
21660 This optimization is off by default at all optimization levels.
21661
21662 @item -mlxc1-sxc1
21663 @itemx -mno-lxc1-sxc1
21664 @opindex mlxc1-sxc1
21665 When applicable, enable (disable) the generation of @code{lwxc1},
21666 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
21667
21668 @item -mmadd4
21669 @itemx -mno-madd4
21670 @opindex mmadd4
21671 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
21672 @code{madd.d} and related instructions. Enabled by default.
21673
21674 @end table
21675
21676 @node MMIX Options
21677 @subsection MMIX Options
21678 @cindex MMIX Options
21679
21680 These options are defined for the MMIX:
21681
21682 @table @gcctabopt
21683 @item -mlibfuncs
21684 @itemx -mno-libfuncs
21685 @opindex mlibfuncs
21686 @opindex mno-libfuncs
21687 Specify that intrinsic library functions are being compiled, passing all
21688 values in registers, no matter the size.
21689
21690 @item -mepsilon
21691 @itemx -mno-epsilon
21692 @opindex mepsilon
21693 @opindex mno-epsilon
21694 Generate floating-point comparison instructions that compare with respect
21695 to the @code{rE} epsilon register.
21696
21697 @item -mabi=mmixware
21698 @itemx -mabi=gnu
21699 @opindex mabi=mmixware
21700 @opindex mabi=gnu
21701 Generate code that passes function parameters and return values that (in
21702 the called function) are seen as registers @code{$0} and up, as opposed to
21703 the GNU ABI which uses global registers @code{$231} and up.
21704
21705 @item -mzero-extend
21706 @itemx -mno-zero-extend
21707 @opindex mzero-extend
21708 @opindex mno-zero-extend
21709 When reading data from memory in sizes shorter than 64 bits, use (do not
21710 use) zero-extending load instructions by default, rather than
21711 sign-extending ones.
21712
21713 @item -mknuthdiv
21714 @itemx -mno-knuthdiv
21715 @opindex mknuthdiv
21716 @opindex mno-knuthdiv
21717 Make the result of a division yielding a remainder have the same sign as
21718 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
21719 remainder follows the sign of the dividend. Both methods are
21720 arithmetically valid, the latter being almost exclusively used.
21721
21722 @item -mtoplevel-symbols
21723 @itemx -mno-toplevel-symbols
21724 @opindex mtoplevel-symbols
21725 @opindex mno-toplevel-symbols
21726 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
21727 code can be used with the @code{PREFIX} assembly directive.
21728
21729 @item -melf
21730 @opindex melf
21731 Generate an executable in the ELF format, rather than the default
21732 @samp{mmo} format used by the @command{mmix} simulator.
21733
21734 @item -mbranch-predict
21735 @itemx -mno-branch-predict
21736 @opindex mbranch-predict
21737 @opindex mno-branch-predict
21738 Use (do not use) the probable-branch instructions, when static branch
21739 prediction indicates a probable branch.
21740
21741 @item -mbase-addresses
21742 @itemx -mno-base-addresses
21743 @opindex mbase-addresses
21744 @opindex mno-base-addresses
21745 Generate (do not generate) code that uses @emph{base addresses}. Using a
21746 base address automatically generates a request (handled by the assembler
21747 and the linker) for a constant to be set up in a global register. The
21748 register is used for one or more base address requests within the range 0
21749 to 255 from the value held in the register. The generally leads to short
21750 and fast code, but the number of different data items that can be
21751 addressed is limited. This means that a program that uses lots of static
21752 data may require @option{-mno-base-addresses}.
21753
21754 @item -msingle-exit
21755 @itemx -mno-single-exit
21756 @opindex msingle-exit
21757 @opindex mno-single-exit
21758 Force (do not force) generated code to have a single exit point in each
21759 function.
21760 @end table
21761
21762 @node MN10300 Options
21763 @subsection MN10300 Options
21764 @cindex MN10300 options
21765
21766 These @option{-m} options are defined for Matsushita MN10300 architectures:
21767
21768 @table @gcctabopt
21769 @item -mmult-bug
21770 @opindex mmult-bug
21771 Generate code to avoid bugs in the multiply instructions for the MN10300
21772 processors. This is the default.
21773
21774 @item -mno-mult-bug
21775 @opindex mno-mult-bug
21776 Do not generate code to avoid bugs in the multiply instructions for the
21777 MN10300 processors.
21778
21779 @item -mam33
21780 @opindex mam33
21781 Generate code using features specific to the AM33 processor.
21782
21783 @item -mno-am33
21784 @opindex mno-am33
21785 Do not generate code using features specific to the AM33 processor. This
21786 is the default.
21787
21788 @item -mam33-2
21789 @opindex mam33-2
21790 Generate code using features specific to the AM33/2.0 processor.
21791
21792 @item -mam34
21793 @opindex mam34
21794 Generate code using features specific to the AM34 processor.
21795
21796 @item -mtune=@var{cpu-type}
21797 @opindex mtune
21798 Use the timing characteristics of the indicated CPU type when
21799 scheduling instructions. This does not change the targeted processor
21800 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
21801 @samp{am33-2} or @samp{am34}.
21802
21803 @item -mreturn-pointer-on-d0
21804 @opindex mreturn-pointer-on-d0
21805 When generating a function that returns a pointer, return the pointer
21806 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
21807 only in @code{a0}, and attempts to call such functions without a prototype
21808 result in errors. Note that this option is on by default; use
21809 @option{-mno-return-pointer-on-d0} to disable it.
21810
21811 @item -mno-crt0
21812 @opindex mno-crt0
21813 Do not link in the C run-time initialization object file.
21814
21815 @item -mrelax
21816 @opindex mrelax
21817 Indicate to the linker that it should perform a relaxation optimization pass
21818 to shorten branches, calls and absolute memory addresses. This option only
21819 has an effect when used on the command line for the final link step.
21820
21821 This option makes symbolic debugging impossible.
21822
21823 @item -mliw
21824 @opindex mliw
21825 Allow the compiler to generate @emph{Long Instruction Word}
21826 instructions if the target is the @samp{AM33} or later. This is the
21827 default. This option defines the preprocessor macro @code{__LIW__}.
21828
21829 @item -mnoliw
21830 @opindex mnoliw
21831 Do not allow the compiler to generate @emph{Long Instruction Word}
21832 instructions. This option defines the preprocessor macro
21833 @code{__NO_LIW__}.
21834
21835 @item -msetlb
21836 @opindex msetlb
21837 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
21838 instructions if the target is the @samp{AM33} or later. This is the
21839 default. This option defines the preprocessor macro @code{__SETLB__}.
21840
21841 @item -mnosetlb
21842 @opindex mnosetlb
21843 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
21844 instructions. This option defines the preprocessor macro
21845 @code{__NO_SETLB__}.
21846
21847 @end table
21848
21849 @node Moxie Options
21850 @subsection Moxie Options
21851 @cindex Moxie Options
21852
21853 @table @gcctabopt
21854
21855 @item -meb
21856 @opindex meb
21857 Generate big-endian code. This is the default for @samp{moxie-*-*}
21858 configurations.
21859
21860 @item -mel
21861 @opindex mel
21862 Generate little-endian code.
21863
21864 @item -mmul.x
21865 @opindex mmul.x
21866 Generate mul.x and umul.x instructions. This is the default for
21867 @samp{moxiebox-*-*} configurations.
21868
21869 @item -mno-crt0
21870 @opindex mno-crt0
21871 Do not link in the C run-time initialization object file.
21872
21873 @end table
21874
21875 @node MSP430 Options
21876 @subsection MSP430 Options
21877 @cindex MSP430 Options
21878
21879 These options are defined for the MSP430:
21880
21881 @table @gcctabopt
21882
21883 @item -masm-hex
21884 @opindex masm-hex
21885 Force assembly output to always use hex constants. Normally such
21886 constants are signed decimals, but this option is available for
21887 testsuite and/or aesthetic purposes.
21888
21889 @item -mmcu=
21890 @opindex mmcu=
21891 Select the MCU to target. This is used to create a C preprocessor
21892 symbol based upon the MCU name, converted to upper case and pre- and
21893 post-fixed with @samp{__}. This in turn is used by the
21894 @file{msp430.h} header file to select an MCU-specific supplementary
21895 header file.
21896
21897 The option also sets the ISA to use. If the MCU name is one that is
21898 known to only support the 430 ISA then that is selected, otherwise the
21899 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
21900 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
21901 name selects the 430X ISA.
21902
21903 In addition an MCU-specific linker script is added to the linker
21904 command line. The script's name is the name of the MCU with
21905 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
21906 command line defines the C preprocessor symbol @code{__XXX__} and
21907 cause the linker to search for a script called @file{xxx.ld}.
21908
21909 This option is also passed on to the assembler.
21910
21911 @item -mwarn-mcu
21912 @itemx -mno-warn-mcu
21913 @opindex mwarn-mcu
21914 @opindex mno-warn-mcu
21915 This option enables or disables warnings about conflicts between the
21916 MCU name specified by the @option{-mmcu} option and the ISA set by the
21917 @option{-mcpu} option and/or the hardware multiply support set by the
21918 @option{-mhwmult} option. It also toggles warnings about unrecognized
21919 MCU names. This option is on by default.
21920
21921 @item -mcpu=
21922 @opindex mcpu=
21923 Specifies the ISA to use. Accepted values are @samp{msp430},
21924 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
21925 @option{-mmcu=} option should be used to select the ISA.
21926
21927 @item -msim
21928 @opindex msim
21929 Link to the simulator runtime libraries and linker script. Overrides
21930 any scripts that would be selected by the @option{-mmcu=} option.
21931
21932 @item -mlarge
21933 @opindex mlarge
21934 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
21935
21936 @item -msmall
21937 @opindex msmall
21938 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
21939
21940 @item -mrelax
21941 @opindex mrelax
21942 This option is passed to the assembler and linker, and allows the
21943 linker to perform certain optimizations that cannot be done until
21944 the final link.
21945
21946 @item mhwmult=
21947 @opindex mhwmult=
21948 Describes the type of hardware multiply supported by the target.
21949 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
21950 for the original 16-bit-only multiply supported by early MCUs.
21951 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
21952 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
21953 A value of @samp{auto} can also be given. This tells GCC to deduce
21954 the hardware multiply support based upon the MCU name provided by the
21955 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
21956 the MCU name is not recognized then no hardware multiply support is
21957 assumed. @code{auto} is the default setting.
21958
21959 Hardware multiplies are normally performed by calling a library
21960 routine. This saves space in the generated code. When compiling at
21961 @option{-O3} or higher however the hardware multiplier is invoked
21962 inline. This makes for bigger, but faster code.
21963
21964 The hardware multiply routines disable interrupts whilst running and
21965 restore the previous interrupt state when they finish. This makes
21966 them safe to use inside interrupt handlers as well as in normal code.
21967
21968 @item -minrt
21969 @opindex minrt
21970 Enable the use of a minimum runtime environment - no static
21971 initializers or constructors. This is intended for memory-constrained
21972 devices. The compiler includes special symbols in some objects
21973 that tell the linker and runtime which code fragments are required.
21974
21975 @item -mcode-region=
21976 @itemx -mdata-region=
21977 @opindex mcode-region
21978 @opindex mdata-region
21979 These options tell the compiler where to place functions and data that
21980 do not have one of the @code{lower}, @code{upper}, @code{either} or
21981 @code{section} attributes. Possible values are @code{lower},
21982 @code{upper}, @code{either} or @code{any}. The first three behave
21983 like the corresponding attribute. The fourth possible value -
21984 @code{any} - is the default. It leaves placement entirely up to the
21985 linker script and how it assigns the standard sections
21986 (@code{.text}, @code{.data}, etc) to the memory regions.
21987
21988 @item -msilicon-errata=
21989 @opindex msilicon-errata
21990 This option passes on a request to assembler to enable the fixes for
21991 the named silicon errata.
21992
21993 @item -msilicon-errata-warn=
21994 @opindex msilicon-errata-warn
21995 This option passes on a request to the assembler to enable warning
21996 messages when a silicon errata might need to be applied.
21997
21998 @end table
21999
22000 @node NDS32 Options
22001 @subsection NDS32 Options
22002 @cindex NDS32 Options
22003
22004 These options are defined for NDS32 implementations:
22005
22006 @table @gcctabopt
22007
22008 @item -mbig-endian
22009 @opindex mbig-endian
22010 Generate code in big-endian mode.
22011
22012 @item -mlittle-endian
22013 @opindex mlittle-endian
22014 Generate code in little-endian mode.
22015
22016 @item -mreduced-regs
22017 @opindex mreduced-regs
22018 Use reduced-set registers for register allocation.
22019
22020 @item -mfull-regs
22021 @opindex mfull-regs
22022 Use full-set registers for register allocation.
22023
22024 @item -mcmov
22025 @opindex mcmov
22026 Generate conditional move instructions.
22027
22028 @item -mno-cmov
22029 @opindex mno-cmov
22030 Do not generate conditional move instructions.
22031
22032 @item -mext-perf
22033 @opindex mperf-ext
22034 Generate performance extension instructions.
22035
22036 @item -mno-ext-perf
22037 @opindex mno-perf-ext
22038 Do not generate performance extension instructions.
22039
22040 @item -mext-perf2
22041 @opindex mperf-ext
22042 Generate performance extension 2 instructions.
22043
22044 @item -mno-ext-perf2
22045 @opindex mno-perf-ext
22046 Do not generate performance extension 2 instructions.
22047
22048 @item -mext-string
22049 @opindex mperf-ext
22050 Generate string extension instructions.
22051
22052 @item -mno-ext-string
22053 @opindex mno-perf-ext
22054 Do not generate string extension instructions.
22055
22056 @item -mv3push
22057 @opindex mv3push
22058 Generate v3 push25/pop25 instructions.
22059
22060 @item -mno-v3push
22061 @opindex mno-v3push
22062 Do not generate v3 push25/pop25 instructions.
22063
22064 @item -m16-bit
22065 @opindex m16-bit
22066 Generate 16-bit instructions.
22067
22068 @item -mno-16-bit
22069 @opindex mno-16-bit
22070 Do not generate 16-bit instructions.
22071
22072 @item -misr-vector-size=@var{num}
22073 @opindex misr-vector-size
22074 Specify the size of each interrupt vector, which must be 4 or 16.
22075
22076 @item -mcache-block-size=@var{num}
22077 @opindex mcache-block-size
22078 Specify the size of each cache block,
22079 which must be a power of 2 between 4 and 512.
22080
22081 @item -march=@var{arch}
22082 @opindex march
22083 Specify the name of the target architecture.
22084
22085 @item -mcmodel=@var{code-model}
22086 @opindex mcmodel
22087 Set the code model to one of
22088 @table @asis
22089 @item @samp{small}
22090 All the data and read-only data segments must be within 512KB addressing space.
22091 The text segment must be within 16MB addressing space.
22092 @item @samp{medium}
22093 The data segment must be within 512KB while the read-only data segment can be
22094 within 4GB addressing space. The text segment should be still within 16MB
22095 addressing space.
22096 @item @samp{large}
22097 All the text and data segments can be within 4GB addressing space.
22098 @end table
22099
22100 @item -mctor-dtor
22101 @opindex mctor-dtor
22102 Enable constructor/destructor feature.
22103
22104 @item -mrelax
22105 @opindex mrelax
22106 Guide linker to relax instructions.
22107
22108 @end table
22109
22110 @node Nios II Options
22111 @subsection Nios II Options
22112 @cindex Nios II options
22113 @cindex Altera Nios II options
22114
22115 These are the options defined for the Altera Nios II processor.
22116
22117 @table @gcctabopt
22118
22119 @item -G @var{num}
22120 @opindex G
22121 @cindex smaller data references
22122 Put global and static objects less than or equal to @var{num} bytes
22123 into the small data or BSS sections instead of the normal data or BSS
22124 sections. The default value of @var{num} is 8.
22125
22126 @item -mgpopt=@var{option}
22127 @itemx -mgpopt
22128 @itemx -mno-gpopt
22129 @opindex mgpopt
22130 @opindex mno-gpopt
22131 Generate (do not generate) GP-relative accesses. The following
22132 @var{option} names are recognized:
22133
22134 @table @samp
22135
22136 @item none
22137 Do not generate GP-relative accesses.
22138
22139 @item local
22140 Generate GP-relative accesses for small data objects that are not
22141 external, weak, or uninitialized common symbols.
22142 Also use GP-relative addressing for objects that
22143 have been explicitly placed in a small data section via a @code{section}
22144 attribute.
22145
22146 @item global
22147 As for @samp{local}, but also generate GP-relative accesses for
22148 small data objects that are external, weak, or common. If you use this option,
22149 you must ensure that all parts of your program (including libraries) are
22150 compiled with the same @option{-G} setting.
22151
22152 @item data
22153 Generate GP-relative accesses for all data objects in the program. If you
22154 use this option, the entire data and BSS segments
22155 of your program must fit in 64K of memory and you must use an appropriate
22156 linker script to allocate them within the addressable range of the
22157 global pointer.
22158
22159 @item all
22160 Generate GP-relative addresses for function pointers as well as data
22161 pointers. If you use this option, the entire text, data, and BSS segments
22162 of your program must fit in 64K of memory and you must use an appropriate
22163 linker script to allocate them within the addressable range of the
22164 global pointer.
22165
22166 @end table
22167
22168 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
22169 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
22170
22171 The default is @option{-mgpopt} except when @option{-fpic} or
22172 @option{-fPIC} is specified to generate position-independent code.
22173 Note that the Nios II ABI does not permit GP-relative accesses from
22174 shared libraries.
22175
22176 You may need to specify @option{-mno-gpopt} explicitly when building
22177 programs that include large amounts of small data, including large
22178 GOT data sections. In this case, the 16-bit offset for GP-relative
22179 addressing may not be large enough to allow access to the entire
22180 small data section.
22181
22182 @item -mgprel-sec=@var{regexp}
22183 @opindex mgprel-sec
22184 This option specifies additional section names that can be accessed via
22185 GP-relative addressing. It is most useful in conjunction with
22186 @code{section} attributes on variable declarations
22187 (@pxref{Common Variable Attributes}) and a custom linker script.
22188 The @var{regexp} is a POSIX Extended Regular Expression.
22189
22190 This option does not affect the behavior of the @option{-G} option, and
22191 the specified sections are in addition to the standard @code{.sdata}
22192 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
22193
22194 @item -mr0rel-sec=@var{regexp}
22195 @opindex mr0rel-sec
22196 This option specifies names of sections that can be accessed via a
22197 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
22198 of the 32-bit address space. It is most useful in conjunction with
22199 @code{section} attributes on variable declarations
22200 (@pxref{Common Variable Attributes}) and a custom linker script.
22201 The @var{regexp} is a POSIX Extended Regular Expression.
22202
22203 In contrast to the use of GP-relative addressing for small data,
22204 zero-based addressing is never generated by default and there are no
22205 conventional section names used in standard linker scripts for sections
22206 in the low or high areas of memory.
22207
22208 @item -mel
22209 @itemx -meb
22210 @opindex mel
22211 @opindex meb
22212 Generate little-endian (default) or big-endian (experimental) code,
22213 respectively.
22214
22215 @item -march=@var{arch}
22216 @opindex march
22217 This specifies the name of the target Nios II architecture. GCC uses this
22218 name to determine what kind of instructions it can emit when generating
22219 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
22220
22221 The preprocessor macro @code{__nios2_arch__} is available to programs,
22222 with value 1 or 2, indicating the targeted ISA level.
22223
22224 @item -mbypass-cache
22225 @itemx -mno-bypass-cache
22226 @opindex mno-bypass-cache
22227 @opindex mbypass-cache
22228 Force all load and store instructions to always bypass cache by
22229 using I/O variants of the instructions. The default is not to
22230 bypass the cache.
22231
22232 @item -mno-cache-volatile
22233 @itemx -mcache-volatile
22234 @opindex mcache-volatile
22235 @opindex mno-cache-volatile
22236 Volatile memory access bypass the cache using the I/O variants of
22237 the load and store instructions. The default is not to bypass the cache.
22238
22239 @item -mno-fast-sw-div
22240 @itemx -mfast-sw-div
22241 @opindex mno-fast-sw-div
22242 @opindex mfast-sw-div
22243 Do not use table-based fast divide for small numbers. The default
22244 is to use the fast divide at @option{-O3} and above.
22245
22246 @item -mno-hw-mul
22247 @itemx -mhw-mul
22248 @itemx -mno-hw-mulx
22249 @itemx -mhw-mulx
22250 @itemx -mno-hw-div
22251 @itemx -mhw-div
22252 @opindex mno-hw-mul
22253 @opindex mhw-mul
22254 @opindex mno-hw-mulx
22255 @opindex mhw-mulx
22256 @opindex mno-hw-div
22257 @opindex mhw-div
22258 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
22259 instructions by the compiler. The default is to emit @code{mul}
22260 and not emit @code{div} and @code{mulx}.
22261
22262 @item -mbmx
22263 @itemx -mno-bmx
22264 @itemx -mcdx
22265 @itemx -mno-cdx
22266 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
22267 CDX (code density) instructions. Enabling these instructions also
22268 requires @option{-march=r2}. Since these instructions are optional
22269 extensions to the R2 architecture, the default is not to emit them.
22270
22271 @item -mcustom-@var{insn}=@var{N}
22272 @itemx -mno-custom-@var{insn}
22273 @opindex mcustom-@var{insn}
22274 @opindex mno-custom-@var{insn}
22275 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
22276 custom instruction with encoding @var{N} when generating code that uses
22277 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
22278 instruction 253 for single-precision floating-point add operations instead
22279 of the default behavior of using a library call.
22280
22281 The following values of @var{insn} are supported. Except as otherwise
22282 noted, floating-point operations are expected to be implemented with
22283 normal IEEE 754 semantics and correspond directly to the C operators or the
22284 equivalent GCC built-in functions (@pxref{Other Builtins}).
22285
22286 Single-precision floating point:
22287 @table @asis
22288
22289 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
22290 Binary arithmetic operations.
22291
22292 @item @samp{fnegs}
22293 Unary negation.
22294
22295 @item @samp{fabss}
22296 Unary absolute value.
22297
22298 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
22299 Comparison operations.
22300
22301 @item @samp{fmins}, @samp{fmaxs}
22302 Floating-point minimum and maximum. These instructions are only
22303 generated if @option{-ffinite-math-only} is specified.
22304
22305 @item @samp{fsqrts}
22306 Unary square root operation.
22307
22308 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
22309 Floating-point trigonometric and exponential functions. These instructions
22310 are only generated if @option{-funsafe-math-optimizations} is also specified.
22311
22312 @end table
22313
22314 Double-precision floating point:
22315 @table @asis
22316
22317 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
22318 Binary arithmetic operations.
22319
22320 @item @samp{fnegd}
22321 Unary negation.
22322
22323 @item @samp{fabsd}
22324 Unary absolute value.
22325
22326 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
22327 Comparison operations.
22328
22329 @item @samp{fmind}, @samp{fmaxd}
22330 Double-precision minimum and maximum. These instructions are only
22331 generated if @option{-ffinite-math-only} is specified.
22332
22333 @item @samp{fsqrtd}
22334 Unary square root operation.
22335
22336 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
22337 Double-precision trigonometric and exponential functions. These instructions
22338 are only generated if @option{-funsafe-math-optimizations} is also specified.
22339
22340 @end table
22341
22342 Conversions:
22343 @table @asis
22344 @item @samp{fextsd}
22345 Conversion from single precision to double precision.
22346
22347 @item @samp{ftruncds}
22348 Conversion from double precision to single precision.
22349
22350 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
22351 Conversion from floating point to signed or unsigned integer types, with
22352 truncation towards zero.
22353
22354 @item @samp{round}
22355 Conversion from single-precision floating point to signed integer,
22356 rounding to the nearest integer and ties away from zero.
22357 This corresponds to the @code{__builtin_lroundf} function when
22358 @option{-fno-math-errno} is used.
22359
22360 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
22361 Conversion from signed or unsigned integer types to floating-point types.
22362
22363 @end table
22364
22365 In addition, all of the following transfer instructions for internal
22366 registers X and Y must be provided to use any of the double-precision
22367 floating-point instructions. Custom instructions taking two
22368 double-precision source operands expect the first operand in the
22369 64-bit register X. The other operand (or only operand of a unary
22370 operation) is given to the custom arithmetic instruction with the
22371 least significant half in source register @var{src1} and the most
22372 significant half in @var{src2}. A custom instruction that returns a
22373 double-precision result returns the most significant 32 bits in the
22374 destination register and the other half in 32-bit register Y.
22375 GCC automatically generates the necessary code sequences to write
22376 register X and/or read register Y when double-precision floating-point
22377 instructions are used.
22378
22379 @table @asis
22380
22381 @item @samp{fwrx}
22382 Write @var{src1} into the least significant half of X and @var{src2} into
22383 the most significant half of X.
22384
22385 @item @samp{fwry}
22386 Write @var{src1} into Y.
22387
22388 @item @samp{frdxhi}, @samp{frdxlo}
22389 Read the most or least (respectively) significant half of X and store it in
22390 @var{dest}.
22391
22392 @item @samp{frdy}
22393 Read the value of Y and store it into @var{dest}.
22394 @end table
22395
22396 Note that you can gain more local control over generation of Nios II custom
22397 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
22398 and @code{target("no-custom-@var{insn}")} function attributes
22399 (@pxref{Function Attributes})
22400 or pragmas (@pxref{Function Specific Option Pragmas}).
22401
22402 @item -mcustom-fpu-cfg=@var{name}
22403 @opindex mcustom-fpu-cfg
22404
22405 This option enables a predefined, named set of custom instruction encodings
22406 (see @option{-mcustom-@var{insn}} above).
22407 Currently, the following sets are defined:
22408
22409 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
22410 @gccoptlist{-mcustom-fmuls=252 @gol
22411 -mcustom-fadds=253 @gol
22412 -mcustom-fsubs=254 @gol
22413 -fsingle-precision-constant}
22414
22415 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
22416 @gccoptlist{-mcustom-fmuls=252 @gol
22417 -mcustom-fadds=253 @gol
22418 -mcustom-fsubs=254 @gol
22419 -mcustom-fdivs=255 @gol
22420 -fsingle-precision-constant}
22421
22422 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
22423 @gccoptlist{-mcustom-floatus=243 @gol
22424 -mcustom-fixsi=244 @gol
22425 -mcustom-floatis=245 @gol
22426 -mcustom-fcmpgts=246 @gol
22427 -mcustom-fcmples=249 @gol
22428 -mcustom-fcmpeqs=250 @gol
22429 -mcustom-fcmpnes=251 @gol
22430 -mcustom-fmuls=252 @gol
22431 -mcustom-fadds=253 @gol
22432 -mcustom-fsubs=254 @gol
22433 -mcustom-fdivs=255 @gol
22434 -fsingle-precision-constant}
22435
22436 Custom instruction assignments given by individual
22437 @option{-mcustom-@var{insn}=} options override those given by
22438 @option{-mcustom-fpu-cfg=}, regardless of the
22439 order of the options on the command line.
22440
22441 Note that you can gain more local control over selection of a FPU
22442 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
22443 function attribute (@pxref{Function Attributes})
22444 or pragma (@pxref{Function Specific Option Pragmas}).
22445
22446 @end table
22447
22448 These additional @samp{-m} options are available for the Altera Nios II
22449 ELF (bare-metal) target:
22450
22451 @table @gcctabopt
22452
22453 @item -mhal
22454 @opindex mhal
22455 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
22456 startup and termination code, and is typically used in conjunction with
22457 @option{-msys-crt0=} to specify the location of the alternate startup code
22458 provided by the HAL BSP.
22459
22460 @item -msmallc
22461 @opindex msmallc
22462 Link with a limited version of the C library, @option{-lsmallc}, rather than
22463 Newlib.
22464
22465 @item -msys-crt0=@var{startfile}
22466 @opindex msys-crt0
22467 @var{startfile} is the file name of the startfile (crt0) to use
22468 when linking. This option is only useful in conjunction with @option{-mhal}.
22469
22470 @item -msys-lib=@var{systemlib}
22471 @opindex msys-lib
22472 @var{systemlib} is the library name of the library that provides
22473 low-level system calls required by the C library,
22474 e.g. @code{read} and @code{write}.
22475 This option is typically used to link with a library provided by a HAL BSP.
22476
22477 @end table
22478
22479 @node Nvidia PTX Options
22480 @subsection Nvidia PTX Options
22481 @cindex Nvidia PTX options
22482 @cindex nvptx options
22483
22484 These options are defined for Nvidia PTX:
22485
22486 @table @gcctabopt
22487
22488 @item -m32
22489 @itemx -m64
22490 @opindex m32
22491 @opindex m64
22492 Generate code for 32-bit or 64-bit ABI.
22493
22494 @item -misa=@var{ISA-string}
22495 @opindex march
22496 Generate code for given the specified PTX ISA (e.g.@ @samp{sm_35}). ISA
22497 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
22498 @samp{sm_35}. The default ISA is sm_30.
22499
22500 @item -mmainkernel
22501 @opindex mmainkernel
22502 Link in code for a __main kernel. This is for stand-alone instead of
22503 offloading execution.
22504
22505 @item -moptimize
22506 @opindex moptimize
22507 Apply partitioned execution optimizations. This is the default when any
22508 level of optimization is selected.
22509
22510 @item -msoft-stack
22511 @opindex msoft-stack
22512 Generate code that does not use @code{.local} memory
22513 directly for stack storage. Instead, a per-warp stack pointer is
22514 maintained explicitly. This enables variable-length stack allocation (with
22515 variable-length arrays or @code{alloca}), and when global memory is used for
22516 underlying storage, makes it possible to access automatic variables from other
22517 threads, or with atomic instructions. This code generation variant is used
22518 for OpenMP offloading, but the option is exposed on its own for the purpose
22519 of testing the compiler; to generate code suitable for linking into programs
22520 using OpenMP offloading, use option @option{-mgomp}.
22521
22522 @item -muniform-simt
22523 @opindex muniform-simt
22524 Switch to code generation variant that allows to execute all threads in each
22525 warp, while maintaining memory state and side effects as if only one thread
22526 in each warp was active outside of OpenMP SIMD regions. All atomic operations
22527 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
22528 current lane index equals the master lane index), and the register being
22529 assigned is copied via a shuffle instruction from the master lane. Outside of
22530 SIMD regions lane 0 is the master; inside, each thread sees itself as the
22531 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
22532 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
22533 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
22534 with current lane index to compute the master lane index.
22535
22536 @item -mgomp
22537 @opindex mgomp
22538 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
22539 @option{-muniform-simt} options, and selects corresponding multilib variant.
22540
22541 @end table
22542
22543 @node PDP-11 Options
22544 @subsection PDP-11 Options
22545 @cindex PDP-11 Options
22546
22547 These options are defined for the PDP-11:
22548
22549 @table @gcctabopt
22550 @item -mfpu
22551 @opindex mfpu
22552 Use hardware FPP floating point. This is the default. (FIS floating
22553 point on the PDP-11/40 is not supported.) Implies -m45.
22554
22555 @item -msoft-float
22556 @opindex msoft-float
22557 Do not use hardware floating point.
22558
22559 @item -mac0
22560 @opindex mac0
22561 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
22562
22563 @item -mno-ac0
22564 @opindex mno-ac0
22565 Return floating-point results in memory. This is the default.
22566
22567 @item -m40
22568 @opindex m40
22569 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
22570
22571 @item -m45
22572 @opindex m45
22573 Generate code for a PDP-11/45. This is the default.
22574
22575 @item -m10
22576 @opindex m10
22577 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
22578
22579 @item -mint16
22580 @itemx -mno-int32
22581 @opindex mint16
22582 @opindex mno-int32
22583 Use 16-bit @code{int}. This is the default.
22584
22585 @item -mint32
22586 @itemx -mno-int16
22587 @opindex mint32
22588 @opindex mno-int16
22589 Use 32-bit @code{int}.
22590
22591 @item -mfloat64
22592 @itemx -mno-float32
22593 @opindex mfloat64
22594 @opindex mno-float32
22595 Use 64-bit @code{float}. This is the default.
22596
22597 @item -mfloat32
22598 @itemx -mno-float64
22599 @opindex mfloat32
22600 @opindex mno-float64
22601 Use 32-bit @code{float}.
22602
22603 @item -msplit
22604 @opindex msplit
22605 Target has split instruction and data space. Implies -m45.
22606
22607 @item -munix-asm
22608 @opindex munix-asm
22609 Use Unix assembler syntax.
22610
22611 @item -mdec-asm
22612 @opindex mdec-asm
22613 Use DEC assembler syntax.
22614
22615 @item -mgnu-asm
22616 @opindex mgnu-asm
22617 Use GNU assembler syntax. This is the default.
22618 @end table
22619
22620 @node picoChip Options
22621 @subsection picoChip Options
22622 @cindex picoChip options
22623
22624 These @samp{-m} options are defined for picoChip implementations:
22625
22626 @table @gcctabopt
22627
22628 @item -mae=@var{ae_type}
22629 @opindex mcpu
22630 Set the instruction set, register set, and instruction scheduling
22631 parameters for array element type @var{ae_type}. Supported values
22632 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
22633
22634 @option{-mae=ANY} selects a completely generic AE type. Code
22635 generated with this option runs on any of the other AE types. The
22636 code is not as efficient as it would be if compiled for a specific
22637 AE type, and some types of operation (e.g., multiplication) do not
22638 work properly on all types of AE.
22639
22640 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
22641 for compiled code, and is the default.
22642
22643 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
22644 option may suffer from poor performance of byte (char) manipulation,
22645 since the DSP AE does not provide hardware support for byte load/stores.
22646
22647 @item -msymbol-as-address
22648 Enable the compiler to directly use a symbol name as an address in a
22649 load/store instruction, without first loading it into a
22650 register. Typically, the use of this option generates larger
22651 programs, which run faster than when the option isn't used. However, the
22652 results vary from program to program, so it is left as a user option,
22653 rather than being permanently enabled.
22654
22655 @item -mno-inefficient-warnings
22656 Disables warnings about the generation of inefficient code. These
22657 warnings can be generated, for example, when compiling code that
22658 performs byte-level memory operations on the MAC AE type. The MAC AE has
22659 no hardware support for byte-level memory operations, so all byte
22660 load/stores must be synthesized from word load/store operations. This is
22661 inefficient and a warning is generated to indicate
22662 that you should rewrite the code to avoid byte operations, or to target
22663 an AE type that has the necessary hardware support. This option disables
22664 these warnings.
22665
22666 @end table
22667
22668 @node PowerPC Options
22669 @subsection PowerPC Options
22670 @cindex PowerPC options
22671
22672 These are listed under @xref{RS/6000 and PowerPC Options}.
22673
22674 @node PowerPC SPE Options
22675 @subsection PowerPC SPE Options
22676 @cindex PowerPC SPE options
22677
22678 These @samp{-m} options are defined for PowerPC SPE:
22679 @table @gcctabopt
22680 @item -mmfcrf
22681 @itemx -mno-mfcrf
22682 @itemx -mpopcntb
22683 @itemx -mno-popcntb
22684 @opindex mmfcrf
22685 @opindex mno-mfcrf
22686 @opindex mpopcntb
22687 @opindex mno-popcntb
22688 You use these options to specify which instructions are available on the
22689 processor you are using. The default value of these options is
22690 determined when configuring GCC@. Specifying the
22691 @option{-mcpu=@var{cpu_type}} overrides the specification of these
22692 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
22693 rather than the options listed above.
22694
22695 The @option{-mmfcrf} option allows GCC to generate the move from
22696 condition register field instruction implemented on the POWER4
22697 processor and other processors that support the PowerPC V2.01
22698 architecture.
22699 The @option{-mpopcntb} option allows GCC to generate the popcount and
22700 double-precision FP reciprocal estimate instruction implemented on the
22701 POWER5 processor and other processors that support the PowerPC V2.02
22702 architecture.
22703
22704 @item -mcpu=@var{cpu_type}
22705 @opindex mcpu
22706 Set architecture type, register usage, and
22707 instruction scheduling parameters for machine type @var{cpu_type}.
22708 Supported values for @var{cpu_type} are @samp{8540}, @samp{8548},
22709 and @samp{native}.
22710
22711 @option{-mcpu=powerpc} specifies pure 32-bit PowerPC (either
22712 endian), with an appropriate, generic processor model assumed for
22713 scheduling purposes.
22714
22715 Specifying @samp{native} as cpu type detects and selects the
22716 architecture option that corresponds to the host processor of the
22717 system performing the compilation.
22718 @option{-mcpu=native} has no effect if GCC does not recognize the
22719 processor.
22720
22721 The other options specify a specific processor. Code generated under
22722 those options runs best on that processor, and may not run at all on
22723 others.
22724
22725 The @option{-mcpu} options automatically enable or disable the
22726 following options:
22727
22728 @gccoptlist{-mhard-float -mmfcrf -mmultiple @gol
22729 -mpopcntb -mpopcntd @gol
22730 -msingle-float -mdouble-float @gol
22731 -mfloat128}
22732
22733 The particular options set for any particular CPU varies between
22734 compiler versions, depending on what setting seems to produce optimal
22735 code for that CPU; it doesn't necessarily reflect the actual hardware's
22736 capabilities. If you wish to set an individual option to a particular
22737 value, you may specify it after the @option{-mcpu} option, like
22738 @option{-mcpu=8548}.
22739
22740 @item -mtune=@var{cpu_type}
22741 @opindex mtune
22742 Set the instruction scheduling parameters for machine type
22743 @var{cpu_type}, but do not set the architecture type or register usage,
22744 as @option{-mcpu=@var{cpu_type}} does. The same
22745 values for @var{cpu_type} are used for @option{-mtune} as for
22746 @option{-mcpu}. If both are specified, the code generated uses the
22747 architecture and registers set by @option{-mcpu}, but the
22748 scheduling parameters set by @option{-mtune}.
22749
22750 @item -msecure-plt
22751 @opindex msecure-plt
22752 Generate code that allows @command{ld} and @command{ld.so}
22753 to build executables and shared
22754 libraries with non-executable @code{.plt} and @code{.got} sections.
22755 This is a PowerPC
22756 32-bit SYSV ABI option.
22757
22758 @item -mbss-plt
22759 @opindex mbss-plt
22760 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
22761 fills in, and
22762 requires @code{.plt} and @code{.got}
22763 sections that are both writable and executable.
22764 This is a PowerPC 32-bit SYSV ABI option.
22765
22766 @item -misel
22767 @itemx -mno-isel
22768 @opindex misel
22769 @opindex mno-isel
22770 This switch enables or disables the generation of ISEL instructions.
22771
22772 @item -misel=@var{yes/no}
22773 This switch has been deprecated. Use @option{-misel} and
22774 @option{-mno-isel} instead.
22775
22776 @item -mspe
22777 @itemx -mno-spe
22778 @opindex mspe
22779 @opindex mno-spe
22780 This switch enables or disables the generation of SPE simd
22781 instructions.
22782
22783 @item -mspe=@var{yes/no}
22784 This option has been deprecated. Use @option{-mspe} and
22785 @option{-mno-spe} instead.
22786
22787 @item -mfloat128
22788 @itemx -mno-float128
22789 @opindex mfloat128
22790 @opindex mno-float128
22791 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
22792 and use either software emulation for IEEE 128-bit floating point or
22793 hardware instructions.
22794
22795 @item -mfloat-gprs=@var{yes/single/double/no}
22796 @itemx -mfloat-gprs
22797 @opindex mfloat-gprs
22798 This switch enables or disables the generation of floating-point
22799 operations on the general-purpose registers for architectures that
22800 support it.
22801
22802 The argument @samp{yes} or @samp{single} enables the use of
22803 single-precision floating-point operations.
22804
22805 The argument @samp{double} enables the use of single and
22806 double-precision floating-point operations.
22807
22808 The argument @samp{no} disables floating-point operations on the
22809 general-purpose registers.
22810
22811 This option is currently only available on the MPC854x.
22812
22813 @item -mfull-toc
22814 @itemx -mno-fp-in-toc
22815 @itemx -mno-sum-in-toc
22816 @itemx -mminimal-toc
22817 @opindex mfull-toc
22818 @opindex mno-fp-in-toc
22819 @opindex mno-sum-in-toc
22820 @opindex mminimal-toc
22821 Modify generation of the TOC (Table Of Contents), which is created for
22822 every executable file. The @option{-mfull-toc} option is selected by
22823 default. In that case, GCC allocates at least one TOC entry for
22824 each unique non-automatic variable reference in your program. GCC
22825 also places floating-point constants in the TOC@. However, only
22826 16,384 entries are available in the TOC@.
22827
22828 If you receive a linker error message that saying you have overflowed
22829 the available TOC space, you can reduce the amount of TOC space used
22830 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
22831 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
22832 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
22833 generate code to calculate the sum of an address and a constant at
22834 run time instead of putting that sum into the TOC@. You may specify one
22835 or both of these options. Each causes GCC to produce very slightly
22836 slower and larger code at the expense of conserving TOC space.
22837
22838 If you still run out of space in the TOC even when you specify both of
22839 these options, specify @option{-mminimal-toc} instead. This option causes
22840 GCC to make only one TOC entry for every file. When you specify this
22841 option, GCC produces code that is slower and larger but which
22842 uses extremely little TOC space. You may wish to use this option
22843 only on files that contain less frequently-executed code.
22844
22845 @item -maix32
22846 @opindex maix32
22847 Disables the 64-bit ABI. GCC defaults to @option{-maix32}.
22848
22849 @item -mxl-compat
22850 @itemx -mno-xl-compat
22851 @opindex mxl-compat
22852 @opindex mno-xl-compat
22853 Produce code that conforms more closely to IBM XL compiler semantics
22854 when using AIX-compatible ABI@. Pass floating-point arguments to
22855 prototyped functions beyond the register save area (RSA) on the stack
22856 in addition to argument FPRs. Do not assume that most significant
22857 double in 128-bit long double value is properly rounded when comparing
22858 values and converting to double. Use XL symbol names for long double
22859 support routines.
22860
22861 The AIX calling convention was extended but not initially documented to
22862 handle an obscure K&R C case of calling a function that takes the
22863 address of its arguments with fewer arguments than declared. IBM XL
22864 compilers access floating-point arguments that do not fit in the
22865 RSA from the stack when a subroutine is compiled without
22866 optimization. Because always storing floating-point arguments on the
22867 stack is inefficient and rarely needed, this option is not enabled by
22868 default and only is necessary when calling subroutines compiled by IBM
22869 XL compilers without optimization.
22870
22871 @item -malign-natural
22872 @itemx -malign-power
22873 @opindex malign-natural
22874 @opindex malign-power
22875 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
22876 @option{-malign-natural} overrides the ABI-defined alignment of larger
22877 types, such as floating-point doubles, on their natural size-based boundary.
22878 The option @option{-malign-power} instructs GCC to follow the ABI-specified
22879 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
22880
22881 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
22882 is not supported.
22883
22884 @item -msoft-float
22885 @itemx -mhard-float
22886 @opindex msoft-float
22887 @opindex mhard-float
22888 Generate code that does not use (uses) the floating-point register set.
22889 Software floating-point emulation is provided if you use the
22890 @option{-msoft-float} option, and pass the option to GCC when linking.
22891
22892 @item -msingle-float
22893 @itemx -mdouble-float
22894 @opindex msingle-float
22895 @opindex mdouble-float
22896 Generate code for single- or double-precision floating-point operations.
22897 @option{-mdouble-float} implies @option{-msingle-float}.
22898
22899 @item -mmultiple
22900 @itemx -mno-multiple
22901 @opindex mmultiple
22902 @opindex mno-multiple
22903 Generate code that uses (does not use) the load multiple word
22904 instructions and the store multiple word instructions. These
22905 instructions are generated by default on POWER systems, and not
22906 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
22907 PowerPC systems, since those instructions do not work when the
22908 processor is in little-endian mode. The exceptions are PPC740 and
22909 PPC750 which permit these instructions in little-endian mode.
22910
22911 @item -mupdate
22912 @itemx -mno-update
22913 @opindex mupdate
22914 @opindex mno-update
22915 Generate code that uses (does not use) the load or store instructions
22916 that update the base register to the address of the calculated memory
22917 location. These instructions are generated by default. If you use
22918 @option{-mno-update}, there is a small window between the time that the
22919 stack pointer is updated and the address of the previous frame is
22920 stored, which means code that walks the stack frame across interrupts or
22921 signals may get corrupted data.
22922
22923 @item -mavoid-indexed-addresses
22924 @itemx -mno-avoid-indexed-addresses
22925 @opindex mavoid-indexed-addresses
22926 @opindex mno-avoid-indexed-addresses
22927 Generate code that tries to avoid (not avoid) the use of indexed load
22928 or store instructions. These instructions can incur a performance
22929 penalty on Power6 processors in certain situations, such as when
22930 stepping through large arrays that cross a 16M boundary. This option
22931 is enabled by default when targeting Power6 and disabled otherwise.
22932
22933 @item -mfused-madd
22934 @itemx -mno-fused-madd
22935 @opindex mfused-madd
22936 @opindex mno-fused-madd
22937 Generate code that uses (does not use) the floating-point multiply and
22938 accumulate instructions. These instructions are generated by default
22939 if hardware floating point is used. The machine-dependent
22940 @option{-mfused-madd} option is now mapped to the machine-independent
22941 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
22942 mapped to @option{-ffp-contract=off}.
22943
22944 @item -mno-strict-align
22945 @itemx -mstrict-align
22946 @opindex mno-strict-align
22947 @opindex mstrict-align
22948 On System V.4 and embedded PowerPC systems do not (do) assume that
22949 unaligned memory references are handled by the system.
22950
22951 @item -mrelocatable
22952 @itemx -mno-relocatable
22953 @opindex mrelocatable
22954 @opindex mno-relocatable
22955 Generate code that allows (does not allow) a static executable to be
22956 relocated to a different address at run time. A simple embedded
22957 PowerPC system loader should relocate the entire contents of
22958 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
22959 a table of 32-bit addresses generated by this option. For this to
22960 work, all objects linked together must be compiled with
22961 @option{-mrelocatable} or @option{-mrelocatable-lib}.
22962 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
22963
22964 @item -mrelocatable-lib
22965 @itemx -mno-relocatable-lib
22966 @opindex mrelocatable-lib
22967 @opindex mno-relocatable-lib
22968 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
22969 @code{.fixup} section to allow static executables to be relocated at
22970 run time, but @option{-mrelocatable-lib} does not use the smaller stack
22971 alignment of @option{-mrelocatable}. Objects compiled with
22972 @option{-mrelocatable-lib} may be linked with objects compiled with
22973 any combination of the @option{-mrelocatable} options.
22974
22975 @item -mno-toc
22976 @itemx -mtoc
22977 @opindex mno-toc
22978 @opindex mtoc
22979 On System V.4 and embedded PowerPC systems do not (do) assume that
22980 register 2 contains a pointer to a global area pointing to the addresses
22981 used in the program.
22982
22983 @item -mlittle
22984 @itemx -mlittle-endian
22985 @opindex mlittle
22986 @opindex mlittle-endian
22987 On System V.4 and embedded PowerPC systems compile code for the
22988 processor in little-endian mode. The @option{-mlittle-endian} option is
22989 the same as @option{-mlittle}.
22990
22991 @item -mbig
22992 @itemx -mbig-endian
22993 @opindex mbig
22994 @opindex mbig-endian
22995 On System V.4 and embedded PowerPC systems compile code for the
22996 processor in big-endian mode. The @option{-mbig-endian} option is
22997 the same as @option{-mbig}.
22998
22999 @item -mdynamic-no-pic
23000 @opindex mdynamic-no-pic
23001 On Darwin and Mac OS X systems, compile code so that it is not
23002 relocatable, but that its external references are relocatable. The
23003 resulting code is suitable for applications, but not shared
23004 libraries.
23005
23006 @item -msingle-pic-base
23007 @opindex msingle-pic-base
23008 Treat the register used for PIC addressing as read-only, rather than
23009 loading it in the prologue for each function. The runtime system is
23010 responsible for initializing this register with an appropriate value
23011 before execution begins.
23012
23013 @item -mprioritize-restricted-insns=@var{priority}
23014 @opindex mprioritize-restricted-insns
23015 This option controls the priority that is assigned to
23016 dispatch-slot restricted instructions during the second scheduling
23017 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
23018 or @samp{2} to assign no, highest, or second-highest (respectively)
23019 priority to dispatch-slot restricted
23020 instructions.
23021
23022 @item -msched-costly-dep=@var{dependence_type}
23023 @opindex msched-costly-dep
23024 This option controls which dependences are considered costly
23025 by the target during instruction scheduling. The argument
23026 @var{dependence_type} takes one of the following values:
23027
23028 @table @asis
23029 @item @samp{no}
23030 No dependence is costly.
23031
23032 @item @samp{all}
23033 All dependences are costly.
23034
23035 @item @samp{true_store_to_load}
23036 A true dependence from store to load is costly.
23037
23038 @item @samp{store_to_load}
23039 Any dependence from store to load is costly.
23040
23041 @item @var{number}
23042 Any dependence for which the latency is greater than or equal to
23043 @var{number} is costly.
23044 @end table
23045
23046 @item -minsert-sched-nops=@var{scheme}
23047 @opindex minsert-sched-nops
23048 This option controls which NOP insertion scheme is used during
23049 the second scheduling pass. The argument @var{scheme} takes one of the
23050 following values:
23051
23052 @table @asis
23053 @item @samp{no}
23054 Don't insert NOPs.
23055
23056 @item @samp{pad}
23057 Pad with NOPs any dispatch group that has vacant issue slots,
23058 according to the scheduler's grouping.
23059
23060 @item @samp{regroup_exact}
23061 Insert NOPs to force costly dependent insns into
23062 separate groups. Insert exactly as many NOPs as needed to force an insn
23063 to a new group, according to the estimated processor grouping.
23064
23065 @item @var{number}
23066 Insert NOPs to force costly dependent insns into
23067 separate groups. Insert @var{number} NOPs to force an insn to a new group.
23068 @end table
23069
23070 @item -mcall-sysv
23071 @opindex mcall-sysv
23072 On System V.4 and embedded PowerPC systems compile code using calling
23073 conventions that adhere to the March 1995 draft of the System V
23074 Application Binary Interface, PowerPC processor supplement. This is the
23075 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
23076
23077 @item -mcall-sysv-eabi
23078 @itemx -mcall-eabi
23079 @opindex mcall-sysv-eabi
23080 @opindex mcall-eabi
23081 Specify both @option{-mcall-sysv} and @option{-meabi} options.
23082
23083 @item -mcall-sysv-noeabi
23084 @opindex mcall-sysv-noeabi
23085 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
23086
23087 @item -mcall-aixdesc
23088 @opindex m
23089 On System V.4 and embedded PowerPC systems compile code for the AIX
23090 operating system.
23091
23092 @item -mcall-linux
23093 @opindex mcall-linux
23094 On System V.4 and embedded PowerPC systems compile code for the
23095 Linux-based GNU system.
23096
23097 @item -mcall-freebsd
23098 @opindex mcall-freebsd
23099 On System V.4 and embedded PowerPC systems compile code for the
23100 FreeBSD operating system.
23101
23102 @item -mcall-netbsd
23103 @opindex mcall-netbsd
23104 On System V.4 and embedded PowerPC systems compile code for the
23105 NetBSD operating system.
23106
23107 @item -mcall-openbsd
23108 @opindex mcall-netbsd
23109 On System V.4 and embedded PowerPC systems compile code for the
23110 OpenBSD operating system.
23111
23112 @item -maix-struct-return
23113 @opindex maix-struct-return
23114 Return all structures in memory (as specified by the AIX ABI)@.
23115
23116 @item -msvr4-struct-return
23117 @opindex msvr4-struct-return
23118 Return structures smaller than 8 bytes in registers (as specified by the
23119 SVR4 ABI)@.
23120
23121 @item -mabi=@var{abi-type}
23122 @opindex mabi
23123 Extend the current ABI with a particular extension, or remove such extension.
23124 Valid values are @samp{altivec}, @samp{no-altivec}, @samp{spe},
23125 @samp{no-spe}, @samp{ibmlongdouble}, @samp{ieeelongdouble},
23126 @samp{elfv1}, @samp{elfv2}@.
23127
23128 @item -mabi=spe
23129 @opindex mabi=spe
23130 Extend the current ABI with SPE ABI extensions. This does not change
23131 the default ABI, instead it adds the SPE ABI extensions to the current
23132 ABI@.
23133
23134 @item -mabi=no-spe
23135 @opindex mabi=no-spe
23136 Disable Book-E SPE ABI extensions for the current ABI@.
23137
23138 @item -mabi=ibmlongdouble
23139 @opindex mabi=ibmlongdouble
23140 Change the current ABI to use IBM extended-precision long double.
23141 This is not likely to work if your system defaults to using IEEE
23142 extended-precision long double. If you change the long double type
23143 from IEEE extended-precision, the compiler will issue a warning unless
23144 you use the @option{-Wno-psabi} option.
23145
23146 @item -mabi=ieeelongdouble
23147 @opindex mabi=ieeelongdouble
23148 Change the current ABI to use IEEE extended-precision long double.
23149 This is not likely to work if your system defaults to using IBM
23150 extended-precision long double. If you change the long double type
23151 from IBM extended-precision, the compiler will issue a warning unless
23152 you use the @option{-Wno-psabi} option.
23153
23154 @item -mabi=elfv1
23155 @opindex mabi=elfv1
23156 Change the current ABI to use the ELFv1 ABI.
23157 This is the default ABI for big-endian PowerPC 64-bit Linux.
23158 Overriding the default ABI requires special system support and is
23159 likely to fail in spectacular ways.
23160
23161 @item -mabi=elfv2
23162 @opindex mabi=elfv2
23163 Change the current ABI to use the ELFv2 ABI.
23164 This is the default ABI for little-endian PowerPC 64-bit Linux.
23165 Overriding the default ABI requires special system support and is
23166 likely to fail in spectacular ways.
23167
23168 @item -mgnu-attribute
23169 @itemx -mno-gnu-attribute
23170 @opindex mgnu-attribute
23171 @opindex mno-gnu-attribute
23172 Emit .gnu_attribute assembly directives to set tag/value pairs in a
23173 .gnu.attributes section that specify ABI variations in function
23174 parameters or return values.
23175
23176 @item -mprototype
23177 @itemx -mno-prototype
23178 @opindex mprototype
23179 @opindex mno-prototype
23180 On System V.4 and embedded PowerPC systems assume that all calls to
23181 variable argument functions are properly prototyped. Otherwise, the
23182 compiler must insert an instruction before every non-prototyped call to
23183 set or clear bit 6 of the condition code register (@code{CR}) to
23184 indicate whether floating-point values are passed in the floating-point
23185 registers in case the function takes variable arguments. With
23186 @option{-mprototype}, only calls to prototyped variable argument functions
23187 set or clear the bit.
23188
23189 @item -msim
23190 @opindex msim
23191 On embedded PowerPC systems, assume that the startup module is called
23192 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
23193 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
23194 configurations.
23195
23196 @item -mmvme
23197 @opindex mmvme
23198 On embedded PowerPC systems, assume that the startup module is called
23199 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
23200 @file{libc.a}.
23201
23202 @item -mads
23203 @opindex mads
23204 On embedded PowerPC systems, assume that the startup module is called
23205 @file{crt0.o} and the standard C libraries are @file{libads.a} and
23206 @file{libc.a}.
23207
23208 @item -myellowknife
23209 @opindex myellowknife
23210 On embedded PowerPC systems, assume that the startup module is called
23211 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
23212 @file{libc.a}.
23213
23214 @item -mvxworks
23215 @opindex mvxworks
23216 On System V.4 and embedded PowerPC systems, specify that you are
23217 compiling for a VxWorks system.
23218
23219 @item -memb
23220 @opindex memb
23221 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
23222 header to indicate that @samp{eabi} extended relocations are used.
23223
23224 @item -meabi
23225 @itemx -mno-eabi
23226 @opindex meabi
23227 @opindex mno-eabi
23228 On System V.4 and embedded PowerPC systems do (do not) adhere to the
23229 Embedded Applications Binary Interface (EABI), which is a set of
23230 modifications to the System V.4 specifications. Selecting @option{-meabi}
23231 means that the stack is aligned to an 8-byte boundary, a function
23232 @code{__eabi} is called from @code{main} to set up the EABI
23233 environment, and the @option{-msdata} option can use both @code{r2} and
23234 @code{r13} to point to two separate small data areas. Selecting
23235 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
23236 no EABI initialization function is called from @code{main}, and the
23237 @option{-msdata} option only uses @code{r13} to point to a single
23238 small data area. The @option{-meabi} option is on by default if you
23239 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
23240
23241 @item -msdata=eabi
23242 @opindex msdata=eabi
23243 On System V.4 and embedded PowerPC systems, put small initialized
23244 @code{const} global and static data in the @code{.sdata2} section, which
23245 is pointed to by register @code{r2}. Put small initialized
23246 non-@code{const} global and static data in the @code{.sdata} section,
23247 which is pointed to by register @code{r13}. Put small uninitialized
23248 global and static data in the @code{.sbss} section, which is adjacent to
23249 the @code{.sdata} section. The @option{-msdata=eabi} option is
23250 incompatible with the @option{-mrelocatable} option. The
23251 @option{-msdata=eabi} option also sets the @option{-memb} option.
23252
23253 @item -msdata=sysv
23254 @opindex msdata=sysv
23255 On System V.4 and embedded PowerPC systems, put small global and static
23256 data in the @code{.sdata} section, which is pointed to by register
23257 @code{r13}. Put small uninitialized global and static data in the
23258 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
23259 The @option{-msdata=sysv} option is incompatible with the
23260 @option{-mrelocatable} option.
23261
23262 @item -msdata=default
23263 @itemx -msdata
23264 @opindex msdata=default
23265 @opindex msdata
23266 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
23267 compile code the same as @option{-msdata=eabi}, otherwise compile code the
23268 same as @option{-msdata=sysv}.
23269
23270 @item -msdata=data
23271 @opindex msdata=data
23272 On System V.4 and embedded PowerPC systems, put small global
23273 data in the @code{.sdata} section. Put small uninitialized global
23274 data in the @code{.sbss} section. Do not use register @code{r13}
23275 to address small data however. This is the default behavior unless
23276 other @option{-msdata} options are used.
23277
23278 @item -msdata=none
23279 @itemx -mno-sdata
23280 @opindex msdata=none
23281 @opindex mno-sdata
23282 On embedded PowerPC systems, put all initialized global and static data
23283 in the @code{.data} section, and all uninitialized data in the
23284 @code{.bss} section.
23285
23286 @item -mblock-move-inline-limit=@var{num}
23287 @opindex mblock-move-inline-limit
23288 Inline all block moves (such as calls to @code{memcpy} or structure
23289 copies) less than or equal to @var{num} bytes. The minimum value for
23290 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
23291 targets. The default value is target-specific.
23292
23293 @item -G @var{num}
23294 @opindex G
23295 @cindex smaller data references (PowerPC)
23296 @cindex .sdata/.sdata2 references (PowerPC)
23297 On embedded PowerPC systems, put global and static items less than or
23298 equal to @var{num} bytes into the small data or BSS sections instead of
23299 the normal data or BSS section. By default, @var{num} is 8. The
23300 @option{-G @var{num}} switch is also passed to the linker.
23301 All modules should be compiled with the same @option{-G @var{num}} value.
23302
23303 @item -mregnames
23304 @itemx -mno-regnames
23305 @opindex mregnames
23306 @opindex mno-regnames
23307 On System V.4 and embedded PowerPC systems do (do not) emit register
23308 names in the assembly language output using symbolic forms.
23309
23310 @item -mlongcall
23311 @itemx -mno-longcall
23312 @opindex mlongcall
23313 @opindex mno-longcall
23314 By default assume that all calls are far away so that a longer and more
23315 expensive calling sequence is required. This is required for calls
23316 farther than 32 megabytes (33,554,432 bytes) from the current location.
23317 A short call is generated if the compiler knows
23318 the call cannot be that far away. This setting can be overridden by
23319 the @code{shortcall} function attribute, or by @code{#pragma
23320 longcall(0)}.
23321
23322 Some linkers are capable of detecting out-of-range calls and generating
23323 glue code on the fly. On these systems, long calls are unnecessary and
23324 generate slower code. As of this writing, the AIX linker can do this,
23325 as can the GNU linker for PowerPC/64. It is planned to add this feature
23326 to the GNU linker for 32-bit PowerPC systems as well.
23327
23328 In the future, GCC may ignore all longcall specifications
23329 when the linker is known to generate glue.
23330
23331 @item -mtls-markers
23332 @itemx -mno-tls-markers
23333 @opindex mtls-markers
23334 @opindex mno-tls-markers
23335 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
23336 specifying the function argument. The relocation allows the linker to
23337 reliably associate function call with argument setup instructions for
23338 TLS optimization, which in turn allows GCC to better schedule the
23339 sequence.
23340
23341 @item -mrecip
23342 @itemx -mno-recip
23343 @opindex mrecip
23344 This option enables use of the reciprocal estimate and
23345 reciprocal square root estimate instructions with additional
23346 Newton-Raphson steps to increase precision instead of doing a divide or
23347 square root and divide for floating-point arguments. You should use
23348 the @option{-ffast-math} option when using @option{-mrecip} (or at
23349 least @option{-funsafe-math-optimizations},
23350 @option{-ffinite-math-only}, @option{-freciprocal-math} and
23351 @option{-fno-trapping-math}). Note that while the throughput of the
23352 sequence is generally higher than the throughput of the non-reciprocal
23353 instruction, the precision of the sequence can be decreased by up to 2
23354 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
23355 roots.
23356
23357 @item -mrecip=@var{opt}
23358 @opindex mrecip=opt
23359 This option controls which reciprocal estimate instructions
23360 may be used. @var{opt} is a comma-separated list of options, which may
23361 be preceded by a @code{!} to invert the option:
23362
23363 @table @samp
23364
23365 @item all
23366 Enable all estimate instructions.
23367
23368 @item default
23369 Enable the default instructions, equivalent to @option{-mrecip}.
23370
23371 @item none
23372 Disable all estimate instructions, equivalent to @option{-mno-recip}.
23373
23374 @item div
23375 Enable the reciprocal approximation instructions for both
23376 single and double precision.
23377
23378 @item divf
23379 Enable the single-precision reciprocal approximation instructions.
23380
23381 @item divd
23382 Enable the double-precision reciprocal approximation instructions.
23383
23384 @item rsqrt
23385 Enable the reciprocal square root approximation instructions for both
23386 single and double precision.
23387
23388 @item rsqrtf
23389 Enable the single-precision reciprocal square root approximation instructions.
23390
23391 @item rsqrtd
23392 Enable the double-precision reciprocal square root approximation instructions.
23393
23394 @end table
23395
23396 So, for example, @option{-mrecip=all,!rsqrtd} enables
23397 all of the reciprocal estimate instructions, except for the
23398 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
23399 which handle the double-precision reciprocal square root calculations.
23400
23401 @item -mrecip-precision
23402 @itemx -mno-recip-precision
23403 @opindex mrecip-precision
23404 Assume (do not assume) that the reciprocal estimate instructions
23405 provide higher-precision estimates than is mandated by the PowerPC
23406 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
23407 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
23408 The double-precision square root estimate instructions are not generated by
23409 default on low-precision machines, since they do not provide an
23410 estimate that converges after three steps.
23411
23412 @item -mpointers-to-nested-functions
23413 @itemx -mno-pointers-to-nested-functions
23414 @opindex mpointers-to-nested-functions
23415 Generate (do not generate) code to load up the static chain register
23416 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
23417 systems where a function pointer points to a 3-word descriptor giving
23418 the function address, TOC value to be loaded in register @code{r2}, and
23419 static chain value to be loaded in register @code{r11}. The
23420 @option{-mpointers-to-nested-functions} is on by default. You cannot
23421 call through pointers to nested functions or pointers
23422 to functions compiled in other languages that use the static chain if
23423 you use @option{-mno-pointers-to-nested-functions}.
23424
23425 @item -msave-toc-indirect
23426 @itemx -mno-save-toc-indirect
23427 @opindex msave-toc-indirect
23428 Generate (do not generate) code to save the TOC value in the reserved
23429 stack location in the function prologue if the function calls through
23430 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
23431 saved in the prologue, it is saved just before the call through the
23432 pointer. The @option{-mno-save-toc-indirect} option is the default.
23433
23434 @item -mcompat-align-parm
23435 @itemx -mno-compat-align-parm
23436 @opindex mcompat-align-parm
23437 Generate (do not generate) code to pass structure parameters with a
23438 maximum alignment of 64 bits, for compatibility with older versions
23439 of GCC.
23440
23441 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
23442 structure parameter on a 128-bit boundary when that structure contained
23443 a member requiring 128-bit alignment. This is corrected in more
23444 recent versions of GCC. This option may be used to generate code
23445 that is compatible with functions compiled with older versions of
23446 GCC.
23447
23448 The @option{-mno-compat-align-parm} option is the default.
23449
23450 @item -mstack-protector-guard=@var{guard}
23451 @itemx -mstack-protector-guard-reg=@var{reg}
23452 @itemx -mstack-protector-guard-offset=@var{offset}
23453 @itemx -mstack-protector-guard-symbol=@var{symbol}
23454 @opindex mstack-protector-guard
23455 @opindex mstack-protector-guard-reg
23456 @opindex mstack-protector-guard-offset
23457 @opindex mstack-protector-guard-symbol
23458 Generate stack protection code using canary at @var{guard}. Supported
23459 locations are @samp{global} for global canary or @samp{tls} for per-thread
23460 canary in the TLS block (the default with GNU libc version 2.4 or later).
23461
23462 With the latter choice the options
23463 @option{-mstack-protector-guard-reg=@var{reg}} and
23464 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
23465 which register to use as base register for reading the canary, and from what
23466 offset from that base register. The default for those is as specified in the
23467 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
23468 the offset with a symbol reference to a canary in the TLS block.
23469 @end table
23470
23471
23472 @node RISC-V Options
23473 @subsection RISC-V Options
23474 @cindex RISC-V Options
23475
23476 These command-line options are defined for RISC-V targets:
23477
23478 @table @gcctabopt
23479 @item -mbranch-cost=@var{n}
23480 @opindex mbranch-cost
23481 Set the cost of branches to roughly @var{n} instructions.
23482
23483 @item -mplt
23484 @itemx -mno-plt
23485 @opindex plt
23486 When generating PIC code, do or don't allow the use of PLTs. Ignored for
23487 non-PIC. The default is @option{-mplt}.
23488
23489 @item -mabi=@var{ABI-string}
23490 @opindex mabi
23491 Specify integer and floating-point calling convention. @var{ABI-string}
23492 contains two parts: the size of integer types and the registers used for
23493 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
23494 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
23495 32-bit), and that floating-point values up to 64 bits wide are passed in F
23496 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
23497 allows the compiler to generate code that uses the F and D extensions but only
23498 allows floating-point values up to 32 bits long to be passed in registers; or
23499 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
23500 passed in registers.
23501
23502 The default for this argument is system dependent, users who want a specific
23503 calling convention should specify one explicitly. The valid calling
23504 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
23505 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
23506 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
23507 invalid because the ABI requires 64-bit values be passed in F registers, but F
23508 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
23509 only be used with the @samp{rv32e} architecture. This ABI is not well
23510 specified at present, and is subject to change.
23511
23512 @item -mfdiv
23513 @itemx -mno-fdiv
23514 @opindex mfdiv
23515 Do or don't use hardware floating-point divide and square root instructions.
23516 This requires the F or D extensions for floating-point registers. The default
23517 is to use them if the specified architecture has these instructions.
23518
23519 @item -mdiv
23520 @itemx -mno-div
23521 @opindex mdiv
23522 Do or don't use hardware instructions for integer division. This requires the
23523 M extension. The default is to use them if the specified architecture has
23524 these instructions.
23525
23526 @item -march=@var{ISA-string}
23527 @opindex march
23528 Generate code for given RISC-V ISA (e.g.@ @samp{rv64im}). ISA strings must be
23529 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
23530 @samp{rv32imaf}.
23531
23532 @item -mtune=@var{processor-string}
23533 @opindex mtune
23534 Optimize the output for the given processor, specified by microarchitecture
23535 name.
23536
23537 @item -mpreferred-stack-boundary=@var{num}
23538 @opindex mpreferred-stack-boundary
23539 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
23540 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
23541 the default is 4 (16 bytes or 128-bits).
23542
23543 @strong{Warning:} If you use this switch, then you must build all modules with
23544 the same value, including any libraries. This includes the system libraries
23545 and startup modules.
23546
23547 @item -msmall-data-limit=@var{n}
23548 @opindex msmall-data-limit
23549 Put global and static data smaller than @var{n} bytes into a special section
23550 (on some targets).
23551
23552 @item -msave-restore
23553 @itemx -mno-save-restore
23554 @opindex msave-restore
23555 Do or don't use smaller but slower prologue and epilogue code that uses
23556 library function calls. The default is to use fast inline prologues and
23557 epilogues.
23558
23559 @item -mstrict-align
23560 @itemx -mno-strict-align
23561 @opindex mstrict-align
23562 Do not or do generate unaligned memory accesses. The default is set depending
23563 on whether the processor we are optimizing for supports fast unaligned access
23564 or not.
23565
23566 @item -mcmodel=medlow
23567 @opindex mcmodel=medlow
23568 Generate code for the medium-low code model. The program and its statically
23569 defined symbols must lie within a single 2 GiB address range and must lie
23570 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
23571 statically or dynamically linked. This is the default code model.
23572
23573 @item -mcmodel=medany
23574 @opindex mcmodel=medany
23575 Generate code for the medium-any code model. The program and its statically
23576 defined symbols must be within any single 2 GiB address range. Programs can be
23577 statically or dynamically linked.
23578
23579 @item -mexplicit-relocs
23580 @itemx -mno-exlicit-relocs
23581 Use or do not use assembler relocation operators when dealing with symbolic
23582 addresses. The alternative is to use assembler macros instead, which may
23583 limit optimization.
23584
23585 @item -mrelax
23586 @itemx -mno-relax
23587 Take advantage of linker relaxations to reduce the number of instructions
23588 required to materialize symbol addresses. The default is to take advantage of
23589 linker relaxations.
23590
23591 @end table
23592
23593 @node RL78 Options
23594 @subsection RL78 Options
23595 @cindex RL78 Options
23596
23597 @table @gcctabopt
23598
23599 @item -msim
23600 @opindex msim
23601 Links in additional target libraries to support operation within a
23602 simulator.
23603
23604 @item -mmul=none
23605 @itemx -mmul=g10
23606 @itemx -mmul=g13
23607 @itemx -mmul=g14
23608 @itemx -mmul=rl78
23609 @opindex mmul
23610 Specifies the type of hardware multiplication and division support to
23611 be used. The simplest is @code{none}, which uses software for both
23612 multiplication and division. This is the default. The @code{g13}
23613 value is for the hardware multiply/divide peripheral found on the
23614 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
23615 the multiplication and division instructions supported by the RL78/G14
23616 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
23617 the value @code{mg10} is an alias for @code{none}.
23618
23619 In addition a C preprocessor macro is defined, based upon the setting
23620 of this option. Possible values are: @code{__RL78_MUL_NONE__},
23621 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
23622
23623 @item -mcpu=g10
23624 @itemx -mcpu=g13
23625 @itemx -mcpu=g14
23626 @itemx -mcpu=rl78
23627 @opindex mcpu
23628 Specifies the RL78 core to target. The default is the G14 core, also
23629 known as an S3 core or just RL78. The G13 or S2 core does not have
23630 multiply or divide instructions, instead it uses a hardware peripheral
23631 for these operations. The G10 or S1 core does not have register
23632 banks, so it uses a different calling convention.
23633
23634 If this option is set it also selects the type of hardware multiply
23635 support to use, unless this is overridden by an explicit
23636 @option{-mmul=none} option on the command line. Thus specifying
23637 @option{-mcpu=g13} enables the use of the G13 hardware multiply
23638 peripheral and specifying @option{-mcpu=g10} disables the use of
23639 hardware multiplications altogether.
23640
23641 Note, although the RL78/G14 core is the default target, specifying
23642 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
23643 change the behavior of the toolchain since it also enables G14
23644 hardware multiply support. If these options are not specified on the
23645 command line then software multiplication routines will be used even
23646 though the code targets the RL78 core. This is for backwards
23647 compatibility with older toolchains which did not have hardware
23648 multiply and divide support.
23649
23650 In addition a C preprocessor macro is defined, based upon the setting
23651 of this option. Possible values are: @code{__RL78_G10__},
23652 @code{__RL78_G13__} or @code{__RL78_G14__}.
23653
23654 @item -mg10
23655 @itemx -mg13
23656 @itemx -mg14
23657 @itemx -mrl78
23658 @opindex mg10
23659 @opindex mg13
23660 @opindex mg14
23661 @opindex mrl78
23662 These are aliases for the corresponding @option{-mcpu=} option. They
23663 are provided for backwards compatibility.
23664
23665 @item -mallregs
23666 @opindex mallregs
23667 Allow the compiler to use all of the available registers. By default
23668 registers @code{r24..r31} are reserved for use in interrupt handlers.
23669 With this option enabled these registers can be used in ordinary
23670 functions as well.
23671
23672 @item -m64bit-doubles
23673 @itemx -m32bit-doubles
23674 @opindex m64bit-doubles
23675 @opindex m32bit-doubles
23676 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
23677 or 32 bits (@option{-m32bit-doubles}) in size. The default is
23678 @option{-m32bit-doubles}.
23679
23680 @item -msave-mduc-in-interrupts
23681 @itemx -mno-save-mduc-in-interrupts
23682 @opindex msave-mduc-in-interrupts
23683 @opindex mno-save-mduc-in-interrupts
23684 Specifies that interrupt handler functions should preserve the
23685 MDUC registers. This is only necessary if normal code might use
23686 the MDUC registers, for example because it performs multiplication
23687 and division operations. The default is to ignore the MDUC registers
23688 as this makes the interrupt handlers faster. The target option -mg13
23689 needs to be passed for this to work as this feature is only available
23690 on the G13 target (S2 core). The MDUC registers will only be saved
23691 if the interrupt handler performs a multiplication or division
23692 operation or it calls another function.
23693
23694 @end table
23695
23696 @node RS/6000 and PowerPC Options
23697 @subsection IBM RS/6000 and PowerPC Options
23698 @cindex RS/6000 and PowerPC Options
23699 @cindex IBM RS/6000 and PowerPC Options
23700
23701 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
23702 @table @gcctabopt
23703 @item -mpowerpc-gpopt
23704 @itemx -mno-powerpc-gpopt
23705 @itemx -mpowerpc-gfxopt
23706 @itemx -mno-powerpc-gfxopt
23707 @need 800
23708 @itemx -mpowerpc64
23709 @itemx -mno-powerpc64
23710 @itemx -mmfcrf
23711 @itemx -mno-mfcrf
23712 @itemx -mpopcntb
23713 @itemx -mno-popcntb
23714 @itemx -mpopcntd
23715 @itemx -mno-popcntd
23716 @itemx -mfprnd
23717 @itemx -mno-fprnd
23718 @need 800
23719 @itemx -mcmpb
23720 @itemx -mno-cmpb
23721 @itemx -mmfpgpr
23722 @itemx -mno-mfpgpr
23723 @itemx -mhard-dfp
23724 @itemx -mno-hard-dfp
23725 @opindex mpowerpc-gpopt
23726 @opindex mno-powerpc-gpopt
23727 @opindex mpowerpc-gfxopt
23728 @opindex mno-powerpc-gfxopt
23729 @opindex mpowerpc64
23730 @opindex mno-powerpc64
23731 @opindex mmfcrf
23732 @opindex mno-mfcrf
23733 @opindex mpopcntb
23734 @opindex mno-popcntb
23735 @opindex mpopcntd
23736 @opindex mno-popcntd
23737 @opindex mfprnd
23738 @opindex mno-fprnd
23739 @opindex mcmpb
23740 @opindex mno-cmpb
23741 @opindex mmfpgpr
23742 @opindex mno-mfpgpr
23743 @opindex mhard-dfp
23744 @opindex mno-hard-dfp
23745 You use these options to specify which instructions are available on the
23746 processor you are using. The default value of these options is
23747 determined when configuring GCC@. Specifying the
23748 @option{-mcpu=@var{cpu_type}} overrides the specification of these
23749 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
23750 rather than the options listed above.
23751
23752 Specifying @option{-mpowerpc-gpopt} allows
23753 GCC to use the optional PowerPC architecture instructions in the
23754 General Purpose group, including floating-point square root. Specifying
23755 @option{-mpowerpc-gfxopt} allows GCC to
23756 use the optional PowerPC architecture instructions in the Graphics
23757 group, including floating-point select.
23758
23759 The @option{-mmfcrf} option allows GCC to generate the move from
23760 condition register field instruction implemented on the POWER4
23761 processor and other processors that support the PowerPC V2.01
23762 architecture.
23763 The @option{-mpopcntb} option allows GCC to generate the popcount and
23764 double-precision FP reciprocal estimate instruction implemented on the
23765 POWER5 processor and other processors that support the PowerPC V2.02
23766 architecture.
23767 The @option{-mpopcntd} option allows GCC to generate the popcount
23768 instruction implemented on the POWER7 processor and other processors
23769 that support the PowerPC V2.06 architecture.
23770 The @option{-mfprnd} option allows GCC to generate the FP round to
23771 integer instructions implemented on the POWER5+ processor and other
23772 processors that support the PowerPC V2.03 architecture.
23773 The @option{-mcmpb} option allows GCC to generate the compare bytes
23774 instruction implemented on the POWER6 processor and other processors
23775 that support the PowerPC V2.05 architecture.
23776 The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
23777 general-purpose register instructions implemented on the POWER6X
23778 processor and other processors that support the extended PowerPC V2.05
23779 architecture.
23780 The @option{-mhard-dfp} option allows GCC to generate the decimal
23781 floating-point instructions implemented on some POWER processors.
23782
23783 The @option{-mpowerpc64} option allows GCC to generate the additional
23784 64-bit instructions that are found in the full PowerPC64 architecture
23785 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
23786 @option{-mno-powerpc64}.
23787
23788 @item -mcpu=@var{cpu_type}
23789 @opindex mcpu
23790 Set architecture type, register usage, and
23791 instruction scheduling parameters for machine type @var{cpu_type}.
23792 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
23793 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
23794 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
23795 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
23796 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
23797 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
23798 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
23799 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
23800 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
23801 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
23802 @samp{power9}, @samp{powerpc}, @samp{powerpc64}, @samp{powerpc64le},
23803 @samp{rs64}, and @samp{native}.
23804
23805 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
23806 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
23807 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
23808 architecture machine types, with an appropriate, generic processor
23809 model assumed for scheduling purposes.
23810
23811 Specifying @samp{native} as cpu type detects and selects the
23812 architecture option that corresponds to the host processor of the
23813 system performing the compilation.
23814 @option{-mcpu=native} has no effect if GCC does not recognize the
23815 processor.
23816
23817 The other options specify a specific processor. Code generated under
23818 those options runs best on that processor, and may not run at all on
23819 others.
23820
23821 The @option{-mcpu} options automatically enable or disable the
23822 following options:
23823
23824 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
23825 -mpopcntb -mpopcntd -mpowerpc64 @gol
23826 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
23827 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
23828 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
23829 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
23830
23831 The particular options set for any particular CPU varies between
23832 compiler versions, depending on what setting seems to produce optimal
23833 code for that CPU; it doesn't necessarily reflect the actual hardware's
23834 capabilities. If you wish to set an individual option to a particular
23835 value, you may specify it after the @option{-mcpu} option, like
23836 @option{-mcpu=970 -mno-altivec}.
23837
23838 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
23839 not enabled or disabled by the @option{-mcpu} option at present because
23840 AIX does not have full support for these options. You may still
23841 enable or disable them individually if you're sure it'll work in your
23842 environment.
23843
23844 @item -mtune=@var{cpu_type}
23845 @opindex mtune
23846 Set the instruction scheduling parameters for machine type
23847 @var{cpu_type}, but do not set the architecture type or register usage,
23848 as @option{-mcpu=@var{cpu_type}} does. The same
23849 values for @var{cpu_type} are used for @option{-mtune} as for
23850 @option{-mcpu}. If both are specified, the code generated uses the
23851 architecture and registers set by @option{-mcpu}, but the
23852 scheduling parameters set by @option{-mtune}.
23853
23854 @item -mcmodel=small
23855 @opindex mcmodel=small
23856 Generate PowerPC64 code for the small model: The TOC is limited to
23857 64k.
23858
23859 @item -mcmodel=medium
23860 @opindex mcmodel=medium
23861 Generate PowerPC64 code for the medium model: The TOC and other static
23862 data may be up to a total of 4G in size. This is the default for 64-bit
23863 Linux.
23864
23865 @item -mcmodel=large
23866 @opindex mcmodel=large
23867 Generate PowerPC64 code for the large model: The TOC may be up to 4G
23868 in size. Other data and code is only limited by the 64-bit address
23869 space.
23870
23871 @item -maltivec
23872 @itemx -mno-altivec
23873 @opindex maltivec
23874 @opindex mno-altivec
23875 Generate code that uses (does not use) AltiVec instructions, and also
23876 enable the use of built-in functions that allow more direct access to
23877 the AltiVec instruction set. You may also need to set
23878 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
23879 enhancements.
23880
23881 When @option{-maltivec} is used, rather than @option{-maltivec=le} or
23882 @option{-maltivec=be}, the element order for AltiVec intrinsics such
23883 as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
23884 match array element order corresponding to the endianness of the
23885 target. That is, element zero identifies the leftmost element in a
23886 vector register when targeting a big-endian platform, and identifies
23887 the rightmost element in a vector register when targeting a
23888 little-endian platform.
23889
23890 @item -maltivec=be
23891 @opindex maltivec=be
23892 Generate AltiVec instructions using big-endian element order,
23893 regardless of whether the target is big- or little-endian. This is
23894 the default when targeting a big-endian platform. Using this option
23895 is currently deprecated. Support for this feature will be removed in
23896 GCC 9.
23897
23898 The element order is used to interpret element numbers in AltiVec
23899 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23900 @code{vec_insert}. By default, these match array element order
23901 corresponding to the endianness for the target.
23902
23903 @item -maltivec=le
23904 @opindex maltivec=le
23905 Generate AltiVec instructions using little-endian element order,
23906 regardless of whether the target is big- or little-endian. This is
23907 the default when targeting a little-endian platform. This option is
23908 currently ignored when targeting a big-endian platform.
23909
23910 The element order is used to interpret element numbers in AltiVec
23911 intrinsics such as @code{vec_splat}, @code{vec_extract}, and
23912 @code{vec_insert}. By default, these match array element order
23913 corresponding to the endianness for the target.
23914
23915 @item -mvrsave
23916 @itemx -mno-vrsave
23917 @opindex mvrsave
23918 @opindex mno-vrsave
23919 Generate VRSAVE instructions when generating AltiVec code.
23920
23921 @item -msecure-plt
23922 @opindex msecure-plt
23923 Generate code that allows @command{ld} and @command{ld.so}
23924 to build executables and shared
23925 libraries with non-executable @code{.plt} and @code{.got} sections.
23926 This is a PowerPC
23927 32-bit SYSV ABI option.
23928
23929 @item -mbss-plt
23930 @opindex mbss-plt
23931 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
23932 fills in, and
23933 requires @code{.plt} and @code{.got}
23934 sections that are both writable and executable.
23935 This is a PowerPC 32-bit SYSV ABI option.
23936
23937 @item -misel
23938 @itemx -mno-isel
23939 @opindex misel
23940 @opindex mno-isel
23941 This switch enables or disables the generation of ISEL instructions.
23942
23943 @item -mvsx
23944 @itemx -mno-vsx
23945 @opindex mvsx
23946 @opindex mno-vsx
23947 Generate code that uses (does not use) vector/scalar (VSX)
23948 instructions, and also enable the use of built-in functions that allow
23949 more direct access to the VSX instruction set.
23950
23951 @item -mcrypto
23952 @itemx -mno-crypto
23953 @opindex mcrypto
23954 @opindex mno-crypto
23955 Enable the use (disable) of the built-in functions that allow direct
23956 access to the cryptographic instructions that were added in version
23957 2.07 of the PowerPC ISA.
23958
23959 @item -mhtm
23960 @itemx -mno-htm
23961 @opindex mhtm
23962 @opindex mno-htm
23963 Enable (disable) the use of the built-in functions that allow direct
23964 access to the Hardware Transactional Memory (HTM) instructions that
23965 were added in version 2.07 of the PowerPC ISA.
23966
23967 @item -mpower8-fusion
23968 @itemx -mno-power8-fusion
23969 @opindex mpower8-fusion
23970 @opindex mno-power8-fusion
23971 Generate code that keeps (does not keeps) some integer operations
23972 adjacent so that the instructions can be fused together on power8 and
23973 later processors.
23974
23975 @item -mpower8-vector
23976 @itemx -mno-power8-vector
23977 @opindex mpower8-vector
23978 @opindex mno-power8-vector
23979 Generate code that uses (does not use) the vector and scalar
23980 instructions that were added in version 2.07 of the PowerPC ISA. Also
23981 enable the use of built-in functions that allow more direct access to
23982 the vector instructions.
23983
23984 @item -mquad-memory
23985 @itemx -mno-quad-memory
23986 @opindex mquad-memory
23987 @opindex mno-quad-memory
23988 Generate code that uses (does not use) the non-atomic quad word memory
23989 instructions. The @option{-mquad-memory} option requires use of
23990 64-bit mode.
23991
23992 @item -mquad-memory-atomic
23993 @itemx -mno-quad-memory-atomic
23994 @opindex mquad-memory-atomic
23995 @opindex mno-quad-memory-atomic
23996 Generate code that uses (does not use) the atomic quad word memory
23997 instructions. The @option{-mquad-memory-atomic} option requires use of
23998 64-bit mode.
23999
24000 @item -mfloat128
24001 @itemx -mno-float128
24002 @opindex mfloat128
24003 @opindex mno-float128
24004 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24005 and use either software emulation for IEEE 128-bit floating point or
24006 hardware instructions.
24007
24008 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24009 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24010 use the IEEE 128-bit floating point support. The IEEE 128-bit
24011 floating point support only works on PowerPC Linux systems.
24012
24013 The default for @option{-mfloat128} is enabled on PowerPC Linux
24014 systems using the VSX instruction set, and disabled on other systems.
24015
24016 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24017 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24018 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24019 floating point instructions. Otherwise, if you do not specify to
24020 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24021 system, IEEE 128-bit floating point will be done with software
24022 emulation.
24023
24024 @item -mfloat128-hardware
24025 @itemx -mno-float128-hardware
24026 @opindex mfloat128-hardware
24027 @opindex mno-float128-hardware
24028 Enable/disable using ISA 3.0 hardware instructions to support the
24029 @var{__float128} data type.
24030
24031 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24032 Linux systems using the ISA 3.0 instruction set, and disabled on other
24033 systems.
24034
24035 @item -m32
24036 @itemx -m64
24037 @opindex m32
24038 @opindex m64
24039 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24040 targets (including GNU/Linux). The 32-bit environment sets int, long
24041 and pointer to 32 bits and generates code that runs on any PowerPC
24042 variant. The 64-bit environment sets int to 32 bits and long and
24043 pointer to 64 bits, and generates code for PowerPC64, as for
24044 @option{-mpowerpc64}.
24045
24046 @item -mfull-toc
24047 @itemx -mno-fp-in-toc
24048 @itemx -mno-sum-in-toc
24049 @itemx -mminimal-toc
24050 @opindex mfull-toc
24051 @opindex mno-fp-in-toc
24052 @opindex mno-sum-in-toc
24053 @opindex mminimal-toc
24054 Modify generation of the TOC (Table Of Contents), which is created for
24055 every executable file. The @option{-mfull-toc} option is selected by
24056 default. In that case, GCC allocates at least one TOC entry for
24057 each unique non-automatic variable reference in your program. GCC
24058 also places floating-point constants in the TOC@. However, only
24059 16,384 entries are available in the TOC@.
24060
24061 If you receive a linker error message that saying you have overflowed
24062 the available TOC space, you can reduce the amount of TOC space used
24063 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24064 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24065 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24066 generate code to calculate the sum of an address and a constant at
24067 run time instead of putting that sum into the TOC@. You may specify one
24068 or both of these options. Each causes GCC to produce very slightly
24069 slower and larger code at the expense of conserving TOC space.
24070
24071 If you still run out of space in the TOC even when you specify both of
24072 these options, specify @option{-mminimal-toc} instead. This option causes
24073 GCC to make only one TOC entry for every file. When you specify this
24074 option, GCC produces code that is slower and larger but which
24075 uses extremely little TOC space. You may wish to use this option
24076 only on files that contain less frequently-executed code.
24077
24078 @item -maix64
24079 @itemx -maix32
24080 @opindex maix64
24081 @opindex maix32
24082 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24083 @code{long} type, and the infrastructure needed to support them.
24084 Specifying @option{-maix64} implies @option{-mpowerpc64},
24085 while @option{-maix32} disables the 64-bit ABI and
24086 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24087
24088 @item -mxl-compat
24089 @itemx -mno-xl-compat
24090 @opindex mxl-compat
24091 @opindex mno-xl-compat
24092 Produce code that conforms more closely to IBM XL compiler semantics
24093 when using AIX-compatible ABI@. Pass floating-point arguments to
24094 prototyped functions beyond the register save area (RSA) on the stack
24095 in addition to argument FPRs. Do not assume that most significant
24096 double in 128-bit long double value is properly rounded when comparing
24097 values and converting to double. Use XL symbol names for long double
24098 support routines.
24099
24100 The AIX calling convention was extended but not initially documented to
24101 handle an obscure K&R C case of calling a function that takes the
24102 address of its arguments with fewer arguments than declared. IBM XL
24103 compilers access floating-point arguments that do not fit in the
24104 RSA from the stack when a subroutine is compiled without
24105 optimization. Because always storing floating-point arguments on the
24106 stack is inefficient and rarely needed, this option is not enabled by
24107 default and only is necessary when calling subroutines compiled by IBM
24108 XL compilers without optimization.
24109
24110 @item -mpe
24111 @opindex mpe
24112 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24113 application written to use message passing with special startup code to
24114 enable the application to run. The system must have PE installed in the
24115 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24116 must be overridden with the @option{-specs=} option to specify the
24117 appropriate directory location. The Parallel Environment does not
24118 support threads, so the @option{-mpe} option and the @option{-pthread}
24119 option are incompatible.
24120
24121 @item -malign-natural
24122 @itemx -malign-power
24123 @opindex malign-natural
24124 @opindex malign-power
24125 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24126 @option{-malign-natural} overrides the ABI-defined alignment of larger
24127 types, such as floating-point doubles, on their natural size-based boundary.
24128 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24129 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24130
24131 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24132 is not supported.
24133
24134 @item -msoft-float
24135 @itemx -mhard-float
24136 @opindex msoft-float
24137 @opindex mhard-float
24138 Generate code that does not use (uses) the floating-point register set.
24139 Software floating-point emulation is provided if you use the
24140 @option{-msoft-float} option, and pass the option to GCC when linking.
24141
24142 @item -mmultiple
24143 @itemx -mno-multiple
24144 @opindex mmultiple
24145 @opindex mno-multiple
24146 Generate code that uses (does not use) the load multiple word
24147 instructions and the store multiple word instructions. These
24148 instructions are generated by default on POWER systems, and not
24149 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24150 PowerPC systems, since those instructions do not work when the
24151 processor is in little-endian mode. The exceptions are PPC740 and
24152 PPC750 which permit these instructions in little-endian mode.
24153
24154 @item -mupdate
24155 @itemx -mno-update
24156 @opindex mupdate
24157 @opindex mno-update
24158 Generate code that uses (does not use) the load or store instructions
24159 that update the base register to the address of the calculated memory
24160 location. These instructions are generated by default. If you use
24161 @option{-mno-update}, there is a small window between the time that the
24162 stack pointer is updated and the address of the previous frame is
24163 stored, which means code that walks the stack frame across interrupts or
24164 signals may get corrupted data.
24165
24166 @item -mavoid-indexed-addresses
24167 @itemx -mno-avoid-indexed-addresses
24168 @opindex mavoid-indexed-addresses
24169 @opindex mno-avoid-indexed-addresses
24170 Generate code that tries to avoid (not avoid) the use of indexed load
24171 or store instructions. These instructions can incur a performance
24172 penalty on Power6 processors in certain situations, such as when
24173 stepping through large arrays that cross a 16M boundary. This option
24174 is enabled by default when targeting Power6 and disabled otherwise.
24175
24176 @item -mfused-madd
24177 @itemx -mno-fused-madd
24178 @opindex mfused-madd
24179 @opindex mno-fused-madd
24180 Generate code that uses (does not use) the floating-point multiply and
24181 accumulate instructions. These instructions are generated by default
24182 if hardware floating point is used. The machine-dependent
24183 @option{-mfused-madd} option is now mapped to the machine-independent
24184 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24185 mapped to @option{-ffp-contract=off}.
24186
24187 @item -mmulhw
24188 @itemx -mno-mulhw
24189 @opindex mmulhw
24190 @opindex mno-mulhw
24191 Generate code that uses (does not use) the half-word multiply and
24192 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24193 These instructions are generated by default when targeting those
24194 processors.
24195
24196 @item -mdlmzb
24197 @itemx -mno-dlmzb
24198 @opindex mdlmzb
24199 @opindex mno-dlmzb
24200 Generate code that uses (does not use) the string-search @samp{dlmzb}
24201 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24202 generated by default when targeting those processors.
24203
24204 @item -mno-bit-align
24205 @itemx -mbit-align
24206 @opindex mno-bit-align
24207 @opindex mbit-align
24208 On System V.4 and embedded PowerPC systems do not (do) force structures
24209 and unions that contain bit-fields to be aligned to the base type of the
24210 bit-field.
24211
24212 For example, by default a structure containing nothing but 8
24213 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24214 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24215 the structure is aligned to a 1-byte boundary and is 1 byte in
24216 size.
24217
24218 @item -mno-strict-align
24219 @itemx -mstrict-align
24220 @opindex mno-strict-align
24221 @opindex mstrict-align
24222 On System V.4 and embedded PowerPC systems do not (do) assume that
24223 unaligned memory references are handled by the system.
24224
24225 @item -mrelocatable
24226 @itemx -mno-relocatable
24227 @opindex mrelocatable
24228 @opindex mno-relocatable
24229 Generate code that allows (does not allow) a static executable to be
24230 relocated to a different address at run time. A simple embedded
24231 PowerPC system loader should relocate the entire contents of
24232 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24233 a table of 32-bit addresses generated by this option. For this to
24234 work, all objects linked together must be compiled with
24235 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24236 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24237
24238 @item -mrelocatable-lib
24239 @itemx -mno-relocatable-lib
24240 @opindex mrelocatable-lib
24241 @opindex mno-relocatable-lib
24242 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24243 @code{.fixup} section to allow static executables to be relocated at
24244 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24245 alignment of @option{-mrelocatable}. Objects compiled with
24246 @option{-mrelocatable-lib} may be linked with objects compiled with
24247 any combination of the @option{-mrelocatable} options.
24248
24249 @item -mno-toc
24250 @itemx -mtoc
24251 @opindex mno-toc
24252 @opindex mtoc
24253 On System V.4 and embedded PowerPC systems do not (do) assume that
24254 register 2 contains a pointer to a global area pointing to the addresses
24255 used in the program.
24256
24257 @item -mlittle
24258 @itemx -mlittle-endian
24259 @opindex mlittle
24260 @opindex mlittle-endian
24261 On System V.4 and embedded PowerPC systems compile code for the
24262 processor in little-endian mode. The @option{-mlittle-endian} option is
24263 the same as @option{-mlittle}.
24264
24265 @item -mbig
24266 @itemx -mbig-endian
24267 @opindex mbig
24268 @opindex mbig-endian
24269 On System V.4 and embedded PowerPC systems compile code for the
24270 processor in big-endian mode. The @option{-mbig-endian} option is
24271 the same as @option{-mbig}.
24272
24273 @item -mdynamic-no-pic
24274 @opindex mdynamic-no-pic
24275 On Darwin and Mac OS X systems, compile code so that it is not
24276 relocatable, but that its external references are relocatable. The
24277 resulting code is suitable for applications, but not shared
24278 libraries.
24279
24280 @item -msingle-pic-base
24281 @opindex msingle-pic-base
24282 Treat the register used for PIC addressing as read-only, rather than
24283 loading it in the prologue for each function. The runtime system is
24284 responsible for initializing this register with an appropriate value
24285 before execution begins.
24286
24287 @item -mprioritize-restricted-insns=@var{priority}
24288 @opindex mprioritize-restricted-insns
24289 This option controls the priority that is assigned to
24290 dispatch-slot restricted instructions during the second scheduling
24291 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24292 or @samp{2} to assign no, highest, or second-highest (respectively)
24293 priority to dispatch-slot restricted
24294 instructions.
24295
24296 @item -msched-costly-dep=@var{dependence_type}
24297 @opindex msched-costly-dep
24298 This option controls which dependences are considered costly
24299 by the target during instruction scheduling. The argument
24300 @var{dependence_type} takes one of the following values:
24301
24302 @table @asis
24303 @item @samp{no}
24304 No dependence is costly.
24305
24306 @item @samp{all}
24307 All dependences are costly.
24308
24309 @item @samp{true_store_to_load}
24310 A true dependence from store to load is costly.
24311
24312 @item @samp{store_to_load}
24313 Any dependence from store to load is costly.
24314
24315 @item @var{number}
24316 Any dependence for which the latency is greater than or equal to
24317 @var{number} is costly.
24318 @end table
24319
24320 @item -minsert-sched-nops=@var{scheme}
24321 @opindex minsert-sched-nops
24322 This option controls which NOP insertion scheme is used during
24323 the second scheduling pass. The argument @var{scheme} takes one of the
24324 following values:
24325
24326 @table @asis
24327 @item @samp{no}
24328 Don't insert NOPs.
24329
24330 @item @samp{pad}
24331 Pad with NOPs any dispatch group that has vacant issue slots,
24332 according to the scheduler's grouping.
24333
24334 @item @samp{regroup_exact}
24335 Insert NOPs to force costly dependent insns into
24336 separate groups. Insert exactly as many NOPs as needed to force an insn
24337 to a new group, according to the estimated processor grouping.
24338
24339 @item @var{number}
24340 Insert NOPs to force costly dependent insns into
24341 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24342 @end table
24343
24344 @item -mcall-sysv
24345 @opindex mcall-sysv
24346 On System V.4 and embedded PowerPC systems compile code using calling
24347 conventions that adhere to the March 1995 draft of the System V
24348 Application Binary Interface, PowerPC processor supplement. This is the
24349 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24350
24351 @item -mcall-sysv-eabi
24352 @itemx -mcall-eabi
24353 @opindex mcall-sysv-eabi
24354 @opindex mcall-eabi
24355 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24356
24357 @item -mcall-sysv-noeabi
24358 @opindex mcall-sysv-noeabi
24359 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24360
24361 @item -mcall-aixdesc
24362 @opindex m
24363 On System V.4 and embedded PowerPC systems compile code for the AIX
24364 operating system.
24365
24366 @item -mcall-linux
24367 @opindex mcall-linux
24368 On System V.4 and embedded PowerPC systems compile code for the
24369 Linux-based GNU system.
24370
24371 @item -mcall-freebsd
24372 @opindex mcall-freebsd
24373 On System V.4 and embedded PowerPC systems compile code for the
24374 FreeBSD operating system.
24375
24376 @item -mcall-netbsd
24377 @opindex mcall-netbsd
24378 On System V.4 and embedded PowerPC systems compile code for the
24379 NetBSD operating system.
24380
24381 @item -mcall-openbsd
24382 @opindex mcall-netbsd
24383 On System V.4 and embedded PowerPC systems compile code for the
24384 OpenBSD operating system.
24385
24386 @item -mtraceback=@var{traceback_type}
24387 @opindex mtraceback
24388 Select the type of traceback table. Valid values for @var{traceback_type}
24389 are @samp{full}, @samp{part}, and @samp{no}.
24390
24391 @item -maix-struct-return
24392 @opindex maix-struct-return
24393 Return all structures in memory (as specified by the AIX ABI)@.
24394
24395 @item -msvr4-struct-return
24396 @opindex msvr4-struct-return
24397 Return structures smaller than 8 bytes in registers (as specified by the
24398 SVR4 ABI)@.
24399
24400 @item -mabi=@var{abi-type}
24401 @opindex mabi
24402 Extend the current ABI with a particular extension, or remove such extension.
24403 Valid values are @samp{altivec}, @samp{no-altivec},
24404 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24405 @samp{elfv1}, @samp{elfv2}@.
24406
24407 @item -mabi=ibmlongdouble
24408 @opindex mabi=ibmlongdouble
24409 Change the current ABI to use IBM extended-precision long double.
24410 This is not likely to work if your system defaults to using IEEE
24411 extended-precision long double. If you change the long double type
24412 from IEEE extended-precision, the compiler will issue a warning unless
24413 you use the @option{-Wno-psabi} option.
24414
24415 @item -mabi=ieeelongdouble
24416 @opindex mabi=ieeelongdouble
24417 Change the current ABI to use IEEE extended-precision long double.
24418 This is not likely to work if your system defaults to using IBM
24419 extended-precision long double. If you change the long double type
24420 from IBM extended-precision, the compiler will issue a warning unless
24421 you use the @option{-Wno-psabi} option.
24422
24423 @item -mabi=elfv1
24424 @opindex mabi=elfv1
24425 Change the current ABI to use the ELFv1 ABI.
24426 This is the default ABI for big-endian PowerPC 64-bit Linux.
24427 Overriding the default ABI requires special system support and is
24428 likely to fail in spectacular ways.
24429
24430 @item -mabi=elfv2
24431 @opindex mabi=elfv2
24432 Change the current ABI to use the ELFv2 ABI.
24433 This is the default ABI for little-endian PowerPC 64-bit Linux.
24434 Overriding the default ABI requires special system support and is
24435 likely to fail in spectacular ways.
24436
24437 @item -mgnu-attribute
24438 @itemx -mno-gnu-attribute
24439 @opindex mgnu-attribute
24440 @opindex mno-gnu-attribute
24441 Emit .gnu_attribute assembly directives to set tag/value pairs in a
24442 .gnu.attributes section that specify ABI variations in function
24443 parameters or return values.
24444
24445 @item -mprototype
24446 @itemx -mno-prototype
24447 @opindex mprototype
24448 @opindex mno-prototype
24449 On System V.4 and embedded PowerPC systems assume that all calls to
24450 variable argument functions are properly prototyped. Otherwise, the
24451 compiler must insert an instruction before every non-prototyped call to
24452 set or clear bit 6 of the condition code register (@code{CR}) to
24453 indicate whether floating-point values are passed in the floating-point
24454 registers in case the function takes variable arguments. With
24455 @option{-mprototype}, only calls to prototyped variable argument functions
24456 set or clear the bit.
24457
24458 @item -msim
24459 @opindex msim
24460 On embedded PowerPC systems, assume that the startup module is called
24461 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
24462 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
24463 configurations.
24464
24465 @item -mmvme
24466 @opindex mmvme
24467 On embedded PowerPC systems, assume that the startup module is called
24468 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
24469 @file{libc.a}.
24470
24471 @item -mads
24472 @opindex mads
24473 On embedded PowerPC systems, assume that the startup module is called
24474 @file{crt0.o} and the standard C libraries are @file{libads.a} and
24475 @file{libc.a}.
24476
24477 @item -myellowknife
24478 @opindex myellowknife
24479 On embedded PowerPC systems, assume that the startup module is called
24480 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
24481 @file{libc.a}.
24482
24483 @item -mvxworks
24484 @opindex mvxworks
24485 On System V.4 and embedded PowerPC systems, specify that you are
24486 compiling for a VxWorks system.
24487
24488 @item -memb
24489 @opindex memb
24490 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
24491 header to indicate that @samp{eabi} extended relocations are used.
24492
24493 @item -meabi
24494 @itemx -mno-eabi
24495 @opindex meabi
24496 @opindex mno-eabi
24497 On System V.4 and embedded PowerPC systems do (do not) adhere to the
24498 Embedded Applications Binary Interface (EABI), which is a set of
24499 modifications to the System V.4 specifications. Selecting @option{-meabi}
24500 means that the stack is aligned to an 8-byte boundary, a function
24501 @code{__eabi} is called from @code{main} to set up the EABI
24502 environment, and the @option{-msdata} option can use both @code{r2} and
24503 @code{r13} to point to two separate small data areas. Selecting
24504 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
24505 no EABI initialization function is called from @code{main}, and the
24506 @option{-msdata} option only uses @code{r13} to point to a single
24507 small data area. The @option{-meabi} option is on by default if you
24508 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
24509
24510 @item -msdata=eabi
24511 @opindex msdata=eabi
24512 On System V.4 and embedded PowerPC systems, put small initialized
24513 @code{const} global and static data in the @code{.sdata2} section, which
24514 is pointed to by register @code{r2}. Put small initialized
24515 non-@code{const} global and static data in the @code{.sdata} section,
24516 which is pointed to by register @code{r13}. Put small uninitialized
24517 global and static data in the @code{.sbss} section, which is adjacent to
24518 the @code{.sdata} section. The @option{-msdata=eabi} option is
24519 incompatible with the @option{-mrelocatable} option. The
24520 @option{-msdata=eabi} option also sets the @option{-memb} option.
24521
24522 @item -msdata=sysv
24523 @opindex msdata=sysv
24524 On System V.4 and embedded PowerPC systems, put small global and static
24525 data in the @code{.sdata} section, which is pointed to by register
24526 @code{r13}. Put small uninitialized global and static data in the
24527 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
24528 The @option{-msdata=sysv} option is incompatible with the
24529 @option{-mrelocatable} option.
24530
24531 @item -msdata=default
24532 @itemx -msdata
24533 @opindex msdata=default
24534 @opindex msdata
24535 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
24536 compile code the same as @option{-msdata=eabi}, otherwise compile code the
24537 same as @option{-msdata=sysv}.
24538
24539 @item -msdata=data
24540 @opindex msdata=data
24541 On System V.4 and embedded PowerPC systems, put small global
24542 data in the @code{.sdata} section. Put small uninitialized global
24543 data in the @code{.sbss} section. Do not use register @code{r13}
24544 to address small data however. This is the default behavior unless
24545 other @option{-msdata} options are used.
24546
24547 @item -msdata=none
24548 @itemx -mno-sdata
24549 @opindex msdata=none
24550 @opindex mno-sdata
24551 On embedded PowerPC systems, put all initialized global and static data
24552 in the @code{.data} section, and all uninitialized data in the
24553 @code{.bss} section.
24554
24555 @item -mreadonly-in-sdata
24556 @opindex mreadonly-in-sdata
24557 @opindex mno-readonly-in-sdata
24558 Put read-only objects in the @code{.sdata} section as well. This is the
24559 default.
24560
24561 @item -mblock-move-inline-limit=@var{num}
24562 @opindex mblock-move-inline-limit
24563 Inline all block moves (such as calls to @code{memcpy} or structure
24564 copies) less than or equal to @var{num} bytes. The minimum value for
24565 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
24566 targets. The default value is target-specific.
24567
24568 @item -mblock-compare-inline-limit=@var{num}
24569 @opindex mblock-compare-inline-limit
24570 Generate non-looping inline code for all block compares (such as calls
24571 to @code{memcmp} or structure compares) less than or equal to @var{num}
24572 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
24573 block compare is disabled. The default value is target-specific.
24574
24575 @item -mblock-compare-inline-loop-limit=@var{num}
24576 @opindex mblock-compare-inline-loop-limit
24577 Generate an inline expansion using loop code for all block compares that
24578 are less than or equal to @var{num} bytes, but greater than the limit
24579 for non-loop inline block compare expansion. If the block length is not
24580 constant, at most @var{num} bytes will be compared before @code{memcmp}
24581 is called to compare the remainder of the block. The default value is
24582 target-specific.
24583
24584 @item -mstring-compare-inline-limit=@var{num}
24585 @opindex mstring-compare-inline-limit
24586 Compare at most @var{num} string bytes with inline code.
24587 If the difference or end of string is not found at the
24588 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
24589 take care of the rest of the comparison. The default is 64 bytes.
24590
24591 @item -G @var{num}
24592 @opindex G
24593 @cindex smaller data references (PowerPC)
24594 @cindex .sdata/.sdata2 references (PowerPC)
24595 On embedded PowerPC systems, put global and static items less than or
24596 equal to @var{num} bytes into the small data or BSS sections instead of
24597 the normal data or BSS section. By default, @var{num} is 8. The
24598 @option{-G @var{num}} switch is also passed to the linker.
24599 All modules should be compiled with the same @option{-G @var{num}} value.
24600
24601 @item -mregnames
24602 @itemx -mno-regnames
24603 @opindex mregnames
24604 @opindex mno-regnames
24605 On System V.4 and embedded PowerPC systems do (do not) emit register
24606 names in the assembly language output using symbolic forms.
24607
24608 @item -mlongcall
24609 @itemx -mno-longcall
24610 @opindex mlongcall
24611 @opindex mno-longcall
24612 By default assume that all calls are far away so that a longer and more
24613 expensive calling sequence is required. This is required for calls
24614 farther than 32 megabytes (33,554,432 bytes) from the current location.
24615 A short call is generated if the compiler knows
24616 the call cannot be that far away. This setting can be overridden by
24617 the @code{shortcall} function attribute, or by @code{#pragma
24618 longcall(0)}.
24619
24620 Some linkers are capable of detecting out-of-range calls and generating
24621 glue code on the fly. On these systems, long calls are unnecessary and
24622 generate slower code. As of this writing, the AIX linker can do this,
24623 as can the GNU linker for PowerPC/64. It is planned to add this feature
24624 to the GNU linker for 32-bit PowerPC systems as well.
24625
24626 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
24627 callee, L42}, plus a @dfn{branch island} (glue code). The two target
24628 addresses represent the callee and the branch island. The
24629 Darwin/PPC linker prefers the first address and generates a @code{bl
24630 callee} if the PPC @code{bl} instruction reaches the callee directly;
24631 otherwise, the linker generates @code{bl L42} to call the branch
24632 island. The branch island is appended to the body of the
24633 calling function; it computes the full 32-bit address of the callee
24634 and jumps to it.
24635
24636 On Mach-O (Darwin) systems, this option directs the compiler emit to
24637 the glue for every direct call, and the Darwin linker decides whether
24638 to use or discard it.
24639
24640 In the future, GCC may ignore all longcall specifications
24641 when the linker is known to generate glue.
24642
24643 @item -mtls-markers
24644 @itemx -mno-tls-markers
24645 @opindex mtls-markers
24646 @opindex mno-tls-markers
24647 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
24648 specifying the function argument. The relocation allows the linker to
24649 reliably associate function call with argument setup instructions for
24650 TLS optimization, which in turn allows GCC to better schedule the
24651 sequence.
24652
24653 @item -mrecip
24654 @itemx -mno-recip
24655 @opindex mrecip
24656 This option enables use of the reciprocal estimate and
24657 reciprocal square root estimate instructions with additional
24658 Newton-Raphson steps to increase precision instead of doing a divide or
24659 square root and divide for floating-point arguments. You should use
24660 the @option{-ffast-math} option when using @option{-mrecip} (or at
24661 least @option{-funsafe-math-optimizations},
24662 @option{-ffinite-math-only}, @option{-freciprocal-math} and
24663 @option{-fno-trapping-math}). Note that while the throughput of the
24664 sequence is generally higher than the throughput of the non-reciprocal
24665 instruction, the precision of the sequence can be decreased by up to 2
24666 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
24667 roots.
24668
24669 @item -mrecip=@var{opt}
24670 @opindex mrecip=opt
24671 This option controls which reciprocal estimate instructions
24672 may be used. @var{opt} is a comma-separated list of options, which may
24673 be preceded by a @code{!} to invert the option:
24674
24675 @table @samp
24676
24677 @item all
24678 Enable all estimate instructions.
24679
24680 @item default
24681 Enable the default instructions, equivalent to @option{-mrecip}.
24682
24683 @item none
24684 Disable all estimate instructions, equivalent to @option{-mno-recip}.
24685
24686 @item div
24687 Enable the reciprocal approximation instructions for both
24688 single and double precision.
24689
24690 @item divf
24691 Enable the single-precision reciprocal approximation instructions.
24692
24693 @item divd
24694 Enable the double-precision reciprocal approximation instructions.
24695
24696 @item rsqrt
24697 Enable the reciprocal square root approximation instructions for both
24698 single and double precision.
24699
24700 @item rsqrtf
24701 Enable the single-precision reciprocal square root approximation instructions.
24702
24703 @item rsqrtd
24704 Enable the double-precision reciprocal square root approximation instructions.
24705
24706 @end table
24707
24708 So, for example, @option{-mrecip=all,!rsqrtd} enables
24709 all of the reciprocal estimate instructions, except for the
24710 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
24711 which handle the double-precision reciprocal square root calculations.
24712
24713 @item -mrecip-precision
24714 @itemx -mno-recip-precision
24715 @opindex mrecip-precision
24716 Assume (do not assume) that the reciprocal estimate instructions
24717 provide higher-precision estimates than is mandated by the PowerPC
24718 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
24719 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
24720 The double-precision square root estimate instructions are not generated by
24721 default on low-precision machines, since they do not provide an
24722 estimate that converges after three steps.
24723
24724 @item -mveclibabi=@var{type}
24725 @opindex mveclibabi
24726 Specifies the ABI type to use for vectorizing intrinsics using an
24727 external library. The only type supported at present is @samp{mass},
24728 which specifies to use IBM's Mathematical Acceleration Subsystem
24729 (MASS) libraries for vectorizing intrinsics using external libraries.
24730 GCC currently emits calls to @code{acosd2}, @code{acosf4},
24731 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
24732 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
24733 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
24734 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
24735 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
24736 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
24737 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
24738 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
24739 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
24740 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
24741 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
24742 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
24743 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
24744 for power7. Both @option{-ftree-vectorize} and
24745 @option{-funsafe-math-optimizations} must also be enabled. The MASS
24746 libraries must be specified at link time.
24747
24748 @item -mfriz
24749 @itemx -mno-friz
24750 @opindex mfriz
24751 Generate (do not generate) the @code{friz} instruction when the
24752 @option{-funsafe-math-optimizations} option is used to optimize
24753 rounding of floating-point values to 64-bit integer and back to floating
24754 point. The @code{friz} instruction does not return the same value if
24755 the floating-point number is too large to fit in an integer.
24756
24757 @item -mpointers-to-nested-functions
24758 @itemx -mno-pointers-to-nested-functions
24759 @opindex mpointers-to-nested-functions
24760 Generate (do not generate) code to load up the static chain register
24761 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
24762 systems where a function pointer points to a 3-word descriptor giving
24763 the function address, TOC value to be loaded in register @code{r2}, and
24764 static chain value to be loaded in register @code{r11}. The
24765 @option{-mpointers-to-nested-functions} is on by default. You cannot
24766 call through pointers to nested functions or pointers
24767 to functions compiled in other languages that use the static chain if
24768 you use @option{-mno-pointers-to-nested-functions}.
24769
24770 @item -msave-toc-indirect
24771 @itemx -mno-save-toc-indirect
24772 @opindex msave-toc-indirect
24773 Generate (do not generate) code to save the TOC value in the reserved
24774 stack location in the function prologue if the function calls through
24775 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
24776 saved in the prologue, it is saved just before the call through the
24777 pointer. The @option{-mno-save-toc-indirect} option is the default.
24778
24779 @item -mcompat-align-parm
24780 @itemx -mno-compat-align-parm
24781 @opindex mcompat-align-parm
24782 Generate (do not generate) code to pass structure parameters with a
24783 maximum alignment of 64 bits, for compatibility with older versions
24784 of GCC.
24785
24786 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
24787 structure parameter on a 128-bit boundary when that structure contained
24788 a member requiring 128-bit alignment. This is corrected in more
24789 recent versions of GCC. This option may be used to generate code
24790 that is compatible with functions compiled with older versions of
24791 GCC.
24792
24793 The @option{-mno-compat-align-parm} option is the default.
24794
24795 @item -mstack-protector-guard=@var{guard}
24796 @itemx -mstack-protector-guard-reg=@var{reg}
24797 @itemx -mstack-protector-guard-offset=@var{offset}
24798 @itemx -mstack-protector-guard-symbol=@var{symbol}
24799 @opindex mstack-protector-guard
24800 @opindex mstack-protector-guard-reg
24801 @opindex mstack-protector-guard-offset
24802 @opindex mstack-protector-guard-symbol
24803 Generate stack protection code using canary at @var{guard}. Supported
24804 locations are @samp{global} for global canary or @samp{tls} for per-thread
24805 canary in the TLS block (the default with GNU libc version 2.4 or later).
24806
24807 With the latter choice the options
24808 @option{-mstack-protector-guard-reg=@var{reg}} and
24809 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
24810 which register to use as base register for reading the canary, and from what
24811 offset from that base register. The default for those is as specified in the
24812 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
24813 the offset with a symbol reference to a canary in the TLS block.
24814 @end table
24815
24816 @node RX Options
24817 @subsection RX Options
24818 @cindex RX Options
24819
24820 These command-line options are defined for RX targets:
24821
24822 @table @gcctabopt
24823 @item -m64bit-doubles
24824 @itemx -m32bit-doubles
24825 @opindex m64bit-doubles
24826 @opindex m32bit-doubles
24827 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24828 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24829 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
24830 works on 32-bit values, which is why the default is
24831 @option{-m32bit-doubles}.
24832
24833 @item -fpu
24834 @itemx -nofpu
24835 @opindex fpu
24836 @opindex nofpu
24837 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
24838 floating-point hardware. The default is enabled for the RX600
24839 series and disabled for the RX200 series.
24840
24841 Floating-point instructions are only generated for 32-bit floating-point
24842 values, however, so the FPU hardware is not used for doubles if the
24843 @option{-m64bit-doubles} option is used.
24844
24845 @emph{Note} If the @option{-fpu} option is enabled then
24846 @option{-funsafe-math-optimizations} is also enabled automatically.
24847 This is because the RX FPU instructions are themselves unsafe.
24848
24849 @item -mcpu=@var{name}
24850 @opindex mcpu
24851 Selects the type of RX CPU to be targeted. Currently three types are
24852 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
24853 the specific @samp{RX610} CPU. The default is @samp{RX600}.
24854
24855 The only difference between @samp{RX600} and @samp{RX610} is that the
24856 @samp{RX610} does not support the @code{MVTIPL} instruction.
24857
24858 The @samp{RX200} series does not have a hardware floating-point unit
24859 and so @option{-nofpu} is enabled by default when this type is
24860 selected.
24861
24862 @item -mbig-endian-data
24863 @itemx -mlittle-endian-data
24864 @opindex mbig-endian-data
24865 @opindex mlittle-endian-data
24866 Store data (but not code) in the big-endian format. The default is
24867 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
24868 format.
24869
24870 @item -msmall-data-limit=@var{N}
24871 @opindex msmall-data-limit
24872 Specifies the maximum size in bytes of global and static variables
24873 which can be placed into the small data area. Using the small data
24874 area can lead to smaller and faster code, but the size of area is
24875 limited and it is up to the programmer to ensure that the area does
24876 not overflow. Also when the small data area is used one of the RX's
24877 registers (usually @code{r13}) is reserved for use pointing to this
24878 area, so it is no longer available for use by the compiler. This
24879 could result in slower and/or larger code if variables are pushed onto
24880 the stack instead of being held in this register.
24881
24882 Note, common variables (variables that have not been initialized) and
24883 constants are not placed into the small data area as they are assigned
24884 to other sections in the output executable.
24885
24886 The default value is zero, which disables this feature. Note, this
24887 feature is not enabled by default with higher optimization levels
24888 (@option{-O2} etc) because of the potentially detrimental effects of
24889 reserving a register. It is up to the programmer to experiment and
24890 discover whether this feature is of benefit to their program. See the
24891 description of the @option{-mpid} option for a description of how the
24892 actual register to hold the small data area pointer is chosen.
24893
24894 @item -msim
24895 @itemx -mno-sim
24896 @opindex msim
24897 @opindex mno-sim
24898 Use the simulator runtime. The default is to use the libgloss
24899 board-specific runtime.
24900
24901 @item -mas100-syntax
24902 @itemx -mno-as100-syntax
24903 @opindex mas100-syntax
24904 @opindex mno-as100-syntax
24905 When generating assembler output use a syntax that is compatible with
24906 Renesas's AS100 assembler. This syntax can also be handled by the GAS
24907 assembler, but it has some restrictions so it is not generated by default.
24908
24909 @item -mmax-constant-size=@var{N}
24910 @opindex mmax-constant-size
24911 Specifies the maximum size, in bytes, of a constant that can be used as
24912 an operand in a RX instruction. Although the RX instruction set does
24913 allow constants of up to 4 bytes in length to be used in instructions,
24914 a longer value equates to a longer instruction. Thus in some
24915 circumstances it can be beneficial to restrict the size of constants
24916 that are used in instructions. Constants that are too big are instead
24917 placed into a constant pool and referenced via register indirection.
24918
24919 The value @var{N} can be between 0 and 4. A value of 0 (the default)
24920 or 4 means that constants of any size are allowed.
24921
24922 @item -mrelax
24923 @opindex mrelax
24924 Enable linker relaxation. Linker relaxation is a process whereby the
24925 linker attempts to reduce the size of a program by finding shorter
24926 versions of various instructions. Disabled by default.
24927
24928 @item -mint-register=@var{N}
24929 @opindex mint-register
24930 Specify the number of registers to reserve for fast interrupt handler
24931 functions. The value @var{N} can be between 0 and 4. A value of 1
24932 means that register @code{r13} is reserved for the exclusive use
24933 of fast interrupt handlers. A value of 2 reserves @code{r13} and
24934 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
24935 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
24936 A value of 0, the default, does not reserve any registers.
24937
24938 @item -msave-acc-in-interrupts
24939 @opindex msave-acc-in-interrupts
24940 Specifies that interrupt handler functions should preserve the
24941 accumulator register. This is only necessary if normal code might use
24942 the accumulator register, for example because it performs 64-bit
24943 multiplications. The default is to ignore the accumulator as this
24944 makes the interrupt handlers faster.
24945
24946 @item -mpid
24947 @itemx -mno-pid
24948 @opindex mpid
24949 @opindex mno-pid
24950 Enables the generation of position independent data. When enabled any
24951 access to constant data is done via an offset from a base address
24952 held in a register. This allows the location of constant data to be
24953 determined at run time without requiring the executable to be
24954 relocated, which is a benefit to embedded applications with tight
24955 memory constraints. Data that can be modified is not affected by this
24956 option.
24957
24958 Note, using this feature reserves a register, usually @code{r13}, for
24959 the constant data base address. This can result in slower and/or
24960 larger code, especially in complicated functions.
24961
24962 The actual register chosen to hold the constant data base address
24963 depends upon whether the @option{-msmall-data-limit} and/or the
24964 @option{-mint-register} command-line options are enabled. Starting
24965 with register @code{r13} and proceeding downwards, registers are
24966 allocated first to satisfy the requirements of @option{-mint-register},
24967 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
24968 is possible for the small data area register to be @code{r8} if both
24969 @option{-mint-register=4} and @option{-mpid} are specified on the
24970 command line.
24971
24972 By default this feature is not enabled. The default can be restored
24973 via the @option{-mno-pid} command-line option.
24974
24975 @item -mno-warn-multiple-fast-interrupts
24976 @itemx -mwarn-multiple-fast-interrupts
24977 @opindex mno-warn-multiple-fast-interrupts
24978 @opindex mwarn-multiple-fast-interrupts
24979 Prevents GCC from issuing a warning message if it finds more than one
24980 fast interrupt handler when it is compiling a file. The default is to
24981 issue a warning for each extra fast interrupt handler found, as the RX
24982 only supports one such interrupt.
24983
24984 @item -mallow-string-insns
24985 @itemx -mno-allow-string-insns
24986 @opindex mallow-string-insns
24987 @opindex mno-allow-string-insns
24988 Enables or disables the use of the string manipulation instructions
24989 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
24990 @code{SWHILE} and also the @code{RMPA} instruction. These
24991 instructions may prefetch data, which is not safe to do if accessing
24992 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
24993 for more information).
24994
24995 The default is to allow these instructions, but it is not possible for
24996 GCC to reliably detect all circumstances where a string instruction
24997 might be used to access an I/O register, so their use cannot be
24998 disabled automatically. Instead it is reliant upon the programmer to
24999 use the @option{-mno-allow-string-insns} option if their program
25000 accesses I/O space.
25001
25002 When the instructions are enabled GCC defines the C preprocessor
25003 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25004 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25005
25006 @item -mjsr
25007 @itemx -mno-jsr
25008 @opindex mjsr
25009 @opindex mno-jsr
25010 Use only (or not only) @code{JSR} instructions to access functions.
25011 This option can be used when code size exceeds the range of @code{BSR}
25012 instructions. Note that @option{-mno-jsr} does not mean to not use
25013 @code{JSR} but instead means that any type of branch may be used.
25014 @end table
25015
25016 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25017 has special significance to the RX port when used with the
25018 @code{interrupt} function attribute. This attribute indicates a
25019 function intended to process fast interrupts. GCC ensures
25020 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25021 and/or @code{r13} and only provided that the normal use of the
25022 corresponding registers have been restricted via the
25023 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25024 options.
25025
25026 @node S/390 and zSeries Options
25027 @subsection S/390 and zSeries Options
25028 @cindex S/390 and zSeries Options
25029
25030 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25031
25032 @table @gcctabopt
25033 @item -mhard-float
25034 @itemx -msoft-float
25035 @opindex mhard-float
25036 @opindex msoft-float
25037 Use (do not use) the hardware floating-point instructions and registers
25038 for floating-point operations. When @option{-msoft-float} is specified,
25039 functions in @file{libgcc.a} are used to perform floating-point
25040 operations. When @option{-mhard-float} is specified, the compiler
25041 generates IEEE floating-point instructions. This is the default.
25042
25043 @item -mhard-dfp
25044 @itemx -mno-hard-dfp
25045 @opindex mhard-dfp
25046 @opindex mno-hard-dfp
25047 Use (do not use) the hardware decimal-floating-point instructions for
25048 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25049 specified, functions in @file{libgcc.a} are used to perform
25050 decimal-floating-point operations. When @option{-mhard-dfp} is
25051 specified, the compiler generates decimal-floating-point hardware
25052 instructions. This is the default for @option{-march=z9-ec} or higher.
25053
25054 @item -mlong-double-64
25055 @itemx -mlong-double-128
25056 @opindex mlong-double-64
25057 @opindex mlong-double-128
25058 These switches control the size of @code{long double} type. A size
25059 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25060 type. This is the default.
25061
25062 @item -mbackchain
25063 @itemx -mno-backchain
25064 @opindex mbackchain
25065 @opindex mno-backchain
25066 Store (do not store) the address of the caller's frame as backchain pointer
25067 into the callee's stack frame.
25068 A backchain may be needed to allow debugging using tools that do not understand
25069 DWARF call frame information.
25070 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25071 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25072 the backchain is placed into the topmost word of the 96/160 byte register
25073 save area.
25074
25075 In general, code compiled with @option{-mbackchain} is call-compatible with
25076 code compiled with @option{-mmo-backchain}; however, use of the backchain
25077 for debugging purposes usually requires that the whole binary is built with
25078 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25079 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25080 to build a linux kernel use @option{-msoft-float}.
25081
25082 The default is to not maintain the backchain.
25083
25084 @item -mpacked-stack
25085 @itemx -mno-packed-stack
25086 @opindex mpacked-stack
25087 @opindex mno-packed-stack
25088 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25089 specified, the compiler uses the all fields of the 96/160 byte register save
25090 area only for their default purpose; unused fields still take up stack space.
25091 When @option{-mpacked-stack} is specified, register save slots are densely
25092 packed at the top of the register save area; unused space is reused for other
25093 purposes, allowing for more efficient use of the available stack space.
25094 However, when @option{-mbackchain} is also in effect, the topmost word of
25095 the save area is always used to store the backchain, and the return address
25096 register is always saved two words below the backchain.
25097
25098 As long as the stack frame backchain is not used, code generated with
25099 @option{-mpacked-stack} is call-compatible with code generated with
25100 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25101 S/390 or zSeries generated code that uses the stack frame backchain at run
25102 time, not just for debugging purposes. Such code is not call-compatible
25103 with code compiled with @option{-mpacked-stack}. Also, note that the
25104 combination of @option{-mbackchain},
25105 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25106 to build a linux kernel use @option{-msoft-float}.
25107
25108 The default is to not use the packed stack layout.
25109
25110 @item -msmall-exec
25111 @itemx -mno-small-exec
25112 @opindex msmall-exec
25113 @opindex mno-small-exec
25114 Generate (or do not generate) code using the @code{bras} instruction
25115 to do subroutine calls.
25116 This only works reliably if the total executable size does not
25117 exceed 64k. The default is to use the @code{basr} instruction instead,
25118 which does not have this limitation.
25119
25120 @item -m64
25121 @itemx -m31
25122 @opindex m64
25123 @opindex m31
25124 When @option{-m31} is specified, generate code compliant to the
25125 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25126 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25127 particular to generate 64-bit instructions. For the @samp{s390}
25128 targets, the default is @option{-m31}, while the @samp{s390x}
25129 targets default to @option{-m64}.
25130
25131 @item -mzarch
25132 @itemx -mesa
25133 @opindex mzarch
25134 @opindex mesa
25135 When @option{-mzarch} is specified, generate code using the
25136 instructions available on z/Architecture.
25137 When @option{-mesa} is specified, generate code using the
25138 instructions available on ESA/390. Note that @option{-mesa} is
25139 not possible with @option{-m64}.
25140 When generating code compliant to the GNU/Linux for S/390 ABI,
25141 the default is @option{-mesa}. When generating code compliant
25142 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25143
25144 @item -mhtm
25145 @itemx -mno-htm
25146 @opindex mhtm
25147 @opindex mno-htm
25148 The @option{-mhtm} option enables a set of builtins making use of
25149 instructions available with the transactional execution facility
25150 introduced with the IBM zEnterprise EC12 machine generation
25151 @ref{S/390 System z Built-in Functions}.
25152 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25153
25154 @item -mvx
25155 @itemx -mno-vx
25156 @opindex mvx
25157 @opindex mno-vx
25158 When @option{-mvx} is specified, generate code using the instructions
25159 available with the vector extension facility introduced with the IBM
25160 z13 machine generation.
25161 This option changes the ABI for some vector type values with regard to
25162 alignment and calling conventions. In case vector type values are
25163 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25164 command will be added to mark the resulting binary with the ABI used.
25165 @option{-mvx} is enabled by default when using @option{-march=z13}.
25166
25167 @item -mzvector
25168 @itemx -mno-zvector
25169 @opindex mzvector
25170 @opindex mno-zvector
25171 The @option{-mzvector} option enables vector language extensions and
25172 builtins using instructions available with the vector extension
25173 facility introduced with the IBM z13 machine generation.
25174 This option adds support for @samp{vector} to be used as a keyword to
25175 define vector type variables and arguments. @samp{vector} is only
25176 available when GNU extensions are enabled. It will not be expanded
25177 when requesting strict standard compliance e.g. with @option{-std=c99}.
25178 In addition to the GCC low-level builtins @option{-mzvector} enables
25179 a set of builtins added for compatibility with AltiVec-style
25180 implementations like Power and Cell. In order to make use of these
25181 builtins the header file @file{vecintrin.h} needs to be included.
25182 @option{-mzvector} is disabled by default.
25183
25184 @item -mmvcle
25185 @itemx -mno-mvcle
25186 @opindex mmvcle
25187 @opindex mno-mvcle
25188 Generate (or do not generate) code using the @code{mvcle} instruction
25189 to perform block moves. When @option{-mno-mvcle} is specified,
25190 use a @code{mvc} loop instead. This is the default unless optimizing for
25191 size.
25192
25193 @item -mdebug
25194 @itemx -mno-debug
25195 @opindex mdebug
25196 @opindex mno-debug
25197 Print (or do not print) additional debug information when compiling.
25198 The default is to not print debug information.
25199
25200 @item -march=@var{cpu-type}
25201 @opindex march
25202 Generate code that runs on @var{cpu-type}, which is the name of a
25203 system representing a certain processor type. Possible values for
25204 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25205 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25206 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11}, and
25207 @samp{native}.
25208
25209 The default is @option{-march=z900}.
25210
25211 Specifying @samp{native} as cpu type can be used to select the best
25212 architecture option for the host processor.
25213 @option{-march=native} has no effect if GCC does not recognize the
25214 processor.
25215
25216 @item -mtune=@var{cpu-type}
25217 @opindex mtune
25218 Tune to @var{cpu-type} everything applicable about the generated code,
25219 except for the ABI and the set of available instructions.
25220 The list of @var{cpu-type} values is the same as for @option{-march}.
25221 The default is the value used for @option{-march}.
25222
25223 @item -mtpf-trace
25224 @itemx -mno-tpf-trace
25225 @opindex mtpf-trace
25226 @opindex mno-tpf-trace
25227 Generate code that adds (does not add) in TPF OS specific branches to trace
25228 routines in the operating system. This option is off by default, even
25229 when compiling for the TPF OS@.
25230
25231 @item -mfused-madd
25232 @itemx -mno-fused-madd
25233 @opindex mfused-madd
25234 @opindex mno-fused-madd
25235 Generate code that uses (does not use) the floating-point multiply and
25236 accumulate instructions. These instructions are generated by default if
25237 hardware floating point is used.
25238
25239 @item -mwarn-framesize=@var{framesize}
25240 @opindex mwarn-framesize
25241 Emit a warning if the current function exceeds the given frame size. Because
25242 this is a compile-time check it doesn't need to be a real problem when the program
25243 runs. It is intended to identify functions that most probably cause
25244 a stack overflow. It is useful to be used in an environment with limited stack
25245 size e.g.@: the linux kernel.
25246
25247 @item -mwarn-dynamicstack
25248 @opindex mwarn-dynamicstack
25249 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25250 arrays. This is generally a bad idea with a limited stack size.
25251
25252 @item -mstack-guard=@var{stack-guard}
25253 @itemx -mstack-size=@var{stack-size}
25254 @opindex mstack-guard
25255 @opindex mstack-size
25256 If these options are provided the S/390 back end emits additional instructions in
25257 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25258 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25259 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25260 the frame size of the compiled function is chosen.
25261 These options are intended to be used to help debugging stack overflow problems.
25262 The additionally emitted code causes only little overhead and hence can also be
25263 used in production-like systems without greater performance degradation. The given
25264 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25265 @var{stack-guard} without exceeding 64k.
25266 In order to be efficient the extra code makes the assumption that the stack starts
25267 at an address aligned to the value given by @var{stack-size}.
25268 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25269
25270 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25271 @opindex mhotpatch
25272 If the hotpatch option is enabled, a ``hot-patching'' function
25273 prologue is generated for all functions in the compilation unit.
25274 The funtion label is prepended with the given number of two-byte
25275 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25276 the label, 2 * @var{post-halfwords} bytes are appended, using the
25277 largest NOP like instructions the architecture allows (maximum
25278 1000000).
25279
25280 If both arguments are zero, hotpatching is disabled.
25281
25282 This option can be overridden for individual functions with the
25283 @code{hotpatch} attribute.
25284 @end table
25285
25286 @node Score Options
25287 @subsection Score Options
25288 @cindex Score Options
25289
25290 These options are defined for Score implementations:
25291
25292 @table @gcctabopt
25293 @item -meb
25294 @opindex meb
25295 Compile code for big-endian mode. This is the default.
25296
25297 @item -mel
25298 @opindex mel
25299 Compile code for little-endian mode.
25300
25301 @item -mnhwloop
25302 @opindex mnhwloop
25303 Disable generation of @code{bcnz} instructions.
25304
25305 @item -muls
25306 @opindex muls
25307 Enable generation of unaligned load and store instructions.
25308
25309 @item -mmac
25310 @opindex mmac
25311 Enable the use of multiply-accumulate instructions. Disabled by default.
25312
25313 @item -mscore5
25314 @opindex mscore5
25315 Specify the SCORE5 as the target architecture.
25316
25317 @item -mscore5u
25318 @opindex mscore5u
25319 Specify the SCORE5U of the target architecture.
25320
25321 @item -mscore7
25322 @opindex mscore7
25323 Specify the SCORE7 as the target architecture. This is the default.
25324
25325 @item -mscore7d
25326 @opindex mscore7d
25327 Specify the SCORE7D as the target architecture.
25328 @end table
25329
25330 @node SH Options
25331 @subsection SH Options
25332
25333 These @samp{-m} options are defined for the SH implementations:
25334
25335 @table @gcctabopt
25336 @item -m1
25337 @opindex m1
25338 Generate code for the SH1.
25339
25340 @item -m2
25341 @opindex m2
25342 Generate code for the SH2.
25343
25344 @item -m2e
25345 Generate code for the SH2e.
25346
25347 @item -m2a-nofpu
25348 @opindex m2a-nofpu
25349 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25350 that the floating-point unit is not used.
25351
25352 @item -m2a-single-only
25353 @opindex m2a-single-only
25354 Generate code for the SH2a-FPU, in such a way that no double-precision
25355 floating-point operations are used.
25356
25357 @item -m2a-single
25358 @opindex m2a-single
25359 Generate code for the SH2a-FPU assuming the floating-point unit is in
25360 single-precision mode by default.
25361
25362 @item -m2a
25363 @opindex m2a
25364 Generate code for the SH2a-FPU assuming the floating-point unit is in
25365 double-precision mode by default.
25366
25367 @item -m3
25368 @opindex m3
25369 Generate code for the SH3.
25370
25371 @item -m3e
25372 @opindex m3e
25373 Generate code for the SH3e.
25374
25375 @item -m4-nofpu
25376 @opindex m4-nofpu
25377 Generate code for the SH4 without a floating-point unit.
25378
25379 @item -m4-single-only
25380 @opindex m4-single-only
25381 Generate code for the SH4 with a floating-point unit that only
25382 supports single-precision arithmetic.
25383
25384 @item -m4-single
25385 @opindex m4-single
25386 Generate code for the SH4 assuming the floating-point unit is in
25387 single-precision mode by default.
25388
25389 @item -m4
25390 @opindex m4
25391 Generate code for the SH4.
25392
25393 @item -m4-100
25394 @opindex m4-100
25395 Generate code for SH4-100.
25396
25397 @item -m4-100-nofpu
25398 @opindex m4-100-nofpu
25399 Generate code for SH4-100 in such a way that the
25400 floating-point unit is not used.
25401
25402 @item -m4-100-single
25403 @opindex m4-100-single
25404 Generate code for SH4-100 assuming the floating-point unit is in
25405 single-precision mode by default.
25406
25407 @item -m4-100-single-only
25408 @opindex m4-100-single-only
25409 Generate code for SH4-100 in such a way that no double-precision
25410 floating-point operations are used.
25411
25412 @item -m4-200
25413 @opindex m4-200
25414 Generate code for SH4-200.
25415
25416 @item -m4-200-nofpu
25417 @opindex m4-200-nofpu
25418 Generate code for SH4-200 without in such a way that the
25419 floating-point unit is not used.
25420
25421 @item -m4-200-single
25422 @opindex m4-200-single
25423 Generate code for SH4-200 assuming the floating-point unit is in
25424 single-precision mode by default.
25425
25426 @item -m4-200-single-only
25427 @opindex m4-200-single-only
25428 Generate code for SH4-200 in such a way that no double-precision
25429 floating-point operations are used.
25430
25431 @item -m4-300
25432 @opindex m4-300
25433 Generate code for SH4-300.
25434
25435 @item -m4-300-nofpu
25436 @opindex m4-300-nofpu
25437 Generate code for SH4-300 without in such a way that the
25438 floating-point unit is not used.
25439
25440 @item -m4-300-single
25441 @opindex m4-300-single
25442 Generate code for SH4-300 in such a way that no double-precision
25443 floating-point operations are used.
25444
25445 @item -m4-300-single-only
25446 @opindex m4-300-single-only
25447 Generate code for SH4-300 in such a way that no double-precision
25448 floating-point operations are used.
25449
25450 @item -m4-340
25451 @opindex m4-340
25452 Generate code for SH4-340 (no MMU, no FPU).
25453
25454 @item -m4-500
25455 @opindex m4-500
25456 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
25457 assembler.
25458
25459 @item -m4a-nofpu
25460 @opindex m4a-nofpu
25461 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
25462 floating-point unit is not used.
25463
25464 @item -m4a-single-only
25465 @opindex m4a-single-only
25466 Generate code for the SH4a, in such a way that no double-precision
25467 floating-point operations are used.
25468
25469 @item -m4a-single
25470 @opindex m4a-single
25471 Generate code for the SH4a assuming the floating-point unit is in
25472 single-precision mode by default.
25473
25474 @item -m4a
25475 @opindex m4a
25476 Generate code for the SH4a.
25477
25478 @item -m4al
25479 @opindex m4al
25480 Same as @option{-m4a-nofpu}, except that it implicitly passes
25481 @option{-dsp} to the assembler. GCC doesn't generate any DSP
25482 instructions at the moment.
25483
25484 @item -mb
25485 @opindex mb
25486 Compile code for the processor in big-endian mode.
25487
25488 @item -ml
25489 @opindex ml
25490 Compile code for the processor in little-endian mode.
25491
25492 @item -mdalign
25493 @opindex mdalign
25494 Align doubles at 64-bit boundaries. Note that this changes the calling
25495 conventions, and thus some functions from the standard C library do
25496 not work unless you recompile it first with @option{-mdalign}.
25497
25498 @item -mrelax
25499 @opindex mrelax
25500 Shorten some address references at link time, when possible; uses the
25501 linker option @option{-relax}.
25502
25503 @item -mbigtable
25504 @opindex mbigtable
25505 Use 32-bit offsets in @code{switch} tables. The default is to use
25506 16-bit offsets.
25507
25508 @item -mbitops
25509 @opindex mbitops
25510 Enable the use of bit manipulation instructions on SH2A.
25511
25512 @item -mfmovd
25513 @opindex mfmovd
25514 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
25515 alignment constraints.
25516
25517 @item -mrenesas
25518 @opindex mrenesas
25519 Comply with the calling conventions defined by Renesas.
25520
25521 @item -mno-renesas
25522 @opindex mno-renesas
25523 Comply with the calling conventions defined for GCC before the Renesas
25524 conventions were available. This option is the default for all
25525 targets of the SH toolchain.
25526
25527 @item -mnomacsave
25528 @opindex mnomacsave
25529 Mark the @code{MAC} register as call-clobbered, even if
25530 @option{-mrenesas} is given.
25531
25532 @item -mieee
25533 @itemx -mno-ieee
25534 @opindex mieee
25535 @opindex mno-ieee
25536 Control the IEEE compliance of floating-point comparisons, which affects the
25537 handling of cases where the result of a comparison is unordered. By default
25538 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
25539 enabled @option{-mno-ieee} is implicitly set, which results in faster
25540 floating-point greater-equal and less-equal comparisons. The implicit settings
25541 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
25542
25543 @item -minline-ic_invalidate
25544 @opindex minline-ic_invalidate
25545 Inline code to invalidate instruction cache entries after setting up
25546 nested function trampolines.
25547 This option has no effect if @option{-musermode} is in effect and the selected
25548 code generation option (e.g. @option{-m4}) does not allow the use of the @code{icbi}
25549 instruction.
25550 If the selected code generation option does not allow the use of the @code{icbi}
25551 instruction, and @option{-musermode} is not in effect, the inlined code
25552 manipulates the instruction cache address array directly with an associative
25553 write. This not only requires privileged mode at run time, but it also
25554 fails if the cache line had been mapped via the TLB and has become unmapped.
25555
25556 @item -misize
25557 @opindex misize
25558 Dump instruction size and location in the assembly code.
25559
25560 @item -mpadstruct
25561 @opindex mpadstruct
25562 This option is deprecated. It pads structures to multiple of 4 bytes,
25563 which is incompatible with the SH ABI@.
25564
25565 @item -matomic-model=@var{model}
25566 @opindex matomic-model=@var{model}
25567 Sets the model of atomic operations and additional parameters as a comma
25568 separated list. For details on the atomic built-in functions see
25569 @ref{__atomic Builtins}. The following models and parameters are supported:
25570
25571 @table @samp
25572
25573 @item none
25574 Disable compiler generated atomic sequences and emit library calls for atomic
25575 operations. This is the default if the target is not @code{sh*-*-linux*}.
25576
25577 @item soft-gusa
25578 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
25579 built-in functions. The generated atomic sequences require additional support
25580 from the interrupt/exception handling code of the system and are only suitable
25581 for SH3* and SH4* single-core systems. This option is enabled by default when
25582 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
25583 this option also partially utilizes the hardware atomic instructions
25584 @code{movli.l} and @code{movco.l} to create more efficient code, unless
25585 @samp{strict} is specified.
25586
25587 @item soft-tcb
25588 Generate software atomic sequences that use a variable in the thread control
25589 block. This is a variation of the gUSA sequences which can also be used on
25590 SH1* and SH2* targets. The generated atomic sequences require additional
25591 support from the interrupt/exception handling code of the system and are only
25592 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
25593 parameter has to be specified as well.
25594
25595 @item soft-imask
25596 Generate software atomic sequences that temporarily disable interrupts by
25597 setting @code{SR.IMASK = 1111}. This model works only when the program runs
25598 in privileged mode and is only suitable for single-core systems. Additional
25599 support from the interrupt/exception handling code of the system is not
25600 required. This model is enabled by default when the target is
25601 @code{sh*-*-linux*} and SH1* or SH2*.
25602
25603 @item hard-llcs
25604 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
25605 instructions only. This is only available on SH4A and is suitable for
25606 multi-core systems. Since the hardware instructions support only 32 bit atomic
25607 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
25608 Code compiled with this option is also compatible with other software
25609 atomic model interrupt/exception handling systems if executed on an SH4A
25610 system. Additional support from the interrupt/exception handling code of the
25611 system is not required for this model.
25612
25613 @item gbr-offset=
25614 This parameter specifies the offset in bytes of the variable in the thread
25615 control block structure that should be used by the generated atomic sequences
25616 when the @samp{soft-tcb} model has been selected. For other models this
25617 parameter is ignored. The specified value must be an integer multiple of four
25618 and in the range 0-1020.
25619
25620 @item strict
25621 This parameter prevents mixed usage of multiple atomic models, even if they
25622 are compatible, and makes the compiler generate atomic sequences of the
25623 specified model only.
25624
25625 @end table
25626
25627 @item -mtas
25628 @opindex mtas
25629 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
25630 Notice that depending on the particular hardware and software configuration
25631 this can degrade overall performance due to the operand cache line flushes
25632 that are implied by the @code{tas.b} instruction. On multi-core SH4A
25633 processors the @code{tas.b} instruction must be used with caution since it
25634 can result in data corruption for certain cache configurations.
25635
25636 @item -mprefergot
25637 @opindex mprefergot
25638 When generating position-independent code, emit function calls using
25639 the Global Offset Table instead of the Procedure Linkage Table.
25640
25641 @item -musermode
25642 @itemx -mno-usermode
25643 @opindex musermode
25644 @opindex mno-usermode
25645 Don't allow (allow) the compiler generating privileged mode code. Specifying
25646 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
25647 inlined code would not work in user mode. @option{-musermode} is the default
25648 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
25649 @option{-musermode} has no effect, since there is no user mode.
25650
25651 @item -multcost=@var{number}
25652 @opindex multcost=@var{number}
25653 Set the cost to assume for a multiply insn.
25654
25655 @item -mdiv=@var{strategy}
25656 @opindex mdiv=@var{strategy}
25657 Set the division strategy to be used for integer division operations.
25658 @var{strategy} can be one of:
25659
25660 @table @samp
25661
25662 @item call-div1
25663 Calls a library function that uses the single-step division instruction
25664 @code{div1} to perform the operation. Division by zero calculates an
25665 unspecified result and does not trap. This is the default except for SH4,
25666 SH2A and SHcompact.
25667
25668 @item call-fp
25669 Calls a library function that performs the operation in double precision
25670 floating point. Division by zero causes a floating-point exception. This is
25671 the default for SHcompact with FPU. Specifying this for targets that do not
25672 have a double precision FPU defaults to @code{call-div1}.
25673
25674 @item call-table
25675 Calls a library function that uses a lookup table for small divisors and
25676 the @code{div1} instruction with case distinction for larger divisors. Division
25677 by zero calculates an unspecified result and does not trap. This is the default
25678 for SH4. Specifying this for targets that do not have dynamic shift
25679 instructions defaults to @code{call-div1}.
25680
25681 @end table
25682
25683 When a division strategy has not been specified the default strategy is
25684 selected based on the current target. For SH2A the default strategy is to
25685 use the @code{divs} and @code{divu} instructions instead of library function
25686 calls.
25687
25688 @item -maccumulate-outgoing-args
25689 @opindex maccumulate-outgoing-args
25690 Reserve space once for outgoing arguments in the function prologue rather
25691 than around each call. Generally beneficial for performance and size. Also
25692 needed for unwinding to avoid changing the stack frame around conditional code.
25693
25694 @item -mdivsi3_libfunc=@var{name}
25695 @opindex mdivsi3_libfunc=@var{name}
25696 Set the name of the library function used for 32-bit signed division to
25697 @var{name}.
25698 This only affects the name used in the @samp{call} division strategies, and
25699 the compiler still expects the same sets of input/output/clobbered registers as
25700 if this option were not present.
25701
25702 @item -mfixed-range=@var{register-range}
25703 @opindex mfixed-range
25704 Generate code treating the given register range as fixed registers.
25705 A fixed register is one that the register allocator can not use. This is
25706 useful when compiling kernel code. A register range is specified as
25707 two registers separated by a dash. Multiple register ranges can be
25708 specified separated by a comma.
25709
25710 @item -mbranch-cost=@var{num}
25711 @opindex mbranch-cost=@var{num}
25712 Assume @var{num} to be the cost for a branch instruction. Higher numbers
25713 make the compiler try to generate more branch-free code if possible.
25714 If not specified the value is selected depending on the processor type that
25715 is being compiled for.
25716
25717 @item -mzdcbranch
25718 @itemx -mno-zdcbranch
25719 @opindex mzdcbranch
25720 @opindex mno-zdcbranch
25721 Assume (do not assume) that zero displacement conditional branch instructions
25722 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
25723 compiler prefers zero displacement branch code sequences. This is
25724 enabled by default when generating code for SH4 and SH4A. It can be explicitly
25725 disabled by specifying @option{-mno-zdcbranch}.
25726
25727 @item -mcbranch-force-delay-slot
25728 @opindex mcbranch-force-delay-slot
25729 Force the usage of delay slots for conditional branches, which stuffs the delay
25730 slot with a @code{nop} if a suitable instruction cannot be found. By default
25731 this option is disabled. It can be enabled to work around hardware bugs as
25732 found in the original SH7055.
25733
25734 @item -mfused-madd
25735 @itemx -mno-fused-madd
25736 @opindex mfused-madd
25737 @opindex mno-fused-madd
25738 Generate code that uses (does not use) the floating-point multiply and
25739 accumulate instructions. These instructions are generated by default
25740 if hardware floating point is used. The machine-dependent
25741 @option{-mfused-madd} option is now mapped to the machine-independent
25742 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25743 mapped to @option{-ffp-contract=off}.
25744
25745 @item -mfsca
25746 @itemx -mno-fsca
25747 @opindex mfsca
25748 @opindex mno-fsca
25749 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
25750 and cosine approximations. The option @option{-mfsca} must be used in
25751 combination with @option{-funsafe-math-optimizations}. It is enabled by default
25752 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
25753 approximations even if @option{-funsafe-math-optimizations} is in effect.
25754
25755 @item -mfsrra
25756 @itemx -mno-fsrra
25757 @opindex mfsrra
25758 @opindex mno-fsrra
25759 Allow or disallow the compiler to emit the @code{fsrra} instruction for
25760 reciprocal square root approximations. The option @option{-mfsrra} must be used
25761 in combination with @option{-funsafe-math-optimizations} and
25762 @option{-ffinite-math-only}. It is enabled by default when generating code for
25763 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
25764 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
25765 in effect.
25766
25767 @item -mpretend-cmove
25768 @opindex mpretend-cmove
25769 Prefer zero-displacement conditional branches for conditional move instruction
25770 patterns. This can result in faster code on the SH4 processor.
25771
25772 @item -mfdpic
25773 @opindex fdpic
25774 Generate code using the FDPIC ABI.
25775
25776 @end table
25777
25778 @node Solaris 2 Options
25779 @subsection Solaris 2 Options
25780 @cindex Solaris 2 options
25781
25782 These @samp{-m} options are supported on Solaris 2:
25783
25784 @table @gcctabopt
25785 @item -mclear-hwcap
25786 @opindex mclear-hwcap
25787 @option{-mclear-hwcap} tells the compiler to remove the hardware
25788 capabilities generated by the Solaris assembler. This is only necessary
25789 when object files use ISA extensions not supported by the current
25790 machine, but check at runtime whether or not to use them.
25791
25792 @item -mimpure-text
25793 @opindex mimpure-text
25794 @option{-mimpure-text}, used in addition to @option{-shared}, tells
25795 the compiler to not pass @option{-z text} to the linker when linking a
25796 shared object. Using this option, you can link position-dependent
25797 code into a shared object.
25798
25799 @option{-mimpure-text} suppresses the ``relocations remain against
25800 allocatable but non-writable sections'' linker error message.
25801 However, the necessary relocations trigger copy-on-write, and the
25802 shared object is not actually shared across processes. Instead of
25803 using @option{-mimpure-text}, you should compile all source code with
25804 @option{-fpic} or @option{-fPIC}.
25805
25806 @end table
25807
25808 These switches are supported in addition to the above on Solaris 2:
25809
25810 @table @gcctabopt
25811 @item -pthreads
25812 @opindex pthreads
25813 This is a synonym for @option{-pthread}.
25814 @end table
25815
25816 @node SPARC Options
25817 @subsection SPARC Options
25818 @cindex SPARC options
25819
25820 These @samp{-m} options are supported on the SPARC:
25821
25822 @table @gcctabopt
25823 @item -mno-app-regs
25824 @itemx -mapp-regs
25825 @opindex mno-app-regs
25826 @opindex mapp-regs
25827 Specify @option{-mapp-regs} to generate output using the global registers
25828 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
25829 global register 1, each global register 2 through 4 is then treated as an
25830 allocable register that is clobbered by function calls. This is the default.
25831
25832 To be fully SVR4 ABI-compliant at the cost of some performance loss,
25833 specify @option{-mno-app-regs}. You should compile libraries and system
25834 software with this option.
25835
25836 @item -mflat
25837 @itemx -mno-flat
25838 @opindex mflat
25839 @opindex mno-flat
25840 With @option{-mflat}, the compiler does not generate save/restore instructions
25841 and uses a ``flat'' or single register window model. This model is compatible
25842 with the regular register window model. The local registers and the input
25843 registers (0--5) are still treated as ``call-saved'' registers and are
25844 saved on the stack as needed.
25845
25846 With @option{-mno-flat} (the default), the compiler generates save/restore
25847 instructions (except for leaf functions). This is the normal operating mode.
25848
25849 @item -mfpu
25850 @itemx -mhard-float
25851 @opindex mfpu
25852 @opindex mhard-float
25853 Generate output containing floating-point instructions. This is the
25854 default.
25855
25856 @item -mno-fpu
25857 @itemx -msoft-float
25858 @opindex mno-fpu
25859 @opindex msoft-float
25860 Generate output containing library calls for floating point.
25861 @strong{Warning:} the requisite libraries are not available for all SPARC
25862 targets. Normally the facilities of the machine's usual C compiler are
25863 used, but this cannot be done directly in cross-compilation. You must make
25864 your own arrangements to provide suitable library functions for
25865 cross-compilation. The embedded targets @samp{sparc-*-aout} and
25866 @samp{sparclite-*-*} do provide software floating-point support.
25867
25868 @option{-msoft-float} changes the calling convention in the output file;
25869 therefore, it is only useful if you compile @emph{all} of a program with
25870 this option. In particular, you need to compile @file{libgcc.a}, the
25871 library that comes with GCC, with @option{-msoft-float} in order for
25872 this to work.
25873
25874 @item -mhard-quad-float
25875 @opindex mhard-quad-float
25876 Generate output containing quad-word (long double) floating-point
25877 instructions.
25878
25879 @item -msoft-quad-float
25880 @opindex msoft-quad-float
25881 Generate output containing library calls for quad-word (long double)
25882 floating-point instructions. The functions called are those specified
25883 in the SPARC ABI@. This is the default.
25884
25885 As of this writing, there are no SPARC implementations that have hardware
25886 support for the quad-word floating-point instructions. They all invoke
25887 a trap handler for one of these instructions, and then the trap handler
25888 emulates the effect of the instruction. Because of the trap handler overhead,
25889 this is much slower than calling the ABI library routines. Thus the
25890 @option{-msoft-quad-float} option is the default.
25891
25892 @item -mno-unaligned-doubles
25893 @itemx -munaligned-doubles
25894 @opindex mno-unaligned-doubles
25895 @opindex munaligned-doubles
25896 Assume that doubles have 8-byte alignment. This is the default.
25897
25898 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
25899 alignment only if they are contained in another type, or if they have an
25900 absolute address. Otherwise, it assumes they have 4-byte alignment.
25901 Specifying this option avoids some rare compatibility problems with code
25902 generated by other compilers. It is not the default because it results
25903 in a performance loss, especially for floating-point code.
25904
25905 @item -muser-mode
25906 @itemx -mno-user-mode
25907 @opindex muser-mode
25908 @opindex mno-user-mode
25909 Do not generate code that can only run in supervisor mode. This is relevant
25910 only for the @code{casa} instruction emitted for the LEON3 processor. This
25911 is the default.
25912
25913 @item -mfaster-structs
25914 @itemx -mno-faster-structs
25915 @opindex mfaster-structs
25916 @opindex mno-faster-structs
25917 With @option{-mfaster-structs}, the compiler assumes that structures
25918 should have 8-byte alignment. This enables the use of pairs of
25919 @code{ldd} and @code{std} instructions for copies in structure
25920 assignment, in place of twice as many @code{ld} and @code{st} pairs.
25921 However, the use of this changed alignment directly violates the SPARC
25922 ABI@. Thus, it's intended only for use on targets where the developer
25923 acknowledges that their resulting code is not directly in line with
25924 the rules of the ABI@.
25925
25926 @item -mstd-struct-return
25927 @itemx -mno-std-struct-return
25928 @opindex mstd-struct-return
25929 @opindex mno-std-struct-return
25930 With @option{-mstd-struct-return}, the compiler generates checking code
25931 in functions returning structures or unions to detect size mismatches
25932 between the two sides of function calls, as per the 32-bit ABI@.
25933
25934 The default is @option{-mno-std-struct-return}. This option has no effect
25935 in 64-bit mode.
25936
25937 @item -mlra
25938 @itemx -mno-lra
25939 @opindex mlra
25940 @opindex mno-lra
25941 Enable Local Register Allocation. This is the default for SPARC since GCC 7
25942 so @option{-mno-lra} needs to be passed to get old Reload.
25943
25944 @item -mcpu=@var{cpu_type}
25945 @opindex mcpu
25946 Set the instruction set, register set, and instruction scheduling parameters
25947 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
25948 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
25949 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
25950 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
25951 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
25952 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
25953
25954 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
25955 which selects the best architecture option for the host processor.
25956 @option{-mcpu=native} has no effect if GCC does not recognize
25957 the processor.
25958
25959 Default instruction scheduling parameters are used for values that select
25960 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
25961 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
25962
25963 Here is a list of each supported architecture and their supported
25964 implementations.
25965
25966 @table @asis
25967 @item v7
25968 cypress, leon3v7
25969
25970 @item v8
25971 supersparc, hypersparc, leon, leon3
25972
25973 @item sparclite
25974 f930, f934, sparclite86x
25975
25976 @item sparclet
25977 tsc701
25978
25979 @item v9
25980 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
25981 niagara7, m8
25982 @end table
25983
25984 By default (unless configured otherwise), GCC generates code for the V7
25985 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
25986 additionally optimizes it for the Cypress CY7C602 chip, as used in the
25987 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
25988 SPARCStation 1, 2, IPX etc.
25989
25990 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
25991 architecture. The only difference from V7 code is that the compiler emits
25992 the integer multiply and integer divide instructions which exist in SPARC-V8
25993 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
25994 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
25995 2000 series.
25996
25997 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
25998 the SPARC architecture. This adds the integer multiply, integer divide step
25999 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26000 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26001 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26002 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26003 MB86934 chip, which is the more recent SPARClite with FPU@.
26004
26005 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26006 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26007 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26008 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26009 optimizes it for the TEMIC SPARClet chip.
26010
26011 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26012 architecture. This adds 64-bit integer and floating-point move instructions,
26013 3 additional floating-point condition code registers and conditional move
26014 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26015 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26016 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26017 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26018 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26019 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26020 additionally optimizes it for Sun UltraSPARC T2 chips. With
26021 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26022 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26023 additionally optimizes it for Sun UltraSPARC T4 chips. With
26024 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26025 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26026 additionally optimizes it for Oracle M8 chips.
26027
26028 @item -mtune=@var{cpu_type}
26029 @opindex mtune
26030 Set the instruction scheduling parameters for machine type
26031 @var{cpu_type}, but do not set the instruction set or register set that the
26032 option @option{-mcpu=@var{cpu_type}} does.
26033
26034 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26035 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26036 that select a particular CPU implementation. Those are
26037 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26038 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26039 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26040 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26041 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26042 and GNU/Linux toolchains, @samp{native} can also be used.
26043
26044 @item -mv8plus
26045 @itemx -mno-v8plus
26046 @opindex mv8plus
26047 @opindex mno-v8plus
26048 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26049 difference from the V8 ABI is that the global and out registers are
26050 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26051 mode for all SPARC-V9 processors.
26052
26053 @item -mvis
26054 @itemx -mno-vis
26055 @opindex mvis
26056 @opindex mno-vis
26057 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26058 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26059
26060 @item -mvis2
26061 @itemx -mno-vis2
26062 @opindex mvis2
26063 @opindex mno-vis2
26064 With @option{-mvis2}, GCC generates code that takes advantage of
26065 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26066 default is @option{-mvis2} when targeting a cpu that supports such
26067 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26068 also sets @option{-mvis}.
26069
26070 @item -mvis3
26071 @itemx -mno-vis3
26072 @opindex mvis3
26073 @opindex mno-vis3
26074 With @option{-mvis3}, GCC generates code that takes advantage of
26075 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26076 default is @option{-mvis3} when targeting a cpu that supports such
26077 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26078 also sets @option{-mvis2} and @option{-mvis}.
26079
26080 @item -mvis4
26081 @itemx -mno-vis4
26082 @opindex mvis4
26083 @opindex mno-vis4
26084 With @option{-mvis4}, GCC generates code that takes advantage of
26085 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26086 default is @option{-mvis4} when targeting a cpu that supports such
26087 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26088 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26089
26090 @item -mvis4b
26091 @itemx -mno-vis4b
26092 @opindex mvis4b
26093 @opindex mno-vis4b
26094 With @option{-mvis4b}, GCC generates code that takes advantage of
26095 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26096 the additional VIS instructions introduced in the Oracle SPARC
26097 Architecture 2017. The default is @option{-mvis4b} when targeting a
26098 cpu that supports such instructions, such as m8 and later. Setting
26099 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26100 @option{-mvis2} and @option{-mvis}.
26101
26102 @item -mcbcond
26103 @itemx -mno-cbcond
26104 @opindex mcbcond
26105 @opindex mno-cbcond
26106 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26107 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26108 when targeting a CPU that supports such instructions, such as Niagara-4 and
26109 later.
26110
26111 @item -mfmaf
26112 @itemx -mno-fmaf
26113 @opindex mfmaf
26114 @opindex mno-fmaf
26115 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26116 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26117 when targeting a CPU that supports such instructions, such as Niagara-3 and
26118 later.
26119
26120 @item -mfsmuld
26121 @itemx -mno-fsmuld
26122 @opindex mfsmuld
26123 @opindex mno-fsmuld
26124 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26125 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26126 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26127 or V9 with FPU except @option{-mcpu=leon}.
26128
26129 @item -mpopc
26130 @itemx -mno-popc
26131 @opindex mpopc
26132 @opindex mno-popc
26133 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26134 Population Count instruction. The default is @option{-mpopc}
26135 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26136 later.
26137
26138 @item -msubxc
26139 @itemx -mno-subxc
26140 @opindex msubxc
26141 @opindex mno-subxc
26142 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26143 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26144 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26145 later.
26146
26147 @item -mfix-at697f
26148 @opindex mfix-at697f
26149 Enable the documented workaround for the single erratum of the Atmel AT697F
26150 processor (which corresponds to erratum #13 of the AT697E processor).
26151
26152 @item -mfix-ut699
26153 @opindex mfix-ut699
26154 Enable the documented workarounds for the floating-point errata and the data
26155 cache nullify errata of the UT699 processor.
26156
26157 @item -mfix-ut700
26158 @opindex mfix-ut700
26159 Enable the documented workaround for the back-to-back store errata of
26160 the UT699E/UT700 processor.
26161
26162 @item -mfix-gr712rc
26163 @opindex mfix-gr712rc
26164 Enable the documented workaround for the back-to-back store errata of
26165 the GR712RC processor.
26166 @end table
26167
26168 These @samp{-m} options are supported in addition to the above
26169 on SPARC-V9 processors in 64-bit environments:
26170
26171 @table @gcctabopt
26172 @item -m32
26173 @itemx -m64
26174 @opindex m32
26175 @opindex m64
26176 Generate code for a 32-bit or 64-bit environment.
26177 The 32-bit environment sets int, long and pointer to 32 bits.
26178 The 64-bit environment sets int to 32 bits and long and pointer
26179 to 64 bits.
26180
26181 @item -mcmodel=@var{which}
26182 @opindex mcmodel
26183 Set the code model to one of
26184
26185 @table @samp
26186 @item medlow
26187 The Medium/Low code model: 64-bit addresses, programs
26188 must be linked in the low 32 bits of memory. Programs can be statically
26189 or dynamically linked.
26190
26191 @item medmid
26192 The Medium/Middle code model: 64-bit addresses, programs
26193 must be linked in the low 44 bits of memory, the text and data segments must
26194 be less than 2GB in size and the data segment must be located within 2GB of
26195 the text segment.
26196
26197 @item medany
26198 The Medium/Anywhere code model: 64-bit addresses, programs
26199 may be linked anywhere in memory, the text and data segments must be less
26200 than 2GB in size and the data segment must be located within 2GB of the
26201 text segment.
26202
26203 @item embmedany
26204 The Medium/Anywhere code model for embedded systems:
26205 64-bit addresses, the text and data segments must be less than 2GB in
26206 size, both starting anywhere in memory (determined at link time). The
26207 global register %g4 points to the base of the data segment. Programs
26208 are statically linked and PIC is not supported.
26209 @end table
26210
26211 @item -mmemory-model=@var{mem-model}
26212 @opindex mmemory-model
26213 Set the memory model in force on the processor to one of
26214
26215 @table @samp
26216 @item default
26217 The default memory model for the processor and operating system.
26218
26219 @item rmo
26220 Relaxed Memory Order
26221
26222 @item pso
26223 Partial Store Order
26224
26225 @item tso
26226 Total Store Order
26227
26228 @item sc
26229 Sequential Consistency
26230 @end table
26231
26232 These memory models are formally defined in Appendix D of the SPARC-V9
26233 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26234
26235 @item -mstack-bias
26236 @itemx -mno-stack-bias
26237 @opindex mstack-bias
26238 @opindex mno-stack-bias
26239 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26240 frame pointer if present, are offset by @minus{}2047 which must be added back
26241 when making stack frame references. This is the default in 64-bit mode.
26242 Otherwise, assume no such offset is present.
26243 @end table
26244
26245 @node SPU Options
26246 @subsection SPU Options
26247 @cindex SPU options
26248
26249 These @samp{-m} options are supported on the SPU:
26250
26251 @table @gcctabopt
26252 @item -mwarn-reloc
26253 @itemx -merror-reloc
26254 @opindex mwarn-reloc
26255 @opindex merror-reloc
26256
26257 The loader for SPU does not handle dynamic relocations. By default, GCC
26258 gives an error when it generates code that requires a dynamic
26259 relocation. @option{-mno-error-reloc} disables the error,
26260 @option{-mwarn-reloc} generates a warning instead.
26261
26262 @item -msafe-dma
26263 @itemx -munsafe-dma
26264 @opindex msafe-dma
26265 @opindex munsafe-dma
26266
26267 Instructions that initiate or test completion of DMA must not be
26268 reordered with respect to loads and stores of the memory that is being
26269 accessed.
26270 With @option{-munsafe-dma} you must use the @code{volatile} keyword to protect
26271 memory accesses, but that can lead to inefficient code in places where the
26272 memory is known to not change. Rather than mark the memory as volatile,
26273 you can use @option{-msafe-dma} to tell the compiler to treat
26274 the DMA instructions as potentially affecting all memory.
26275
26276 @item -mbranch-hints
26277 @opindex mbranch-hints
26278
26279 By default, GCC generates a branch hint instruction to avoid
26280 pipeline stalls for always-taken or probably-taken branches. A hint
26281 is not generated closer than 8 instructions away from its branch.
26282 There is little reason to disable them, except for debugging purposes,
26283 or to make an object a little bit smaller.
26284
26285 @item -msmall-mem
26286 @itemx -mlarge-mem
26287 @opindex msmall-mem
26288 @opindex mlarge-mem
26289
26290 By default, GCC generates code assuming that addresses are never larger
26291 than 18 bits. With @option{-mlarge-mem} code is generated that assumes
26292 a full 32-bit address.
26293
26294 @item -mstdmain
26295 @opindex mstdmain
26296
26297 By default, GCC links against startup code that assumes the SPU-style
26298 main function interface (which has an unconventional parameter list).
26299 With @option{-mstdmain}, GCC links your program against startup
26300 code that assumes a C99-style interface to @code{main}, including a
26301 local copy of @code{argv} strings.
26302
26303 @item -mfixed-range=@var{register-range}
26304 @opindex mfixed-range
26305 Generate code treating the given register range as fixed registers.
26306 A fixed register is one that the register allocator cannot use. This is
26307 useful when compiling kernel code. A register range is specified as
26308 two registers separated by a dash. Multiple register ranges can be
26309 specified separated by a comma.
26310
26311 @item -mea32
26312 @itemx -mea64
26313 @opindex mea32
26314 @opindex mea64
26315 Compile code assuming that pointers to the PPU address space accessed
26316 via the @code{__ea} named address space qualifier are either 32 or 64
26317 bits wide. The default is 32 bits. As this is an ABI-changing option,
26318 all object code in an executable must be compiled with the same setting.
26319
26320 @item -maddress-space-conversion
26321 @itemx -mno-address-space-conversion
26322 @opindex maddress-space-conversion
26323 @opindex mno-address-space-conversion
26324 Allow/disallow treating the @code{__ea} address space as superset
26325 of the generic address space. This enables explicit type casts
26326 between @code{__ea} and generic pointer as well as implicit
26327 conversions of generic pointers to @code{__ea} pointers. The
26328 default is to allow address space pointer conversions.
26329
26330 @item -mcache-size=@var{cache-size}
26331 @opindex mcache-size
26332 This option controls the version of libgcc that the compiler links to an
26333 executable and selects a software-managed cache for accessing variables
26334 in the @code{__ea} address space with a particular cache size. Possible
26335 options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
26336 and @samp{128}. The default cache size is 64KB.
26337
26338 @item -matomic-updates
26339 @itemx -mno-atomic-updates
26340 @opindex matomic-updates
26341 @opindex mno-atomic-updates
26342 This option controls the version of libgcc that the compiler links to an
26343 executable and selects whether atomic updates to the software-managed
26344 cache of PPU-side variables are used. If you use atomic updates, changes
26345 to a PPU variable from SPU code using the @code{__ea} named address space
26346 qualifier do not interfere with changes to other PPU variables residing
26347 in the same cache line from PPU code. If you do not use atomic updates,
26348 such interference may occur; however, writing back cache lines is
26349 more efficient. The default behavior is to use atomic updates.
26350
26351 @item -mdual-nops
26352 @itemx -mdual-nops=@var{n}
26353 @opindex mdual-nops
26354 By default, GCC inserts NOPs to increase dual issue when it expects
26355 it to increase performance. @var{n} can be a value from 0 to 10. A
26356 smaller @var{n} inserts fewer NOPs. 10 is the default, 0 is the
26357 same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
26358
26359 @item -mhint-max-nops=@var{n}
26360 @opindex mhint-max-nops
26361 Maximum number of NOPs to insert for a branch hint. A branch hint must
26362 be at least 8 instructions away from the branch it is affecting. GCC
26363 inserts up to @var{n} NOPs to enforce this, otherwise it does not
26364 generate the branch hint.
26365
26366 @item -mhint-max-distance=@var{n}
26367 @opindex mhint-max-distance
26368 The encoding of the branch hint instruction limits the hint to be within
26369 256 instructions of the branch it is affecting. By default, GCC makes
26370 sure it is within 125.
26371
26372 @item -msafe-hints
26373 @opindex msafe-hints
26374 Work around a hardware bug that causes the SPU to stall indefinitely.
26375 By default, GCC inserts the @code{hbrp} instruction to make sure
26376 this stall won't happen.
26377
26378 @end table
26379
26380 @node System V Options
26381 @subsection Options for System V
26382
26383 These additional options are available on System V Release 4 for
26384 compatibility with other compilers on those systems:
26385
26386 @table @gcctabopt
26387 @item -G
26388 @opindex G
26389 Create a shared object.
26390 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26391
26392 @item -Qy
26393 @opindex Qy
26394 Identify the versions of each tool used by the compiler, in a
26395 @code{.ident} assembler directive in the output.
26396
26397 @item -Qn
26398 @opindex Qn
26399 Refrain from adding @code{.ident} directives to the output file (this is
26400 the default).
26401
26402 @item -YP,@var{dirs}
26403 @opindex YP
26404 Search the directories @var{dirs}, and no others, for libraries
26405 specified with @option{-l}.
26406
26407 @item -Ym,@var{dir}
26408 @opindex Ym
26409 Look in the directory @var{dir} to find the M4 preprocessor.
26410 The assembler uses this option.
26411 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26412 @c the generic assembler that comes with Solaris takes just -Ym.
26413 @end table
26414
26415 @node TILE-Gx Options
26416 @subsection TILE-Gx Options
26417 @cindex TILE-Gx options
26418
26419 These @samp{-m} options are supported on the TILE-Gx:
26420
26421 @table @gcctabopt
26422 @item -mcmodel=small
26423 @opindex mcmodel=small
26424 Generate code for the small model. The distance for direct calls is
26425 limited to 500M in either direction. PC-relative addresses are 32
26426 bits. Absolute addresses support the full address range.
26427
26428 @item -mcmodel=large
26429 @opindex mcmodel=large
26430 Generate code for the large model. There is no limitation on call
26431 distance, pc-relative addresses, or absolute addresses.
26432
26433 @item -mcpu=@var{name}
26434 @opindex mcpu
26435 Selects the type of CPU to be targeted. Currently the only supported
26436 type is @samp{tilegx}.
26437
26438 @item -m32
26439 @itemx -m64
26440 @opindex m32
26441 @opindex m64
26442 Generate code for a 32-bit or 64-bit environment. The 32-bit
26443 environment sets int, long, and pointer to 32 bits. The 64-bit
26444 environment sets int to 32 bits and long and pointer to 64 bits.
26445
26446 @item -mbig-endian
26447 @itemx -mlittle-endian
26448 @opindex mbig-endian
26449 @opindex mlittle-endian
26450 Generate code in big/little endian mode, respectively.
26451 @end table
26452
26453 @node TILEPro Options
26454 @subsection TILEPro Options
26455 @cindex TILEPro options
26456
26457 These @samp{-m} options are supported on the TILEPro:
26458
26459 @table @gcctabopt
26460 @item -mcpu=@var{name}
26461 @opindex mcpu
26462 Selects the type of CPU to be targeted. Currently the only supported
26463 type is @samp{tilepro}.
26464
26465 @item -m32
26466 @opindex m32
26467 Generate code for a 32-bit environment, which sets int, long, and
26468 pointer to 32 bits. This is the only supported behavior so the flag
26469 is essentially ignored.
26470 @end table
26471
26472 @node V850 Options
26473 @subsection V850 Options
26474 @cindex V850 Options
26475
26476 These @samp{-m} options are defined for V850 implementations:
26477
26478 @table @gcctabopt
26479 @item -mlong-calls
26480 @itemx -mno-long-calls
26481 @opindex mlong-calls
26482 @opindex mno-long-calls
26483 Treat all calls as being far away (near). If calls are assumed to be
26484 far away, the compiler always loads the function's address into a
26485 register, and calls indirect through the pointer.
26486
26487 @item -mno-ep
26488 @itemx -mep
26489 @opindex mno-ep
26490 @opindex mep
26491 Do not optimize (do optimize) basic blocks that use the same index
26492 pointer 4 or more times to copy pointer into the @code{ep} register, and
26493 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26494 option is on by default if you optimize.
26495
26496 @item -mno-prolog-function
26497 @itemx -mprolog-function
26498 @opindex mno-prolog-function
26499 @opindex mprolog-function
26500 Do not use (do use) external functions to save and restore registers
26501 at the prologue and epilogue of a function. The external functions
26502 are slower, but use less code space if more than one function saves
26503 the same number of registers. The @option{-mprolog-function} option
26504 is on by default if you optimize.
26505
26506 @item -mspace
26507 @opindex mspace
26508 Try to make the code as small as possible. At present, this just turns
26509 on the @option{-mep} and @option{-mprolog-function} options.
26510
26511 @item -mtda=@var{n}
26512 @opindex mtda
26513 Put static or global variables whose size is @var{n} bytes or less into
26514 the tiny data area that register @code{ep} points to. The tiny data
26515 area can hold up to 256 bytes in total (128 bytes for byte references).
26516
26517 @item -msda=@var{n}
26518 @opindex msda
26519 Put static or global variables whose size is @var{n} bytes or less into
26520 the small data area that register @code{gp} points to. The small data
26521 area can hold up to 64 kilobytes.
26522
26523 @item -mzda=@var{n}
26524 @opindex mzda
26525 Put static or global variables whose size is @var{n} bytes or less into
26526 the first 32 kilobytes of memory.
26527
26528 @item -mv850
26529 @opindex mv850
26530 Specify that the target processor is the V850.
26531
26532 @item -mv850e3v5
26533 @opindex mv850e3v5
26534 Specify that the target processor is the V850E3V5. The preprocessor
26535 constant @code{__v850e3v5__} is defined if this option is used.
26536
26537 @item -mv850e2v4
26538 @opindex mv850e2v4
26539 Specify that the target processor is the V850E3V5. This is an alias for
26540 the @option{-mv850e3v5} option.
26541
26542 @item -mv850e2v3
26543 @opindex mv850e2v3
26544 Specify that the target processor is the V850E2V3. The preprocessor
26545 constant @code{__v850e2v3__} is defined if this option is used.
26546
26547 @item -mv850e2
26548 @opindex mv850e2
26549 Specify that the target processor is the V850E2. The preprocessor
26550 constant @code{__v850e2__} is defined if this option is used.
26551
26552 @item -mv850e1
26553 @opindex mv850e1
26554 Specify that the target processor is the V850E1. The preprocessor
26555 constants @code{__v850e1__} and @code{__v850e__} are defined if
26556 this option is used.
26557
26558 @item -mv850es
26559 @opindex mv850es
26560 Specify that the target processor is the V850ES. This is an alias for
26561 the @option{-mv850e1} option.
26562
26563 @item -mv850e
26564 @opindex mv850e
26565 Specify that the target processor is the V850E@. The preprocessor
26566 constant @code{__v850e__} is defined if this option is used.
26567
26568 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
26569 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
26570 are defined then a default target processor is chosen and the
26571 relevant @samp{__v850*__} preprocessor constant is defined.
26572
26573 The preprocessor constants @code{__v850} and @code{__v851__} are always
26574 defined, regardless of which processor variant is the target.
26575
26576 @item -mdisable-callt
26577 @itemx -mno-disable-callt
26578 @opindex mdisable-callt
26579 @opindex mno-disable-callt
26580 This option suppresses generation of the @code{CALLT} instruction for the
26581 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
26582 architecture.
26583
26584 This option is enabled by default when the RH850 ABI is
26585 in use (see @option{-mrh850-abi}), and disabled by default when the
26586 GCC ABI is in use. If @code{CALLT} instructions are being generated
26587 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
26588
26589 @item -mrelax
26590 @itemx -mno-relax
26591 @opindex mrelax
26592 @opindex mno-relax
26593 Pass on (or do not pass on) the @option{-mrelax} command-line option
26594 to the assembler.
26595
26596 @item -mlong-jumps
26597 @itemx -mno-long-jumps
26598 @opindex mlong-jumps
26599 @opindex mno-long-jumps
26600 Disable (or re-enable) the generation of PC-relative jump instructions.
26601
26602 @item -msoft-float
26603 @itemx -mhard-float
26604 @opindex msoft-float
26605 @opindex mhard-float
26606 Disable (or re-enable) the generation of hardware floating point
26607 instructions. This option is only significant when the target
26608 architecture is @samp{V850E2V3} or higher. If hardware floating point
26609 instructions are being generated then the C preprocessor symbol
26610 @code{__FPU_OK__} is defined, otherwise the symbol
26611 @code{__NO_FPU__} is defined.
26612
26613 @item -mloop
26614 @opindex mloop
26615 Enables the use of the e3v5 LOOP instruction. The use of this
26616 instruction is not enabled by default when the e3v5 architecture is
26617 selected because its use is still experimental.
26618
26619 @item -mrh850-abi
26620 @itemx -mghs
26621 @opindex mrh850-abi
26622 @opindex mghs
26623 Enables support for the RH850 version of the V850 ABI. This is the
26624 default. With this version of the ABI the following rules apply:
26625
26626 @itemize
26627 @item
26628 Integer sized structures and unions are returned via a memory pointer
26629 rather than a register.
26630
26631 @item
26632 Large structures and unions (more than 8 bytes in size) are passed by
26633 value.
26634
26635 @item
26636 Functions are aligned to 16-bit boundaries.
26637
26638 @item
26639 The @option{-m8byte-align} command-line option is supported.
26640
26641 @item
26642 The @option{-mdisable-callt} command-line option is enabled by
26643 default. The @option{-mno-disable-callt} command-line option is not
26644 supported.
26645 @end itemize
26646
26647 When this version of the ABI is enabled the C preprocessor symbol
26648 @code{__V850_RH850_ABI__} is defined.
26649
26650 @item -mgcc-abi
26651 @opindex mgcc-abi
26652 Enables support for the old GCC version of the V850 ABI. With this
26653 version of the ABI the following rules apply:
26654
26655 @itemize
26656 @item
26657 Integer sized structures and unions are returned in register @code{r10}.
26658
26659 @item
26660 Large structures and unions (more than 8 bytes in size) are passed by
26661 reference.
26662
26663 @item
26664 Functions are aligned to 32-bit boundaries, unless optimizing for
26665 size.
26666
26667 @item
26668 The @option{-m8byte-align} command-line option is not supported.
26669
26670 @item
26671 The @option{-mdisable-callt} command-line option is supported but not
26672 enabled by default.
26673 @end itemize
26674
26675 When this version of the ABI is enabled the C preprocessor symbol
26676 @code{__V850_GCC_ABI__} is defined.
26677
26678 @item -m8byte-align
26679 @itemx -mno-8byte-align
26680 @opindex m8byte-align
26681 @opindex mno-8byte-align
26682 Enables support for @code{double} and @code{long long} types to be
26683 aligned on 8-byte boundaries. The default is to restrict the
26684 alignment of all objects to at most 4-bytes. When
26685 @option{-m8byte-align} is in effect the C preprocessor symbol
26686 @code{__V850_8BYTE_ALIGN__} is defined.
26687
26688 @item -mbig-switch
26689 @opindex mbig-switch
26690 Generate code suitable for big switch tables. Use this option only if
26691 the assembler/linker complain about out of range branches within a switch
26692 table.
26693
26694 @item -mapp-regs
26695 @opindex mapp-regs
26696 This option causes r2 and r5 to be used in the code generated by
26697 the compiler. This setting is the default.
26698
26699 @item -mno-app-regs
26700 @opindex mno-app-regs
26701 This option causes r2 and r5 to be treated as fixed registers.
26702
26703 @end table
26704
26705 @node VAX Options
26706 @subsection VAX Options
26707 @cindex VAX options
26708
26709 These @samp{-m} options are defined for the VAX:
26710
26711 @table @gcctabopt
26712 @item -munix
26713 @opindex munix
26714 Do not output certain jump instructions (@code{aobleq} and so on)
26715 that the Unix assembler for the VAX cannot handle across long
26716 ranges.
26717
26718 @item -mgnu
26719 @opindex mgnu
26720 Do output those jump instructions, on the assumption that the
26721 GNU assembler is being used.
26722
26723 @item -mg
26724 @opindex mg
26725 Output code for G-format floating-point numbers instead of D-format.
26726 @end table
26727
26728 @node Visium Options
26729 @subsection Visium Options
26730 @cindex Visium options
26731
26732 @table @gcctabopt
26733
26734 @item -mdebug
26735 @opindex mdebug
26736 A program which performs file I/O and is destined to run on an MCM target
26737 should be linked with this option. It causes the libraries libc.a and
26738 libdebug.a to be linked. The program should be run on the target under
26739 the control of the GDB remote debugging stub.
26740
26741 @item -msim
26742 @opindex msim
26743 A program which performs file I/O and is destined to run on the simulator
26744 should be linked with option. This causes libraries libc.a and libsim.a to
26745 be linked.
26746
26747 @item -mfpu
26748 @itemx -mhard-float
26749 @opindex mfpu
26750 @opindex mhard-float
26751 Generate code containing floating-point instructions. This is the
26752 default.
26753
26754 @item -mno-fpu
26755 @itemx -msoft-float
26756 @opindex mno-fpu
26757 @opindex msoft-float
26758 Generate code containing library calls for floating-point.
26759
26760 @option{-msoft-float} changes the calling convention in the output file;
26761 therefore, it is only useful if you compile @emph{all} of a program with
26762 this option. In particular, you need to compile @file{libgcc.a}, the
26763 library that comes with GCC, with @option{-msoft-float} in order for
26764 this to work.
26765
26766 @item -mcpu=@var{cpu_type}
26767 @opindex mcpu
26768 Set the instruction set, register set, and instruction scheduling parameters
26769 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26770 @samp{mcm}, @samp{gr5} and @samp{gr6}.
26771
26772 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
26773
26774 By default (unless configured otherwise), GCC generates code for the GR5
26775 variant of the Visium architecture.
26776
26777 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
26778 architecture. The only difference from GR5 code is that the compiler will
26779 generate block move instructions.
26780
26781 @item -mtune=@var{cpu_type}
26782 @opindex mtune
26783 Set the instruction scheduling parameters for machine type @var{cpu_type},
26784 but do not set the instruction set or register set that the option
26785 @option{-mcpu=@var{cpu_type}} would.
26786
26787 @item -msv-mode
26788 @opindex msv-mode
26789 Generate code for the supervisor mode, where there are no restrictions on
26790 the access to general registers. This is the default.
26791
26792 @item -muser-mode
26793 @opindex muser-mode
26794 Generate code for the user mode, where the access to some general registers
26795 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
26796 mode; on the GR6, only registers r29 to r31 are affected.
26797 @end table
26798
26799 @node VMS Options
26800 @subsection VMS Options
26801
26802 These @samp{-m} options are defined for the VMS implementations:
26803
26804 @table @gcctabopt
26805 @item -mvms-return-codes
26806 @opindex mvms-return-codes
26807 Return VMS condition codes from @code{main}. The default is to return POSIX-style
26808 condition (e.g.@ error) codes.
26809
26810 @item -mdebug-main=@var{prefix}
26811 @opindex mdebug-main=@var{prefix}
26812 Flag the first routine whose name starts with @var{prefix} as the main
26813 routine for the debugger.
26814
26815 @item -mmalloc64
26816 @opindex mmalloc64
26817 Default to 64-bit memory allocation routines.
26818
26819 @item -mpointer-size=@var{size}
26820 @opindex mpointer-size=@var{size}
26821 Set the default size of pointers. Possible options for @var{size} are
26822 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
26823 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
26824 The later option disables @code{pragma pointer_size}.
26825 @end table
26826
26827 @node VxWorks Options
26828 @subsection VxWorks Options
26829 @cindex VxWorks Options
26830
26831 The options in this section are defined for all VxWorks targets.
26832 Options specific to the target hardware are listed with the other
26833 options for that target.
26834
26835 @table @gcctabopt
26836 @item -mrtp
26837 @opindex mrtp
26838 GCC can generate code for both VxWorks kernels and real time processes
26839 (RTPs). This option switches from the former to the latter. It also
26840 defines the preprocessor macro @code{__RTP__}.
26841
26842 @item -non-static
26843 @opindex non-static
26844 Link an RTP executable against shared libraries rather than static
26845 libraries. The options @option{-static} and @option{-shared} can
26846 also be used for RTPs (@pxref{Link Options}); @option{-static}
26847 is the default.
26848
26849 @item -Bstatic
26850 @itemx -Bdynamic
26851 @opindex Bstatic
26852 @opindex Bdynamic
26853 These options are passed down to the linker. They are defined for
26854 compatibility with Diab.
26855
26856 @item -Xbind-lazy
26857 @opindex Xbind-lazy
26858 Enable lazy binding of function calls. This option is equivalent to
26859 @option{-Wl,-z,now} and is defined for compatibility with Diab.
26860
26861 @item -Xbind-now
26862 @opindex Xbind-now
26863 Disable lazy binding of function calls. This option is the default and
26864 is defined for compatibility with Diab.
26865 @end table
26866
26867 @node x86 Options
26868 @subsection x86 Options
26869 @cindex x86 Options
26870
26871 These @samp{-m} options are defined for the x86 family of computers.
26872
26873 @table @gcctabopt
26874
26875 @item -march=@var{cpu-type}
26876 @opindex march
26877 Generate instructions for the machine type @var{cpu-type}. In contrast to
26878 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
26879 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
26880 to generate code that may not run at all on processors other than the one
26881 indicated. Specifying @option{-march=@var{cpu-type}} implies
26882 @option{-mtune=@var{cpu-type}}.
26883
26884 The choices for @var{cpu-type} are:
26885
26886 @table @samp
26887 @item native
26888 This selects the CPU to generate code for at compilation time by determining
26889 the processor type of the compiling machine. Using @option{-march=native}
26890 enables all instruction subsets supported by the local machine (hence
26891 the result might not run on different machines). Using @option{-mtune=native}
26892 produces code optimized for the local machine under the constraints
26893 of the selected instruction set.
26894
26895 @item x86-64
26896 A generic CPU with 64-bit extensions.
26897
26898 @item i386
26899 Original Intel i386 CPU@.
26900
26901 @item i486
26902 Intel i486 CPU@. (No scheduling is implemented for this chip.)
26903
26904 @item i586
26905 @itemx pentium
26906 Intel Pentium CPU with no MMX support.
26907
26908 @item lakemont
26909 Intel Lakemont MCU, based on Intel Pentium CPU.
26910
26911 @item pentium-mmx
26912 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
26913
26914 @item pentiumpro
26915 Intel Pentium Pro CPU@.
26916
26917 @item i686
26918 When used with @option{-march}, the Pentium Pro
26919 instruction set is used, so the code runs on all i686 family chips.
26920 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
26921
26922 @item pentium2
26923 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
26924 support.
26925
26926 @item pentium3
26927 @itemx pentium3m
26928 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
26929 set support.
26930
26931 @item pentium-m
26932 Intel Pentium M; low-power version of Intel Pentium III CPU
26933 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
26934
26935 @item pentium4
26936 @itemx pentium4m
26937 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
26938
26939 @item prescott
26940 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
26941 set support.
26942
26943 @item nocona
26944 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
26945 SSE2 and SSE3 instruction set support.
26946
26947 @item core2
26948 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
26949 instruction set support.
26950
26951 @item nehalem
26952 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26953 SSE4.1, SSE4.2 and POPCNT instruction set support.
26954
26955 @item westmere
26956 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26957 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
26958
26959 @item sandybridge
26960 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26961 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
26962
26963 @item ivybridge
26964 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
26965 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
26966 instruction set support.
26967
26968 @item haswell
26969 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26970 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26971 BMI, BMI2 and F16C instruction set support.
26972
26973 @item broadwell
26974 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26975 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26976 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
26977
26978 @item skylake
26979 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26980 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
26981 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
26982 XSAVES instruction set support.
26983
26984 @item bonnell
26985 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
26986 instruction set support.
26987
26988 @item silvermont
26989 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26990 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
26991
26992 @item goldmont
26993 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
26994 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
26995 instruction set support.
26996
26997 @item goldmont-plus
26998 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
26999 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27000 PTWRITE, RDPID, SGX and UMIP instruction set support.
27001
27002 @item tremont
27003 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27004 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27005 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27006
27007 @item knl
27008 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27009 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27010 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27011 AVX512CD instruction set support.
27012
27013 @item knm
27014 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27015 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27016 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27017 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27018
27019 @item skylake-avx512
27020 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27021 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27022 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27023 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27024
27025 @item cannonlake
27026 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27027 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27028 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27029 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27030 AVX512IFMA, SHA and UMIP instruction set support.
27031
27032 @item icelake-client
27033 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27034 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27035 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27036 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27037 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27038 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27039
27040 @item icelake-server
27041 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27042 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27043 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27044 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27045 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27046 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27047 set support.
27048
27049 @item k6
27050 AMD K6 CPU with MMX instruction set support.
27051
27052 @item k6-2
27053 @itemx k6-3
27054 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27055
27056 @item athlon
27057 @itemx athlon-tbird
27058 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27059 support.
27060
27061 @item athlon-4
27062 @itemx athlon-xp
27063 @itemx athlon-mp
27064 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27065 instruction set support.
27066
27067 @item k8
27068 @itemx opteron
27069 @itemx athlon64
27070 @itemx athlon-fx
27071 Processors based on the AMD K8 core with x86-64 instruction set support,
27072 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27073 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27074 instruction set extensions.)
27075
27076 @item k8-sse3
27077 @itemx opteron-sse3
27078 @itemx athlon64-sse3
27079 Improved versions of AMD K8 cores with SSE3 instruction set support.
27080
27081 @item amdfam10
27082 @itemx barcelona
27083 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27084 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27085 instruction set extensions.)
27086
27087 @item bdver1
27088 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27089 supersets FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27090 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27091 @item bdver2
27092 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27093 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCL_MUL, CX16, MMX,
27094 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27095 extensions.)
27096 @item bdver3
27097 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27098 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27099 PCL_MUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27100 64-bit instruction set extensions.
27101 @item bdver4
27102 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27103 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27104 AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27105 SSE4.2, ABM and 64-bit instruction set extensions.
27106
27107 @item znver1
27108 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27109 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27110 SHA, CLZERO, AES, PCL_MUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27111 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27112 instruction set extensions.
27113
27114 @item btver1
27115 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27116 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27117 instruction set extensions.)
27118
27119 @item btver2
27120 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27121 includes MOVBE, F16C, BMI, AVX, PCL_MUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27122 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27123
27124 @item winchip-c6
27125 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27126 set support.
27127
27128 @item winchip2
27129 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27130 instruction set support.
27131
27132 @item c3
27133 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27134 (No scheduling is implemented for this chip.)
27135
27136 @item c3-2
27137 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27138 (No scheduling is implemented for this chip.)
27139
27140 @item c7
27141 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27142 (No scheduling is implemented for this chip.)
27143
27144 @item samuel-2
27145 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27146 (No scheduling is implemented for this chip.)
27147
27148 @item nehemiah
27149 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27150 (No scheduling is implemented for this chip.)
27151
27152 @item esther
27153 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27154 (No scheduling is implemented for this chip.)
27155
27156 @item eden-x2
27157 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27158 (No scheduling is implemented for this chip.)
27159
27160 @item eden-x4
27161 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27162 AVX and AVX2 instruction set support.
27163 (No scheduling is implemented for this chip.)
27164
27165 @item nano
27166 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27167 instruction set support.
27168 (No scheduling is implemented for this chip.)
27169
27170 @item nano-1000
27171 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27172 instruction set support.
27173 (No scheduling is implemented for this chip.)
27174
27175 @item nano-2000
27176 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27177 instruction set support.
27178 (No scheduling is implemented for this chip.)
27179
27180 @item nano-3000
27181 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27182 instruction set support.
27183 (No scheduling is implemented for this chip.)
27184
27185 @item nano-x2
27186 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27187 instruction set support.
27188 (No scheduling is implemented for this chip.)
27189
27190 @item nano-x4
27191 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27192 instruction set support.
27193 (No scheduling is implemented for this chip.)
27194
27195 @item geode
27196 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27197 @end table
27198
27199 @item -mtune=@var{cpu-type}
27200 @opindex mtune
27201 Tune to @var{cpu-type} everything applicable about the generated code, except
27202 for the ABI and the set of available instructions.
27203 While picking a specific @var{cpu-type} schedules things appropriately
27204 for that particular chip, the compiler does not generate any code that
27205 cannot run on the default machine type unless you use a
27206 @option{-march=@var{cpu-type}} option.
27207 For example, if GCC is configured for i686-pc-linux-gnu
27208 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27209 but still runs on i686 machines.
27210
27211 The choices for @var{cpu-type} are the same as for @option{-march}.
27212 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27213
27214 @table @samp
27215 @item generic
27216 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27217 If you know the CPU on which your code will run, then you should use
27218 the corresponding @option{-mtune} or @option{-march} option instead of
27219 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27220 of your application will have, then you should use this option.
27221
27222 As new processors are deployed in the marketplace, the behavior of this
27223 option will change. Therefore, if you upgrade to a newer version of
27224 GCC, code generation controlled by this option will change to reflect
27225 the processors
27226 that are most common at the time that version of GCC is released.
27227
27228 There is no @option{-march=generic} option because @option{-march}
27229 indicates the instruction set the compiler can use, and there is no
27230 generic instruction set applicable to all processors. In contrast,
27231 @option{-mtune} indicates the processor (or, in this case, collection of
27232 processors) for which the code is optimized.
27233
27234 @item intel
27235 Produce code optimized for the most current Intel processors, which are
27236 Haswell and Silvermont for this version of GCC. If you know the CPU
27237 on which your code will run, then you should use the corresponding
27238 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27239 But, if you want your application performs better on both Haswell and
27240 Silvermont, then you should use this option.
27241
27242 As new Intel processors are deployed in the marketplace, the behavior of
27243 this option will change. Therefore, if you upgrade to a newer version of
27244 GCC, code generation controlled by this option will change to reflect
27245 the most current Intel processors at the time that version of GCC is
27246 released.
27247
27248 There is no @option{-march=intel} option because @option{-march} indicates
27249 the instruction set the compiler can use, and there is no common
27250 instruction set applicable to all processors. In contrast,
27251 @option{-mtune} indicates the processor (or, in this case, collection of
27252 processors) for which the code is optimized.
27253 @end table
27254
27255 @item -mcpu=@var{cpu-type}
27256 @opindex mcpu
27257 A deprecated synonym for @option{-mtune}.
27258
27259 @item -mfpmath=@var{unit}
27260 @opindex mfpmath
27261 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27262 for @var{unit} are:
27263
27264 @table @samp
27265 @item 387
27266 Use the standard 387 floating-point coprocessor present on the majority of chips and
27267 emulated otherwise. Code compiled with this option runs almost everywhere.
27268 The temporary results are computed in 80-bit precision instead of the precision
27269 specified by the type, resulting in slightly different results compared to most
27270 of other chips. See @option{-ffloat-store} for more detailed description.
27271
27272 This is the default choice for non-Darwin x86-32 targets.
27273
27274 @item sse
27275 Use scalar floating-point instructions present in the SSE instruction set.
27276 This instruction set is supported by Pentium III and newer chips,
27277 and in the AMD line
27278 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27279 instruction set supports only single-precision arithmetic, thus the double and
27280 extended-precision arithmetic are still done using 387. A later version, present
27281 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27282 arithmetic too.
27283
27284 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27285 or @option{-msse2} switches to enable SSE extensions and make this option
27286 effective. For the x86-64 compiler, these extensions are enabled by default.
27287
27288 The resulting code should be considerably faster in the majority of cases and avoid
27289 the numerical instability problems of 387 code, but may break some existing
27290 code that expects temporaries to be 80 bits.
27291
27292 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27293 and the default choice for x86-32 targets with the SSE2 instruction set
27294 when @option{-ffast-math} is enabled.
27295
27296 @item sse,387
27297 @itemx sse+387
27298 @itemx both
27299 Attempt to utilize both instruction sets at once. This effectively doubles the
27300 amount of available registers, and on chips with separate execution units for
27301 387 and SSE the execution resources too. Use this option with care, as it is
27302 still experimental, because the GCC register allocator does not model separate
27303 functional units well, resulting in unstable performance.
27304 @end table
27305
27306 @item -masm=@var{dialect}
27307 @opindex masm=@var{dialect}
27308 Output assembly instructions using selected @var{dialect}. Also affects
27309 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27310 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27311 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27312 not support @samp{intel}.
27313
27314 @item -mieee-fp
27315 @itemx -mno-ieee-fp
27316 @opindex mieee-fp
27317 @opindex mno-ieee-fp
27318 Control whether or not the compiler uses IEEE floating-point
27319 comparisons. These correctly handle the case where the result of a
27320 comparison is unordered.
27321
27322 @item -m80387
27323 @itemx -mhard-float
27324 @opindex 80387
27325 @opindex mhard-float
27326 Generate output containing 80387 instructions for floating point.
27327
27328 @item -mno-80387
27329 @itemx -msoft-float
27330 @opindex no-80387
27331 @opindex msoft-float
27332 Generate output containing library calls for floating point.
27333
27334 @strong{Warning:} the requisite libraries are not part of GCC@.
27335 Normally the facilities of the machine's usual C compiler are used, but
27336 this cannot be done directly in cross-compilation. You must make your
27337 own arrangements to provide suitable library functions for
27338 cross-compilation.
27339
27340 On machines where a function returns floating-point results in the 80387
27341 register stack, some floating-point opcodes may be emitted even if
27342 @option{-msoft-float} is used.
27343
27344 @item -mno-fp-ret-in-387
27345 @opindex mno-fp-ret-in-387
27346 Do not use the FPU registers for return values of functions.
27347
27348 The usual calling convention has functions return values of types
27349 @code{float} and @code{double} in an FPU register, even if there
27350 is no FPU@. The idea is that the operating system should emulate
27351 an FPU@.
27352
27353 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27354 in ordinary CPU registers instead.
27355
27356 @item -mno-fancy-math-387
27357 @opindex mno-fancy-math-387
27358 Some 387 emulators do not support the @code{sin}, @code{cos} and
27359 @code{sqrt} instructions for the 387. Specify this option to avoid
27360 generating those instructions.
27361 This option is overridden when @option{-march}
27362 indicates that the target CPU always has an FPU and so the
27363 instruction does not need emulation. These
27364 instructions are not generated unless you also use the
27365 @option{-funsafe-math-optimizations} switch.
27366
27367 @item -malign-double
27368 @itemx -mno-align-double
27369 @opindex malign-double
27370 @opindex mno-align-double
27371 Control whether GCC aligns @code{double}, @code{long double}, and
27372 @code{long long} variables on a two-word boundary or a one-word
27373 boundary. Aligning @code{double} variables on a two-word boundary
27374 produces code that runs somewhat faster on a Pentium at the
27375 expense of more memory.
27376
27377 On x86-64, @option{-malign-double} is enabled by default.
27378
27379 @strong{Warning:} if you use the @option{-malign-double} switch,
27380 structures containing the above types are aligned differently than
27381 the published application binary interface specifications for the x86-32
27382 and are not binary compatible with structures in code compiled
27383 without that switch.
27384
27385 @item -m96bit-long-double
27386 @itemx -m128bit-long-double
27387 @opindex m96bit-long-double
27388 @opindex m128bit-long-double
27389 These switches control the size of @code{long double} type. The x86-32
27390 application binary interface specifies the size to be 96 bits,
27391 so @option{-m96bit-long-double} is the default in 32-bit mode.
27392
27393 Modern architectures (Pentium and newer) prefer @code{long double}
27394 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27395 conforming to the ABI, this is not possible. So specifying
27396 @option{-m128bit-long-double} aligns @code{long double}
27397 to a 16-byte boundary by padding the @code{long double} with an additional
27398 32-bit zero.
27399
27400 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27401 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27402
27403 Notice that neither of these options enable any extra precision over the x87
27404 standard of 80 bits for a @code{long double}.
27405
27406 @strong{Warning:} if you override the default value for your target ABI, this
27407 changes the size of
27408 structures and arrays containing @code{long double} variables,
27409 as well as modifying the function calling convention for functions taking
27410 @code{long double}. Hence they are not binary-compatible
27411 with code compiled without that switch.
27412
27413 @item -mlong-double-64
27414 @itemx -mlong-double-80
27415 @itemx -mlong-double-128
27416 @opindex mlong-double-64
27417 @opindex mlong-double-80
27418 @opindex mlong-double-128
27419 These switches control the size of @code{long double} type. A size
27420 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27421 type. This is the default for 32-bit Bionic C library. A size
27422 of 128 bits makes the @code{long double} type equivalent to the
27423 @code{__float128} type. This is the default for 64-bit Bionic C library.
27424
27425 @strong{Warning:} if you override the default value for your target ABI, this
27426 changes the size of
27427 structures and arrays containing @code{long double} variables,
27428 as well as modifying the function calling convention for functions taking
27429 @code{long double}. Hence they are not binary-compatible
27430 with code compiled without that switch.
27431
27432 @item -malign-data=@var{type}
27433 @opindex malign-data
27434 Control how GCC aligns variables. Supported values for @var{type} are
27435 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27436 and earlier, @samp{abi} uses alignment value as specified by the
27437 psABI, and @samp{cacheline} uses increased alignment value to match
27438 the cache line size. @samp{compat} is the default.
27439
27440 @item -mlarge-data-threshold=@var{threshold}
27441 @opindex mlarge-data-threshold
27442 When @option{-mcmodel=medium} is specified, data objects larger than
27443 @var{threshold} are placed in the large data section. This value must be the
27444 same across all objects linked into the binary, and defaults to 65535.
27445
27446 @item -mrtd
27447 @opindex mrtd
27448 Use a different function-calling convention, in which functions that
27449 take a fixed number of arguments return with the @code{ret @var{num}}
27450 instruction, which pops their arguments while returning. This saves one
27451 instruction in the caller since there is no need to pop the arguments
27452 there.
27453
27454 You can specify that an individual function is called with this calling
27455 sequence with the function attribute @code{stdcall}. You can also
27456 override the @option{-mrtd} option by using the function attribute
27457 @code{cdecl}. @xref{Function Attributes}.
27458
27459 @strong{Warning:} this calling convention is incompatible with the one
27460 normally used on Unix, so you cannot use it if you need to call
27461 libraries compiled with the Unix compiler.
27462
27463 Also, you must provide function prototypes for all functions that
27464 take variable numbers of arguments (including @code{printf});
27465 otherwise incorrect code is generated for calls to those
27466 functions.
27467
27468 In addition, seriously incorrect code results if you call a
27469 function with too many arguments. (Normally, extra arguments are
27470 harmlessly ignored.)
27471
27472 @item -mregparm=@var{num}
27473 @opindex mregparm
27474 Control how many registers are used to pass integer arguments. By
27475 default, no registers are used to pass arguments, and at most 3
27476 registers can be used. You can control this behavior for a specific
27477 function by using the function attribute @code{regparm}.
27478 @xref{Function Attributes}.
27479
27480 @strong{Warning:} if you use this switch, and
27481 @var{num} is nonzero, then you must build all modules with the same
27482 value, including any libraries. This includes the system libraries and
27483 startup modules.
27484
27485 @item -msseregparm
27486 @opindex msseregparm
27487 Use SSE register passing conventions for float and double arguments
27488 and return values. You can control this behavior for a specific
27489 function by using the function attribute @code{sseregparm}.
27490 @xref{Function Attributes}.
27491
27492 @strong{Warning:} if you use this switch then you must build all
27493 modules with the same value, including any libraries. This includes
27494 the system libraries and startup modules.
27495
27496 @item -mvect8-ret-in-mem
27497 @opindex mvect8-ret-in-mem
27498 Return 8-byte vectors in memory instead of MMX registers. This is the
27499 default on Solaris@tie{}8 and 9 and VxWorks to match the ABI of the Sun
27500 Studio compilers until version 12. Later compiler versions (starting
27501 with Studio 12 Update@tie{}1) follow the ABI used by other x86 targets, which
27502 is the default on Solaris@tie{}10 and later. @emph{Only} use this option if
27503 you need to remain compatible with existing code produced by those
27504 previous compiler versions or older versions of GCC@.
27505
27506 @item -mpc32
27507 @itemx -mpc64
27508 @itemx -mpc80
27509 @opindex mpc32
27510 @opindex mpc64
27511 @opindex mpc80
27512
27513 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
27514 is specified, the significands of results of floating-point operations are
27515 rounded to 24 bits (single precision); @option{-mpc64} rounds the
27516 significands of results of floating-point operations to 53 bits (double
27517 precision) and @option{-mpc80} rounds the significands of results of
27518 floating-point operations to 64 bits (extended double precision), which is
27519 the default. When this option is used, floating-point operations in higher
27520 precisions are not available to the programmer without setting the FPU
27521 control word explicitly.
27522
27523 Setting the rounding of floating-point operations to less than the default
27524 80 bits can speed some programs by 2% or more. Note that some mathematical
27525 libraries assume that extended-precision (80-bit) floating-point operations
27526 are enabled by default; routines in such libraries could suffer significant
27527 loss of accuracy, typically through so-called ``catastrophic cancellation'',
27528 when this option is used to set the precision to less than extended precision.
27529
27530 @item -mstackrealign
27531 @opindex mstackrealign
27532 Realign the stack at entry. On the x86, the @option{-mstackrealign}
27533 option generates an alternate prologue and epilogue that realigns the
27534 run-time stack if necessary. This supports mixing legacy codes that keep
27535 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
27536 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
27537 applicable to individual functions.
27538
27539 @item -mpreferred-stack-boundary=@var{num}
27540 @opindex mpreferred-stack-boundary
27541 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
27542 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
27543 the default is 4 (16 bytes or 128 bits).
27544
27545 @strong{Warning:} When generating code for the x86-64 architecture with
27546 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
27547 used to keep the stack boundary aligned to 8 byte boundary. Since
27548 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
27549 intended to be used in controlled environment where stack space is
27550 important limitation. This option leads to wrong code when functions
27551 compiled with 16 byte stack alignment (such as functions from a standard
27552 library) are called with misaligned stack. In this case, SSE
27553 instructions may lead to misaligned memory access traps. In addition,
27554 variable arguments are handled incorrectly for 16 byte aligned
27555 objects (including x87 long double and __int128), leading to wrong
27556 results. You must build all modules with
27557 @option{-mpreferred-stack-boundary=3}, including any libraries. This
27558 includes the system libraries and startup modules.
27559
27560 @item -mincoming-stack-boundary=@var{num}
27561 @opindex mincoming-stack-boundary
27562 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
27563 boundary. If @option{-mincoming-stack-boundary} is not specified,
27564 the one specified by @option{-mpreferred-stack-boundary} is used.
27565
27566 On Pentium and Pentium Pro, @code{double} and @code{long double} values
27567 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
27568 suffer significant run time performance penalties. On Pentium III, the
27569 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
27570 properly if it is not 16-byte aligned.
27571
27572 To ensure proper alignment of this values on the stack, the stack boundary
27573 must be as aligned as that required by any value stored on the stack.
27574 Further, every function must be generated such that it keeps the stack
27575 aligned. Thus calling a function compiled with a higher preferred
27576 stack boundary from a function compiled with a lower preferred stack
27577 boundary most likely misaligns the stack. It is recommended that
27578 libraries that use callbacks always use the default setting.
27579
27580 This extra alignment does consume extra stack space, and generally
27581 increases code size. Code that is sensitive to stack space usage, such
27582 as embedded systems and operating system kernels, may want to reduce the
27583 preferred alignment to @option{-mpreferred-stack-boundary=2}.
27584
27585 @need 200
27586 @item -mmmx
27587 @opindex mmmx
27588 @need 200
27589 @itemx -msse
27590 @opindex msse
27591 @need 200
27592 @itemx -msse2
27593 @opindex msse2
27594 @need 200
27595 @itemx -msse3
27596 @opindex msse3
27597 @need 200
27598 @itemx -mssse3
27599 @opindex mssse3
27600 @need 200
27601 @itemx -msse4
27602 @opindex msse4
27603 @need 200
27604 @itemx -msse4a
27605 @opindex msse4a
27606 @need 200
27607 @itemx -msse4.1
27608 @opindex msse4.1
27609 @need 200
27610 @itemx -msse4.2
27611 @opindex msse4.2
27612 @need 200
27613 @itemx -mavx
27614 @opindex mavx
27615 @need 200
27616 @itemx -mavx2
27617 @opindex mavx2
27618 @need 200
27619 @itemx -mavx512f
27620 @opindex mavx512f
27621 @need 200
27622 @itemx -mavx512pf
27623 @opindex mavx512pf
27624 @need 200
27625 @itemx -mavx512er
27626 @opindex mavx512er
27627 @need 200
27628 @itemx -mavx512cd
27629 @opindex mavx512cd
27630 @need 200
27631 @itemx -mavx512vl
27632 @opindex mavx512vl
27633 @need 200
27634 @itemx -mavx512bw
27635 @opindex mavx512bw
27636 @need 200
27637 @itemx -mavx512dq
27638 @opindex mavx512dq
27639 @need 200
27640 @itemx -mavx512ifma
27641 @opindex mavx512ifma
27642 @need 200
27643 @itemx -mavx512vbmi
27644 @opindex mavx512vbmi
27645 @need 200
27646 @itemx -msha
27647 @opindex msha
27648 @need 200
27649 @itemx -maes
27650 @opindex maes
27651 @need 200
27652 @itemx -mpclmul
27653 @opindex mpclmul
27654 @need 200
27655 @itemx -mclflushopt
27656 @opindex mclflushopt
27657 @need 200
27658 @itemx -mfsgsbase
27659 @opindex mfsgsbase
27660 @need 200
27661 @itemx -mrdrnd
27662 @opindex mrdrnd
27663 @need 200
27664 @itemx -mf16c
27665 @opindex mf16c
27666 @need 200
27667 @itemx -mfma
27668 @opindex mfma
27669 @need 200
27670 @itemx -mpconfig
27671 @opindex mpconfig
27672 @need 200
27673 @itemx -mwbnoinvd
27674 @opindex mwbnoinvd
27675 @need 200
27676 @itemx -mfma4
27677 @opindex mfma4
27678 @need 200
27679 @itemx -mprefetchwt1
27680 @opindex mprefetchwt1
27681 @need 200
27682 @itemx -mxop
27683 @opindex mxop
27684 @need 200
27685 @itemx -mlwp
27686 @opindex mlwp
27687 @need 200
27688 @itemx -m3dnow
27689 @opindex m3dnow
27690 @need 200
27691 @itemx -m3dnowa
27692 @opindex m3dnowa
27693 @need 200
27694 @itemx -mpopcnt
27695 @opindex mpopcnt
27696 @need 200
27697 @itemx -mabm
27698 @opindex mabm
27699 @need 200
27700 @itemx -mbmi
27701 @opindex mbmi
27702 @need 200
27703 @itemx -mbmi2
27704 @need 200
27705 @itemx -mlzcnt
27706 @opindex mlzcnt
27707 @need 200
27708 @itemx -mfxsr
27709 @opindex mfxsr
27710 @need 200
27711 @itemx -mxsave
27712 @opindex mxsave
27713 @need 200
27714 @itemx -mxsaveopt
27715 @opindex mxsaveopt
27716 @need 200
27717 @itemx -mxsavec
27718 @opindex mxsavec
27719 @need 200
27720 @itemx -mxsaves
27721 @opindex mxsaves
27722 @need 200
27723 @itemx -mrtm
27724 @opindex mrtm
27725 @need 200
27726 @itemx -mtbm
27727 @opindex mtbm
27728 @need 200
27729 @itemx -mmwaitx
27730 @opindex mmwaitx
27731 @need 200
27732 @itemx -mclzero
27733 @opindex mclzero
27734 @need 200
27735 @itemx -mpku
27736 @opindex mpku
27737 @need 200
27738 @itemx -mavx512vbmi2
27739 @opindex mavx512vbmi2
27740 @need 200
27741 @itemx -mgfni
27742 @opindex mgfni
27743 @need 200
27744 @itemx -mvaes
27745 @opindex mvaes
27746 @need 200
27747 @itemx -mwaitpkg
27748 @opindex -mwaitpkg
27749 @need 200
27750 @itemx -mvpclmulqdq
27751 @opindex mvpclmulqdq
27752 @need 200
27753 @itemx -mavx512bitalg
27754 @opindex mavx512bitalg
27755 @need 200
27756 @itemx -mmovdiri
27757 @opindex mmovdiri
27758 @need 200
27759 @itemx -mmovdir64b
27760 @opindex mmovdir64b
27761 @need 200
27762 @itemx -mavx512vpopcntdq
27763 @opindex mavx512vpopcntdq
27764 @need 200
27765 @itemx -mcldemote
27766 @opindex mcldemote
27767 These switches enable the use of instructions in the MMX, SSE,
27768 SSE2, SSE3, SSSE3, SSE4.1, AVX, AVX2, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27769 SHA, AES, PCLMUL, FSGSBASE, RDRND, F16C, FMA, SSE4A, FMA4, XOP, LWP, ABM,
27770 AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, BMI, BMI2, VAES, WAITPKG,
27771 FXSR, XSAVE, XSAVEOPT, LZCNT, RTM, MWAITX, PKU, IBT, SHSTK, AVX512VBMI2,
27772 GFNI, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B,
27773 AVX512VPOPCNTDQ, CLDEMOTE, 3DNow!@: or enhanced 3DNow!@: extended instruction
27774 sets. Each has a corresponding @option{-mno-} option to disable use of these
27775 instructions.
27776
27777 These extensions are also available as built-in functions: see
27778 @ref{x86 Built-in Functions}, for details of the functions enabled and
27779 disabled by these switches.
27780
27781 To generate SSE/SSE2 instructions automatically from floating-point
27782 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
27783
27784 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
27785 generates new AVX instructions or AVX equivalence for all SSEx instructions
27786 when needed.
27787
27788 These options enable GCC to use these extended instructions in
27789 generated code, even without @option{-mfpmath=sse}. Applications that
27790 perform run-time CPU detection must compile separate files for each
27791 supported architecture, using the appropriate flags. In particular,
27792 the file containing the CPU detection code should be compiled without
27793 these options.
27794
27795 @item -mdump-tune-features
27796 @opindex mdump-tune-features
27797 This option instructs GCC to dump the names of the x86 performance
27798 tuning features and default settings. The names can be used in
27799 @option{-mtune-ctrl=@var{feature-list}}.
27800
27801 @item -mtune-ctrl=@var{feature-list}
27802 @opindex mtune-ctrl=@var{feature-list}
27803 This option is used to do fine grain control of x86 code generation features.
27804 @var{feature-list} is a comma separated list of @var{feature} names. See also
27805 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
27806 on if it is not preceded with @samp{^}, otherwise, it is turned off.
27807 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
27808 developers. Using it may lead to code paths not covered by testing and can
27809 potentially result in compiler ICEs or runtime errors.
27810
27811 @item -mno-default
27812 @opindex mno-default
27813 This option instructs GCC to turn off all tunable features. See also
27814 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
27815
27816 @item -mcld
27817 @opindex mcld
27818 This option instructs GCC to emit a @code{cld} instruction in the prologue
27819 of functions that use string instructions. String instructions depend on
27820 the DF flag to select between autoincrement or autodecrement mode. While the
27821 ABI specifies the DF flag to be cleared on function entry, some operating
27822 systems violate this specification by not clearing the DF flag in their
27823 exception dispatchers. The exception handler can be invoked with the DF flag
27824 set, which leads to wrong direction mode when string instructions are used.
27825 This option can be enabled by default on 32-bit x86 targets by configuring
27826 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
27827 instructions can be suppressed with the @option{-mno-cld} compiler option
27828 in this case.
27829
27830 @item -mvzeroupper
27831 @opindex mvzeroupper
27832 This option instructs GCC to emit a @code{vzeroupper} instruction
27833 before a transfer of control flow out of the function to minimize
27834 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
27835 intrinsics.
27836
27837 @item -mprefer-avx128
27838 @opindex mprefer-avx128
27839 This option instructs GCC to use 128-bit AVX instructions instead of
27840 256-bit AVX instructions in the auto-vectorizer.
27841
27842 @item -mprefer-vector-width=@var{opt}
27843 @opindex mprefer-vector-width
27844 This option instructs GCC to use @var{opt}-bit vector width in instructions
27845 instead of default on the selected platform.
27846
27847 @table @samp
27848 @item none
27849 No extra limitations applied to GCC other than defined by the selected platform.
27850
27851 @item 128
27852 Prefer 128-bit vector width for instructions.
27853
27854 @item 256
27855 Prefer 256-bit vector width for instructions.
27856
27857 @item 512
27858 Prefer 512-bit vector width for instructions.
27859 @end table
27860
27861 @item -mcx16
27862 @opindex mcx16
27863 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
27864 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
27865 objects. This is useful for atomic updates of data structures exceeding one
27866 machine word in size. The compiler uses this instruction to implement
27867 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
27868 128-bit integers, a library call is always used.
27869
27870 @item -msahf
27871 @opindex msahf
27872 This option enables generation of @code{SAHF} instructions in 64-bit code.
27873 Early Intel Pentium 4 CPUs with Intel 64 support,
27874 prior to the introduction of Pentium 4 G1 step in December 2005,
27875 lacked the @code{LAHF} and @code{SAHF} instructions
27876 which are supported by AMD64.
27877 These are load and store instructions, respectively, for certain status flags.
27878 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
27879 @code{drem}, and @code{remainder} built-in functions;
27880 see @ref{Other Builtins} for details.
27881
27882 @item -mmovbe
27883 @opindex mmovbe
27884 This option enables use of the @code{movbe} instruction to implement
27885 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
27886
27887 @item -mshstk
27888 @opindex mshstk
27889 The @option{-mshstk} option enables shadow stack built-in functions
27890 from x86 Control-flow Enforcement Technology (CET).
27891
27892 @item -mcrc32
27893 @opindex mcrc32
27894 This option enables built-in functions @code{__builtin_ia32_crc32qi},
27895 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
27896 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
27897
27898 @item -mrecip
27899 @opindex mrecip
27900 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
27901 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
27902 with an additional Newton-Raphson step
27903 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
27904 (and their vectorized
27905 variants) for single-precision floating-point arguments. These instructions
27906 are generated only when @option{-funsafe-math-optimizations} is enabled
27907 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
27908 Note that while the throughput of the sequence is higher than the throughput
27909 of the non-reciprocal instruction, the precision of the sequence can be
27910 decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
27911
27912 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
27913 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
27914 combination), and doesn't need @option{-mrecip}.
27915
27916 Also note that GCC emits the above sequence with additional Newton-Raphson step
27917 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
27918 already with @option{-ffast-math} (or the above option combination), and
27919 doesn't need @option{-mrecip}.
27920
27921 @item -mrecip=@var{opt}
27922 @opindex mrecip=opt
27923 This option controls which reciprocal estimate instructions
27924 may be used. @var{opt} is a comma-separated list of options, which may
27925 be preceded by a @samp{!} to invert the option:
27926
27927 @table @samp
27928 @item all
27929 Enable all estimate instructions.
27930
27931 @item default
27932 Enable the default instructions, equivalent to @option{-mrecip}.
27933
27934 @item none
27935 Disable all estimate instructions, equivalent to @option{-mno-recip}.
27936
27937 @item div
27938 Enable the approximation for scalar division.
27939
27940 @item vec-div
27941 Enable the approximation for vectorized division.
27942
27943 @item sqrt
27944 Enable the approximation for scalar square root.
27945
27946 @item vec-sqrt
27947 Enable the approximation for vectorized square root.
27948 @end table
27949
27950 So, for example, @option{-mrecip=all,!sqrt} enables
27951 all of the reciprocal approximations, except for square root.
27952
27953 @item -mveclibabi=@var{type}
27954 @opindex mveclibabi
27955 Specifies the ABI type to use for vectorizing intrinsics using an
27956 external library. Supported values for @var{type} are @samp{svml}
27957 for the Intel short
27958 vector math library and @samp{acml} for the AMD math core library.
27959 To use this option, both @option{-ftree-vectorize} and
27960 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
27961 ABI-compatible library must be specified at link time.
27962
27963 GCC currently emits calls to @code{vmldExp2},
27964 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
27965 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
27966 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
27967 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
27968 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
27969 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
27970 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
27971 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
27972 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
27973 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
27974 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
27975 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
27976 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
27977 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
27978 when @option{-mveclibabi=acml} is used.
27979
27980 @item -mabi=@var{name}
27981 @opindex mabi
27982 Generate code for the specified calling convention. Permissible values
27983 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
27984 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
27985 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
27986 You can control this behavior for specific functions by
27987 using the function attributes @code{ms_abi} and @code{sysv_abi}.
27988 @xref{Function Attributes}.
27989
27990 @item -mforce-indirect-call
27991 @opindex mforce-indirect-call
27992 Force all calls to functions to be indirect. This is useful
27993 when using Intel Processor Trace where it generates more precise timing
27994 information for function calls.
27995
27996 @item -mcall-ms2sysv-xlogues
27997 @opindex mcall-ms2sysv-xlogues
27998 @opindex mno-call-ms2sysv-xlogues
27999 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28000 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28001 default, the code for saving and restoring these registers is emitted inline,
28002 resulting in fairly lengthy prologues and epilogues. Using
28003 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28004 use stubs in the static portion of libgcc to perform these saves and restores,
28005 thus reducing function size at the cost of a few extra instructions.
28006
28007 @item -mtls-dialect=@var{type}
28008 @opindex mtls-dialect
28009 Generate code to access thread-local storage using the @samp{gnu} or
28010 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28011 @samp{gnu2} is more efficient, but it may add compile- and run-time
28012 requirements that cannot be satisfied on all systems.
28013
28014 @item -mpush-args
28015 @itemx -mno-push-args
28016 @opindex mpush-args
28017 @opindex mno-push-args
28018 Use PUSH operations to store outgoing parameters. This method is shorter
28019 and usually equally fast as method using SUB/MOV operations and is enabled
28020 by default. In some cases disabling it may improve performance because of
28021 improved scheduling and reduced dependencies.
28022
28023 @item -maccumulate-outgoing-args
28024 @opindex maccumulate-outgoing-args
28025 If enabled, the maximum amount of space required for outgoing arguments is
28026 computed in the function prologue. This is faster on most modern CPUs
28027 because of reduced dependencies, improved scheduling and reduced stack usage
28028 when the preferred stack boundary is not equal to 2. The drawback is a notable
28029 increase in code size. This switch implies @option{-mno-push-args}.
28030
28031 @item -mthreads
28032 @opindex mthreads
28033 Support thread-safe exception handling on MinGW. Programs that rely
28034 on thread-safe exception handling must compile and link all code with the
28035 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28036 @option{-D_MT}; when linking, it links in a special thread helper library
28037 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28038
28039 @item -mms-bitfields
28040 @itemx -mno-ms-bitfields
28041 @opindex mms-bitfields
28042 @opindex mno-ms-bitfields
28043
28044 Enable/disable bit-field layout compatible with the native Microsoft
28045 Windows compiler.
28046
28047 If @code{packed} is used on a structure, or if bit-fields are used,
28048 it may be that the Microsoft ABI lays out the structure differently
28049 than the way GCC normally does. Particularly when moving packed
28050 data between functions compiled with GCC and the native Microsoft compiler
28051 (either via function call or as data in a file), it may be necessary to access
28052 either format.
28053
28054 This option is enabled by default for Microsoft Windows
28055 targets. This behavior can also be controlled locally by use of variable
28056 or type attributes. For more information, see @ref{x86 Variable Attributes}
28057 and @ref{x86 Type Attributes}.
28058
28059 The Microsoft structure layout algorithm is fairly simple with the exception
28060 of the bit-field packing.
28061 The padding and alignment of members of structures and whether a bit-field
28062 can straddle a storage-unit boundary are determine by these rules:
28063
28064 @enumerate
28065 @item Structure members are stored sequentially in the order in which they are
28066 declared: the first member has the lowest memory address and the last member
28067 the highest.
28068
28069 @item Every data object has an alignment requirement. The alignment requirement
28070 for all data except structures, unions, and arrays is either the size of the
28071 object or the current packing size (specified with either the
28072 @code{aligned} attribute or the @code{pack} pragma),
28073 whichever is less. For structures, unions, and arrays,
28074 the alignment requirement is the largest alignment requirement of its members.
28075 Every object is allocated an offset so that:
28076
28077 @smallexample
28078 offset % alignment_requirement == 0
28079 @end smallexample
28080
28081 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28082 unit if the integral types are the same size and if the next bit-field fits
28083 into the current allocation unit without crossing the boundary imposed by the
28084 common alignment requirements of the bit-fields.
28085 @end enumerate
28086
28087 MSVC interprets zero-length bit-fields in the following ways:
28088
28089 @enumerate
28090 @item If a zero-length bit-field is inserted between two bit-fields that
28091 are normally coalesced, the bit-fields are not coalesced.
28092
28093 For example:
28094
28095 @smallexample
28096 struct
28097 @{
28098 unsigned long bf_1 : 12;
28099 unsigned long : 0;
28100 unsigned long bf_2 : 12;
28101 @} t1;
28102 @end smallexample
28103
28104 @noindent
28105 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28106 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28107
28108 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28109 alignment of the zero-length bit-field is greater than the member that follows it,
28110 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28111
28112 For example:
28113
28114 @smallexample
28115 struct
28116 @{
28117 char foo : 4;
28118 short : 0;
28119 char bar;
28120 @} t2;
28121
28122 struct
28123 @{
28124 char foo : 4;
28125 short : 0;
28126 double bar;
28127 @} t3;
28128 @end smallexample
28129
28130 @noindent
28131 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28132 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28133 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28134 of the structure.
28135
28136 Taking this into account, it is important to note the following:
28137
28138 @enumerate
28139 @item If a zero-length bit-field follows a normal bit-field, the type of the
28140 zero-length bit-field may affect the alignment of the structure as whole. For
28141 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28142 normal bit-field, and is of type short.
28143
28144 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28145 still affect the alignment of the structure:
28146
28147 @smallexample
28148 struct
28149 @{
28150 char foo : 6;
28151 long : 0;
28152 @} t4;
28153 @end smallexample
28154
28155 @noindent
28156 Here, @code{t4} takes up 4 bytes.
28157 @end enumerate
28158
28159 @item Zero-length bit-fields following non-bit-field members are ignored:
28160
28161 @smallexample
28162 struct
28163 @{
28164 char foo;
28165 long : 0;
28166 char bar;
28167 @} t5;
28168 @end smallexample
28169
28170 @noindent
28171 Here, @code{t5} takes up 2 bytes.
28172 @end enumerate
28173
28174
28175 @item -mno-align-stringops
28176 @opindex mno-align-stringops
28177 Do not align the destination of inlined string operations. This switch reduces
28178 code size and improves performance in case the destination is already aligned,
28179 but GCC doesn't know about it.
28180
28181 @item -minline-all-stringops
28182 @opindex minline-all-stringops
28183 By default GCC inlines string operations only when the destination is
28184 known to be aligned to least a 4-byte boundary.
28185 This enables more inlining and increases code
28186 size, but may improve performance of code that depends on fast
28187 @code{memcpy}, @code{strlen},
28188 and @code{memset} for short lengths.
28189
28190 @item -minline-stringops-dynamically
28191 @opindex minline-stringops-dynamically
28192 For string operations of unknown size, use run-time checks with
28193 inline code for small blocks and a library call for large blocks.
28194
28195 @item -mstringop-strategy=@var{alg}
28196 @opindex mstringop-strategy=@var{alg}
28197 Override the internal decision heuristic for the particular algorithm to use
28198 for inlining string operations. The allowed values for @var{alg} are:
28199
28200 @table @samp
28201 @item rep_byte
28202 @itemx rep_4byte
28203 @itemx rep_8byte
28204 Expand using i386 @code{rep} prefix of the specified size.
28205
28206 @item byte_loop
28207 @itemx loop
28208 @itemx unrolled_loop
28209 Expand into an inline loop.
28210
28211 @item libcall
28212 Always use a library call.
28213 @end table
28214
28215 @item -mmemcpy-strategy=@var{strategy}
28216 @opindex mmemcpy-strategy=@var{strategy}
28217 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28218 should be inlined and what inline algorithm to use when the expected size
28219 of the copy operation is known. @var{strategy}
28220 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28221 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28222 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28223 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28224 in the list must be specified in increasing order. The minimal byte size for
28225 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28226 preceding range.
28227
28228 @item -mmemset-strategy=@var{strategy}
28229 @opindex mmemset-strategy=@var{strategy}
28230 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28231 @code{__builtin_memset} expansion.
28232
28233 @item -momit-leaf-frame-pointer
28234 @opindex momit-leaf-frame-pointer
28235 Don't keep the frame pointer in a register for leaf functions. This
28236 avoids the instructions to save, set up, and restore frame pointers and
28237 makes an extra register available in leaf functions. The option
28238 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28239 which might make debugging harder.
28240
28241 @item -mtls-direct-seg-refs
28242 @itemx -mno-tls-direct-seg-refs
28243 @opindex mtls-direct-seg-refs
28244 Controls whether TLS variables may be accessed with offsets from the
28245 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28246 or whether the thread base pointer must be added. Whether or not this
28247 is valid depends on the operating system, and whether it maps the
28248 segment to cover the entire TLS area.
28249
28250 For systems that use the GNU C Library, the default is on.
28251
28252 @item -msse2avx
28253 @itemx -mno-sse2avx
28254 @opindex msse2avx
28255 Specify that the assembler should encode SSE instructions with VEX
28256 prefix. The option @option{-mavx} turns this on by default.
28257
28258 @item -mfentry
28259 @itemx -mno-fentry
28260 @opindex mfentry
28261 If profiling is active (@option{-pg}), put the profiling
28262 counter call before the prologue.
28263 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28264 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28265
28266 @item -mrecord-mcount
28267 @itemx -mno-record-mcount
28268 @opindex mrecord-mcount
28269 If profiling is active (@option{-pg}), generate a __mcount_loc section
28270 that contains pointers to each profiling call. This is useful for
28271 automatically patching and out calls.
28272
28273 @item -mnop-mcount
28274 @itemx -mno-nop-mcount
28275 @opindex mnop-mcount
28276 If profiling is active (@option{-pg}), generate the calls to
28277 the profiling functions as NOPs. This is useful when they
28278 should be patched in later dynamically. This is likely only
28279 useful together with @option{-mrecord-mcount}.
28280
28281 @item -mskip-rax-setup
28282 @itemx -mno-skip-rax-setup
28283 @opindex mskip-rax-setup
28284 When generating code for the x86-64 architecture with SSE extensions
28285 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28286 register when there are no variable arguments passed in vector registers.
28287
28288 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28289 saving vector registers on stack when passing variable arguments, the
28290 impacts of this option are callees may waste some stack space,
28291 misbehave or jump to a random location. GCC 4.4 or newer don't have
28292 those issues, regardless the RAX register value.
28293
28294 @item -m8bit-idiv
28295 @itemx -mno-8bit-idiv
28296 @opindex m8bit-idiv
28297 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28298 much faster than 32-bit/64-bit integer divide. This option generates a
28299 run-time check. If both dividend and divisor are within range of 0
28300 to 255, 8-bit unsigned integer divide is used instead of
28301 32-bit/64-bit integer divide.
28302
28303 @item -mavx256-split-unaligned-load
28304 @itemx -mavx256-split-unaligned-store
28305 @opindex mavx256-split-unaligned-load
28306 @opindex mavx256-split-unaligned-store
28307 Split 32-byte AVX unaligned load and store.
28308
28309 @item -mstack-protector-guard=@var{guard}
28310 @itemx -mstack-protector-guard-reg=@var{reg}
28311 @itemx -mstack-protector-guard-offset=@var{offset}
28312 @opindex mstack-protector-guard
28313 @opindex mstack-protector-guard-reg
28314 @opindex mstack-protector-guard-offset
28315 Generate stack protection code using canary at @var{guard}. Supported
28316 locations are @samp{global} for global canary or @samp{tls} for per-thread
28317 canary in the TLS block (the default). This option has effect only when
28318 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28319
28320 With the latter choice the options
28321 @option{-mstack-protector-guard-reg=@var{reg}} and
28322 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28323 which segment register (@code{%fs} or @code{%gs}) to use as base register
28324 for reading the canary, and from what offset from that base register.
28325 The default for those is as specified in the relevant ABI.
28326
28327 @item -mgeneral-regs-only
28328 @opindex mgeneral-regs-only
28329 Generate code that uses only the general-purpose registers. This
28330 prevents the compiler from using floating-point, vector, mask and bound
28331 registers.
28332
28333 @item -mindirect-branch=@var{choice}
28334 @opindex -mindirect-branch
28335 Convert indirect call and jump with @var{choice}. The default is
28336 @samp{keep}, which keeps indirect call and jump unmodified.
28337 @samp{thunk} converts indirect call and jump to call and return thunk.
28338 @samp{thunk-inline} converts indirect call and jump to inlined call
28339 and return thunk. @samp{thunk-extern} converts indirect call and jump
28340 to external call and return thunk provided in a separate object file.
28341 You can control this behavior for a specific function by using the
28342 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28343
28344 Note that @option{-mcmodel=large} is incompatible with
28345 @option{-mindirect-branch=thunk} and
28346 @option{-mindirect-branch=thunk-extern} since the thunk function may
28347 not be reachable in the large code model.
28348
28349 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28350 @option{-fcf-protection=branch} since the external thunk can not be modified
28351 to disable control-flow check.
28352
28353 @item -mfunction-return=@var{choice}
28354 @opindex -mfunction-return
28355 Convert function return with @var{choice}. The default is @samp{keep},
28356 which keeps function return unmodified. @samp{thunk} converts function
28357 return to call and return thunk. @samp{thunk-inline} converts function
28358 return to inlined call and return thunk. @samp{thunk-extern} converts
28359 function return to external call and return thunk provided in a separate
28360 object file. You can control this behavior for a specific function by
28361 using the function attribute @code{function_return}.
28362 @xref{Function Attributes}.
28363
28364 Note that @option{-mcmodel=large} is incompatible with
28365 @option{-mfunction-return=thunk} and
28366 @option{-mfunction-return=thunk-extern} since the thunk function may
28367 not be reachable in the large code model.
28368
28369
28370 @item -mindirect-branch-register
28371 @opindex -mindirect-branch-register
28372 Force indirect call and jump via register.
28373
28374 @end table
28375
28376 These @samp{-m} switches are supported in addition to the above
28377 on x86-64 processors in 64-bit environments.
28378
28379 @table @gcctabopt
28380 @item -m32
28381 @itemx -m64
28382 @itemx -mx32
28383 @itemx -m16
28384 @itemx -miamcu
28385 @opindex m32
28386 @opindex m64
28387 @opindex mx32
28388 @opindex m16
28389 @opindex miamcu
28390 Generate code for a 16-bit, 32-bit or 64-bit environment.
28391 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28392 to 32 bits, and
28393 generates code that runs on any i386 system.
28394
28395 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28396 types to 64 bits, and generates code for the x86-64 architecture.
28397 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28398 and @option{-mdynamic-no-pic} options.
28399
28400 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28401 to 32 bits, and
28402 generates code for the x86-64 architecture.
28403
28404 The @option{-m16} option is the same as @option{-m32}, except for that
28405 it outputs the @code{.code16gcc} assembly directive at the beginning of
28406 the assembly output so that the binary can run in 16-bit mode.
28407
28408 The @option{-miamcu} option generates code which conforms to Intel MCU
28409 psABI. It requires the @option{-m32} option to be turned on.
28410
28411 @item -mno-red-zone
28412 @opindex mno-red-zone
28413 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28414 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28415 stack pointer that is not modified by signal or interrupt handlers
28416 and therefore can be used for temporary data without adjusting the stack
28417 pointer. The flag @option{-mno-red-zone} disables this red zone.
28418
28419 @item -mcmodel=small
28420 @opindex mcmodel=small
28421 Generate code for the small code model: the program and its symbols must
28422 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28423 Programs can be statically or dynamically linked. This is the default
28424 code model.
28425
28426 @item -mcmodel=kernel
28427 @opindex mcmodel=kernel
28428 Generate code for the kernel code model. The kernel runs in the
28429 negative 2 GB of the address space.
28430 This model has to be used for Linux kernel code.
28431
28432 @item -mcmodel=medium
28433 @opindex mcmodel=medium
28434 Generate code for the medium model: the program is linked in the lower 2
28435 GB of the address space. Small symbols are also placed there. Symbols
28436 with sizes larger than @option{-mlarge-data-threshold} are put into
28437 large data or BSS sections and can be located above 2GB. Programs can
28438 be statically or dynamically linked.
28439
28440 @item -mcmodel=large
28441 @opindex mcmodel=large
28442 Generate code for the large model. This model makes no assumptions
28443 about addresses and sizes of sections.
28444
28445 @item -maddress-mode=long
28446 @opindex maddress-mode=long
28447 Generate code for long address mode. This is only supported for 64-bit
28448 and x32 environments. It is the default address mode for 64-bit
28449 environments.
28450
28451 @item -maddress-mode=short
28452 @opindex maddress-mode=short
28453 Generate code for short address mode. This is only supported for 32-bit
28454 and x32 environments. It is the default address mode for 32-bit and
28455 x32 environments.
28456 @end table
28457
28458 @node x86 Windows Options
28459 @subsection x86 Windows Options
28460 @cindex x86 Windows Options
28461 @cindex Windows Options for x86
28462
28463 These additional options are available for Microsoft Windows targets:
28464
28465 @table @gcctabopt
28466 @item -mconsole
28467 @opindex mconsole
28468 This option
28469 specifies that a console application is to be generated, by
28470 instructing the linker to set the PE header subsystem type
28471 required for console applications.
28472 This option is available for Cygwin and MinGW targets and is
28473 enabled by default on those targets.
28474
28475 @item -mdll
28476 @opindex mdll
28477 This option is available for Cygwin and MinGW targets. It
28478 specifies that a DLL---a dynamic link library---is to be
28479 generated, enabling the selection of the required runtime
28480 startup object and entry point.
28481
28482 @item -mnop-fun-dllimport
28483 @opindex mnop-fun-dllimport
28484 This option is available for Cygwin and MinGW targets. It
28485 specifies that the @code{dllimport} attribute should be ignored.
28486
28487 @item -mthread
28488 @opindex mthread
28489 This option is available for MinGW targets. It specifies
28490 that MinGW-specific thread support is to be used.
28491
28492 @item -municode
28493 @opindex municode
28494 This option is available for MinGW-w64 targets. It causes
28495 the @code{UNICODE} preprocessor macro to be predefined, and
28496 chooses Unicode-capable runtime startup code.
28497
28498 @item -mwin32
28499 @opindex mwin32
28500 This option is available for Cygwin and MinGW targets. It
28501 specifies that the typical Microsoft Windows predefined macros are to
28502 be set in the pre-processor, but does not influence the choice
28503 of runtime library/startup code.
28504
28505 @item -mwindows
28506 @opindex mwindows
28507 This option is available for Cygwin and MinGW targets. It
28508 specifies that a GUI application is to be generated by
28509 instructing the linker to set the PE header subsystem type
28510 appropriately.
28511
28512 @item -fno-set-stack-executable
28513 @opindex fno-set-stack-executable
28514 This option is available for MinGW targets. It specifies that
28515 the executable flag for the stack used by nested functions isn't
28516 set. This is necessary for binaries running in kernel mode of
28517 Microsoft Windows, as there the User32 API, which is used to set executable
28518 privileges, isn't available.
28519
28520 @item -fwritable-relocated-rdata
28521 @opindex fno-writable-relocated-rdata
28522 This option is available for MinGW and Cygwin targets. It specifies
28523 that relocated-data in read-only section is put into the @code{.data}
28524 section. This is a necessary for older runtimes not supporting
28525 modification of @code{.rdata} sections for pseudo-relocation.
28526
28527 @item -mpe-aligned-commons
28528 @opindex mpe-aligned-commons
28529 This option is available for Cygwin and MinGW targets. It
28530 specifies that the GNU extension to the PE file format that
28531 permits the correct alignment of COMMON variables should be
28532 used when generating code. It is enabled by default if
28533 GCC detects that the target assembler found during configuration
28534 supports the feature.
28535 @end table
28536
28537 See also under @ref{x86 Options} for standard options.
28538
28539 @node Xstormy16 Options
28540 @subsection Xstormy16 Options
28541 @cindex Xstormy16 Options
28542
28543 These options are defined for Xstormy16:
28544
28545 @table @gcctabopt
28546 @item -msim
28547 @opindex msim
28548 Choose startup files and linker script suitable for the simulator.
28549 @end table
28550
28551 @node Xtensa Options
28552 @subsection Xtensa Options
28553 @cindex Xtensa Options
28554
28555 These options are supported for Xtensa targets:
28556
28557 @table @gcctabopt
28558 @item -mconst16
28559 @itemx -mno-const16
28560 @opindex mconst16
28561 @opindex mno-const16
28562 Enable or disable use of @code{CONST16} instructions for loading
28563 constant values. The @code{CONST16} instruction is currently not a
28564 standard option from Tensilica. When enabled, @code{CONST16}
28565 instructions are always used in place of the standard @code{L32R}
28566 instructions. The use of @code{CONST16} is enabled by default only if
28567 the @code{L32R} instruction is not available.
28568
28569 @item -mfused-madd
28570 @itemx -mno-fused-madd
28571 @opindex mfused-madd
28572 @opindex mno-fused-madd
28573 Enable or disable use of fused multiply/add and multiply/subtract
28574 instructions in the floating-point option. This has no effect if the
28575 floating-point option is not also enabled. Disabling fused multiply/add
28576 and multiply/subtract instructions forces the compiler to use separate
28577 instructions for the multiply and add/subtract operations. This may be
28578 desirable in some cases where strict IEEE 754-compliant results are
28579 required: the fused multiply add/subtract instructions do not round the
28580 intermediate result, thereby producing results with @emph{more} bits of
28581 precision than specified by the IEEE standard. Disabling fused multiply
28582 add/subtract instructions also ensures that the program output is not
28583 sensitive to the compiler's ability to combine multiply and add/subtract
28584 operations.
28585
28586 @item -mserialize-volatile
28587 @itemx -mno-serialize-volatile
28588 @opindex mserialize-volatile
28589 @opindex mno-serialize-volatile
28590 When this option is enabled, GCC inserts @code{MEMW} instructions before
28591 @code{volatile} memory references to guarantee sequential consistency.
28592 The default is @option{-mserialize-volatile}. Use
28593 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
28594
28595 @item -mforce-no-pic
28596 @opindex mforce-no-pic
28597 For targets, like GNU/Linux, where all user-mode Xtensa code must be
28598 position-independent code (PIC), this option disables PIC for compiling
28599 kernel code.
28600
28601 @item -mtext-section-literals
28602 @itemx -mno-text-section-literals
28603 @opindex mtext-section-literals
28604 @opindex mno-text-section-literals
28605 These options control the treatment of literal pools. The default is
28606 @option{-mno-text-section-literals}, which places literals in a separate
28607 section in the output file. This allows the literal pool to be placed
28608 in a data RAM/ROM, and it also allows the linker to combine literal
28609 pools from separate object files to remove redundant literals and
28610 improve code size. With @option{-mtext-section-literals}, the literals
28611 are interspersed in the text section in order to keep them as close as
28612 possible to their references. This may be necessary for large assembly
28613 files. Literals for each function are placed right before that function.
28614
28615 @item -mauto-litpools
28616 @itemx -mno-auto-litpools
28617 @opindex mauto-litpools
28618 @opindex mno-auto-litpools
28619 These options control the treatment of literal pools. The default is
28620 @option{-mno-auto-litpools}, which places literals in a separate
28621 section in the output file unless @option{-mtext-section-literals} is
28622 used. With @option{-mauto-litpools} the literals are interspersed in
28623 the text section by the assembler. Compiler does not produce explicit
28624 @code{.literal} directives and loads literals into registers with
28625 @code{MOVI} instructions instead of @code{L32R} to let the assembler
28626 do relaxation and place literals as necessary. This option allows
28627 assembler to create several literal pools per function and assemble
28628 very big functions, which may not be possible with
28629 @option{-mtext-section-literals}.
28630
28631 @item -mtarget-align
28632 @itemx -mno-target-align
28633 @opindex mtarget-align
28634 @opindex mno-target-align
28635 When this option is enabled, GCC instructs the assembler to
28636 automatically align instructions to reduce branch penalties at the
28637 expense of some code density. The assembler attempts to widen density
28638 instructions to align branch targets and the instructions following call
28639 instructions. If there are not enough preceding safe density
28640 instructions to align a target, no widening is performed. The
28641 default is @option{-mtarget-align}. These options do not affect the
28642 treatment of auto-aligned instructions like @code{LOOP}, which the
28643 assembler always aligns, either by widening density instructions or
28644 by inserting NOP instructions.
28645
28646 @item -mlongcalls
28647 @itemx -mno-longcalls
28648 @opindex mlongcalls
28649 @opindex mno-longcalls
28650 When this option is enabled, GCC instructs the assembler to translate
28651 direct calls to indirect calls unless it can determine that the target
28652 of a direct call is in the range allowed by the call instruction. This
28653 translation typically occurs for calls to functions in other source
28654 files. Specifically, the assembler translates a direct @code{CALL}
28655 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
28656 The default is @option{-mno-longcalls}. This option should be used in
28657 programs where the call target can potentially be out of range. This
28658 option is implemented in the assembler, not the compiler, so the
28659 assembly code generated by GCC still shows direct call
28660 instructions---look at the disassembled object code to see the actual
28661 instructions. Note that the assembler uses an indirect call for
28662 every cross-file call, not just those that really are out of range.
28663 @end table
28664
28665 @node zSeries Options
28666 @subsection zSeries Options
28667 @cindex zSeries options
28668
28669 These are listed under @xref{S/390 and zSeries Options}.
28670
28671
28672 @c man end
28673
28674 @node Spec Files
28675 @section Specifying Subprocesses and the Switches to Pass to Them
28676 @cindex Spec Files
28677
28678 @command{gcc} is a driver program. It performs its job by invoking a
28679 sequence of other programs to do the work of compiling, assembling and
28680 linking. GCC interprets its command-line parameters and uses these to
28681 deduce which programs it should invoke, and which command-line options
28682 it ought to place on their command lines. This behavior is controlled
28683 by @dfn{spec strings}. In most cases there is one spec string for each
28684 program that GCC can invoke, but a few programs have multiple spec
28685 strings to control their behavior. The spec strings built into GCC can
28686 be overridden by using the @option{-specs=} command-line switch to specify
28687 a spec file.
28688
28689 @dfn{Spec files} are plain-text files that are used to construct spec
28690 strings. They consist of a sequence of directives separated by blank
28691 lines. The type of directive is determined by the first non-whitespace
28692 character on the line, which can be one of the following:
28693
28694 @table @code
28695 @item %@var{command}
28696 Issues a @var{command} to the spec file processor. The commands that can
28697 appear here are:
28698
28699 @table @code
28700 @item %include <@var{file}>
28701 @cindex @code{%include}
28702 Search for @var{file} and insert its text at the current point in the
28703 specs file.
28704
28705 @item %include_noerr <@var{file}>
28706 @cindex @code{%include_noerr}
28707 Just like @samp{%include}, but do not generate an error message if the include
28708 file cannot be found.
28709
28710 @item %rename @var{old_name} @var{new_name}
28711 @cindex @code{%rename}
28712 Rename the spec string @var{old_name} to @var{new_name}.
28713
28714 @end table
28715
28716 @item *[@var{spec_name}]:
28717 This tells the compiler to create, override or delete the named spec
28718 string. All lines after this directive up to the next directive or
28719 blank line are considered to be the text for the spec string. If this
28720 results in an empty string then the spec is deleted. (Or, if the
28721 spec did not exist, then nothing happens.) Otherwise, if the spec
28722 does not currently exist a new spec is created. If the spec does
28723 exist then its contents are overridden by the text of this
28724 directive, unless the first character of that text is the @samp{+}
28725 character, in which case the text is appended to the spec.
28726
28727 @item [@var{suffix}]:
28728 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
28729 and up to the next directive or blank line are considered to make up the
28730 spec string for the indicated suffix. When the compiler encounters an
28731 input file with the named suffix, it processes the spec string in
28732 order to work out how to compile that file. For example:
28733
28734 @smallexample
28735 .ZZ:
28736 z-compile -input %i
28737 @end smallexample
28738
28739 This says that any input file whose name ends in @samp{.ZZ} should be
28740 passed to the program @samp{z-compile}, which should be invoked with the
28741 command-line switch @option{-input} and with the result of performing the
28742 @samp{%i} substitution. (See below.)
28743
28744 As an alternative to providing a spec string, the text following a
28745 suffix directive can be one of the following:
28746
28747 @table @code
28748 @item @@@var{language}
28749 This says that the suffix is an alias for a known @var{language}. This is
28750 similar to using the @option{-x} command-line switch to GCC to specify a
28751 language explicitly. For example:
28752
28753 @smallexample
28754 .ZZ:
28755 @@c++
28756 @end smallexample
28757
28758 Says that .ZZ files are, in fact, C++ source files.
28759
28760 @item #@var{name}
28761 This causes an error messages saying:
28762
28763 @smallexample
28764 @var{name} compiler not installed on this system.
28765 @end smallexample
28766 @end table
28767
28768 GCC already has an extensive list of suffixes built into it.
28769 This directive adds an entry to the end of the list of suffixes, but
28770 since the list is searched from the end backwards, it is effectively
28771 possible to override earlier entries using this technique.
28772
28773 @end table
28774
28775 GCC has the following spec strings built into it. Spec files can
28776 override these strings or create their own. Note that individual
28777 targets can also add their own spec strings to this list.
28778
28779 @smallexample
28780 asm Options to pass to the assembler
28781 asm_final Options to pass to the assembler post-processor
28782 cpp Options to pass to the C preprocessor
28783 cc1 Options to pass to the C compiler
28784 cc1plus Options to pass to the C++ compiler
28785 endfile Object files to include at the end of the link
28786 link Options to pass to the linker
28787 lib Libraries to include on the command line to the linker
28788 libgcc Decides which GCC support library to pass to the linker
28789 linker Sets the name of the linker
28790 predefines Defines to be passed to the C preprocessor
28791 signed_char Defines to pass to CPP to say whether @code{char} is signed
28792 by default
28793 startfile Object files to include at the start of the link
28794 @end smallexample
28795
28796 Here is a small example of a spec file:
28797
28798 @smallexample
28799 %rename lib old_lib
28800
28801 *lib:
28802 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
28803 @end smallexample
28804
28805 This example renames the spec called @samp{lib} to @samp{old_lib} and
28806 then overrides the previous definition of @samp{lib} with a new one.
28807 The new definition adds in some extra command-line options before
28808 including the text of the old definition.
28809
28810 @dfn{Spec strings} are a list of command-line options to be passed to their
28811 corresponding program. In addition, the spec strings can contain
28812 @samp{%}-prefixed sequences to substitute variable text or to
28813 conditionally insert text into the command line. Using these constructs
28814 it is possible to generate quite complex command lines.
28815
28816 Here is a table of all defined @samp{%}-sequences for spec
28817 strings. Note that spaces are not generated automatically around the
28818 results of expanding these sequences. Therefore you can concatenate them
28819 together or combine them with constant text in a single argument.
28820
28821 @table @code
28822 @item %%
28823 Substitute one @samp{%} into the program name or argument.
28824
28825 @item %i
28826 Substitute the name of the input file being processed.
28827
28828 @item %b
28829 Substitute the basename of the input file being processed.
28830 This is the substring up to (and not including) the last period
28831 and not including the directory.
28832
28833 @item %B
28834 This is the same as @samp{%b}, but include the file suffix (text after
28835 the last period).
28836
28837 @item %d
28838 Marks the argument containing or following the @samp{%d} as a
28839 temporary file name, so that that file is deleted if GCC exits
28840 successfully. Unlike @samp{%g}, this contributes no text to the
28841 argument.
28842
28843 @item %g@var{suffix}
28844 Substitute a file name that has suffix @var{suffix} and is chosen
28845 once per compilation, and mark the argument in the same way as
28846 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
28847 name is now chosen in a way that is hard to predict even when previously
28848 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
28849 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
28850 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
28851 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
28852 was simply substituted with a file name chosen once per compilation,
28853 without regard to any appended suffix (which was therefore treated
28854 just like ordinary text), making such attacks more likely to succeed.
28855
28856 @item %u@var{suffix}
28857 Like @samp{%g}, but generates a new temporary file name
28858 each time it appears instead of once per compilation.
28859
28860 @item %U@var{suffix}
28861 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
28862 new one if there is no such last file name. In the absence of any
28863 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
28864 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
28865 involves the generation of two distinct file names, one
28866 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
28867 simply substituted with a file name chosen for the previous @samp{%u},
28868 without regard to any appended suffix.
28869
28870 @item %j@var{suffix}
28871 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
28872 writable, and if @option{-save-temps} is not used;
28873 otherwise, substitute the name
28874 of a temporary file, just like @samp{%u}. This temporary file is not
28875 meant for communication between processes, but rather as a junk
28876 disposal mechanism.
28877
28878 @item %|@var{suffix}
28879 @itemx %m@var{suffix}
28880 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
28881 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
28882 all. These are the two most common ways to instruct a program that it
28883 should read from standard input or write to standard output. If you
28884 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
28885 construct: see for example @file{f/lang-specs.h}.
28886
28887 @item %.@var{SUFFIX}
28888 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
28889 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
28890 terminated by the next space or %.
28891
28892 @item %w
28893 Marks the argument containing or following the @samp{%w} as the
28894 designated output file of this compilation. This puts the argument
28895 into the sequence of arguments that @samp{%o} substitutes.
28896
28897 @item %o
28898 Substitutes the names of all the output files, with spaces
28899 automatically placed around them. You should write spaces
28900 around the @samp{%o} as well or the results are undefined.
28901 @samp{%o} is for use in the specs for running the linker.
28902 Input files whose names have no recognized suffix are not compiled
28903 at all, but they are included among the output files, so they are
28904 linked.
28905
28906 @item %O
28907 Substitutes the suffix for object files. Note that this is
28908 handled specially when it immediately follows @samp{%g, %u, or %U},
28909 because of the need for those to form complete file names. The
28910 handling is such that @samp{%O} is treated exactly as if it had already
28911 been substituted, except that @samp{%g, %u, and %U} do not currently
28912 support additional @var{suffix} characters following @samp{%O} as they do
28913 following, for example, @samp{.o}.
28914
28915 @item %p
28916 Substitutes the standard macro predefinitions for the
28917 current target machine. Use this when running @command{cpp}.
28918
28919 @item %P
28920 Like @samp{%p}, but puts @samp{__} before and after the name of each
28921 predefined macro, except for macros that start with @samp{__} or with
28922 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
28923 C@.
28924
28925 @item %I
28926 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
28927 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
28928 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
28929 and @option{-imultilib} as necessary.
28930
28931 @item %s
28932 Current argument is the name of a library or startup file of some sort.
28933 Search for that file in a standard list of directories and substitute
28934 the full name found. The current working directory is included in the
28935 list of directories scanned.
28936
28937 @item %T
28938 Current argument is the name of a linker script. Search for that file
28939 in the current list of directories to scan for libraries. If the file
28940 is located insert a @option{--script} option into the command line
28941 followed by the full path name found. If the file is not found then
28942 generate an error message. Note: the current working directory is not
28943 searched.
28944
28945 @item %e@var{str}
28946 Print @var{str} as an error message. @var{str} is terminated by a newline.
28947 Use this when inconsistent options are detected.
28948
28949 @item %(@var{name})
28950 Substitute the contents of spec string @var{name} at this point.
28951
28952 @item %x@{@var{option}@}
28953 Accumulate an option for @samp{%X}.
28954
28955 @item %X
28956 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
28957 spec string.
28958
28959 @item %Y
28960 Output the accumulated assembler options specified by @option{-Wa}.
28961
28962 @item %Z
28963 Output the accumulated preprocessor options specified by @option{-Wp}.
28964
28965 @item %a
28966 Process the @code{asm} spec. This is used to compute the
28967 switches to be passed to the assembler.
28968
28969 @item %A
28970 Process the @code{asm_final} spec. This is a spec string for
28971 passing switches to an assembler post-processor, if such a program is
28972 needed.
28973
28974 @item %l
28975 Process the @code{link} spec. This is the spec for computing the
28976 command line passed to the linker. Typically it makes use of the
28977 @samp{%L %G %S %D and %E} sequences.
28978
28979 @item %D
28980 Dump out a @option{-L} option for each directory that GCC believes might
28981 contain startup files. If the target supports multilibs then the
28982 current multilib directory is prepended to each of these paths.
28983
28984 @item %L
28985 Process the @code{lib} spec. This is a spec string for deciding which
28986 libraries are included on the command line to the linker.
28987
28988 @item %G
28989 Process the @code{libgcc} spec. This is a spec string for deciding
28990 which GCC support library is included on the command line to the linker.
28991
28992 @item %S
28993 Process the @code{startfile} spec. This is a spec for deciding which
28994 object files are the first ones passed to the linker. Typically
28995 this might be a file named @file{crt0.o}.
28996
28997 @item %E
28998 Process the @code{endfile} spec. This is a spec string that specifies
28999 the last object files that are passed to the linker.
29000
29001 @item %C
29002 Process the @code{cpp} spec. This is used to construct the arguments
29003 to be passed to the C preprocessor.
29004
29005 @item %1
29006 Process the @code{cc1} spec. This is used to construct the options to be
29007 passed to the actual C compiler (@command{cc1}).
29008
29009 @item %2
29010 Process the @code{cc1plus} spec. This is used to construct the options to be
29011 passed to the actual C++ compiler (@command{cc1plus}).
29012
29013 @item %*
29014 Substitute the variable part of a matched option. See below.
29015 Note that each comma in the substituted string is replaced by
29016 a single space.
29017
29018 @item %<S
29019 Remove all occurrences of @code{-S} from the command line. Note---this
29020 command is position dependent. @samp{%} commands in the spec string
29021 before this one see @code{-S}, @samp{%} commands in the spec string
29022 after this one do not.
29023
29024 @item %:@var{function}(@var{args})
29025 Call the named function @var{function}, passing it @var{args}.
29026 @var{args} is first processed as a nested spec string, then split
29027 into an argument vector in the usual fashion. The function returns
29028 a string which is processed as if it had appeared literally as part
29029 of the current spec.
29030
29031 The following built-in spec functions are provided:
29032
29033 @table @code
29034 @item @code{getenv}
29035 The @code{getenv} spec function takes two arguments: an environment
29036 variable name and a string. If the environment variable is not
29037 defined, a fatal error is issued. Otherwise, the return value is the
29038 value of the environment variable concatenated with the string. For
29039 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29040
29041 @smallexample
29042 %:getenv(TOPDIR /include)
29043 @end smallexample
29044
29045 expands to @file{/path/to/top/include}.
29046
29047 @item @code{if-exists}
29048 The @code{if-exists} spec function takes one argument, an absolute
29049 pathname to a file. If the file exists, @code{if-exists} returns the
29050 pathname. Here is a small example of its usage:
29051
29052 @smallexample
29053 *startfile:
29054 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29055 @end smallexample
29056
29057 @item @code{if-exists-else}
29058 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29059 spec function, except that it takes two arguments. The first argument is
29060 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29061 returns the pathname. If it does not exist, it returns the second argument.
29062 This way, @code{if-exists-else} can be used to select one file or another,
29063 based on the existence of the first. Here is a small example of its usage:
29064
29065 @smallexample
29066 *startfile:
29067 crt0%O%s %:if-exists(crti%O%s) \
29068 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29069 @end smallexample
29070
29071 @item @code{replace-outfile}
29072 The @code{replace-outfile} spec function takes two arguments. It looks for the
29073 first argument in the outfiles array and replaces it with the second argument. Here
29074 is a small example of its usage:
29075
29076 @smallexample
29077 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29078 @end smallexample
29079
29080 @item @code{remove-outfile}
29081 The @code{remove-outfile} spec function takes one argument. It looks for the
29082 first argument in the outfiles array and removes it. Here is a small example
29083 its usage:
29084
29085 @smallexample
29086 %:remove-outfile(-lm)
29087 @end smallexample
29088
29089 @item @code{pass-through-libs}
29090 The @code{pass-through-libs} spec function takes any number of arguments. It
29091 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29092 assumes are the names of linker input library archive files) and returns a
29093 result containing all the found arguments each prepended by
29094 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29095 intended to be passed to the LTO linker plugin.
29096
29097 @smallexample
29098 %:pass-through-libs(%G %L %G)
29099 @end smallexample
29100
29101 @item @code{print-asm-header}
29102 The @code{print-asm-header} function takes no arguments and simply
29103 prints a banner like:
29104
29105 @smallexample
29106 Assembler options
29107 =================
29108
29109 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29110 @end smallexample
29111
29112 It is used to separate compiler options from assembler options
29113 in the @option{--target-help} output.
29114 @end table
29115
29116 @item %@{S@}
29117 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29118 If that switch is not specified, this substitutes nothing. Note that
29119 the leading dash is omitted when specifying this option, and it is
29120 automatically inserted if the substitution is performed. Thus the spec
29121 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29122 and outputs the command-line option @option{-foo}.
29123
29124 @item %W@{S@}
29125 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29126 deleted on failure.
29127
29128 @item %@{S*@}
29129 Substitutes all the switches specified to GCC whose names start
29130 with @code{-S}, but which also take an argument. This is used for
29131 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29132 GCC considers @option{-o foo} as being
29133 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29134 text, including the space. Thus two arguments are generated.
29135
29136 @item %@{S*&T*@}
29137 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29138 (the order of @code{S} and @code{T} in the spec is not significant).
29139 There can be any number of ampersand-separated variables; for each the
29140 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29141
29142 @item %@{S:X@}
29143 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29144
29145 @item %@{!S:X@}
29146 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29147
29148 @item %@{S*:X@}
29149 Substitutes @code{X} if one or more switches whose names start with
29150 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29151 once, no matter how many such switches appeared. However, if @code{%*}
29152 appears somewhere in @code{X}, then @code{X} is substituted once
29153 for each matching switch, with the @code{%*} replaced by the part of
29154 that switch matching the @code{*}.
29155
29156 If @code{%*} appears as the last part of a spec sequence then a space
29157 is added after the end of the last substitution. If there is more
29158 text in the sequence, however, then a space is not generated. This
29159 allows the @code{%*} substitution to be used as part of a larger
29160 string. For example, a spec string like this:
29161
29162 @smallexample
29163 %@{mcu=*:--script=%*/memory.ld@}
29164 @end smallexample
29165
29166 @noindent
29167 when matching an option like @option{-mcu=newchip} produces:
29168
29169 @smallexample
29170 --script=newchip/memory.ld
29171 @end smallexample
29172
29173 @item %@{.S:X@}
29174 Substitutes @code{X}, if processing a file with suffix @code{S}.
29175
29176 @item %@{!.S:X@}
29177 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29178
29179 @item %@{,S:X@}
29180 Substitutes @code{X}, if processing a file for language @code{S}.
29181
29182 @item %@{!,S:X@}
29183 Substitutes @code{X}, if not processing a file for language @code{S}.
29184
29185 @item %@{S|P:X@}
29186 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29187 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29188 @code{*} sequences as well, although they have a stronger binding than
29189 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29190 alternatives must be starred, and only the first matching alternative
29191 is substituted.
29192
29193 For example, a spec string like this:
29194
29195 @smallexample
29196 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29197 @end smallexample
29198
29199 @noindent
29200 outputs the following command-line options from the following input
29201 command-line options:
29202
29203 @smallexample
29204 fred.c -foo -baz
29205 jim.d -bar -boggle
29206 -d fred.c -foo -baz -boggle
29207 -d jim.d -bar -baz -boggle
29208 @end smallexample
29209
29210 @item %@{S:X; T:Y; :D@}
29211
29212 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29213 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29214 be as many clauses as you need. This may be combined with @code{.},
29215 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29216
29217
29218 @end table
29219
29220 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29221 or similar construct can use a backslash to ignore the special meaning
29222 of the character following it, thus allowing literal matching of a
29223 character that is otherwise specially treated. For example,
29224 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29225 @option{-std=iso9899:1999} option is given.
29226
29227 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29228 construct may contain other nested @samp{%} constructs or spaces, or
29229 even newlines. They are processed as usual, as described above.
29230 Trailing white space in @code{X} is ignored. White space may also
29231 appear anywhere on the left side of the colon in these constructs,
29232 except between @code{.} or @code{*} and the corresponding word.
29233
29234 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29235 handled specifically in these constructs. If another value of
29236 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29237 @option{-W} switch is found later in the command line, the earlier
29238 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29239 just one letter, which passes all matching options.
29240
29241 The character @samp{|} at the beginning of the predicate text is used to
29242 indicate that a command should be piped to the following command, but
29243 only if @option{-pipe} is specified.
29244
29245 It is built into GCC which switches take arguments and which do not.
29246 (You might think it would be useful to generalize this to allow each
29247 compiler's spec to say which switches take arguments. But this cannot
29248 be done in a consistent fashion. GCC cannot even decide which input
29249 files have been specified without knowing which switches take arguments,
29250 and it must know which input files to compile in order to tell which
29251 compilers to run).
29252
29253 GCC also knows implicitly that arguments starting in @option{-l} are to be
29254 treated as compiler output files, and passed to the linker in their
29255 proper position among the other output files.
29256
29257 @node Environment Variables
29258 @section Environment Variables Affecting GCC
29259 @cindex environment variables
29260
29261 @c man begin ENVIRONMENT
29262 This section describes several environment variables that affect how GCC
29263 operates. Some of them work by specifying directories or prefixes to use
29264 when searching for various kinds of files. Some are used to specify other
29265 aspects of the compilation environment.
29266
29267 Note that you can also specify places to search using options such as
29268 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29269 take precedence over places specified using environment variables, which
29270 in turn take precedence over those specified by the configuration of GCC@.
29271 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29272 GNU Compiler Collection (GCC) Internals}.
29273
29274 @table @env
29275 @item LANG
29276 @itemx LC_CTYPE
29277 @c @itemx LC_COLLATE
29278 @itemx LC_MESSAGES
29279 @c @itemx LC_MONETARY
29280 @c @itemx LC_NUMERIC
29281 @c @itemx LC_TIME
29282 @itemx LC_ALL
29283 @findex LANG
29284 @findex LC_CTYPE
29285 @c @findex LC_COLLATE
29286 @findex LC_MESSAGES
29287 @c @findex LC_MONETARY
29288 @c @findex LC_NUMERIC
29289 @c @findex LC_TIME
29290 @findex LC_ALL
29291 @cindex locale
29292 These environment variables control the way that GCC uses
29293 localization information which allows GCC to work with different
29294 national conventions. GCC inspects the locale categories
29295 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29296 so. These locale categories can be set to any value supported by your
29297 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29298 Kingdom encoded in UTF-8.
29299
29300 The @env{LC_CTYPE} environment variable specifies character
29301 classification. GCC uses it to determine the character boundaries in
29302 a string; this is needed for some multibyte encodings that contain quote
29303 and escape characters that are otherwise interpreted as a string
29304 end or escape.
29305
29306 The @env{LC_MESSAGES} environment variable specifies the language to
29307 use in diagnostic messages.
29308
29309 If the @env{LC_ALL} environment variable is set, it overrides the value
29310 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29311 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29312 environment variable. If none of these variables are set, GCC
29313 defaults to traditional C English behavior.
29314
29315 @item TMPDIR
29316 @findex TMPDIR
29317 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29318 files. GCC uses temporary files to hold the output of one stage of
29319 compilation which is to be used as input to the next stage: for example,
29320 the output of the preprocessor, which is the input to the compiler
29321 proper.
29322
29323 @item GCC_COMPARE_DEBUG
29324 @findex GCC_COMPARE_DEBUG
29325 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29326 @option{-fcompare-debug} to the compiler driver. See the documentation
29327 of this option for more details.
29328
29329 @item GCC_EXEC_PREFIX
29330 @findex GCC_EXEC_PREFIX
29331 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29332 names of the subprograms executed by the compiler. No slash is added
29333 when this prefix is combined with the name of a subprogram, but you can
29334 specify a prefix that ends with a slash if you wish.
29335
29336 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29337 an appropriate prefix to use based on the pathname it is invoked with.
29338
29339 If GCC cannot find the subprogram using the specified prefix, it
29340 tries looking in the usual places for the subprogram.
29341
29342 The default value of @env{GCC_EXEC_PREFIX} is
29343 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29344 the installed compiler. In many cases @var{prefix} is the value
29345 of @code{prefix} when you ran the @file{configure} script.
29346
29347 Other prefixes specified with @option{-B} take precedence over this prefix.
29348
29349 This prefix is also used for finding files such as @file{crt0.o} that are
29350 used for linking.
29351
29352 In addition, the prefix is used in an unusual way in finding the
29353 directories to search for header files. For each of the standard
29354 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29355 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29356 replacing that beginning with the specified prefix to produce an
29357 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29358 @file{foo/bar} just before it searches the standard directory
29359 @file{/usr/local/lib/bar}.
29360 If a standard directory begins with the configured
29361 @var{prefix} then the value of @var{prefix} is replaced by
29362 @env{GCC_EXEC_PREFIX} when looking for header files.
29363
29364 @item COMPILER_PATH
29365 @findex COMPILER_PATH
29366 The value of @env{COMPILER_PATH} is a colon-separated list of
29367 directories, much like @env{PATH}. GCC tries the directories thus
29368 specified when searching for subprograms, if it cannot find the
29369 subprograms using @env{GCC_EXEC_PREFIX}.
29370
29371 @item LIBRARY_PATH
29372 @findex LIBRARY_PATH
29373 The value of @env{LIBRARY_PATH} is a colon-separated list of
29374 directories, much like @env{PATH}. When configured as a native compiler,
29375 GCC tries the directories thus specified when searching for special
29376 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29377 using GCC also uses these directories when searching for ordinary
29378 libraries for the @option{-l} option (but directories specified with
29379 @option{-L} come first).
29380
29381 @item LANG
29382 @findex LANG
29383 @cindex locale definition
29384 This variable is used to pass locale information to the compiler. One way in
29385 which this information is used is to determine the character set to be used
29386 when character literals, string literals and comments are parsed in C and C++.
29387 When the compiler is configured to allow multibyte characters,
29388 the following values for @env{LANG} are recognized:
29389
29390 @table @samp
29391 @item C-JIS
29392 Recognize JIS characters.
29393 @item C-SJIS
29394 Recognize SJIS characters.
29395 @item C-EUCJP
29396 Recognize EUCJP characters.
29397 @end table
29398
29399 If @env{LANG} is not defined, or if it has some other value, then the
29400 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29401 recognize and translate multibyte characters.
29402 @end table
29403
29404 @noindent
29405 Some additional environment variables affect the behavior of the
29406 preprocessor.
29407
29408 @include cppenv.texi
29409
29410 @c man end
29411
29412 @node Precompiled Headers
29413 @section Using Precompiled Headers
29414 @cindex precompiled headers
29415 @cindex speed of compilation
29416
29417 Often large projects have many header files that are included in every
29418 source file. The time the compiler takes to process these header files
29419 over and over again can account for nearly all of the time required to
29420 build the project. To make builds faster, GCC allows you to
29421 @dfn{precompile} a header file.
29422
29423 To create a precompiled header file, simply compile it as you would any
29424 other file, if necessary using the @option{-x} option to make the driver
29425 treat it as a C or C++ header file. You may want to use a
29426 tool like @command{make} to keep the precompiled header up-to-date when
29427 the headers it contains change.
29428
29429 A precompiled header file is searched for when @code{#include} is
29430 seen in the compilation. As it searches for the included file
29431 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29432 compiler looks for a precompiled header in each directory just before it
29433 looks for the include file in that directory. The name searched for is
29434 the name specified in the @code{#include} with @samp{.gch} appended. If
29435 the precompiled header file cannot be used, it is ignored.
29436
29437 For instance, if you have @code{#include "all.h"}, and you have
29438 @file{all.h.gch} in the same directory as @file{all.h}, then the
29439 precompiled header file is used if possible, and the original
29440 header is used otherwise.
29441
29442 Alternatively, you might decide to put the precompiled header file in a
29443 directory and use @option{-I} to ensure that directory is searched
29444 before (or instead of) the directory containing the original header.
29445 Then, if you want to check that the precompiled header file is always
29446 used, you can put a file of the same name as the original header in this
29447 directory containing an @code{#error} command.
29448
29449 This also works with @option{-include}. So yet another way to use
29450 precompiled headers, good for projects not designed with precompiled
29451 header files in mind, is to simply take most of the header files used by
29452 a project, include them from another header file, precompile that header
29453 file, and @option{-include} the precompiled header. If the header files
29454 have guards against multiple inclusion, they are skipped because
29455 they've already been included (in the precompiled header).
29456
29457 If you need to precompile the same header file for different
29458 languages, targets, or compiler options, you can instead make a
29459 @emph{directory} named like @file{all.h.gch}, and put each precompiled
29460 header in the directory, perhaps using @option{-o}. It doesn't matter
29461 what you call the files in the directory; every precompiled header in
29462 the directory is considered. The first precompiled header
29463 encountered in the directory that is valid for this compilation is
29464 used; they're searched in no particular order.
29465
29466 There are many other possibilities, limited only by your imagination,
29467 good sense, and the constraints of your build system.
29468
29469 A precompiled header file can be used only when these conditions apply:
29470
29471 @itemize
29472 @item
29473 Only one precompiled header can be used in a particular compilation.
29474
29475 @item
29476 A precompiled header cannot be used once the first C token is seen. You
29477 can have preprocessor directives before a precompiled header; you cannot
29478 include a precompiled header from inside another header.
29479
29480 @item
29481 The precompiled header file must be produced for the same language as
29482 the current compilation. You cannot use a C precompiled header for a C++
29483 compilation.
29484
29485 @item
29486 The precompiled header file must have been produced by the same compiler
29487 binary as the current compilation is using.
29488
29489 @item
29490 Any macros defined before the precompiled header is included must
29491 either be defined in the same way as when the precompiled header was
29492 generated, or must not affect the precompiled header, which usually
29493 means that they don't appear in the precompiled header at all.
29494
29495 The @option{-D} option is one way to define a macro before a
29496 precompiled header is included; using a @code{#define} can also do it.
29497 There are also some options that define macros implicitly, like
29498 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
29499 defined this way.
29500
29501 @item If debugging information is output when using the precompiled
29502 header, using @option{-g} or similar, the same kind of debugging information
29503 must have been output when building the precompiled header. However,
29504 a precompiled header built using @option{-g} can be used in a compilation
29505 when no debugging information is being output.
29506
29507 @item The same @option{-m} options must generally be used when building
29508 and using the precompiled header. @xref{Submodel Options},
29509 for any cases where this rule is relaxed.
29510
29511 @item Each of the following options must be the same when building and using
29512 the precompiled header:
29513
29514 @gccoptlist{-fexceptions}
29515
29516 @item
29517 Some other command-line options starting with @option{-f},
29518 @option{-p}, or @option{-O} must be defined in the same way as when
29519 the precompiled header was generated. At present, it's not clear
29520 which options are safe to change and which are not; the safest choice
29521 is to use exactly the same options when generating and using the
29522 precompiled header. The following are known to be safe:
29523
29524 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
29525 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
29526 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
29527 -pedantic-errors}
29528
29529 @end itemize
29530
29531 For all of these except the last, the compiler automatically
29532 ignores the precompiled header if the conditions aren't met. If you
29533 find an option combination that doesn't work and doesn't cause the
29534 precompiled header to be ignored, please consider filing a bug report,
29535 see @ref{Bugs}.
29536
29537 If you do use differing options when generating and using the
29538 precompiled header, the actual behavior is a mixture of the
29539 behavior for the options. For instance, if you use @option{-g} to
29540 generate the precompiled header but not when using it, you may or may
29541 not get debugging information for routines in the precompiled header.