]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/invoke.texi
96a95162696b922ea7bccb2997b1703d1f5576bf
[thirdparty/gcc.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988-2020 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-2020 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 * Static Analyzer Options:: More expensive warnings.
157 * Debugging Options:: Producing debuggable code.
158 * Optimize Options:: How much optimization?
159 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
160 * Preprocessor Options:: Controlling header files and macro definitions.
161 Also, getting dependency information for Make.
162 * Assembler Options:: Passing options to the assembler.
163 * Link Options:: Specifying libraries and so on.
164 * Directory Options:: Where to find header files and libraries.
165 Where to find the compiler executable files.
166 * Code Gen Options:: Specifying conventions for function calls, data layout
167 and register usage.
168 * Developer Options:: Printing GCC configuration info, statistics, and
169 debugging dumps.
170 * Submodel Options:: Target-specific options, such as compiling for a
171 specific processor variant.
172 * Spec Files:: How to pass switches to sub-processes.
173 * Environment Variables:: Env vars that affect GCC.
174 * Precompiled Headers:: Compiling a header once, and using it many times.
175 @end menu
176
177 @c man begin OPTIONS
178
179 @node Option Summary
180 @section Option Summary
181
182 Here is a summary of all the options, grouped by type. Explanations are
183 in the following sections.
184
185 @table @emph
186 @item Overall Options
187 @xref{Overall Options,,Options Controlling the Kind of Output}.
188 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
189 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
190 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
191 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
192 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
193 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
194
195 @item C Language Options
196 @xref{C Dialect Options,,Options Controlling C Dialect}.
197 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
198 -fpermitted-flt-eval-methods=@var{standard} @gol
199 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
200 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
201 -fhosted -ffreestanding @gol
202 -fopenacc -fopenacc-dim=@var{geom} @gol
203 -fopenmp -fopenmp-simd @gol
204 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
205 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
206 -fsigned-bitfields -fsigned-char @gol
207 -funsigned-bitfields -funsigned-char}
208
209 @item C++ Language Options
210 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
211 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
212 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
213 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
214 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
215 -fno-elide-constructors @gol
216 -fno-enforce-eh-specs @gol
217 -fno-gnu-keywords @gol
218 -fno-implicit-templates @gol
219 -fno-implicit-inline-templates @gol
220 -fno-implement-inlines -fms-extensions @gol
221 -fnew-inheriting-ctors @gol
222 -fnew-ttp-matching @gol
223 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
224 -fno-optional-diags -fpermissive @gol
225 -fno-pretty-templates @gol
226 -fno-rtti -fsized-deallocation @gol
227 -ftemplate-backtrace-limit=@var{n} @gol
228 -ftemplate-depth=@var{n} @gol
229 -fno-threadsafe-statics -fuse-cxa-atexit @gol
230 -fno-weak -nostdinc++ @gol
231 -fvisibility-inlines-hidden @gol
232 -fvisibility-ms-compat @gol
233 -fext-numeric-literals @gol
234 -Wabi-tag -Wcatch-value -Wcatch-value=@var{n} @gol
235 -Wno-class-conversion -Wclass-memaccess @gol
236 -Wcomma-subscript -Wconditionally-supported @gol
237 -Wno-conversion-null -Wctor-dtor-privacy -Wno-delete-incomplete @gol
238 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
239 -Weffc++ -Wextra-semi -Wno-inaccessible-base @gol
240 -Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol
241 -Wno-invalid-offsetof -Wno-literal-suffix -Wmismatched-tags @gol
242 -Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol
243 -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol
244 -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol
245 -Wredundant-move -Wredundant-tags @gol
246 -Wreorder -Wregister @gol
247 -Wstrict-null-sentinel -Wno-subobject-linkage -Wtemplates @gol
248 -Wno-non-template-friend -Wold-style-cast @gol
249 -Woverloaded-virtual -Wno-pmf-conversions -Wsign-promo @gol
250 -Wsized-deallocation -Wsuggest-final-methods @gol
251 -Wsuggest-final-types -Wsuggest-override @gol
252 -Wno-terminate -Wuseless-cast -Wvirtual-inheritance @gol
253 -Wno-virtual-move-assign -Wvolatile -Wzero-as-null-pointer-constant}
254
255 @item Objective-C and Objective-C++ Language Options
256 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
257 Objective-C and Objective-C++ Dialects}.
258 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
259 -fgnu-runtime -fnext-runtime @gol
260 -fno-nil-receivers @gol
261 -fobjc-abi-version=@var{n} @gol
262 -fobjc-call-cxx-cdtors @gol
263 -fobjc-direct-dispatch @gol
264 -fobjc-exceptions @gol
265 -fobjc-gc @gol
266 -fobjc-nilcheck @gol
267 -fobjc-std=objc1 @gol
268 -fno-local-ivars @gol
269 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
270 -freplace-objc-classes @gol
271 -fzero-link @gol
272 -gen-decls @gol
273 -Wassign-intercept -Wno-property-assign-default @gol
274 -Wno-protocol -Wselector @gol
275 -Wstrict-selector-match @gol
276 -Wundeclared-selector}
277
278 @item Diagnostic Message Formatting Options
279 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
280 @gccoptlist{-fmessage-length=@var{n} @gol
281 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
282 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
283 -fdiagnostics-urls=@r{[}auto@r{|}never@r{|}always@r{]} @gol
284 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
285 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
286 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
287 -fno-diagnostics-show-cwe @gol
288 -fdiagnostics-minimum-margin-width=@var{width} @gol
289 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
290 -fdiagnostics-show-template-tree -fno-elide-type @gol
291 -fdiagnostics-path-format=@r{[}none@r{|}separate-events@r{|}inline-events@r{]} @gol
292 -fdiagnostics-show-path-depths @gol
293 -fno-show-column}
294
295 @item Warning Options
296 @xref{Warning Options,,Options to Request or Suppress Warnings}.
297 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
298 -pedantic-errors @gol
299 -w -Wextra -Wall -Wabi=@var{n} @gol
300 -Waddress -Wno-address-of-packed-member -Waggregate-return @gol
301 -Walloc-size-larger-than=@var{byte-size} -Walloc-zero @gol
302 -Walloca -Walloca-larger-than=@var{byte-size} @gol
303 -Wno-aggressive-loop-optimizations @gol
304 -Warith-conversion @gol
305 -Warray-bounds -Warray-bounds=@var{n} @gol
306 -Wno-attributes -Wattribute-alias=@var{n} -Wno-attribute-alias @gol
307 -Wno-attribute-warning -Wbool-compare -Wbool-operation @gol
308 -Wno-builtin-declaration-mismatch @gol
309 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
310 -Wc11-c2x-compat @gol
311 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
312 -Wc++20-compat @gol
313 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
314 -Wchar-subscripts @gol
315 -Wclobbered -Wcomment @gol
316 -Wconversion -Wno-coverage-mismatch -Wno-cpp @gol
317 -Wdangling-else -Wdate-time @gol
318 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
319 -Wdisabled-optimization @gol
320 -Wno-discarded-array-qualifiers -Wno-discarded-qualifiers @gol
321 -Wno-div-by-zero -Wdouble-promotion @gol
322 -Wduplicated-branches -Wduplicated-cond @gol
323 -Wempty-body -Wno-endif-labels -Wenum-compare -Wenum-conversion @gol
324 -Werror -Werror=* -Wexpansion-to-defined -Wfatal-errors @gol
325 -Wfloat-conversion -Wfloat-equal -Wformat -Wformat=2 @gol
326 -Wno-format-contains-nul -Wno-format-extra-args @gol
327 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
328 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
329 -Wformat-y2k -Wframe-address @gol
330 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
331 -Wno-hsa -Wno-if-not-aligned -Wno-ignored-attributes @gol
332 -Wignored-qualifiers -Wno-incompatible-pointer-types @gol
333 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
334 -Wno-implicit-function-declaration -Wno-implicit-int @gol
335 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
336 -Wno-int-to-pointer-cast -Wno-invalid-memory-model @gol
337 -Winvalid-pch -Wjump-misses-init -Wlarger-than=@var{byte-size} @gol
338 -Wlogical-not-parentheses -Wlogical-op -Wlong-long @gol
339 -Wno-lto-type-mismatch -Wmain -Wmaybe-uninitialized @gol
340 -Wmemset-elt-size -Wmemset-transposed-args @gol
341 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
342 -Wmissing-field-initializers -Wmissing-format-attribute @gol
343 -Wmissing-include-dirs -Wmissing-noreturn -Wno-missing-profile @gol
344 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
345 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
346 -Wnull-dereference -Wno-odr -Wopenmp-simd @gol
347 -Wno-overflow -Woverlength-strings -Wno-override-init-side-effects @gol
348 -Wpacked -Wno-packed-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
349 -Wparentheses -Wno-pedantic-ms-format @gol
350 -Wpointer-arith -Wno-pointer-compare -Wno-pointer-to-int-cast @gol
351 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
352 -Wrestrict -Wno-return-local-addr -Wreturn-type @gol
353 -Wno-scalar-storage-order -Wsequence-point @gol
354 -Wshadow -Wshadow=global -Wshadow=local -Wshadow=compatible-local @gol
355 -Wno-shadow-ivar @gol
356 -Wno-shift-count-negative -Wno-shift-count-overflow -Wshift-negative-value @gol
357 -Wno-shift-overflow -Wshift-overflow=@var{n} @gol
358 -Wsign-compare -Wsign-conversion @gol
359 -Wno-sizeof-array-argument @gol
360 -Wsizeof-pointer-div -Wsizeof-pointer-memaccess @gol
361 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
362 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
363 -Wstring-compare @gol
364 -Wstringop-overflow=@var{n} -Wno-stringop-truncation @gol
365 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
366 -Wswitch -Wno-switch-bool -Wswitch-default -Wswitch-enum @gol
367 -Wno-switch-outside-range -Wno-switch-unreachable -Wsync-nand @gol
368 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
369 -Wtype-limits -Wundef @gol
370 -Wuninitialized -Wunknown-pragmas @gol
371 -Wunsuffixed-float-constants -Wunused @gol
372 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
373 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
374 -Wunused-function -Wunused-label -Wunused-local-typedefs @gol
375 -Wunused-macros @gol
376 -Wunused-parameter -Wno-unused-result @gol
377 -Wunused-value -Wunused-variable @gol
378 -Wno-varargs -Wvariadic-macros @gol
379 -Wvector-operation-performance @gol
380 -Wvla -Wvla-larger-than=@var{byte-size} -Wno-vla-larger-than @gol
381 -Wvolatile-register-var -Wwrite-strings @gol
382 -Wzero-length-bounds}
383
384 @item Static Analyzer Options
385 @gccoptlist{
386 -fanalyzer @gol
387 -fanalyzer-call-summaries @gol
388 -fanalyzer-checker=@var{name} @gol
389 -fanalyzer-fine-grained @gol
390 -fanalyzer-state-merge @gol
391 -fanalyzer-state-purge @gol
392 -fanalyzer-transitivity @gol
393 -fanalyzer-verbose-edges @gol
394 -fanalyzer-verbose-state-changes @gol
395 -fanalyzer-verbosity=@var{level} @gol
396 -fdump-analyzer @gol
397 -fdump-analyzer-stderr @gol
398 -fdump-analyzer-callgraph @gol
399 -fdump-analyzer-exploded-graph @gol
400 -fdump-analyzer-exploded-nodes @gol
401 -fdump-analyzer-exploded-nodes-2 @gol
402 -fdump-analyzer-exploded-nodes-3 @gol
403 -fdump-analyzer-state-purge @gol
404 -fdump-analyzer-supergraph @gol
405 -Wno-analyzer-double-fclose @gol
406 -Wno-analyzer-double-free @gol
407 -Wno-analyzer-exposure-through-output-file @gol
408 -Wno-analyzer-file-leak @gol
409 -Wno-analyzer-free-of-non-heap @gol
410 -Wno-analyzer-malloc-leak @gol
411 -Wno-analyzer-null-argument @gol
412 -Wno-analyzer-null-dereference @gol
413 -Wno-analyzer-possible-null-argument @gol
414 -Wno-analyzer-possible-null-dereference @gol
415 -Wno-analyzer-stale-setjmp-buffer @gol
416 -Wno-analyzer-tainted-array-index @gol
417 -Wanalyzer-too-complex @gol
418 -Wno-analyzer-unsafe-call-within-signal-handler @gol
419 -Wno-analyzer-use-after-free @gol
420 -Wno-analyzer-use-of-pointer-in-stale-stack-frame @gol
421 -Wno-analyzer-use-of-uninitialized-value @gol
422 }
423
424 @item C and Objective-C-only Warning Options
425 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
426 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
427 -Wold-style-declaration -Wold-style-definition @gol
428 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
429 -Wdeclaration-after-statement -Wpointer-sign}
430
431 @item Debugging Options
432 @xref{Debugging Options,,Options for Debugging Your Program}.
433 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
434 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
435 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
436 -gas-loc-support -gno-as-loc-support @gol
437 -gas-locview-support -gno-as-locview-support @gol
438 -gcolumn-info -gno-column-info @gol
439 -gstatement-frontiers -gno-statement-frontiers @gol
440 -gvariable-location-views -gno-variable-location-views @gol
441 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
442 -ginline-points -gno-inline-points @gol
443 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
444 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
445 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
446 -fno-eliminate-unused-debug-types @gol
447 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
448 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
449 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
450 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
451 -fvar-tracking -fvar-tracking-assignments}
452
453 @item Optimization Options
454 @xref{Optimize Options,,Options that Control Optimization}.
455 @gccoptlist{-faggressive-loop-optimizations @gol
456 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
457 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
458 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
459 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
460 -fno-allocation-dce -fallow-store-data-races @gol
461 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
462 -fauto-inc-dec -fbranch-probabilities @gol
463 -fcaller-saves @gol
464 -fcombine-stack-adjustments -fconserve-stack @gol
465 -fcompare-elim -fcprop-registers -fcrossjumping @gol
466 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
467 -fcx-limited-range @gol
468 -fdata-sections -fdce -fdelayed-branch @gol
469 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
470 -fdevirtualize-at-ltrans -fdse @gol
471 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
472 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
473 -ffinite-loops @gol
474 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
475 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
476 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
477 -fif-conversion2 -findirect-inlining @gol
478 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
479 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
480 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
481 -fipa-reference -fipa-reference-addressable @gol
482 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
483 -flive-patching=@var{level} @gol
484 -fira-region=@var{region} -fira-hoist-pressure @gol
485 -fira-loop-pressure -fno-ira-share-save-slots @gol
486 -fno-ira-share-spill-slots @gol
487 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
488 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
489 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
490 -floop-block -floop-interchange -floop-strip-mine @gol
491 -floop-unroll-and-jam -floop-nest-optimize @gol
492 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
493 -flto-partition=@var{alg} -fmerge-all-constants @gol
494 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
495 -fmove-loop-invariants -fno-branch-count-reg @gol
496 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
497 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
498 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
499 -fno-sched-spec -fno-signed-zeros @gol
500 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
501 -fomit-frame-pointer -foptimize-sibling-calls @gol
502 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
503 -fprefetch-loop-arrays @gol
504 -fprofile-correction @gol
505 -fprofile-use -fprofile-use=@var{path} -fprofile-partial-training @gol
506 -fprofile-values -fprofile-reorder-functions @gol
507 -freciprocal-math -free -frename-registers -freorder-blocks @gol
508 -freorder-blocks-algorithm=@var{algorithm} @gol
509 -freorder-blocks-and-partition -freorder-functions @gol
510 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
511 -frounding-math -fsave-optimization-record @gol
512 -fsched2-use-superblocks -fsched-pressure @gol
513 -fsched-spec-load -fsched-spec-load-dangerous @gol
514 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
515 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
516 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
517 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
518 -fschedule-fusion @gol
519 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
520 -fselective-scheduling -fselective-scheduling2 @gol
521 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
522 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
523 -fsignaling-nans @gol
524 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
525 -fsplit-paths @gol
526 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
527 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
528 -fthread-jumps -ftracer -ftree-bit-ccp @gol
529 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
530 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
531 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
532 -ftree-loop-if-convert -ftree-loop-im @gol
533 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
534 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
535 -ftree-loop-vectorize @gol
536 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
537 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
538 -ftree-switch-conversion -ftree-tail-merge @gol
539 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
540 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
541 -funsafe-math-optimizations -funswitch-loops @gol
542 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
543 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
544 --param @var{name}=@var{value}
545 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
546
547 @item Program Instrumentation Options
548 @xref{Instrumentation Options,,Program Instrumentation Options}.
549 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
550 -fprofile-abs-path @gol
551 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
552 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
553 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} -fprofile-reproducibility @gol
554 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
555 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
556 -fsanitize-undefined-trap-on-error -fbounds-check @gol
557 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
558 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
559 -fstack-protector-explicit -fstack-check @gol
560 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
561 -fno-stack-limit -fsplit-stack @gol
562 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
563 -fvtv-counts -fvtv-debug @gol
564 -finstrument-functions @gol
565 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
566 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
567
568 @item Preprocessor Options
569 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
570 @gccoptlist{-A@var{question}=@var{answer} @gol
571 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
572 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
573 -dD -dI -dM -dN -dU @gol
574 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
575 -fexec-charset=@var{charset} -fextended-identifiers @gol
576 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
577 -fmax-include-depth=@var{depth} @gol
578 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
579 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
580 -fwide-exec-charset=@var{charset} -fworking-directory @gol
581 -H -imacros @var{file} -include @var{file} @gol
582 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
583 -no-integrated-cpp -P -pthread -remap @gol
584 -traditional -traditional-cpp -trigraphs @gol
585 -U@var{macro} -undef @gol
586 -Wp,@var{option} -Xpreprocessor @var{option}}
587
588 @item Assembler Options
589 @xref{Assembler Options,,Passing Options to the Assembler}.
590 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
591
592 @item Linker Options
593 @xref{Link Options,,Options for Linking}.
594 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
595 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
596 -e @var{entry} --entry=@var{entry} @gol
597 -pie -pthread -r -rdynamic @gol
598 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
599 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
600 -shared -shared-libgcc -symbolic @gol
601 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
602 -u @var{symbol} -z @var{keyword}}
603
604 @item Directory Options
605 @xref{Directory Options,,Options for Directory Search}.
606 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
607 -idirafter @var{dir} @gol
608 -imacros @var{file} -imultilib @var{dir} @gol
609 -iplugindir=@var{dir} -iprefix @var{file} @gol
610 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
611 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
612 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
613 -nostdinc -nostdinc++ --sysroot=@var{dir}}
614
615 @item Code Generation Options
616 @xref{Code Gen Options,,Options for Code Generation Conventions}.
617 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
618 -ffixed-@var{reg} -fexceptions @gol
619 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
620 -fasynchronous-unwind-tables @gol
621 -fno-gnu-unique @gol
622 -finhibit-size-directive -fcommon -fno-ident @gol
623 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
624 -fno-jump-tables @gol
625 -frecord-gcc-switches @gol
626 -freg-struct-return -fshort-enums -fshort-wchar @gol
627 -fverbose-asm -fpack-struct[=@var{n}] @gol
628 -fleading-underscore -ftls-model=@var{model} @gol
629 -fstack-reuse=@var{reuse_level} @gol
630 -ftrampolines -ftrapv -fwrapv @gol
631 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
632 -fstrict-volatile-bitfields -fsync-libcalls}
633
634 @item Developer Options
635 @xref{Developer Options,,GCC Developer Options}.
636 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
637 -dumpfullversion -fcallgraph-info@r{[}=su,da@r{]}
638 -fchecking -fchecking=@var{n}
639 -fdbg-cnt-list @gol -fdbg-cnt=@var{counter-value-list} @gol
640 -fdisable-ipa-@var{pass_name} @gol
641 -fdisable-rtl-@var{pass_name} @gol
642 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
643 -fdisable-tree-@var{pass_name} @gol
644 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
645 -fdump-debug -fdump-earlydebug @gol
646 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
647 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
648 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
649 -fdump-lang-all @gol
650 -fdump-lang-@var{switch} @gol
651 -fdump-lang-@var{switch}-@var{options} @gol
652 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
653 -fdump-passes @gol
654 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
655 -fdump-statistics @gol
656 -fdump-tree-all @gol
657 -fdump-tree-@var{switch} @gol
658 -fdump-tree-@var{switch}-@var{options} @gol
659 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
660 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
661 -fenable-@var{kind}-@var{pass} @gol
662 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
663 -fira-verbose=@var{n} @gol
664 -flto-report -flto-report-wpa -fmem-report-wpa @gol
665 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
666 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
667 -fprofile-report @gol
668 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
669 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
670 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
671 -fvar-tracking-assignments-toggle -gtoggle @gol
672 -print-file-name=@var{library} -print-libgcc-file-name @gol
673 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
674 -print-prog-name=@var{program} -print-search-dirs -Q @gol
675 -print-sysroot -print-sysroot-headers-suffix @gol
676 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
677
678 @item Machine-Dependent Options
679 @xref{Submodel Options,,Machine-Dependent Options}.
680 @c This list is ordered alphanumerically by subsection name.
681 @c Try and put the significant identifier (CPU or system) first,
682 @c so users have a clue at guessing where the ones they want will be.
683
684 @emph{AArch64 Options}
685 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
686 -mgeneral-regs-only @gol
687 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
688 -mstrict-align -mno-strict-align @gol
689 -momit-leaf-frame-pointer @gol
690 -mtls-dialect=desc -mtls-dialect=traditional @gol
691 -mtls-size=@var{size} @gol
692 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
693 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
694 -mpc-relative-literal-loads @gol
695 -msign-return-address=@var{scope} @gol
696 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
697 +@var{b-key}]|@var{bti} @gol
698 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
699 -moverride=@var{string} -mverbose-cost-dump @gol
700 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
701 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
702 -moutline-atomics }
703
704 @emph{Adapteva Epiphany Options}
705 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
706 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
707 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
708 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
709 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
710 -msplit-vecmove-early -m1reg-@var{reg}}
711
712 @emph{AMD GCN Options}
713 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
714
715 @emph{ARC Options}
716 @gccoptlist{-mbarrel-shifter -mjli-always @gol
717 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
718 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
719 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
720 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
721 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
722 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
723 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
724 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
725 -mvolatile-cache -mtp-regno=@var{regno} @gol
726 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
727 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
728 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
729 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
730 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
731 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
732 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
733 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
734
735 @emph{ARM Options}
736 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
737 -mabi=@var{name} @gol
738 -mapcs-stack-check -mno-apcs-stack-check @gol
739 -mapcs-reentrant -mno-apcs-reentrant @gol
740 -mgeneral-regs-only @gol
741 -msched-prolog -mno-sched-prolog @gol
742 -mlittle-endian -mbig-endian @gol
743 -mbe8 -mbe32 @gol
744 -mfloat-abi=@var{name} @gol
745 -mfp16-format=@var{name}
746 -mthumb-interwork -mno-thumb-interwork @gol
747 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
748 -mtune=@var{name} -mprint-tune-info @gol
749 -mstructure-size-boundary=@var{n} @gol
750 -mabort-on-noreturn @gol
751 -mlong-calls -mno-long-calls @gol
752 -msingle-pic-base -mno-single-pic-base @gol
753 -mpic-register=@var{reg} @gol
754 -mnop-fun-dllimport @gol
755 -mpoke-function-name @gol
756 -mthumb -marm -mflip-thumb @gol
757 -mtpcs-frame -mtpcs-leaf-frame @gol
758 -mcaller-super-interworking -mcallee-super-interworking @gol
759 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
760 -mword-relocations @gol
761 -mfix-cortex-m3-ldrd @gol
762 -munaligned-access @gol
763 -mneon-for-64bits @gol
764 -mslow-flash-data @gol
765 -masm-syntax-unified @gol
766 -mrestrict-it @gol
767 -mverbose-cost-dump @gol
768 -mpure-code @gol
769 -mcmse @gol
770 -mfdpic}
771
772 @emph{AVR Options}
773 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
774 -mbranch-cost=@var{cost} @gol
775 -mcall-prologues -mgas-isr-prologues -mint8 @gol
776 -mdouble=@var{bits} -mlong-double=@var{bits} @gol
777 -mn_flash=@var{size} -mno-interrupts @gol
778 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
779 -mfract-convert-truncate @gol
780 -mshort-calls -nodevicelib -nodevicespecs @gol
781 -Waddr-space-convert -Wmisspelled-isr}
782
783 @emph{Blackfin Options}
784 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
785 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
786 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
787 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
788 -mno-id-shared-library -mshared-library-id=@var{n} @gol
789 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
790 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
791 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
792 -micplb}
793
794 @emph{C6X Options}
795 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
796 -msim -msdata=@var{sdata-type}}
797
798 @emph{CRIS Options}
799 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
800 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
801 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
802 -mstack-align -mdata-align -mconst-align @gol
803 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
804 -melf -maout -melinux -mlinux -sim -sim2 @gol
805 -mmul-bug-workaround -mno-mul-bug-workaround}
806
807 @emph{CR16 Options}
808 @gccoptlist{-mmac @gol
809 -mcr16cplus -mcr16c @gol
810 -msim -mint32 -mbit-ops
811 -mdata-model=@var{model}}
812
813 @emph{C-SKY Options}
814 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
815 -mbig-endian -EB -mlittle-endian -EL @gol
816 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
817 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
818 -mdsp -medsp -mvdsp @gol
819 -mdiv -msmart -mhigh-registers -manchor @gol
820 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
821 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
822
823 @emph{Darwin Options}
824 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
825 -arch_only -bind_at_load -bundle -bundle_loader @gol
826 -client_name -compatibility_version -current_version @gol
827 -dead_strip @gol
828 -dependency-file -dylib_file -dylinker_install_name @gol
829 -dynamic -dynamiclib -exported_symbols_list @gol
830 -filelist -flat_namespace -force_cpusubtype_ALL @gol
831 -force_flat_namespace -headerpad_max_install_names @gol
832 -iframework @gol
833 -image_base -init -install_name -keep_private_externs @gol
834 -multi_module -multiply_defined -multiply_defined_unused @gol
835 -noall_load -no_dead_strip_inits_and_terms @gol
836 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
837 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
838 -private_bundle -read_only_relocs -sectalign @gol
839 -sectobjectsymbols -whyload -seg1addr @gol
840 -sectcreate -sectobjectsymbols -sectorder @gol
841 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
842 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
843 -segprot -segs_read_only_addr -segs_read_write_addr @gol
844 -single_module -static -sub_library -sub_umbrella @gol
845 -twolevel_namespace -umbrella -undefined @gol
846 -unexported_symbols_list -weak_reference_mismatches @gol
847 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
848 -mkernel -mone-byte-bool}
849
850 @emph{DEC Alpha Options}
851 @gccoptlist{-mno-fp-regs -msoft-float @gol
852 -mieee -mieee-with-inexact -mieee-conformant @gol
853 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
854 -mtrap-precision=@var{mode} -mbuild-constants @gol
855 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
856 -mbwx -mmax -mfix -mcix @gol
857 -mfloat-vax -mfloat-ieee @gol
858 -mexplicit-relocs -msmall-data -mlarge-data @gol
859 -msmall-text -mlarge-text @gol
860 -mmemory-latency=@var{time}}
861
862 @emph{eBPF Options}
863 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
864 -mframe-limit=@var{bytes}}
865
866 @emph{FR30 Options}
867 @gccoptlist{-msmall-model -mno-lsim}
868
869 @emph{FT32 Options}
870 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
871
872 @emph{FRV Options}
873 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
874 -mhard-float -msoft-float @gol
875 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
876 -mdouble -mno-double @gol
877 -mmedia -mno-media -mmuladd -mno-muladd @gol
878 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
879 -mlinked-fp -mlong-calls -malign-labels @gol
880 -mlibrary-pic -macc-4 -macc-8 @gol
881 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
882 -moptimize-membar -mno-optimize-membar @gol
883 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
884 -mvliw-branch -mno-vliw-branch @gol
885 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
886 -mno-nested-cond-exec -mtomcat-stats @gol
887 -mTLS -mtls @gol
888 -mcpu=@var{cpu}}
889
890 @emph{GNU/Linux Options}
891 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
892 -tno-android-cc -tno-android-ld}
893
894 @emph{H8/300 Options}
895 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
896
897 @emph{HPPA Options}
898 @gccoptlist{-march=@var{architecture-type} @gol
899 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
900 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
901 -mfixed-range=@var{register-range} @gol
902 -mjump-in-delay -mlinker-opt -mlong-calls @gol
903 -mlong-load-store -mno-disable-fpregs @gol
904 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
905 -mno-jump-in-delay -mno-long-load-store @gol
906 -mno-portable-runtime -mno-soft-float @gol
907 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
908 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
909 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
910 -munix=@var{unix-std} -nolibdld -static -threads}
911
912 @emph{IA-64 Options}
913 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
914 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
915 -mconstant-gp -mauto-pic -mfused-madd @gol
916 -minline-float-divide-min-latency @gol
917 -minline-float-divide-max-throughput @gol
918 -mno-inline-float-divide @gol
919 -minline-int-divide-min-latency @gol
920 -minline-int-divide-max-throughput @gol
921 -mno-inline-int-divide @gol
922 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
923 -mno-inline-sqrt @gol
924 -mdwarf2-asm -mearly-stop-bits @gol
925 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
926 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
927 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
928 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
929 -msched-spec-ldc -msched-spec-control-ldc @gol
930 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
931 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
932 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
933 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
934
935 @emph{LM32 Options}
936 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
937 -msign-extend-enabled -muser-enabled}
938
939 @emph{M32R/D Options}
940 @gccoptlist{-m32r2 -m32rx -m32r @gol
941 -mdebug @gol
942 -malign-loops -mno-align-loops @gol
943 -missue-rate=@var{number} @gol
944 -mbranch-cost=@var{number} @gol
945 -mmodel=@var{code-size-model-type} @gol
946 -msdata=@var{sdata-type} @gol
947 -mno-flush-func -mflush-func=@var{name} @gol
948 -mno-flush-trap -mflush-trap=@var{number} @gol
949 -G @var{num}}
950
951 @emph{M32C Options}
952 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
953
954 @emph{M680x0 Options}
955 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
956 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
957 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
958 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
959 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
960 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
961 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
962 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
963 -mxgot -mno-xgot -mlong-jump-table-offsets}
964
965 @emph{MCore Options}
966 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
967 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
968 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
969 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
970 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
971
972 @emph{MeP Options}
973 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
974 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
975 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
976 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
977 -mtiny=@var{n}}
978
979 @emph{MicroBlaze Options}
980 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
981 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
982 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
983 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
984 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
985 -mpic-data-is-text-relative}
986
987 @emph{MIPS Options}
988 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
989 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
990 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
991 -mips16 -mno-mips16 -mflip-mips16 @gol
992 -minterlink-compressed -mno-interlink-compressed @gol
993 -minterlink-mips16 -mno-interlink-mips16 @gol
994 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
995 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
996 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
997 -mno-float -msingle-float -mdouble-float @gol
998 -modd-spreg -mno-odd-spreg @gol
999 -mabs=@var{mode} -mnan=@var{encoding} @gol
1000 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
1001 -mmcu -mmno-mcu @gol
1002 -meva -mno-eva @gol
1003 -mvirt -mno-virt @gol
1004 -mxpa -mno-xpa @gol
1005 -mcrc -mno-crc @gol
1006 -mginv -mno-ginv @gol
1007 -mmicromips -mno-micromips @gol
1008 -mmsa -mno-msa @gol
1009 -mloongson-mmi -mno-loongson-mmi @gol
1010 -mloongson-ext -mno-loongson-ext @gol
1011 -mloongson-ext2 -mno-loongson-ext2 @gol
1012 -mfpu=@var{fpu-type} @gol
1013 -msmartmips -mno-smartmips @gol
1014 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
1015 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
1016 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
1017 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
1018 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
1019 -membedded-data -mno-embedded-data @gol
1020 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
1021 -mcode-readable=@var{setting} @gol
1022 -msplit-addresses -mno-split-addresses @gol
1023 -mexplicit-relocs -mno-explicit-relocs @gol
1024 -mcheck-zero-division -mno-check-zero-division @gol
1025 -mdivide-traps -mdivide-breaks @gol
1026 -mload-store-pairs -mno-load-store-pairs @gol
1027 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
1028 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
1029 -mfix-24k -mno-fix-24k @gol
1030 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
1031 -mfix-r5900 -mno-fix-r5900 @gol
1032 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
1033 -mfix-vr4120 -mno-fix-vr4120 @gol
1034 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
1035 -mflush-func=@var{func} -mno-flush-func @gol
1036 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
1037 -mcompact-branches=@var{policy} @gol
1038 -mfp-exceptions -mno-fp-exceptions @gol
1039 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
1040 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
1041 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
1042 -mframe-header-opt -mno-frame-header-opt}
1043
1044 @emph{MMIX Options}
1045 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
1046 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
1047 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
1048 -mno-base-addresses -msingle-exit -mno-single-exit}
1049
1050 @emph{MN10300 Options}
1051 @gccoptlist{-mmult-bug -mno-mult-bug @gol
1052 -mno-am33 -mam33 -mam33-2 -mam34 @gol
1053 -mtune=@var{cpu-type} @gol
1054 -mreturn-pointer-on-d0 @gol
1055 -mno-crt0 -mrelax -mliw -msetlb}
1056
1057 @emph{Moxie Options}
1058 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1059
1060 @emph{MSP430 Options}
1061 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1062 -mwarn-mcu @gol
1063 -mcode-region= -mdata-region= @gol
1064 -msilicon-errata= -msilicon-errata-warn= @gol
1065 -mhwmult= -minrt -mtiny-printf}
1066
1067 @emph{NDS32 Options}
1068 @gccoptlist{-mbig-endian -mlittle-endian @gol
1069 -mreduced-regs -mfull-regs @gol
1070 -mcmov -mno-cmov @gol
1071 -mext-perf -mno-ext-perf @gol
1072 -mext-perf2 -mno-ext-perf2 @gol
1073 -mext-string -mno-ext-string @gol
1074 -mv3push -mno-v3push @gol
1075 -m16bit -mno-16bit @gol
1076 -misr-vector-size=@var{num} @gol
1077 -mcache-block-size=@var{num} @gol
1078 -march=@var{arch} @gol
1079 -mcmodel=@var{code-model} @gol
1080 -mctor-dtor -mrelax}
1081
1082 @emph{Nios II Options}
1083 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1084 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1085 -mel -meb @gol
1086 -mno-bypass-cache -mbypass-cache @gol
1087 -mno-cache-volatile -mcache-volatile @gol
1088 -mno-fast-sw-div -mfast-sw-div @gol
1089 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1090 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1091 -mcustom-fpu-cfg=@var{name} @gol
1092 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1093 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1094
1095 @emph{Nvidia PTX Options}
1096 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1097
1098 @emph{OpenRISC Options}
1099 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1100 -msoft-mul -msoft-div @gol
1101 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1102 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1103
1104 @emph{PDP-11 Options}
1105 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1106 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1107 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1108
1109 @emph{picoChip Options}
1110 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1111 -msymbol-as-address -mno-inefficient-warnings}
1112
1113 @emph{PowerPC Options}
1114 See RS/6000 and PowerPC Options.
1115
1116 @emph{PRU Options}
1117 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1118 -mabi=@var{variant} @gol}
1119
1120 @emph{RISC-V Options}
1121 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1122 -mplt -mno-plt @gol
1123 -mabi=@var{ABI-string} @gol
1124 -mfdiv -mno-fdiv @gol
1125 -mdiv -mno-div @gol
1126 -march=@var{ISA-string} @gol
1127 -mtune=@var{processor-string} @gol
1128 -mpreferred-stack-boundary=@var{num} @gol
1129 -msmall-data-limit=@var{N-bytes} @gol
1130 -msave-restore -mno-save-restore @gol
1131 -mstrict-align -mno-strict-align @gol
1132 -mcmodel=medlow -mcmodel=medany @gol
1133 -mexplicit-relocs -mno-explicit-relocs @gol
1134 -mrelax -mno-relax @gol
1135 -mriscv-attribute -mmo-riscv-attribute @gol
1136 -malign-data=@var{type}}
1137
1138 @emph{RL78 Options}
1139 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1140 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1141 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1142
1143 @emph{RS/6000 and PowerPC Options}
1144 @gccoptlist{-mcpu=@var{cpu-type} @gol
1145 -mtune=@var{cpu-type} @gol
1146 -mcmodel=@var{code-model} @gol
1147 -mpowerpc64 @gol
1148 -maltivec -mno-altivec @gol
1149 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1150 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1151 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1152 -mfprnd -mno-fprnd @gol
1153 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1154 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1155 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1156 -malign-power -malign-natural @gol
1157 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1158 -mupdate -mno-update @gol
1159 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1160 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1161 -mstrict-align -mno-strict-align -mrelocatable @gol
1162 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1163 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1164 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1165 -mprioritize-restricted-insns=@var{priority} @gol
1166 -msched-costly-dep=@var{dependence_type} @gol
1167 -minsert-sched-nops=@var{scheme} @gol
1168 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1169 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1170 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1171 -mtraceback=@var{traceback_type} @gol
1172 -maix-struct-return -msvr4-struct-return @gol
1173 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1174 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1175 -mblock-move-inline-limit=@var{num} @gol
1176 -mblock-compare-inline-limit=@var{num} @gol
1177 -mblock-compare-inline-loop-limit=@var{num} @gol
1178 -mstring-compare-inline-limit=@var{num} @gol
1179 -misel -mno-isel @gol
1180 -mvrsave -mno-vrsave @gol
1181 -mmulhw -mno-mulhw @gol
1182 -mdlmzb -mno-dlmzb @gol
1183 -mprototype -mno-prototype @gol
1184 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1185 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1186 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1187 -mno-recip-precision @gol
1188 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1189 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1190 -msave-toc-indirect -mno-save-toc-indirect @gol
1191 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1192 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1193 -mquad-memory -mno-quad-memory @gol
1194 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1195 -mcompat-align-parm -mno-compat-align-parm @gol
1196 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1197 -mgnu-attribute -mno-gnu-attribute @gol
1198 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1199 -mstack-protector-guard-offset=@var{offset} -mprefixed -mno-prefixed @gol
1200 -mpcrel -mno-pcrel}
1201
1202 @emph{RX Options}
1203 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1204 -mcpu=@gol
1205 -mbig-endian-data -mlittle-endian-data @gol
1206 -msmall-data @gol
1207 -msim -mno-sim@gol
1208 -mas100-syntax -mno-as100-syntax@gol
1209 -mrelax@gol
1210 -mmax-constant-size=@gol
1211 -mint-register=@gol
1212 -mpid@gol
1213 -mallow-string-insns -mno-allow-string-insns@gol
1214 -mjsr@gol
1215 -mno-warn-multiple-fast-interrupts@gol
1216 -msave-acc-in-interrupts}
1217
1218 @emph{S/390 and zSeries Options}
1219 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1220 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1221 -mlong-double-64 -mlong-double-128 @gol
1222 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1223 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1224 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1225 -mhtm -mvx -mzvector @gol
1226 -mtpf-trace -mno-tpf-trace -mtpf-trace-skip -mno-tpf-trace-skip @gol
1227 -mfused-madd -mno-fused-madd @gol
1228 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1229 -mhotpatch=@var{halfwords},@var{halfwords}}
1230
1231 @emph{Score Options}
1232 @gccoptlist{-meb -mel @gol
1233 -mnhwloop @gol
1234 -muls @gol
1235 -mmac @gol
1236 -mscore5 -mscore5u -mscore7 -mscore7d}
1237
1238 @emph{SH Options}
1239 @gccoptlist{-m1 -m2 -m2e @gol
1240 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1241 -m3 -m3e @gol
1242 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1243 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1244 -mb -ml -mdalign -mrelax @gol
1245 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1246 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1247 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1248 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1249 -maccumulate-outgoing-args @gol
1250 -matomic-model=@var{atomic-model} @gol
1251 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1252 -mcbranch-force-delay-slot @gol
1253 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1254 -mpretend-cmove -mtas}
1255
1256 @emph{Solaris 2 Options}
1257 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1258 -pthreads}
1259
1260 @emph{SPARC Options}
1261 @gccoptlist{-mcpu=@var{cpu-type} @gol
1262 -mtune=@var{cpu-type} @gol
1263 -mcmodel=@var{code-model} @gol
1264 -mmemory-model=@var{mem-model} @gol
1265 -m32 -m64 -mapp-regs -mno-app-regs @gol
1266 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1267 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1268 -mhard-quad-float -msoft-quad-float @gol
1269 -mstack-bias -mno-stack-bias @gol
1270 -mstd-struct-return -mno-std-struct-return @gol
1271 -munaligned-doubles -mno-unaligned-doubles @gol
1272 -muser-mode -mno-user-mode @gol
1273 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1274 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1275 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1276 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1277 -mpopc -mno-popc -msubxc -mno-subxc @gol
1278 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1279 -mlra -mno-lra}
1280
1281 @emph{System V Options}
1282 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1283
1284 @emph{TILE-Gx Options}
1285 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1286 -mcmodel=@var{code-model}}
1287
1288 @emph{TILEPro Options}
1289 @gccoptlist{-mcpu=@var{cpu} -m32}
1290
1291 @emph{V850 Options}
1292 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1293 -mprolog-function -mno-prolog-function -mspace @gol
1294 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1295 -mapp-regs -mno-app-regs @gol
1296 -mdisable-callt -mno-disable-callt @gol
1297 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1298 -mv850e -mv850 -mv850e3v5 @gol
1299 -mloop @gol
1300 -mrelax @gol
1301 -mlong-jumps @gol
1302 -msoft-float @gol
1303 -mhard-float @gol
1304 -mgcc-abi @gol
1305 -mrh850-abi @gol
1306 -mbig-switch}
1307
1308 @emph{VAX Options}
1309 @gccoptlist{-mg -mgnu -munix}
1310
1311 @emph{Visium Options}
1312 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1313 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1314
1315 @emph{VMS Options}
1316 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1317 -mpointer-size=@var{size}}
1318
1319 @emph{VxWorks Options}
1320 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1321 -Xbind-lazy -Xbind-now}
1322
1323 @emph{x86 Options}
1324 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1325 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1326 -mfpmath=@var{unit} @gol
1327 -masm=@var{dialect} -mno-fancy-math-387 @gol
1328 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1329 -mno-wide-multiply -mrtd -malign-double @gol
1330 -mpreferred-stack-boundary=@var{num} @gol
1331 -mincoming-stack-boundary=@var{num} @gol
1332 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1333 -mrecip -mrecip=@var{opt} @gol
1334 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1335 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1336 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1337 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1338 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1339 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1340 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1341 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1342 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1343 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1344 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1345 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1346 -mrdseed -msgx -mavx512vp2intersect@gol
1347 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1348 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1349 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1350 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1351 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1352 -mregparm=@var{num} -msseregparm @gol
1353 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1354 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1355 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1356 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1357 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1358 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1359 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1360 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1361 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1362 -mstack-protector-guard-reg=@var{reg} @gol
1363 -mstack-protector-guard-offset=@var{offset} @gol
1364 -mstack-protector-guard-symbol=@var{symbol} @gol
1365 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1366 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1367 -mindirect-branch-register}
1368
1369 @emph{x86 Windows Options}
1370 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1371 -mnop-fun-dllimport -mthread @gol
1372 -municode -mwin32 -mwindows -fno-set-stack-executable}
1373
1374 @emph{Xstormy16 Options}
1375 @gccoptlist{-msim}
1376
1377 @emph{Xtensa Options}
1378 @gccoptlist{-mconst16 -mno-const16 @gol
1379 -mfused-madd -mno-fused-madd @gol
1380 -mforce-no-pic @gol
1381 -mserialize-volatile -mno-serialize-volatile @gol
1382 -mtext-section-literals -mno-text-section-literals @gol
1383 -mauto-litpools -mno-auto-litpools @gol
1384 -mtarget-align -mno-target-align @gol
1385 -mlongcalls -mno-longcalls}
1386
1387 @emph{zSeries Options}
1388 See S/390 and zSeries Options.
1389 @end table
1390
1391
1392 @node Overall Options
1393 @section Options Controlling the Kind of Output
1394
1395 Compilation can involve up to four stages: preprocessing, compilation
1396 proper, assembly and linking, always in that order. GCC is capable of
1397 preprocessing and compiling several files either into several
1398 assembler input files, or into one assembler input file; then each
1399 assembler input file produces an object file, and linking combines all
1400 the object files (those newly compiled, and those specified as input)
1401 into an executable file.
1402
1403 @cindex file name suffix
1404 For any given input file, the file name suffix determines what kind of
1405 compilation is done:
1406
1407 @table @gcctabopt
1408 @item @var{file}.c
1409 C source code that must be preprocessed.
1410
1411 @item @var{file}.i
1412 C source code that should not be preprocessed.
1413
1414 @item @var{file}.ii
1415 C++ source code that should not be preprocessed.
1416
1417 @item @var{file}.m
1418 Objective-C source code. Note that you must link with the @file{libobjc}
1419 library to make an Objective-C program work.
1420
1421 @item @var{file}.mi
1422 Objective-C source code that should not be preprocessed.
1423
1424 @item @var{file}.mm
1425 @itemx @var{file}.M
1426 Objective-C++ source code. Note that you must link with the @file{libobjc}
1427 library to make an Objective-C++ program work. Note that @samp{.M} refers
1428 to a literal capital M@.
1429
1430 @item @var{file}.mii
1431 Objective-C++ source code that should not be preprocessed.
1432
1433 @item @var{file}.h
1434 C, C++, Objective-C or Objective-C++ header file to be turned into a
1435 precompiled header (default), or C, C++ header file to be turned into an
1436 Ada spec (via the @option{-fdump-ada-spec} switch).
1437
1438 @item @var{file}.cc
1439 @itemx @var{file}.cp
1440 @itemx @var{file}.cxx
1441 @itemx @var{file}.cpp
1442 @itemx @var{file}.CPP
1443 @itemx @var{file}.c++
1444 @itemx @var{file}.C
1445 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1446 the last two letters must both be literally @samp{x}. Likewise,
1447 @samp{.C} refers to a literal capital C@.
1448
1449 @item @var{file}.mm
1450 @itemx @var{file}.M
1451 Objective-C++ source code that must be preprocessed.
1452
1453 @item @var{file}.mii
1454 Objective-C++ source code that should not be preprocessed.
1455
1456 @item @var{file}.hh
1457 @itemx @var{file}.H
1458 @itemx @var{file}.hp
1459 @itemx @var{file}.hxx
1460 @itemx @var{file}.hpp
1461 @itemx @var{file}.HPP
1462 @itemx @var{file}.h++
1463 @itemx @var{file}.tcc
1464 C++ header file to be turned into a precompiled header or Ada spec.
1465
1466 @item @var{file}.f
1467 @itemx @var{file}.for
1468 @itemx @var{file}.ftn
1469 Fixed form Fortran source code that should not be preprocessed.
1470
1471 @item @var{file}.F
1472 @itemx @var{file}.FOR
1473 @itemx @var{file}.fpp
1474 @itemx @var{file}.FPP
1475 @itemx @var{file}.FTN
1476 Fixed form Fortran source code that must be preprocessed (with the traditional
1477 preprocessor).
1478
1479 @item @var{file}.f90
1480 @itemx @var{file}.f95
1481 @itemx @var{file}.f03
1482 @itemx @var{file}.f08
1483 Free form Fortran source code that should not be preprocessed.
1484
1485 @item @var{file}.F90
1486 @itemx @var{file}.F95
1487 @itemx @var{file}.F03
1488 @itemx @var{file}.F08
1489 Free form Fortran source code that must be preprocessed (with the
1490 traditional preprocessor).
1491
1492 @item @var{file}.go
1493 Go source code.
1494
1495 @item @var{file}.brig
1496 BRIG files (binary representation of HSAIL).
1497
1498 @item @var{file}.d
1499 D source code.
1500
1501 @item @var{file}.di
1502 D interface file.
1503
1504 @item @var{file}.dd
1505 D documentation code (Ddoc).
1506
1507 @item @var{file}.ads
1508 Ada source code file that contains a library unit declaration (a
1509 declaration of a package, subprogram, or generic, or a generic
1510 instantiation), or a library unit renaming declaration (a package,
1511 generic, or subprogram renaming declaration). Such files are also
1512 called @dfn{specs}.
1513
1514 @item @var{file}.adb
1515 Ada source code file containing a library unit body (a subprogram or
1516 package body). Such files are also called @dfn{bodies}.
1517
1518 @c GCC also knows about some suffixes for languages not yet included:
1519 @c Ratfor:
1520 @c @var{file}.r
1521
1522 @item @var{file}.s
1523 Assembler code.
1524
1525 @item @var{file}.S
1526 @itemx @var{file}.sx
1527 Assembler code that must be preprocessed.
1528
1529 @item @var{other}
1530 An object file to be fed straight into linking.
1531 Any file name with no recognized suffix is treated this way.
1532 @end table
1533
1534 @opindex x
1535 You can specify the input language explicitly with the @option{-x} option:
1536
1537 @table @gcctabopt
1538 @item -x @var{language}
1539 Specify explicitly the @var{language} for the following input files
1540 (rather than letting the compiler choose a default based on the file
1541 name suffix). This option applies to all following input files until
1542 the next @option{-x} option. Possible values for @var{language} are:
1543 @smallexample
1544 c c-header cpp-output
1545 c++ c++-header c++-cpp-output
1546 objective-c objective-c-header objective-c-cpp-output
1547 objective-c++ objective-c++-header objective-c++-cpp-output
1548 assembler assembler-with-cpp
1549 ada
1550 d
1551 f77 f77-cpp-input f95 f95-cpp-input
1552 go
1553 brig
1554 @end smallexample
1555
1556 @item -x none
1557 Turn off any specification of a language, so that subsequent files are
1558 handled according to their file name suffixes (as they are if @option{-x}
1559 has not been used at all).
1560 @end table
1561
1562 If you only want some of the stages of compilation, you can use
1563 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1564 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1565 @command{gcc} is to stop. Note that some combinations (for example,
1566 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1567
1568 @table @gcctabopt
1569 @item -c
1570 @opindex c
1571 Compile or assemble the source files, but do not link. The linking
1572 stage simply is not done. The ultimate output is in the form of an
1573 object file for each source file.
1574
1575 By default, the object file name for a source file is made by replacing
1576 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1577
1578 Unrecognized input files, not requiring compilation or assembly, are
1579 ignored.
1580
1581 @item -S
1582 @opindex S
1583 Stop after the stage of compilation proper; do not assemble. The output
1584 is in the form of an assembler code file for each non-assembler input
1585 file specified.
1586
1587 By default, the assembler file name for a source file is made by
1588 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1589
1590 Input files that don't require compilation are ignored.
1591
1592 @item -E
1593 @opindex E
1594 Stop after the preprocessing stage; do not run the compiler proper. The
1595 output is in the form of preprocessed source code, which is sent to the
1596 standard output.
1597
1598 Input files that don't require preprocessing are ignored.
1599
1600 @cindex output file option
1601 @item -o @var{file}
1602 @opindex o
1603 Place output in file @var{file}. This applies to whatever
1604 sort of output is being produced, whether it be an executable file,
1605 an object file, an assembler file or preprocessed C code.
1606
1607 If @option{-o} is not specified, the default is to put an executable
1608 file in @file{a.out}, the object file for
1609 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1610 assembler file in @file{@var{source}.s}, a precompiled header file in
1611 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1612 standard output.
1613
1614 @item -v
1615 @opindex v
1616 Print (on standard error output) the commands executed to run the stages
1617 of compilation. Also print the version number of the compiler driver
1618 program and of the preprocessor and the compiler proper.
1619
1620 @item -###
1621 @opindex ###
1622 Like @option{-v} except the commands are not executed and arguments
1623 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1624 This is useful for shell scripts to capture the driver-generated command lines.
1625
1626 @item --help
1627 @opindex help
1628 Print (on the standard output) a description of the command-line options
1629 understood by @command{gcc}. If the @option{-v} option is also specified
1630 then @option{--help} is also passed on to the various processes
1631 invoked by @command{gcc}, so that they can display the command-line options
1632 they accept. If the @option{-Wextra} option has also been specified
1633 (prior to the @option{--help} option), then command-line options that
1634 have no documentation associated with them are also displayed.
1635
1636 @item --target-help
1637 @opindex target-help
1638 Print (on the standard output) a description of target-specific command-line
1639 options for each tool. For some targets extra target-specific
1640 information may also be printed.
1641
1642 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1643 Print (on the standard output) a description of the command-line
1644 options understood by the compiler that fit into all specified classes
1645 and qualifiers. These are the supported classes:
1646
1647 @table @asis
1648 @item @samp{optimizers}
1649 Display all of the optimization options supported by the
1650 compiler.
1651
1652 @item @samp{warnings}
1653 Display all of the options controlling warning messages
1654 produced by the compiler.
1655
1656 @item @samp{target}
1657 Display target-specific options. Unlike the
1658 @option{--target-help} option however, target-specific options of the
1659 linker and assembler are not displayed. This is because those
1660 tools do not currently support the extended @option{--help=} syntax.
1661
1662 @item @samp{params}
1663 Display the values recognized by the @option{--param}
1664 option.
1665
1666 @item @var{language}
1667 Display the options supported for @var{language}, where
1668 @var{language} is the name of one of the languages supported in this
1669 version of GCC@. If an option is supported by all languages, one needs
1670 to select @samp{common} class.
1671
1672 @item @samp{common}
1673 Display the options that are common to all languages.
1674 @end table
1675
1676 These are the supported qualifiers:
1677
1678 @table @asis
1679 @item @samp{undocumented}
1680 Display only those options that are undocumented.
1681
1682 @item @samp{joined}
1683 Display options taking an argument that appears after an equal
1684 sign in the same continuous piece of text, such as:
1685 @samp{--help=target}.
1686
1687 @item @samp{separate}
1688 Display options taking an argument that appears as a separate word
1689 following the original option, such as: @samp{-o output-file}.
1690 @end table
1691
1692 Thus for example to display all the undocumented target-specific
1693 switches supported by the compiler, use:
1694
1695 @smallexample
1696 --help=target,undocumented
1697 @end smallexample
1698
1699 The sense of a qualifier can be inverted by prefixing it with the
1700 @samp{^} character, so for example to display all binary warning
1701 options (i.e., ones that are either on or off and that do not take an
1702 argument) that have a description, use:
1703
1704 @smallexample
1705 --help=warnings,^joined,^undocumented
1706 @end smallexample
1707
1708 The argument to @option{--help=} should not consist solely of inverted
1709 qualifiers.
1710
1711 Combining several classes is possible, although this usually
1712 restricts the output so much that there is nothing to display. One
1713 case where it does work, however, is when one of the classes is
1714 @var{target}. For example, to display all the target-specific
1715 optimization options, use:
1716
1717 @smallexample
1718 --help=target,optimizers
1719 @end smallexample
1720
1721 The @option{--help=} option can be repeated on the command line. Each
1722 successive use displays its requested class of options, skipping
1723 those that have already been displayed. If @option{--help} is also
1724 specified anywhere on the command line then this takes precedence
1725 over any @option{--help=} option.
1726
1727 If the @option{-Q} option appears on the command line before the
1728 @option{--help=} option, then the descriptive text displayed by
1729 @option{--help=} is changed. Instead of describing the displayed
1730 options, an indication is given as to whether the option is enabled,
1731 disabled or set to a specific value (assuming that the compiler
1732 knows this at the point where the @option{--help=} option is used).
1733
1734 Here is a truncated example from the ARM port of @command{gcc}:
1735
1736 @smallexample
1737 % gcc -Q -mabi=2 --help=target -c
1738 The following options are target specific:
1739 -mabi= 2
1740 -mabort-on-noreturn [disabled]
1741 -mapcs [disabled]
1742 @end smallexample
1743
1744 The output is sensitive to the effects of previous command-line
1745 options, so for example it is possible to find out which optimizations
1746 are enabled at @option{-O2} by using:
1747
1748 @smallexample
1749 -Q -O2 --help=optimizers
1750 @end smallexample
1751
1752 Alternatively you can discover which binary optimizations are enabled
1753 by @option{-O3} by using:
1754
1755 @smallexample
1756 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1757 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1758 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1759 @end smallexample
1760
1761 @item --version
1762 @opindex version
1763 Display the version number and copyrights of the invoked GCC@.
1764
1765 @item -pass-exit-codes
1766 @opindex pass-exit-codes
1767 Normally the @command{gcc} program exits with the code of 1 if any
1768 phase of the compiler returns a non-success return code. If you specify
1769 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1770 the numerically highest error produced by any phase returning an error
1771 indication. The C, C++, and Fortran front ends return 4 if an internal
1772 compiler error is encountered.
1773
1774 @item -pipe
1775 @opindex pipe
1776 Use pipes rather than temporary files for communication between the
1777 various stages of compilation. This fails to work on some systems where
1778 the assembler is unable to read from a pipe; but the GNU assembler has
1779 no trouble.
1780
1781 @item -specs=@var{file}
1782 @opindex specs
1783 Process @var{file} after the compiler reads in the standard @file{specs}
1784 file, in order to override the defaults which the @command{gcc} driver
1785 program uses when determining what switches to pass to @command{cc1},
1786 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1787 @option{-specs=@var{file}} can be specified on the command line, and they
1788 are processed in order, from left to right. @xref{Spec Files}, for
1789 information about the format of the @var{file}.
1790
1791 @item -wrapper
1792 @opindex wrapper
1793 Invoke all subcommands under a wrapper program. The name of the
1794 wrapper program and its parameters are passed as a comma separated
1795 list.
1796
1797 @smallexample
1798 gcc -c t.c -wrapper gdb,--args
1799 @end smallexample
1800
1801 @noindent
1802 This invokes all subprograms of @command{gcc} under
1803 @samp{gdb --args}, thus the invocation of @command{cc1} is
1804 @samp{gdb --args cc1 @dots{}}.
1805
1806 @item -ffile-prefix-map=@var{old}=@var{new}
1807 @opindex ffile-prefix-map
1808 When compiling files residing in directory @file{@var{old}}, record
1809 any references to them in the result of the compilation as if the
1810 files resided in directory @file{@var{new}} instead. Specifying this
1811 option is equivalent to specifying all the individual
1812 @option{-f*-prefix-map} options. This can be used to make reproducible
1813 builds that are location independent. See also
1814 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1815
1816 @item -fplugin=@var{name}.so
1817 @opindex fplugin
1818 Load the plugin code in file @var{name}.so, assumed to be a
1819 shared object to be dlopen'd by the compiler. The base name of
1820 the shared object file is used to identify the plugin for the
1821 purposes of argument parsing (See
1822 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1823 Each plugin should define the callback functions specified in the
1824 Plugins API.
1825
1826 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1827 @opindex fplugin-arg
1828 Define an argument called @var{key} with a value of @var{value}
1829 for the plugin called @var{name}.
1830
1831 @item -fdump-ada-spec@r{[}-slim@r{]}
1832 @opindex fdump-ada-spec
1833 For C and C++ source and include files, generate corresponding Ada specs.
1834 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1835 GNAT User's Guide}, which provides detailed documentation on this feature.
1836
1837 @item -fada-spec-parent=@var{unit}
1838 @opindex fada-spec-parent
1839 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1840 Ada specs as child units of parent @var{unit}.
1841
1842 @item -fdump-go-spec=@var{file}
1843 @opindex fdump-go-spec
1844 For input files in any language, generate corresponding Go
1845 declarations in @var{file}. This generates Go @code{const},
1846 @code{type}, @code{var}, and @code{func} declarations which may be a
1847 useful way to start writing a Go interface to code written in some
1848 other language.
1849
1850 @include @value{srcdir}/../libiberty/at-file.texi
1851 @end table
1852
1853 @node Invoking G++
1854 @section Compiling C++ Programs
1855
1856 @cindex suffixes for C++ source
1857 @cindex C++ source file suffixes
1858 C++ source files conventionally use one of the suffixes @samp{.C},
1859 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1860 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1861 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1862 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1863 files with these names and compiles them as C++ programs even if you
1864 call the compiler the same way as for compiling C programs (usually
1865 with the name @command{gcc}).
1866
1867 @findex g++
1868 @findex c++
1869 However, the use of @command{gcc} does not add the C++ library.
1870 @command{g++} is a program that calls GCC and automatically specifies linking
1871 against the C++ library. It treats @samp{.c},
1872 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1873 files unless @option{-x} is used. This program is also useful when
1874 precompiling a C header file with a @samp{.h} extension for use in C++
1875 compilations. On many systems, @command{g++} is also installed with
1876 the name @command{c++}.
1877
1878 @cindex invoking @command{g++}
1879 When you compile C++ programs, you may specify many of the same
1880 command-line options that you use for compiling programs in any
1881 language; or command-line options meaningful for C and related
1882 languages; or options that are meaningful only for C++ programs.
1883 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1884 explanations of options for languages related to C@.
1885 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1886 explanations of options that are meaningful only for C++ programs.
1887
1888 @node C Dialect Options
1889 @section Options Controlling C Dialect
1890 @cindex dialect options
1891 @cindex language dialect options
1892 @cindex options, dialect
1893
1894 The following options control the dialect of C (or languages derived
1895 from C, such as C++, Objective-C and Objective-C++) that the compiler
1896 accepts:
1897
1898 @table @gcctabopt
1899 @cindex ANSI support
1900 @cindex ISO support
1901 @item -ansi
1902 @opindex ansi
1903 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1904 equivalent to @option{-std=c++98}.
1905
1906 This turns off certain features of GCC that are incompatible with ISO
1907 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1908 such as the @code{asm} and @code{typeof} keywords, and
1909 predefined macros such as @code{unix} and @code{vax} that identify the
1910 type of system you are using. It also enables the undesirable and
1911 rarely used ISO trigraph feature. For the C compiler,
1912 it disables recognition of C++ style @samp{//} comments as well as
1913 the @code{inline} keyword.
1914
1915 The alternate keywords @code{__asm__}, @code{__extension__},
1916 @code{__inline__} and @code{__typeof__} continue to work despite
1917 @option{-ansi}. You would not want to use them in an ISO C program, of
1918 course, but it is useful to put them in header files that might be included
1919 in compilations done with @option{-ansi}. Alternate predefined macros
1920 such as @code{__unix__} and @code{__vax__} are also available, with or
1921 without @option{-ansi}.
1922
1923 The @option{-ansi} option does not cause non-ISO programs to be
1924 rejected gratuitously. For that, @option{-Wpedantic} is required in
1925 addition to @option{-ansi}. @xref{Warning Options}.
1926
1927 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1928 option is used. Some header files may notice this macro and refrain
1929 from declaring certain functions or defining certain macros that the
1930 ISO standard doesn't call for; this is to avoid interfering with any
1931 programs that might use these names for other things.
1932
1933 Functions that are normally built in but do not have semantics
1934 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1935 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1936 built-in functions provided by GCC}, for details of the functions
1937 affected.
1938
1939 @item -std=
1940 @opindex std
1941 Determine the language standard. @xref{Standards,,Language Standards
1942 Supported by GCC}, for details of these standard versions. This option
1943 is currently only supported when compiling C or C++.
1944
1945 The compiler can accept several base standards, such as @samp{c90} or
1946 @samp{c++98}, and GNU dialects of those standards, such as
1947 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1948 compiler accepts all programs following that standard plus those
1949 using GNU extensions that do not contradict it. For example,
1950 @option{-std=c90} turns off certain features of GCC that are
1951 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1952 keywords, but not other GNU extensions that do not have a meaning in
1953 ISO C90, such as omitting the middle term of a @code{?:}
1954 expression. On the other hand, when a GNU dialect of a standard is
1955 specified, all features supported by the compiler are enabled, even when
1956 those features change the meaning of the base standard. As a result, some
1957 strict-conforming programs may be rejected. The particular standard
1958 is used by @option{-Wpedantic} to identify which features are GNU
1959 extensions given that version of the standard. For example
1960 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1961 comments, while @option{-std=gnu99 -Wpedantic} does not.
1962
1963 A value for this option must be provided; possible values are
1964
1965 @table @samp
1966 @item c90
1967 @itemx c89
1968 @itemx iso9899:1990
1969 Support all ISO C90 programs (certain GNU extensions that conflict
1970 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1971
1972 @item iso9899:199409
1973 ISO C90 as modified in amendment 1.
1974
1975 @item c99
1976 @itemx c9x
1977 @itemx iso9899:1999
1978 @itemx iso9899:199x
1979 ISO C99. This standard is substantially completely supported, modulo
1980 bugs and floating-point issues
1981 (mainly but not entirely relating to optional C99 features from
1982 Annexes F and G). See
1983 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1984 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1985
1986 @item c11
1987 @itemx c1x
1988 @itemx iso9899:2011
1989 ISO C11, the 2011 revision of the ISO C standard. This standard is
1990 substantially completely supported, modulo bugs, floating-point issues
1991 (mainly but not entirely relating to optional C11 features from
1992 Annexes F and G) and the optional Annexes K (Bounds-checking
1993 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1994
1995 @item c17
1996 @itemx c18
1997 @itemx iso9899:2017
1998 @itemx iso9899:2018
1999 ISO C17, the 2017 revision of the ISO C standard
2000 (published in 2018). This standard is
2001 same as C11 except for corrections of defects (all of which are also
2002 applied with @option{-std=c11}) and a new value of
2003 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
2004
2005 @item c2x
2006 The next version of the ISO C standard, still under development. The
2007 support for this version is experimental and incomplete.
2008
2009 @item gnu90
2010 @itemx gnu89
2011 GNU dialect of ISO C90 (including some C99 features).
2012
2013 @item gnu99
2014 @itemx gnu9x
2015 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
2016
2017 @item gnu11
2018 @itemx gnu1x
2019 GNU dialect of ISO C11.
2020 The name @samp{gnu1x} is deprecated.
2021
2022 @item gnu17
2023 @itemx gnu18
2024 GNU dialect of ISO C17. This is the default for C code.
2025
2026 @item gnu2x
2027 The next version of the ISO C standard, still under development, plus
2028 GNU extensions. The support for this version is experimental and
2029 incomplete.
2030
2031 @item c++98
2032 @itemx c++03
2033 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
2034 additional defect reports. Same as @option{-ansi} for C++ code.
2035
2036 @item gnu++98
2037 @itemx gnu++03
2038 GNU dialect of @option{-std=c++98}.
2039
2040 @item c++11
2041 @itemx c++0x
2042 The 2011 ISO C++ standard plus amendments.
2043 The name @samp{c++0x} is deprecated.
2044
2045 @item gnu++11
2046 @itemx gnu++0x
2047 GNU dialect of @option{-std=c++11}.
2048 The name @samp{gnu++0x} is deprecated.
2049
2050 @item c++14
2051 @itemx c++1y
2052 The 2014 ISO C++ standard plus amendments.
2053 The name @samp{c++1y} is deprecated.
2054
2055 @item gnu++14
2056 @itemx gnu++1y
2057 GNU dialect of @option{-std=c++14}.
2058 This is the default for C++ code.
2059 The name @samp{gnu++1y} is deprecated.
2060
2061 @item c++17
2062 @itemx c++1z
2063 The 2017 ISO C++ standard plus amendments.
2064 The name @samp{c++1z} is deprecated.
2065
2066 @item gnu++17
2067 @itemx gnu++1z
2068 GNU dialect of @option{-std=c++17}.
2069 The name @samp{gnu++1z} is deprecated.
2070
2071 @item c++20
2072 @itemx c++2a
2073 The next revision of the ISO C++ standard, planned for
2074 2020. Support is highly experimental, and will almost certainly
2075 change in incompatible ways in future releases.
2076
2077 @item gnu++20
2078 @itemx gnu++2a
2079 GNU dialect of @option{-std=c++20}. Support is highly experimental,
2080 and will almost certainly change in incompatible ways in future
2081 releases.
2082 @end table
2083
2084 @item -fgnu89-inline
2085 @opindex fgnu89-inline
2086 The option @option{-fgnu89-inline} tells GCC to use the traditional
2087 GNU semantics for @code{inline} functions when in C99 mode.
2088 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2089 Using this option is roughly equivalent to adding the
2090 @code{gnu_inline} function attribute to all inline functions
2091 (@pxref{Function Attributes}).
2092
2093 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2094 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2095 specifies the default behavior).
2096 This option is not supported in @option{-std=c90} or
2097 @option{-std=gnu90} mode.
2098
2099 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2100 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2101 in effect for @code{inline} functions. @xref{Common Predefined
2102 Macros,,,cpp,The C Preprocessor}.
2103
2104 @item -fpermitted-flt-eval-methods=@var{style}
2105 @opindex fpermitted-flt-eval-methods
2106 @opindex fpermitted-flt-eval-methods=c11
2107 @opindex fpermitted-flt-eval-methods=ts-18661-3
2108 ISO/IEC TS 18661-3 defines new permissible values for
2109 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2110 a semantic type that is an interchange or extended format should be
2111 evaluated to the precision and range of that type. These new values are
2112 a superset of those permitted under C99/C11, which does not specify the
2113 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2114 conforming to C11 may not have been written expecting the possibility of
2115 the new values.
2116
2117 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2118 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2119 or the extended set of values specified in ISO/IEC TS 18661-3.
2120
2121 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2122
2123 The default when in a standards compliant mode (@option{-std=c11} or similar)
2124 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2125 dialect (@option{-std=gnu11} or similar) is
2126 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2127
2128 @item -aux-info @var{filename}
2129 @opindex aux-info
2130 Output to the given filename prototyped declarations for all functions
2131 declared and/or defined in a translation unit, including those in header
2132 files. This option is silently ignored in any language other than C@.
2133
2134 Besides declarations, the file indicates, in comments, the origin of
2135 each declaration (source file and line), whether the declaration was
2136 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2137 @samp{O} for old, respectively, in the first character after the line
2138 number and the colon), and whether it came from a declaration or a
2139 definition (@samp{C} or @samp{F}, respectively, in the following
2140 character). In the case of function definitions, a K&R-style list of
2141 arguments followed by their declarations is also provided, inside
2142 comments, after the declaration.
2143
2144 @item -fallow-parameterless-variadic-functions
2145 @opindex fallow-parameterless-variadic-functions
2146 Accept variadic functions without named parameters.
2147
2148 Although it is possible to define such a function, this is not very
2149 useful as it is not possible to read the arguments. This is only
2150 supported for C as this construct is allowed by C++.
2151
2152 @item -fno-asm
2153 @opindex fno-asm
2154 @opindex fasm
2155 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2156 keyword, so that code can use these words as identifiers. You can use
2157 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2158 instead. @option{-ansi} implies @option{-fno-asm}.
2159
2160 In C++, this switch only affects the @code{typeof} keyword, since
2161 @code{asm} and @code{inline} are standard keywords. You may want to
2162 use the @option{-fno-gnu-keywords} flag instead, which has the same
2163 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2164 switch only affects the @code{asm} and @code{typeof} keywords, since
2165 @code{inline} is a standard keyword in ISO C99.
2166
2167 @item -fno-builtin
2168 @itemx -fno-builtin-@var{function}
2169 @opindex fno-builtin
2170 @opindex fbuiltin
2171 @cindex built-in functions
2172 Don't recognize built-in functions that do not begin with
2173 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2174 functions provided by GCC}, for details of the functions affected,
2175 including those which are not built-in functions when @option{-ansi} or
2176 @option{-std} options for strict ISO C conformance are used because they
2177 do not have an ISO standard meaning.
2178
2179 GCC normally generates special code to handle certain built-in functions
2180 more efficiently; for instance, calls to @code{alloca} may become single
2181 instructions which adjust the stack directly, and calls to @code{memcpy}
2182 may become inline copy loops. The resulting code is often both smaller
2183 and faster, but since the function calls no longer appear as such, you
2184 cannot set a breakpoint on those calls, nor can you change the behavior
2185 of the functions by linking with a different library. In addition,
2186 when a function is recognized as a built-in function, GCC may use
2187 information about that function to warn about problems with calls to
2188 that function, or to generate more efficient code, even if the
2189 resulting code still contains calls to that function. For example,
2190 warnings are given with @option{-Wformat} for bad calls to
2191 @code{printf} when @code{printf} is built in and @code{strlen} is
2192 known not to modify global memory.
2193
2194 With the @option{-fno-builtin-@var{function}} option
2195 only the built-in function @var{function} is
2196 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2197 function is named that is not built-in in this version of GCC, this
2198 option is ignored. There is no corresponding
2199 @option{-fbuiltin-@var{function}} option; if you wish to enable
2200 built-in functions selectively when using @option{-fno-builtin} or
2201 @option{-ffreestanding}, you may define macros such as:
2202
2203 @smallexample
2204 #define abs(n) __builtin_abs ((n))
2205 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2206 @end smallexample
2207
2208 @item -fgimple
2209 @opindex fgimple
2210
2211 Enable parsing of function definitions marked with @code{__GIMPLE}.
2212 This is an experimental feature that allows unit testing of GIMPLE
2213 passes.
2214
2215 @item -fhosted
2216 @opindex fhosted
2217 @cindex hosted environment
2218
2219 Assert that compilation targets a hosted environment. This implies
2220 @option{-fbuiltin}. A hosted environment is one in which the
2221 entire standard library is available, and in which @code{main} has a return
2222 type of @code{int}. Examples are nearly everything except a kernel.
2223 This is equivalent to @option{-fno-freestanding}.
2224
2225 @item -ffreestanding
2226 @opindex ffreestanding
2227 @cindex hosted environment
2228
2229 Assert that compilation targets a freestanding environment. This
2230 implies @option{-fno-builtin}. A freestanding environment
2231 is one in which the standard library may not exist, and program startup may
2232 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2233 This is equivalent to @option{-fno-hosted}.
2234
2235 @xref{Standards,,Language Standards Supported by GCC}, for details of
2236 freestanding and hosted environments.
2237
2238 @item -fopenacc
2239 @opindex fopenacc
2240 @cindex OpenACC accelerator programming
2241 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2242 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2243 compiler generates accelerated code according to the OpenACC Application
2244 Programming Interface v2.6 @w{@uref{https://www.openacc.org}}. This option
2245 implies @option{-pthread}, and thus is only supported on targets that
2246 have support for @option{-pthread}.
2247
2248 @item -fopenacc-dim=@var{geom}
2249 @opindex fopenacc-dim
2250 @cindex OpenACC accelerator programming
2251 Specify default compute dimensions for parallel offload regions that do
2252 not explicitly specify. The @var{geom} value is a triple of
2253 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2254 can be omitted, to use a target-specific default value.
2255
2256 @item -fopenmp
2257 @opindex fopenmp
2258 @cindex OpenMP parallel
2259 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2260 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2261 compiler generates parallel code according to the OpenMP Application
2262 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2263 implies @option{-pthread}, and thus is only supported on targets that
2264 have support for @option{-pthread}. @option{-fopenmp} implies
2265 @option{-fopenmp-simd}.
2266
2267 @item -fopenmp-simd
2268 @opindex fopenmp-simd
2269 @cindex OpenMP SIMD
2270 @cindex SIMD
2271 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2272 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2273 are ignored.
2274
2275 @item -fgnu-tm
2276 @opindex fgnu-tm
2277 When the option @option{-fgnu-tm} is specified, the compiler
2278 generates code for the Linux variant of Intel's current Transactional
2279 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2280 an experimental feature whose interface may change in future versions
2281 of GCC, as the official specification changes. Please note that not
2282 all architectures are supported for this feature.
2283
2284 For more information on GCC's support for transactional memory,
2285 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2286 Transactional Memory Library}.
2287
2288 Note that the transactional memory feature is not supported with
2289 non-call exceptions (@option{-fnon-call-exceptions}).
2290
2291 @item -fms-extensions
2292 @opindex fms-extensions
2293 Accept some non-standard constructs used in Microsoft header files.
2294
2295 In C++ code, this allows member names in structures to be similar
2296 to previous types declarations.
2297
2298 @smallexample
2299 typedef int UOW;
2300 struct ABC @{
2301 UOW UOW;
2302 @};
2303 @end smallexample
2304
2305 Some cases of unnamed fields in structures and unions are only
2306 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2307 fields within structs/unions}, for details.
2308
2309 Note that this option is off for all targets except for x86
2310 targets using ms-abi.
2311
2312 @item -fplan9-extensions
2313 @opindex fplan9-extensions
2314 Accept some non-standard constructs used in Plan 9 code.
2315
2316 This enables @option{-fms-extensions}, permits passing pointers to
2317 structures with anonymous fields to functions that expect pointers to
2318 elements of the type of the field, and permits referring to anonymous
2319 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2320 struct/union fields within structs/unions}, for details. This is only
2321 supported for C, not C++.
2322
2323 @item -fcond-mismatch
2324 @opindex fcond-mismatch
2325 Allow conditional expressions with mismatched types in the second and
2326 third arguments. The value of such an expression is void. This option
2327 is not supported for C++.
2328
2329 @item -flax-vector-conversions
2330 @opindex flax-vector-conversions
2331 Allow implicit conversions between vectors with differing numbers of
2332 elements and/or incompatible element types. This option should not be
2333 used for new code.
2334
2335 @item -funsigned-char
2336 @opindex funsigned-char
2337 Let the type @code{char} be unsigned, like @code{unsigned char}.
2338
2339 Each kind of machine has a default for what @code{char} should
2340 be. It is either like @code{unsigned char} by default or like
2341 @code{signed char} by default.
2342
2343 Ideally, a portable program should always use @code{signed char} or
2344 @code{unsigned char} when it depends on the signedness of an object.
2345 But many programs have been written to use plain @code{char} and
2346 expect it to be signed, or expect it to be unsigned, depending on the
2347 machines they were written for. This option, and its inverse, let you
2348 make such a program work with the opposite default.
2349
2350 The type @code{char} is always a distinct type from each of
2351 @code{signed char} or @code{unsigned char}, even though its behavior
2352 is always just like one of those two.
2353
2354 @item -fsigned-char
2355 @opindex fsigned-char
2356 Let the type @code{char} be signed, like @code{signed char}.
2357
2358 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2359 the negative form of @option{-funsigned-char}. Likewise, the option
2360 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2361
2362 @item -fsigned-bitfields
2363 @itemx -funsigned-bitfields
2364 @itemx -fno-signed-bitfields
2365 @itemx -fno-unsigned-bitfields
2366 @opindex fsigned-bitfields
2367 @opindex funsigned-bitfields
2368 @opindex fno-signed-bitfields
2369 @opindex fno-unsigned-bitfields
2370 These options control whether a bit-field is signed or unsigned, when the
2371 declaration does not use either @code{signed} or @code{unsigned}. By
2372 default, such a bit-field is signed, because this is consistent: the
2373 basic integer types such as @code{int} are signed types.
2374
2375 @item -fsso-struct=@var{endianness}
2376 @opindex fsso-struct
2377 Set the default scalar storage order of structures and unions to the
2378 specified endianness. The accepted values are @samp{big-endian},
2379 @samp{little-endian} and @samp{native} for the native endianness of
2380 the target (the default). This option is not supported for C++.
2381
2382 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2383 code that is not binary compatible with code generated without it if the
2384 specified endianness is not the native endianness of the target.
2385 @end table
2386
2387 @node C++ Dialect Options
2388 @section Options Controlling C++ Dialect
2389
2390 @cindex compiler options, C++
2391 @cindex C++ options, command-line
2392 @cindex options, C++
2393 This section describes the command-line options that are only meaningful
2394 for C++ programs. You can also use most of the GNU compiler options
2395 regardless of what language your program is in. For example, you
2396 might compile a file @file{firstClass.C} like this:
2397
2398 @smallexample
2399 g++ -g -fstrict-enums -O -c firstClass.C
2400 @end smallexample
2401
2402 @noindent
2403 In this example, only @option{-fstrict-enums} is an option meant
2404 only for C++ programs; you can use the other options with any
2405 language supported by GCC@.
2406
2407 Some options for compiling C programs, such as @option{-std}, are also
2408 relevant for C++ programs.
2409 @xref{C Dialect Options,,Options Controlling C Dialect}.
2410
2411 Here is a list of options that are @emph{only} for compiling C++ programs:
2412
2413 @table @gcctabopt
2414
2415 @item -fabi-version=@var{n}
2416 @opindex fabi-version
2417 Use version @var{n} of the C++ ABI@. The default is version 0.
2418
2419 Version 0 refers to the version conforming most closely to
2420 the C++ ABI specification. Therefore, the ABI obtained using version 0
2421 will change in different versions of G++ as ABI bugs are fixed.
2422
2423 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2424
2425 Version 2 is the version of the C++ ABI that first appeared in G++
2426 3.4, and was the default through G++ 4.9.
2427
2428 Version 3 corrects an error in mangling a constant address as a
2429 template argument.
2430
2431 Version 4, which first appeared in G++ 4.5, implements a standard
2432 mangling for vector types.
2433
2434 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2435 attribute const/volatile on function pointer types, decltype of a
2436 plain decl, and use of a function parameter in the declaration of
2437 another parameter.
2438
2439 Version 6, which first appeared in G++ 4.7, corrects the promotion
2440 behavior of C++11 scoped enums and the mangling of template argument
2441 packs, const/static_cast, prefix ++ and --, and a class scope function
2442 used as a template argument.
2443
2444 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2445 builtin type and corrects the mangling of lambdas in default argument
2446 scope.
2447
2448 Version 8, which first appeared in G++ 4.9, corrects the substitution
2449 behavior of function types with function-cv-qualifiers.
2450
2451 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2452 @code{nullptr_t}.
2453
2454 Version 10, which first appeared in G++ 6.1, adds mangling of
2455 attributes that affect type identity, such as ia32 calling convention
2456 attributes (e.g.@: @samp{stdcall}).
2457
2458 Version 11, which first appeared in G++ 7, corrects the mangling of
2459 sizeof... expressions and operator names. For multiple entities with
2460 the same name within a function, that are declared in different scopes,
2461 the mangling now changes starting with the twelfth occurrence. It also
2462 implies @option{-fnew-inheriting-ctors}.
2463
2464 Version 12, which first appeared in G++ 8, corrects the calling
2465 conventions for empty classes on the x86_64 target and for classes
2466 with only deleted copy/move constructors. It accidentally changes the
2467 calling convention for classes with a deleted copy constructor and a
2468 trivial move constructor.
2469
2470 Version 13, which first appeared in G++ 8.2, fixes the accidental
2471 change in version 12.
2472
2473 Version 14, which first appeared in G++ 10, corrects the mangling of
2474 the nullptr expression.
2475
2476 See also @option{-Wabi}.
2477
2478 @item -fabi-compat-version=@var{n}
2479 @opindex fabi-compat-version
2480 On targets that support strong aliases, G++
2481 works around mangling changes by creating an alias with the correct
2482 mangled name when defining a symbol with an incorrect mangled name.
2483 This switch specifies which ABI version to use for the alias.
2484
2485 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2486 compatibility). If another ABI version is explicitly selected, this
2487 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2488 use @option{-fabi-compat-version=2}.
2489
2490 If this option is not provided but @option{-Wabi=@var{n}} is, that
2491 version is used for compatibility aliases. If this option is provided
2492 along with @option{-Wabi} (without the version), the version from this
2493 option is used for the warning.
2494
2495 @item -fno-access-control
2496 @opindex fno-access-control
2497 @opindex faccess-control
2498 Turn off all access checking. This switch is mainly useful for working
2499 around bugs in the access control code.
2500
2501 @item -faligned-new
2502 @opindex faligned-new
2503 Enable support for C++17 @code{new} of types that require more
2504 alignment than @code{void* ::operator new(std::size_t)} provides. A
2505 numeric argument such as @code{-faligned-new=32} can be used to
2506 specify how much alignment (in bytes) is provided by that function,
2507 but few users will need to override the default of
2508 @code{alignof(std::max_align_t)}.
2509
2510 This flag is enabled by default for @option{-std=c++17}.
2511
2512 @item -fchar8_t
2513 @itemx -fno-char8_t
2514 @opindex fchar8_t
2515 @opindex fno-char8_t
2516 Enable support for @code{char8_t} as adopted for C++2a. This includes
2517 the addition of a new @code{char8_t} fundamental type, changes to the
2518 types of UTF-8 string and character literals, new signatures for
2519 user-defined literals, associated standard library updates, and new
2520 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2521
2522 This option enables functions to be overloaded for ordinary and UTF-8
2523 strings:
2524
2525 @smallexample
2526 int f(const char *); // #1
2527 int f(const char8_t *); // #2
2528 int v1 = f("text"); // Calls #1
2529 int v2 = f(u8"text"); // Calls #2
2530 @end smallexample
2531
2532 @noindent
2533 and introduces new signatures for user-defined literals:
2534
2535 @smallexample
2536 int operator""_udl1(char8_t);
2537 int v3 = u8'x'_udl1;
2538 int operator""_udl2(const char8_t*, std::size_t);
2539 int v4 = u8"text"_udl2;
2540 template<typename T, T...> int operator""_udl3();
2541 int v5 = u8"text"_udl3;
2542 @end smallexample
2543
2544 @noindent
2545 The change to the types of UTF-8 string and character literals introduces
2546 incompatibilities with ISO C++11 and later standards. For example, the
2547 following code is well-formed under ISO C++11, but is ill-formed when
2548 @option{-fchar8_t} is specified.
2549
2550 @smallexample
2551 char ca[] = u8"xx"; // error: char-array initialized from wide
2552 // string
2553 const char *cp = u8"xx";// error: invalid conversion from
2554 // `const char8_t*' to `const char*'
2555 int f(const char*);
2556 auto v = f(u8"xx"); // error: invalid conversion from
2557 // `const char8_t*' to `const char*'
2558 std::string s@{u8"xx"@}; // error: no matching function for call to
2559 // `std::basic_string<char>::basic_string()'
2560 using namespace std::literals;
2561 s = u8"xx"s; // error: conversion from
2562 // `basic_string<char8_t>' to non-scalar
2563 // type `basic_string<char>' requested
2564 @end smallexample
2565
2566 @item -fcheck-new
2567 @opindex fcheck-new
2568 Check that the pointer returned by @code{operator new} is non-null
2569 before attempting to modify the storage allocated. This check is
2570 normally unnecessary because the C++ standard specifies that
2571 @code{operator new} only returns @code{0} if it is declared
2572 @code{throw()}, in which case the compiler always checks the
2573 return value even without this option. In all other cases, when
2574 @code{operator new} has a non-empty exception specification, memory
2575 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2576 @samp{new (nothrow)}.
2577
2578 @item -fconcepts
2579 @itemx -fconcepts-ts
2580 @opindex fconcepts
2581 @opindex fconcepts-ts
2582 Below @option{-std=c++2a}, @option{-fconcepts} enables support for the
2583 C++ Extensions for Concepts Technical Specification, ISO 19217 (2015).
2584
2585 With @option{-std=c++2a} and above, Concepts are part of the language
2586 standard, so @option{-fconcepts} defaults to on. But the standard
2587 specification of Concepts differs significantly from the TS, so some
2588 constructs that were allowed in the TS but didn't make it into the
2589 standard can still be enabled by @option{-fconcepts-ts}.
2590
2591 @item -fconstexpr-depth=@var{n}
2592 @opindex fconstexpr-depth
2593 Set the maximum nested evaluation depth for C++11 constexpr functions
2594 to @var{n}. A limit is needed to detect endless recursion during
2595 constant expression evaluation. The minimum specified by the standard
2596 is 512.
2597
2598 @item -fconstexpr-cache-depth=@var{n}
2599 @opindex fconstexpr-cache-depth
2600 Set the maximum level of nested evaluation depth for C++11 constexpr
2601 functions that will be cached to @var{n}. This is a heuristic that
2602 trades off compilation speed (when the cache avoids repeated
2603 calculations) against memory consumption (when the cache grows very
2604 large from highly recursive evaluations). The default is 8. Very few
2605 users are likely to want to adjust it, but if your code does heavy
2606 constexpr calculations you might want to experiment to find which
2607 value works best for you.
2608
2609 @item -fconstexpr-loop-limit=@var{n}
2610 @opindex fconstexpr-loop-limit
2611 Set the maximum number of iterations for a loop in C++14 constexpr functions
2612 to @var{n}. A limit is needed to detect infinite loops during
2613 constant expression evaluation. The default is 262144 (1<<18).
2614
2615 @item -fconstexpr-ops-limit=@var{n}
2616 @opindex fconstexpr-ops-limit
2617 Set the maximum number of operations during a single constexpr evaluation.
2618 Even when number of iterations of a single loop is limited with the above limit,
2619 if there are several nested loops and each of them has many iterations but still
2620 smaller than the above limit, or if in a body of some loop or even outside
2621 of a loop too many expressions need to be evaluated, the resulting constexpr
2622 evaluation might take too long.
2623 The default is 33554432 (1<<25).
2624
2625 @item -fcoroutines
2626 @opindex fcoroutines
2627 Enable support for the C++ coroutines extension (experimental).
2628
2629 @item -fno-elide-constructors
2630 @opindex fno-elide-constructors
2631 @opindex felide-constructors
2632 The C++ standard allows an implementation to omit creating a temporary
2633 that is only used to initialize another object of the same type.
2634 Specifying this option disables that optimization, and forces G++ to
2635 call the copy constructor in all cases. This option also causes G++
2636 to call trivial member functions which otherwise would be expanded inline.
2637
2638 In C++17, the compiler is required to omit these temporaries, but this
2639 option still affects trivial member functions.
2640
2641 @item -fno-enforce-eh-specs
2642 @opindex fno-enforce-eh-specs
2643 @opindex fenforce-eh-specs
2644 Don't generate code to check for violation of exception specifications
2645 at run time. This option violates the C++ standard, but may be useful
2646 for reducing code size in production builds, much like defining
2647 @code{NDEBUG}. This does not give user code permission to throw
2648 exceptions in violation of the exception specifications; the compiler
2649 still optimizes based on the specifications, so throwing an
2650 unexpected exception results in undefined behavior at run time.
2651
2652 @item -fextern-tls-init
2653 @itemx -fno-extern-tls-init
2654 @opindex fextern-tls-init
2655 @opindex fno-extern-tls-init
2656 The C++11 and OpenMP standards allow @code{thread_local} and
2657 @code{threadprivate} variables to have dynamic (runtime)
2658 initialization. To support this, any use of such a variable goes
2659 through a wrapper function that performs any necessary initialization.
2660 When the use and definition of the variable are in the same
2661 translation unit, this overhead can be optimized away, but when the
2662 use is in a different translation unit there is significant overhead
2663 even if the variable doesn't actually need dynamic initialization. If
2664 the programmer can be sure that no use of the variable in a
2665 non-defining TU needs to trigger dynamic initialization (either
2666 because the variable is statically initialized, or a use of the
2667 variable in the defining TU will be executed before any uses in
2668 another TU), they can avoid this overhead with the
2669 @option{-fno-extern-tls-init} option.
2670
2671 On targets that support symbol aliases, the default is
2672 @option{-fextern-tls-init}. On targets that do not support symbol
2673 aliases, the default is @option{-fno-extern-tls-init}.
2674
2675 @item -fno-gnu-keywords
2676 @opindex fno-gnu-keywords
2677 @opindex fgnu-keywords
2678 Do not recognize @code{typeof} as a keyword, so that code can use this
2679 word as an identifier. You can use the keyword @code{__typeof__} instead.
2680 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2681 @option{-std=c++98}, @option{-std=c++11}, etc.
2682
2683 @item -fno-implicit-templates
2684 @opindex fno-implicit-templates
2685 @opindex fimplicit-templates
2686 Never emit code for non-inline templates that are instantiated
2687 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2688 If you use this option, you must take care to structure your code to
2689 include all the necessary explicit instantiations to avoid getting
2690 undefined symbols at link time.
2691 @xref{Template Instantiation}, for more information.
2692
2693 @item -fno-implicit-inline-templates
2694 @opindex fno-implicit-inline-templates
2695 @opindex fimplicit-inline-templates
2696 Don't emit code for implicit instantiations of inline templates, either.
2697 The default is to handle inlines differently so that compiles with and
2698 without optimization need the same set of explicit instantiations.
2699
2700 @item -fno-implement-inlines
2701 @opindex fno-implement-inlines
2702 @opindex fimplement-inlines
2703 To save space, do not emit out-of-line copies of inline functions
2704 controlled by @code{#pragma implementation}. This causes linker
2705 errors if these functions are not inlined everywhere they are called.
2706
2707 @item -fms-extensions
2708 @opindex fms-extensions
2709 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2710 int and getting a pointer to member function via non-standard syntax.
2711
2712 @item -fnew-inheriting-ctors
2713 @opindex fnew-inheriting-ctors
2714 Enable the P0136 adjustment to the semantics of C++11 constructor
2715 inheritance. This is part of C++17 but also considered to be a Defect
2716 Report against C++11 and C++14. This flag is enabled by default
2717 unless @option{-fabi-version=10} or lower is specified.
2718
2719 @item -fnew-ttp-matching
2720 @opindex fnew-ttp-matching
2721 Enable the P0522 resolution to Core issue 150, template template
2722 parameters and default arguments: this allows a template with default
2723 template arguments as an argument for a template template parameter
2724 with fewer template parameters. This flag is enabled by default for
2725 @option{-std=c++17}.
2726
2727 @item -fno-nonansi-builtins
2728 @opindex fno-nonansi-builtins
2729 @opindex fnonansi-builtins
2730 Disable built-in declarations of functions that are not mandated by
2731 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2732 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2733
2734 @item -fnothrow-opt
2735 @opindex fnothrow-opt
2736 Treat a @code{throw()} exception specification as if it were a
2737 @code{noexcept} specification to reduce or eliminate the text size
2738 overhead relative to a function with no exception specification. If
2739 the function has local variables of types with non-trivial
2740 destructors, the exception specification actually makes the
2741 function smaller because the EH cleanups for those variables can be
2742 optimized away. The semantic effect is that an exception thrown out of
2743 a function with such an exception specification results in a call
2744 to @code{terminate} rather than @code{unexpected}.
2745
2746 @item -fno-operator-names
2747 @opindex fno-operator-names
2748 @opindex foperator-names
2749 Do not treat the operator name keywords @code{and}, @code{bitand},
2750 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2751 synonyms as keywords.
2752
2753 @item -fno-optional-diags
2754 @opindex fno-optional-diags
2755 @opindex foptional-diags
2756 Disable diagnostics that the standard says a compiler does not need to
2757 issue. Currently, the only such diagnostic issued by G++ is the one for
2758 a name having multiple meanings within a class.
2759
2760 @item -fpermissive
2761 @opindex fpermissive
2762 Downgrade some diagnostics about nonconformant code from errors to
2763 warnings. Thus, using @option{-fpermissive} allows some
2764 nonconforming code to compile.
2765
2766 @item -fno-pretty-templates
2767 @opindex fno-pretty-templates
2768 @opindex fpretty-templates
2769 When an error message refers to a specialization of a function
2770 template, the compiler normally prints the signature of the
2771 template followed by the template arguments and any typedefs or
2772 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2773 rather than @code{void f(int)}) so that it's clear which template is
2774 involved. When an error message refers to a specialization of a class
2775 template, the compiler omits any template arguments that match
2776 the default template arguments for that template. If either of these
2777 behaviors make it harder to understand the error message rather than
2778 easier, you can use @option{-fno-pretty-templates} to disable them.
2779
2780 @item -fno-rtti
2781 @opindex fno-rtti
2782 @opindex frtti
2783 Disable generation of information about every class with virtual
2784 functions for use by the C++ run-time type identification features
2785 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2786 of the language, you can save some space by using this flag. Note that
2787 exception handling uses the same information, but G++ generates it as
2788 needed. The @code{dynamic_cast} operator can still be used for casts that
2789 do not require run-time type information, i.e.@: casts to @code{void *} or to
2790 unambiguous base classes.
2791
2792 Mixing code compiled with @option{-frtti} with that compiled with
2793 @option{-fno-rtti} may not work. For example, programs may
2794 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2795 for a class compiled with @option{-frtti}.
2796
2797 @item -fsized-deallocation
2798 @opindex fsized-deallocation
2799 Enable the built-in global declarations
2800 @smallexample
2801 void operator delete (void *, std::size_t) noexcept;
2802 void operator delete[] (void *, std::size_t) noexcept;
2803 @end smallexample
2804 as introduced in C++14. This is useful for user-defined replacement
2805 deallocation functions that, for example, use the size of the object
2806 to make deallocation faster. Enabled by default under
2807 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2808 warns about places that might want to add a definition.
2809
2810 @item -fstrict-enums
2811 @opindex fstrict-enums
2812 Allow the compiler to optimize using the assumption that a value of
2813 enumerated type can only be one of the values of the enumeration (as
2814 defined in the C++ standard; basically, a value that can be
2815 represented in the minimum number of bits needed to represent all the
2816 enumerators). This assumption may not be valid if the program uses a
2817 cast to convert an arbitrary integer value to the enumerated type.
2818
2819 @item -fstrong-eval-order
2820 @opindex fstrong-eval-order
2821 Evaluate member access, array subscripting, and shift expressions in
2822 left-to-right order, and evaluate assignment in right-to-left order,
2823 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2824 @option{-fstrong-eval-order=some} enables just the ordering of member
2825 access and shift expressions, and is the default without
2826 @option{-std=c++17}.
2827
2828 @item -ftemplate-backtrace-limit=@var{n}
2829 @opindex ftemplate-backtrace-limit
2830 Set the maximum number of template instantiation notes for a single
2831 warning or error to @var{n}. The default value is 10.
2832
2833 @item -ftemplate-depth=@var{n}
2834 @opindex ftemplate-depth
2835 Set the maximum instantiation depth for template classes to @var{n}.
2836 A limit on the template instantiation depth is needed to detect
2837 endless recursions during template class instantiation. ANSI/ISO C++
2838 conforming programs must not rely on a maximum depth greater than 17
2839 (changed to 1024 in C++11). The default value is 900, as the compiler
2840 can run out of stack space before hitting 1024 in some situations.
2841
2842 @item -fno-threadsafe-statics
2843 @opindex fno-threadsafe-statics
2844 @opindex fthreadsafe-statics
2845 Do not emit the extra code to use the routines specified in the C++
2846 ABI for thread-safe initialization of local statics. You can use this
2847 option to reduce code size slightly in code that doesn't need to be
2848 thread-safe.
2849
2850 @item -fuse-cxa-atexit
2851 @opindex fuse-cxa-atexit
2852 Register destructors for objects with static storage duration with the
2853 @code{__cxa_atexit} function rather than the @code{atexit} function.
2854 This option is required for fully standards-compliant handling of static
2855 destructors, but only works if your C library supports
2856 @code{__cxa_atexit}.
2857
2858 @item -fno-use-cxa-get-exception-ptr
2859 @opindex fno-use-cxa-get-exception-ptr
2860 @opindex fuse-cxa-get-exception-ptr
2861 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2862 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2863 if the runtime routine is not available.
2864
2865 @item -fvisibility-inlines-hidden
2866 @opindex fvisibility-inlines-hidden
2867 This switch declares that the user does not attempt to compare
2868 pointers to inline functions or methods where the addresses of the two functions
2869 are taken in different shared objects.
2870
2871 The effect of this is that GCC may, effectively, mark inline methods with
2872 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2873 appear in the export table of a DSO and do not require a PLT indirection
2874 when used within the DSO@. Enabling this option can have a dramatic effect
2875 on load and link times of a DSO as it massively reduces the size of the
2876 dynamic export table when the library makes heavy use of templates.
2877
2878 The behavior of this switch is not quite the same as marking the
2879 methods as hidden directly, because it does not affect static variables
2880 local to the function or cause the compiler to deduce that
2881 the function is defined in only one shared object.
2882
2883 You may mark a method as having a visibility explicitly to negate the
2884 effect of the switch for that method. For example, if you do want to
2885 compare pointers to a particular inline method, you might mark it as
2886 having default visibility. Marking the enclosing class with explicit
2887 visibility has no effect.
2888
2889 Explicitly instantiated inline methods are unaffected by this option
2890 as their linkage might otherwise cross a shared library boundary.
2891 @xref{Template Instantiation}.
2892
2893 @item -fvisibility-ms-compat
2894 @opindex fvisibility-ms-compat
2895 This flag attempts to use visibility settings to make GCC's C++
2896 linkage model compatible with that of Microsoft Visual Studio.
2897
2898 The flag makes these changes to GCC's linkage model:
2899
2900 @enumerate
2901 @item
2902 It sets the default visibility to @code{hidden}, like
2903 @option{-fvisibility=hidden}.
2904
2905 @item
2906 Types, but not their members, are not hidden by default.
2907
2908 @item
2909 The One Definition Rule is relaxed for types without explicit
2910 visibility specifications that are defined in more than one
2911 shared object: those declarations are permitted if they are
2912 permitted when this option is not used.
2913 @end enumerate
2914
2915 In new code it is better to use @option{-fvisibility=hidden} and
2916 export those classes that are intended to be externally visible.
2917 Unfortunately it is possible for code to rely, perhaps accidentally,
2918 on the Visual Studio behavior.
2919
2920 Among the consequences of these changes are that static data members
2921 of the same type with the same name but defined in different shared
2922 objects are different, so changing one does not change the other;
2923 and that pointers to function members defined in different shared
2924 objects may not compare equal. When this flag is given, it is a
2925 violation of the ODR to define types with the same name differently.
2926
2927 @item -fno-weak
2928 @opindex fno-weak
2929 @opindex fweak
2930 Do not use weak symbol support, even if it is provided by the linker.
2931 By default, G++ uses weak symbols if they are available. This
2932 option exists only for testing, and should not be used by end-users;
2933 it results in inferior code and has no benefits. This option may
2934 be removed in a future release of G++.
2935
2936 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2937 @opindex fext-numeric-literals
2938 @opindex fno-ext-numeric-literals
2939 Accept imaginary, fixed-point, or machine-defined
2940 literal number suffixes as GNU extensions.
2941 When this option is turned off these suffixes are treated
2942 as C++11 user-defined literal numeric suffixes.
2943 This is on by default for all pre-C++11 dialects and all GNU dialects:
2944 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2945 @option{-std=gnu++14}.
2946 This option is off by default
2947 for ISO C++11 onwards (@option{-std=c++11}, ...).
2948
2949 @item -nostdinc++
2950 @opindex nostdinc++
2951 Do not search for header files in the standard directories specific to
2952 C++, but do still search the other standard directories. (This option
2953 is used when building the C++ library.)
2954 @end table
2955
2956 In addition, these warning options have meanings only for C++ programs:
2957
2958 @table @gcctabopt
2959 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
2960 @opindex Wabi-tag
2961 @opindex Wabi-tag
2962 Warn when a type with an ABI tag is used in a context that does not
2963 have that ABI tag. See @ref{C++ Attributes} for more information
2964 about ABI tags.
2965
2966 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
2967 @opindex Wcomma-subscript
2968 @opindex Wno-comma-subscript
2969 Warn about uses of a comma expression within a subscripting expression.
2970 This usage was deprecated in C++2a. However, a comma expression wrapped
2971 in @code{( )} is not deprecated. Example:
2972
2973 @smallexample
2974 @group
2975 void f(int *a, int b, int c) @{
2976 a[b,c]; // deprecated
2977 a[(b,c)]; // OK
2978 @}
2979 @end group
2980 @end smallexample
2981
2982 Enabled by default with @option{-std=c++2a}.
2983
2984 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2985 @opindex Wctor-dtor-privacy
2986 @opindex Wno-ctor-dtor-privacy
2987 Warn when a class seems unusable because all the constructors or
2988 destructors in that class are private, and it has neither friends nor
2989 public static member functions. Also warn if there are no non-private
2990 methods, and there's at least one private member function that isn't
2991 a constructor or destructor.
2992
2993 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2994 @opindex Wdelete-non-virtual-dtor
2995 @opindex Wno-delete-non-virtual-dtor
2996 Warn when @code{delete} is used to destroy an instance of a class that
2997 has virtual functions and non-virtual destructor. It is unsafe to delete
2998 an instance of a derived class through a pointer to a base class if the
2999 base class does not have a virtual destructor. This warning is enabled
3000 by @option{-Wall}.
3001
3002 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3003 @opindex Wdeprecated-copy
3004 @opindex Wno-deprecated-copy
3005 Warn that the implicit declaration of a copy constructor or copy
3006 assignment operator is deprecated if the class has a user-provided
3007 copy constructor or copy assignment operator, in C++11 and up. This
3008 warning is enabled by @option{-Wextra}. With
3009 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3010 user-provided destructor.
3011
3012 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3013 @opindex Winit-list-lifetime
3014 @opindex Wno-init-list-lifetime
3015 Do not warn about uses of @code{std::initializer_list} that are likely
3016 to result in dangling pointers. Since the underlying array for an
3017 @code{initializer_list} is handled like a normal C++ temporary object,
3018 it is easy to inadvertently keep a pointer to the array past the end
3019 of the array's lifetime. For example:
3020
3021 @itemize @bullet
3022 @item
3023 If a function returns a temporary @code{initializer_list}, or a local
3024 @code{initializer_list} variable, the array's lifetime ends at the end
3025 of the return statement, so the value returned has a dangling pointer.
3026
3027 @item
3028 If a new-expression creates an @code{initializer_list}, the array only
3029 lives until the end of the enclosing full-expression, so the
3030 @code{initializer_list} in the heap has a dangling pointer.
3031
3032 @item
3033 When an @code{initializer_list} variable is assigned from a
3034 brace-enclosed initializer list, the temporary array created for the
3035 right side of the assignment only lives until the end of the
3036 full-expression, so at the next statement the @code{initializer_list}
3037 variable has a dangling pointer.
3038
3039 @smallexample
3040 // li's initial underlying array lives as long as li
3041 std::initializer_list<int> li = @{ 1,2,3 @};
3042 // assignment changes li to point to a temporary array
3043 li = @{ 4, 5 @};
3044 // now the temporary is gone and li has a dangling pointer
3045 int i = li.begin()[0] // undefined behavior
3046 @end smallexample
3047
3048 @item
3049 When a list constructor stores the @code{begin} pointer from the
3050 @code{initializer_list} argument, this doesn't extend the lifetime of
3051 the array, so if a class variable is constructed from a temporary
3052 @code{initializer_list}, the pointer is left dangling by the end of
3053 the variable declaration statement.
3054
3055 @end itemize
3056
3057 @item -Wno-literal-suffix @r{(C++ and Objective-C++ only)}
3058 @opindex Wliteral-suffix
3059 @opindex Wno-literal-suffix
3060 Do not warn when a string or character literal is followed by a
3061 ud-suffix which does not begin with an underscore. As a conforming
3062 extension, GCC treats such suffixes as separate preprocessing tokens
3063 in order to maintain backwards compatibility with code that uses
3064 formatting macros from @code{<inttypes.h>}. For example:
3065
3066 @smallexample
3067 #define __STDC_FORMAT_MACROS
3068 #include <inttypes.h>
3069 #include <stdio.h>
3070
3071 int main() @{
3072 int64_t i64 = 123;
3073 printf("My int64: %" PRId64"\n", i64);
3074 @}
3075 @end smallexample
3076
3077 In this case, @code{PRId64} is treated as a separate preprocessing token.
3078
3079 This option also controls warnings when a user-defined literal
3080 operator is declared with a literal suffix identifier that doesn't
3081 begin with an underscore. Literal suffix identifiers that don't begin
3082 with an underscore are reserved for future standardization.
3083
3084 These warnings are enabled by default.
3085
3086 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3087 @opindex Wnarrowing
3088 @opindex Wno-narrowing
3089 For C++11 and later standards, narrowing conversions are diagnosed by default,
3090 as required by the standard. A narrowing conversion from a constant produces
3091 an error, and a narrowing conversion from a non-constant produces a warning,
3092 but @option{-Wno-narrowing} suppresses the diagnostic.
3093 Note that this does not affect the meaning of well-formed code;
3094 narrowing conversions are still considered ill-formed in SFINAE contexts.
3095
3096 With @option{-Wnarrowing} in C++98, warn when a narrowing
3097 conversion prohibited by C++11 occurs within
3098 @samp{@{ @}}, e.g.
3099
3100 @smallexample
3101 int i = @{ 2.2 @}; // error: narrowing from double to int
3102 @end smallexample
3103
3104 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3105
3106 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3107 @opindex Wnoexcept
3108 @opindex Wno-noexcept
3109 Warn when a noexcept-expression evaluates to false because of a call
3110 to a function that does not have a non-throwing exception
3111 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3112 the compiler to never throw an exception.
3113
3114 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3115 @opindex Wnoexcept-type
3116 @opindex Wno-noexcept-type
3117 Warn if the C++17 feature making @code{noexcept} part of a function
3118 type changes the mangled name of a symbol relative to C++14. Enabled
3119 by @option{-Wabi} and @option{-Wc++17-compat}.
3120
3121 As an example:
3122
3123 @smallexample
3124 template <class T> void f(T t) @{ t(); @};
3125 void g() noexcept;
3126 void h() @{ f(g); @}
3127 @end smallexample
3128
3129 @noindent
3130 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3131 C++17 it calls @code{f<void(*)()noexcept>}.
3132
3133 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3134 @opindex Wclass-memaccess
3135 @opindex Wno-class-memaccess
3136 Warn when the destination of a call to a raw memory function such as
3137 @code{memset} or @code{memcpy} is an object of class type, and when writing
3138 into such an object might bypass the class non-trivial or deleted constructor
3139 or copy assignment, violate const-correctness or encapsulation, or corrupt
3140 virtual table pointers. Modifying the representation of such objects may
3141 violate invariants maintained by member functions of the class. For example,
3142 the call to @code{memset} below is undefined because it modifies a non-trivial
3143 class object and is, therefore, diagnosed. The safe way to either initialize
3144 or clear the storage of objects of such types is by using the appropriate
3145 constructor or assignment operator, if one is available.
3146 @smallexample
3147 std::string str = "abc";
3148 memset (&str, 0, sizeof str);
3149 @end smallexample
3150 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3151 Explicitly casting the pointer to the class object to @code{void *} or
3152 to a type that can be safely accessed by the raw memory function suppresses
3153 the warning.
3154
3155 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3156 @opindex Wnon-virtual-dtor
3157 @opindex Wno-non-virtual-dtor
3158 Warn when a class has virtual functions and an accessible non-virtual
3159 destructor itself or in an accessible polymorphic base class, in which
3160 case it is possible but unsafe to delete an instance of a derived
3161 class through a pointer to the class itself or base class. This
3162 warning is automatically enabled if @option{-Weffc++} is specified.
3163
3164 @item -Wregister @r{(C++ and Objective-C++ only)}
3165 @opindex Wregister
3166 @opindex Wno-register
3167 Warn on uses of the @code{register} storage class specifier, except
3168 when it is part of the GNU @ref{Explicit Register Variables} extension.
3169 The use of the @code{register} keyword as storage class specifier has
3170 been deprecated in C++11 and removed in C++17.
3171 Enabled by default with @option{-std=c++17}.
3172
3173 @item -Wreorder @r{(C++ and Objective-C++ only)}
3174 @opindex Wreorder
3175 @opindex Wno-reorder
3176 @cindex reordering, warning
3177 @cindex warning for reordering of member initializers
3178 Warn when the order of member initializers given in the code does not
3179 match the order in which they must be executed. For instance:
3180
3181 @smallexample
3182 struct A @{
3183 int i;
3184 int j;
3185 A(): j (0), i (1) @{ @}
3186 @};
3187 @end smallexample
3188
3189 @noindent
3190 The compiler rearranges the member initializers for @code{i}
3191 and @code{j} to match the declaration order of the members, emitting
3192 a warning to that effect. This warning is enabled by @option{-Wall}.
3193
3194 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3195 @opindex Wpessimizing-move
3196 @opindex Wno-pessimizing-move
3197 This warning warns when a call to @code{std::move} prevents copy
3198 elision. A typical scenario when copy elision can occur is when returning in
3199 a function with a class return type, when the expression being returned is the
3200 name of a non-volatile automatic object, and is not a function parameter, and
3201 has the same type as the function return type.
3202
3203 @smallexample
3204 struct T @{
3205 @dots{}
3206 @};
3207 T fn()
3208 @{
3209 T t;
3210 @dots{}
3211 return std::move (t);
3212 @}
3213 @end smallexample
3214
3215 But in this example, the @code{std::move} call prevents copy elision.
3216
3217 This warning is enabled by @option{-Wall}.
3218
3219 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3220 @opindex Wredundant-move
3221 @opindex Wno-redundant-move
3222 This warning warns about redundant calls to @code{std::move}; that is, when
3223 a move operation would have been performed even without the @code{std::move}
3224 call. This happens because the compiler is forced to treat the object as if
3225 it were an rvalue in certain situations such as returning a local variable,
3226 where copy elision isn't applicable. Consider:
3227
3228 @smallexample
3229 struct T @{
3230 @dots{}
3231 @};
3232 T fn(T t)
3233 @{
3234 @dots{}
3235 return std::move (t);
3236 @}
3237 @end smallexample
3238
3239 Here, the @code{std::move} call is redundant. Because G++ implements Core
3240 Issue 1579, another example is:
3241
3242 @smallexample
3243 struct T @{ // convertible to U
3244 @dots{}
3245 @};
3246 struct U @{
3247 @dots{}
3248 @};
3249 U fn()
3250 @{
3251 T t;
3252 @dots{}
3253 return std::move (t);
3254 @}
3255 @end smallexample
3256 In this example, copy elision isn't applicable because the type of the
3257 expression being returned and the function return type differ, yet G++
3258 treats the return value as if it were designated by an rvalue.
3259
3260 This warning is enabled by @option{-Wextra}.
3261
3262 @item -Wredundant-tags @r{(C++ and Objective-C++ only)}
3263 @opindex Wredundant-tags
3264 @opindex Wno-redundant-tags
3265 Warn about redundant class-key and enum-key in references to class types
3266 and enumerated types in contexts where the key can be eliminated without
3267 causing an ambiguity. For example:
3268
3269 @smallexample
3270 struct foo;
3271 struct foo *p; // warn that keyword struct can be eliminated
3272 @end smallexample
3273
3274 @noindent
3275 On the other hand, in this example there is no warning:
3276
3277 @smallexample
3278 struct foo;
3279 void foo (); // "hides" struct foo
3280 void bar (struct foo&); // no warning, keyword struct is necessary
3281 @end smallexample
3282
3283 @item -Wno-subobject-linkage @r{(C++ and Objective-C++ only)}
3284 @opindex Wsubobject-linkage
3285 @opindex Wno-subobject-linkage
3286 Do not warn
3287 if a class type has a base or a field whose type uses the anonymous
3288 namespace or depends on a type with no linkage. If a type A depends on
3289 a type B with no or internal linkage, defining it in multiple
3290 translation units would be an ODR violation because the meaning of B
3291 is different in each translation unit. If A only appears in a single
3292 translation unit, the best way to silence the warning is to give it
3293 internal linkage by putting it in an anonymous namespace as well. The
3294 compiler doesn't give this warning for types defined in the main .C
3295 file, as those are unlikely to have multiple definitions.
3296 @option{-Wsubobject-linkage} is enabled by default.
3297
3298 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3299 @opindex Weffc++
3300 @opindex Wno-effc++
3301 Warn about violations of the following style guidelines from Scott Meyers'
3302 @cite{Effective C++} series of books:
3303
3304 @itemize @bullet
3305 @item
3306 Define a copy constructor and an assignment operator for classes
3307 with dynamically-allocated memory.
3308
3309 @item
3310 Prefer initialization to assignment in constructors.
3311
3312 @item
3313 Have @code{operator=} return a reference to @code{*this}.
3314
3315 @item
3316 Don't try to return a reference when you must return an object.
3317
3318 @item
3319 Distinguish between prefix and postfix forms of increment and
3320 decrement operators.
3321
3322 @item
3323 Never overload @code{&&}, @code{||}, or @code{,}.
3324
3325 @end itemize
3326
3327 This option also enables @option{-Wnon-virtual-dtor}, which is also
3328 one of the effective C++ recommendations. However, the check is
3329 extended to warn about the lack of virtual destructor in accessible
3330 non-polymorphic bases classes too.
3331
3332 When selecting this option, be aware that the standard library
3333 headers do not obey all of these guidelines; use @samp{grep -v}
3334 to filter out those warnings.
3335
3336 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3337 @opindex Wstrict-null-sentinel
3338 @opindex Wno-strict-null-sentinel
3339 Warn about the use of an uncasted @code{NULL} as sentinel. When
3340 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3341 to @code{__null}. Although it is a null pointer constant rather than a
3342 null pointer, it is guaranteed to be of the same size as a pointer.
3343 But this use is not portable across different compilers.
3344
3345 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3346 @opindex Wno-non-template-friend
3347 @opindex Wnon-template-friend
3348 Disable warnings when non-template friend functions are declared
3349 within a template. In very old versions of GCC that predate implementation
3350 of the ISO standard, declarations such as
3351 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3352 could be interpreted as a particular specialization of a template
3353 function; the warning exists to diagnose compatibility problems,
3354 and is enabled by default.
3355
3356 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3357 @opindex Wold-style-cast
3358 @opindex Wno-old-style-cast
3359 Warn if an old-style (C-style) cast to a non-void type is used within
3360 a C++ program. The new-style casts (@code{dynamic_cast},
3361 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3362 less vulnerable to unintended effects and much easier to search for.
3363
3364 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3365 @opindex Woverloaded-virtual
3366 @opindex Wno-overloaded-virtual
3367 @cindex overloaded virtual function, warning
3368 @cindex warning for overloaded virtual function
3369 Warn when a function declaration hides virtual functions from a
3370 base class. For example, in:
3371
3372 @smallexample
3373 struct A @{
3374 virtual void f();
3375 @};
3376
3377 struct B: public A @{
3378 void f(int);
3379 @};
3380 @end smallexample
3381
3382 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3383 like:
3384
3385 @smallexample
3386 B* b;
3387 b->f();
3388 @end smallexample
3389
3390 @noindent
3391 fails to compile.
3392
3393 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3394 @opindex Wno-pmf-conversions
3395 @opindex Wpmf-conversions
3396 Disable the diagnostic for converting a bound pointer to member function
3397 to a plain pointer.
3398
3399 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3400 @opindex Wsign-promo
3401 @opindex Wno-sign-promo
3402 Warn when overload resolution chooses a promotion from unsigned or
3403 enumerated type to a signed type, over a conversion to an unsigned type of
3404 the same size. Previous versions of G++ tried to preserve
3405 unsignedness, but the standard mandates the current behavior.
3406
3407 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3408 @opindex Wtemplates
3409 @opindex Wno-templates
3410 Warn when a primary template declaration is encountered. Some coding
3411 rules disallow templates, and this may be used to enforce that rule.
3412 The warning is inactive inside a system header file, such as the STL, so
3413 one can still use the STL. One may also instantiate or specialize
3414 templates.
3415
3416 @item -Wmismatched-tags @r{(C++ and Objective-C++ only)}
3417 @opindex Wmismatched-tags
3418 @opindex Wno-mismatched-tags
3419 Warn for declarations of structs, classes, and class templates and their
3420 specializations with a class-key that does not match either the definition
3421 or the first declaration if no definition is provided.
3422
3423 For example, the declaration of @code{struct Object} in the argument list
3424 of @code{draw} triggers the warning. To avoid it, either remove the redundant
3425 class-key @code{struct} or replace it with @code{class} to match its definition.
3426 @smallexample
3427 class Object @{
3428 public:
3429 virtual ~Object () = 0;
3430 @};
3431 void draw (struct Object*);
3432 @end smallexample
3433
3434 It is not wrong to declare a class with the class-key @code{struct} as
3435 the example above shows. The @option{-Wmismatched-tags} option is intended
3436 to help achieve a consistent style of class declarations. In code that is
3437 intended to be portable to Windows-based compilers the warning helps prevent
3438 unresolved references due to the difference in the mangling of symbols
3439 declared with different class-keys. The option can be used either on its
3440 own or in conjunction with @option{-Wredundant-tags}.
3441
3442 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3443 @opindex Wmultiple-inheritance
3444 @opindex Wno-multiple-inheritance
3445 Warn when a class is defined with multiple direct base classes. Some
3446 coding rules disallow multiple inheritance, and this may be used to
3447 enforce that rule. The warning is inactive inside a system header file,
3448 such as the STL, so one can still use the STL. One may also define
3449 classes that indirectly use multiple inheritance.
3450
3451 @item -Wvirtual-inheritance
3452 @opindex Wvirtual-inheritance
3453 @opindex Wno-virtual-inheritance
3454 Warn when a class is defined with a virtual direct base class. Some
3455 coding rules disallow multiple inheritance, and this may be used to
3456 enforce that rule. The warning is inactive inside a system header file,
3457 such as the STL, so one can still use the STL. One may also define
3458 classes that indirectly use virtual inheritance.
3459
3460 @item -Wno-virtual-move-assign
3461 @opindex Wvirtual-move-assign
3462 @opindex Wno-virtual-move-assign
3463 Suppress warnings about inheriting from a virtual base with a
3464 non-trivial C++11 move assignment operator. This is dangerous because
3465 if the virtual base is reachable along more than one path, it is
3466 moved multiple times, which can mean both objects end up in the
3467 moved-from state. If the move assignment operator is written to avoid
3468 moving from a moved-from object, this warning can be disabled.
3469
3470 @item -Wnamespaces
3471 @opindex Wnamespaces
3472 @opindex Wno-namespaces
3473 Warn when a namespace definition is opened. Some coding rules disallow
3474 namespaces, and this may be used to enforce that rule. The warning is
3475 inactive inside a system header file, such as the STL, so one can still
3476 use the STL. One may also use using directives and qualified names.
3477
3478 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3479 @opindex Wterminate
3480 @opindex Wno-terminate
3481 Disable the warning about a throw-expression that will immediately
3482 result in a call to @code{terminate}.
3483
3484 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3485 @opindex Wno-class-conversion
3486 @opindex Wclass-conversion
3487 Do not warn when a conversion function converts an
3488 object to the same type, to a base class of that type, or to void; such
3489 a conversion function will never be called.
3490
3491 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3492 @opindex Wvolatile
3493 @opindex Wno-volatile
3494 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3495 postfix and prefix @code{++} and @code{--} expressions of
3496 @code{volatile}-qualified types, using simple assignments where the left
3497 operand is a @code{volatile}-qualified non-class type for their value,
3498 compound assignments where the left operand is a @code{volatile}-qualified
3499 non-class type, @code{volatile}-qualified function return type,
3500 @code{volatile}-qualified parameter type, and structured bindings of a
3501 @code{volatile}-qualified type. This usage was deprecated in C++20.
3502
3503 Enabled by default with @option{-std=c++2a}.
3504
3505 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
3506 @opindex Wzero-as-null-pointer-constant
3507 @opindex Wno-zero-as-null-pointer-constant
3508 Warn when a literal @samp{0} is used as null pointer constant. This can
3509 be useful to facilitate the conversion to @code{nullptr} in C++11.
3510
3511 @item -Waligned-new
3512 @opindex Waligned-new
3513 @opindex Wno-aligned-new
3514 Warn about a new-expression of a type that requires greater alignment
3515 than the @code{alignof(std::max_align_t)} but uses an allocation
3516 function without an explicit alignment parameter. This option is
3517 enabled by @option{-Wall}.
3518
3519 Normally this only warns about global allocation functions, but
3520 @option{-Waligned-new=all} also warns about class member allocation
3521 functions.
3522
3523 @item -Wno-placement-new
3524 @itemx -Wplacement-new=@var{n}
3525 @opindex Wplacement-new
3526 @opindex Wno-placement-new
3527 Warn about placement new expressions with undefined behavior, such as
3528 constructing an object in a buffer that is smaller than the type of
3529 the object. For example, the placement new expression below is diagnosed
3530 because it attempts to construct an array of 64 integers in a buffer only
3531 64 bytes large.
3532 @smallexample
3533 char buf [64];
3534 new (buf) int[64];
3535 @end smallexample
3536 This warning is enabled by default.
3537
3538 @table @gcctabopt
3539 @item -Wplacement-new=1
3540 This is the default warning level of @option{-Wplacement-new}. At this
3541 level the warning is not issued for some strictly undefined constructs that
3542 GCC allows as extensions for compatibility with legacy code. For example,
3543 the following @code{new} expression is not diagnosed at this level even
3544 though it has undefined behavior according to the C++ standard because
3545 it writes past the end of the one-element array.
3546 @smallexample
3547 struct S @{ int n, a[1]; @};
3548 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
3549 new (s->a)int [32]();
3550 @end smallexample
3551
3552 @item -Wplacement-new=2
3553 At this level, in addition to diagnosing all the same constructs as at level
3554 1, a diagnostic is also issued for placement new expressions that construct
3555 an object in the last member of structure whose type is an array of a single
3556 element and whose size is less than the size of the object being constructed.
3557 While the previous example would be diagnosed, the following construct makes
3558 use of the flexible member array extension to avoid the warning at level 2.
3559 @smallexample
3560 struct S @{ int n, a[]; @};
3561 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
3562 new (s->a)int [32]();
3563 @end smallexample
3564
3565 @end table
3566
3567 @item -Wcatch-value
3568 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
3569 @opindex Wcatch-value
3570 @opindex Wno-catch-value
3571 Warn about catch handlers that do not catch via reference.
3572 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
3573 warn about polymorphic class types that are caught by value.
3574 With @option{-Wcatch-value=2} warn about all class types that are caught
3575 by value. With @option{-Wcatch-value=3} warn about all types that are
3576 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
3577
3578 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
3579 @opindex Wconditionally-supported
3580 @opindex Wno-conditionally-supported
3581 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
3582
3583 @item -Wno-delete-incomplete @r{(C++ and Objective-C++ only)}
3584 @opindex Wdelete-incomplete
3585 @opindex Wno-delete-incomplete
3586 Do not warn when deleting a pointer to incomplete type, which may cause
3587 undefined behavior at runtime. This warning is enabled by default.
3588
3589 @item -Wextra-semi @r{(C++, Objective-C++ only)}
3590 @opindex Wextra-semi
3591 @opindex Wno-extra-semi
3592 Warn about redundant semicolons after in-class function definitions.
3593
3594 @item -Wno-inaccessible-base @r{(C++, Objective-C++ only)}
3595 @opindex Winaccessible-base
3596 @opindex Wno-inaccessible-base
3597 This option controls warnings
3598 when a base class is inaccessible in a class derived from it due to
3599 ambiguity. The warning is enabled by default.
3600 Note that the warning for ambiguous virtual
3601 bases is enabled by the @option{-Wextra} option.
3602 @smallexample
3603 @group
3604 struct A @{ int a; @};
3605
3606 struct B : A @{ @};
3607
3608 struct C : B, A @{ @};
3609 @end group
3610 @end smallexample
3611
3612 @item -Wno-inherited-variadic-ctor
3613 @opindex Winherited-variadic-ctor
3614 @opindex Wno-inherited-variadic-ctor
3615 Suppress warnings about use of C++11 inheriting constructors when the
3616 base class inherited from has a C variadic constructor; the warning is
3617 on by default because the ellipsis is not inherited.
3618
3619 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
3620 @opindex Wno-invalid-offsetof
3621 @opindex Winvalid-offsetof
3622 Suppress warnings from applying the @code{offsetof} macro to a non-POD
3623 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
3624 to a non-standard-layout type is undefined. In existing C++ implementations,
3625 however, @code{offsetof} typically gives meaningful results.
3626 This flag is for users who are aware that they are
3627 writing nonportable code and who have deliberately chosen to ignore the
3628 warning about it.
3629
3630 The restrictions on @code{offsetof} may be relaxed in a future version
3631 of the C++ standard.
3632
3633 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
3634 @opindex Wsized-deallocation
3635 @opindex Wno-sized-deallocation
3636 Warn about a definition of an unsized deallocation function
3637 @smallexample
3638 void operator delete (void *) noexcept;
3639 void operator delete[] (void *) noexcept;
3640 @end smallexample
3641 without a definition of the corresponding sized deallocation function
3642 @smallexample
3643 void operator delete (void *, std::size_t) noexcept;
3644 void operator delete[] (void *, std::size_t) noexcept;
3645 @end smallexample
3646 or vice versa. Enabled by @option{-Wextra} along with
3647 @option{-fsized-deallocation}.
3648
3649 @item -Wsuggest-final-types
3650 @opindex Wno-suggest-final-types
3651 @opindex Wsuggest-final-types
3652 Warn about types with virtual methods where code quality would be improved
3653 if the type were declared with the C++11 @code{final} specifier,
3654 or, if possible,
3655 declared in an anonymous namespace. This allows GCC to more aggressively
3656 devirtualize the polymorphic calls. This warning is more effective with
3657 link-time optimization,
3658 where the information about the class hierarchy graph is
3659 more complete.
3660
3661 @item -Wsuggest-final-methods
3662 @opindex Wno-suggest-final-methods
3663 @opindex Wsuggest-final-methods
3664 Warn about virtual methods where code quality would be improved if the method
3665 were declared with the C++11 @code{final} specifier,
3666 or, if possible, its type were
3667 declared in an anonymous namespace or with the @code{final} specifier.
3668 This warning is
3669 more effective with link-time optimization, where the information about the
3670 class hierarchy graph is more complete. It is recommended to first consider
3671 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
3672 annotations.
3673
3674 @item -Wsuggest-override
3675 @opindex Wsuggest-override
3676 @opindex Wno-suggest-override
3677 Warn about overriding virtual functions that are not marked with the
3678 @code{override} keyword.
3679
3680 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
3681 @opindex Wuseless-cast
3682 @opindex Wno-useless-cast
3683 Warn when an expression is casted to its own type.
3684
3685 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
3686 @opindex Wconversion-null
3687 @opindex Wno-conversion-null
3688 Do not warn for conversions between @code{NULL} and non-pointer
3689 types. @option{-Wconversion-null} is enabled by default.
3690
3691 @end table
3692
3693 @node Objective-C and Objective-C++ Dialect Options
3694 @section Options Controlling Objective-C and Objective-C++ Dialects
3695
3696 @cindex compiler options, Objective-C and Objective-C++
3697 @cindex Objective-C and Objective-C++ options, command-line
3698 @cindex options, Objective-C and Objective-C++
3699 (NOTE: This manual does not describe the Objective-C and Objective-C++
3700 languages themselves. @xref{Standards,,Language Standards
3701 Supported by GCC}, for references.)
3702
3703 This section describes the command-line options that are only meaningful
3704 for Objective-C and Objective-C++ programs. You can also use most of
3705 the language-independent GNU compiler options.
3706 For example, you might compile a file @file{some_class.m} like this:
3707
3708 @smallexample
3709 gcc -g -fgnu-runtime -O -c some_class.m
3710 @end smallexample
3711
3712 @noindent
3713 In this example, @option{-fgnu-runtime} is an option meant only for
3714 Objective-C and Objective-C++ programs; you can use the other options with
3715 any language supported by GCC@.
3716
3717 Note that since Objective-C is an extension of the C language, Objective-C
3718 compilations may also use options specific to the C front-end (e.g.,
3719 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3720 C++-specific options (e.g., @option{-Wabi}).
3721
3722 Here is a list of options that are @emph{only} for compiling Objective-C
3723 and Objective-C++ programs:
3724
3725 @table @gcctabopt
3726 @item -fconstant-string-class=@var{class-name}
3727 @opindex fconstant-string-class
3728 Use @var{class-name} as the name of the class to instantiate for each
3729 literal string specified with the syntax @code{@@"@dots{}"}. The default
3730 class name is @code{NXConstantString} if the GNU runtime is being used, and
3731 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3732 @option{-fconstant-cfstrings} option, if also present, overrides the
3733 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3734 to be laid out as constant CoreFoundation strings.
3735
3736 @item -fgnu-runtime
3737 @opindex fgnu-runtime
3738 Generate object code compatible with the standard GNU Objective-C
3739 runtime. This is the default for most types of systems.
3740
3741 @item -fnext-runtime
3742 @opindex fnext-runtime
3743 Generate output compatible with the NeXT runtime. This is the default
3744 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3745 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3746 used.
3747
3748 @item -fno-nil-receivers
3749 @opindex fno-nil-receivers
3750 @opindex fnil-receivers
3751 Assume that all Objective-C message dispatches (@code{[receiver
3752 message:arg]}) in this translation unit ensure that the receiver is
3753 not @code{nil}. This allows for more efficient entry points in the
3754 runtime to be used. This option is only available in conjunction with
3755 the NeXT runtime and ABI version 0 or 1.
3756
3757 @item -fobjc-abi-version=@var{n}
3758 @opindex fobjc-abi-version
3759 Use version @var{n} of the Objective-C ABI for the selected runtime.
3760 This option is currently supported only for the NeXT runtime. In that
3761 case, Version 0 is the traditional (32-bit) ABI without support for
3762 properties and other Objective-C 2.0 additions. Version 1 is the
3763 traditional (32-bit) ABI with support for properties and other
3764 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3765 nothing is specified, the default is Version 0 on 32-bit target
3766 machines, and Version 2 on 64-bit target machines.
3767
3768 @item -fobjc-call-cxx-cdtors
3769 @opindex fobjc-call-cxx-cdtors
3770 For each Objective-C class, check if any of its instance variables is a
3771 C++ object with a non-trivial default constructor. If so, synthesize a
3772 special @code{- (id) .cxx_construct} instance method which runs
3773 non-trivial default constructors on any such instance variables, in order,
3774 and then return @code{self}. Similarly, check if any instance variable
3775 is a C++ object with a non-trivial destructor, and if so, synthesize a
3776 special @code{- (void) .cxx_destruct} method which runs
3777 all such default destructors, in reverse order.
3778
3779 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3780 methods thusly generated only operate on instance variables
3781 declared in the current Objective-C class, and not those inherited
3782 from superclasses. It is the responsibility of the Objective-C
3783 runtime to invoke all such methods in an object's inheritance
3784 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3785 by the runtime immediately after a new object instance is allocated;
3786 the @code{- (void) .cxx_destruct} methods are invoked immediately
3787 before the runtime deallocates an object instance.
3788
3789 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3790 support for invoking the @code{- (id) .cxx_construct} and
3791 @code{- (void) .cxx_destruct} methods.
3792
3793 @item -fobjc-direct-dispatch
3794 @opindex fobjc-direct-dispatch
3795 Allow fast jumps to the message dispatcher. On Darwin this is
3796 accomplished via the comm page.
3797
3798 @item -fobjc-exceptions
3799 @opindex fobjc-exceptions
3800 Enable syntactic support for structured exception handling in
3801 Objective-C, similar to what is offered by C++. This option
3802 is required to use the Objective-C keywords @code{@@try},
3803 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3804 @code{@@synchronized}. This option is available with both the GNU
3805 runtime and the NeXT runtime (but not available in conjunction with
3806 the NeXT runtime on Mac OS X 10.2 and earlier).
3807
3808 @item -fobjc-gc
3809 @opindex fobjc-gc
3810 Enable garbage collection (GC) in Objective-C and Objective-C++
3811 programs. This option is only available with the NeXT runtime; the
3812 GNU runtime has a different garbage collection implementation that
3813 does not require special compiler flags.
3814
3815 @item -fobjc-nilcheck
3816 @opindex fobjc-nilcheck
3817 For the NeXT runtime with version 2 of the ABI, check for a nil
3818 receiver in method invocations before doing the actual method call.
3819 This is the default and can be disabled using
3820 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3821 checked for nil in this way no matter what this flag is set to.
3822 Currently this flag does nothing when the GNU runtime, or an older
3823 version of the NeXT runtime ABI, is used.
3824
3825 @item -fobjc-std=objc1
3826 @opindex fobjc-std
3827 Conform to the language syntax of Objective-C 1.0, the language
3828 recognized by GCC 4.0. This only affects the Objective-C additions to
3829 the C/C++ language; it does not affect conformance to C/C++ standards,
3830 which is controlled by the separate C/C++ dialect option flags. When
3831 this option is used with the Objective-C or Objective-C++ compiler,
3832 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3833 This is useful if you need to make sure that your Objective-C code can
3834 be compiled with older versions of GCC@.
3835
3836 @item -freplace-objc-classes
3837 @opindex freplace-objc-classes
3838 Emit a special marker instructing @command{ld(1)} not to statically link in
3839 the resulting object file, and allow @command{dyld(1)} to load it in at
3840 run time instead. This is used in conjunction with the Fix-and-Continue
3841 debugging mode, where the object file in question may be recompiled and
3842 dynamically reloaded in the course of program execution, without the need
3843 to restart the program itself. Currently, Fix-and-Continue functionality
3844 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3845 and later.
3846
3847 @item -fzero-link
3848 @opindex fzero-link
3849 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3850 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3851 compile time) with static class references that get initialized at load time,
3852 which improves run-time performance. Specifying the @option{-fzero-link} flag
3853 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3854 to be retained. This is useful in Zero-Link debugging mode, since it allows
3855 for individual class implementations to be modified during program execution.
3856 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3857 regardless of command-line options.
3858
3859 @item -fno-local-ivars
3860 @opindex fno-local-ivars
3861 @opindex flocal-ivars
3862 By default instance variables in Objective-C can be accessed as if
3863 they were local variables from within the methods of the class they're
3864 declared in. This can lead to shadowing between instance variables
3865 and other variables declared either locally inside a class method or
3866 globally with the same name. Specifying the @option{-fno-local-ivars}
3867 flag disables this behavior thus avoiding variable shadowing issues.
3868
3869 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3870 @opindex fivar-visibility
3871 Set the default instance variable visibility to the specified option
3872 so that instance variables declared outside the scope of any access
3873 modifier directives default to the specified visibility.
3874
3875 @item -gen-decls
3876 @opindex gen-decls
3877 Dump interface declarations for all classes seen in the source file to a
3878 file named @file{@var{sourcename}.decl}.
3879
3880 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3881 @opindex Wassign-intercept
3882 @opindex Wno-assign-intercept
3883 Warn whenever an Objective-C assignment is being intercepted by the
3884 garbage collector.
3885
3886 @item -Wno-property-assign-default @r{(Objective-C and Objective-C++ only)}
3887 @opindex Wproperty-assign-default
3888 @opindex Wno-property-assign-default
3889 Do not warn if a property for an Objective-C object has no assign
3890 semantics specified.
3891
3892 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3893 @opindex Wno-protocol
3894 @opindex Wprotocol
3895 If a class is declared to implement a protocol, a warning is issued for
3896 every method in the protocol that is not implemented by the class. The
3897 default behavior is to issue a warning for every method not explicitly
3898 implemented in the class, even if a method implementation is inherited
3899 from the superclass. If you use the @option{-Wno-protocol} option, then
3900 methods inherited from the superclass are considered to be implemented,
3901 and no warning is issued for them.
3902
3903 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3904 @opindex Wselector
3905 @opindex Wno-selector
3906 Warn if multiple methods of different types for the same selector are
3907 found during compilation. The check is performed on the list of methods
3908 in the final stage of compilation. Additionally, a check is performed
3909 for each selector appearing in a @code{@@selector(@dots{})}
3910 expression, and a corresponding method for that selector has been found
3911 during compilation. Because these checks scan the method table only at
3912 the end of compilation, these warnings are not produced if the final
3913 stage of compilation is not reached, for example because an error is
3914 found during compilation, or because the @option{-fsyntax-only} option is
3915 being used.
3916
3917 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3918 @opindex Wstrict-selector-match
3919 @opindex Wno-strict-selector-match
3920 Warn if multiple methods with differing argument and/or return types are
3921 found for a given selector when attempting to send a message using this
3922 selector to a receiver of type @code{id} or @code{Class}. When this flag
3923 is off (which is the default behavior), the compiler omits such warnings
3924 if any differences found are confined to types that share the same size
3925 and alignment.
3926
3927 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3928 @opindex Wundeclared-selector
3929 @opindex Wno-undeclared-selector
3930 Warn if a @code{@@selector(@dots{})} expression referring to an
3931 undeclared selector is found. A selector is considered undeclared if no
3932 method with that name has been declared before the
3933 @code{@@selector(@dots{})} expression, either explicitly in an
3934 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3935 an @code{@@implementation} section. This option always performs its
3936 checks as soon as a @code{@@selector(@dots{})} expression is found,
3937 while @option{-Wselector} only performs its checks in the final stage of
3938 compilation. This also enforces the coding style convention
3939 that methods and selectors must be declared before being used.
3940
3941 @item -print-objc-runtime-info
3942 @opindex print-objc-runtime-info
3943 Generate C header describing the largest structure that is passed by
3944 value, if any.
3945
3946 @end table
3947
3948 @node Diagnostic Message Formatting Options
3949 @section Options to Control Diagnostic Messages Formatting
3950 @cindex options to control diagnostics formatting
3951 @cindex diagnostic messages
3952 @cindex message formatting
3953
3954 Traditionally, diagnostic messages have been formatted irrespective of
3955 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3956 options described below
3957 to control the formatting algorithm for diagnostic messages,
3958 e.g.@: how many characters per line, how often source location
3959 information should be reported. Note that some language front ends may not
3960 honor these options.
3961
3962 @table @gcctabopt
3963 @item -fmessage-length=@var{n}
3964 @opindex fmessage-length
3965 Try to format error messages so that they fit on lines of about
3966 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3967 done; each error message appears on a single line. This is the
3968 default for all front ends.
3969
3970 Note - this option also affects the display of the @samp{#error} and
3971 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3972 function/type/variable attribute. It does not however affect the
3973 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3974
3975 @item -fdiagnostics-show-location=once
3976 @opindex fdiagnostics-show-location
3977 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3978 reporter to emit source location information @emph{once}; that is, in
3979 case the message is too long to fit on a single physical line and has to
3980 be wrapped, the source location won't be emitted (as prefix) again,
3981 over and over, in subsequent continuation lines. This is the default
3982 behavior.
3983
3984 @item -fdiagnostics-show-location=every-line
3985 Only meaningful in line-wrapping mode. Instructs the diagnostic
3986 messages reporter to emit the same source location information (as
3987 prefix) for physical lines that result from the process of breaking
3988 a message which is too long to fit on a single line.
3989
3990 @item -fdiagnostics-color[=@var{WHEN}]
3991 @itemx -fno-diagnostics-color
3992 @opindex fdiagnostics-color
3993 @cindex highlight, color
3994 @vindex GCC_COLORS @r{environment variable}
3995 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3996 or @samp{auto}. The default depends on how the compiler has been configured,
3997 it can be any of the above @var{WHEN} options or also @samp{never}
3998 if @env{GCC_COLORS} environment variable isn't present in the environment,
3999 and @samp{auto} otherwise.
4000 @samp{auto} makes GCC use color only when the standard error is a terminal,
4001 and when not executing in an emacs shell.
4002 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
4003 aliases for @option{-fdiagnostics-color=always} and
4004 @option{-fdiagnostics-color=never}, respectively.
4005
4006 The colors are defined by the environment variable @env{GCC_COLORS}.
4007 Its value is a colon-separated list of capabilities and Select Graphic
4008 Rendition (SGR) substrings. SGR commands are interpreted by the
4009 terminal or terminal emulator. (See the section in the documentation
4010 of your text terminal for permitted values and their meanings as
4011 character attributes.) These substring values are integers in decimal
4012 representation and can be concatenated with semicolons.
4013 Common values to concatenate include
4014 @samp{1} for bold,
4015 @samp{4} for underline,
4016 @samp{5} for blink,
4017 @samp{7} for inverse,
4018 @samp{39} for default foreground color,
4019 @samp{30} to @samp{37} for foreground colors,
4020 @samp{90} to @samp{97} for 16-color mode foreground colors,
4021 @samp{38;5;0} to @samp{38;5;255}
4022 for 88-color and 256-color modes foreground colors,
4023 @samp{49} for default background color,
4024 @samp{40} to @samp{47} for background colors,
4025 @samp{100} to @samp{107} for 16-color mode background colors,
4026 and @samp{48;5;0} to @samp{48;5;255}
4027 for 88-color and 256-color modes background colors.
4028
4029 The default @env{GCC_COLORS} is
4030 @smallexample
4031 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
4032 quote=01:path=01;36:fixit-insert=32:fixit-delete=31:\
4033 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
4034 type-diff=01;32
4035 @end smallexample
4036 @noindent
4037 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
4038 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
4039 @samp{01} is bold, and @samp{31} is red.
4040 Setting @env{GCC_COLORS} to the empty string disables colors.
4041 Supported capabilities are as follows.
4042
4043 @table @code
4044 @item error=
4045 @vindex error GCC_COLORS @r{capability}
4046 SGR substring for error: markers.
4047
4048 @item warning=
4049 @vindex warning GCC_COLORS @r{capability}
4050 SGR substring for warning: markers.
4051
4052 @item note=
4053 @vindex note GCC_COLORS @r{capability}
4054 SGR substring for note: markers.
4055
4056 @item path=
4057 @vindex path GCC_COLORS @r{capability}
4058 SGR substring for colorizing paths of control-flow events as printed
4059 via @option{-fdiagnostics-path-format=}, such as the identifiers of
4060 individual events and lines indicating interprocedural calls and returns.
4061
4062 @item range1=
4063 @vindex range1 GCC_COLORS @r{capability}
4064 SGR substring for first additional range.
4065
4066 @item range2=
4067 @vindex range2 GCC_COLORS @r{capability}
4068 SGR substring for second additional range.
4069
4070 @item locus=
4071 @vindex locus GCC_COLORS @r{capability}
4072 SGR substring for location information, @samp{file:line} or
4073 @samp{file:line:column} etc.
4074
4075 @item quote=
4076 @vindex quote GCC_COLORS @r{capability}
4077 SGR substring for information printed within quotes.
4078
4079 @item fixit-insert=
4080 @vindex fixit-insert GCC_COLORS @r{capability}
4081 SGR substring for fix-it hints suggesting text to
4082 be inserted or replaced.
4083
4084 @item fixit-delete=
4085 @vindex fixit-delete GCC_COLORS @r{capability}
4086 SGR substring for fix-it hints suggesting text to
4087 be deleted.
4088
4089 @item diff-filename=
4090 @vindex diff-filename GCC_COLORS @r{capability}
4091 SGR substring for filename headers within generated patches.
4092
4093 @item diff-hunk=
4094 @vindex diff-hunk GCC_COLORS @r{capability}
4095 SGR substring for the starts of hunks within generated patches.
4096
4097 @item diff-delete=
4098 @vindex diff-delete GCC_COLORS @r{capability}
4099 SGR substring for deleted lines within generated patches.
4100
4101 @item diff-insert=
4102 @vindex diff-insert GCC_COLORS @r{capability}
4103 SGR substring for inserted lines within generated patches.
4104
4105 @item type-diff=
4106 @vindex type-diff GCC_COLORS @r{capability}
4107 SGR substring for highlighting mismatching types within template
4108 arguments in the C++ frontend.
4109 @end table
4110
4111 @item -fdiagnostics-urls[=@var{WHEN}]
4112 @opindex fdiagnostics-urls
4113 @cindex urls
4114 @vindex GCC_URLS @r{environment variable}
4115 @vindex TERM_URLS @r{environment variable}
4116 Use escape sequences to embed URLs in diagnostics. For example, when
4117 @option{-fdiagnostics-show-option} emits text showing the command-line
4118 option controlling a diagnostic, embed a URL for documentation of that
4119 option.
4120
4121 @var{WHEN} is @samp{never}, @samp{always}, or @samp{auto}.
4122 @samp{auto} makes GCC use URL escape sequences only when the standard error
4123 is a terminal, and when not executing in an emacs shell or any graphical
4124 terminal which is known to be incompatible with this feature, see below.
4125
4126 The default depends on how the compiler has been configured.
4127 It can be any of the above @var{WHEN} options.
4128
4129 GCC can also be configured (via the
4130 @option{--with-diagnostics-urls=auto-if-env} configure-time option)
4131 so that the default is affected by environment variables.
4132 Under such a configuration, GCC defaults to using @samp{auto}
4133 if either @env{GCC_URLS} or @env{TERM_URLS} environment variables are
4134 present and non-empty in the environment of the compiler, or @samp{never}
4135 if neither are.
4136
4137 However, even with @option{-fdiagnostics-urls=always} the behavior is
4138 dependent on those environment variables:
4139 If @env{GCC_URLS} is set to empty or @samp{no}, do not embed URLs in
4140 diagnostics. If set to @samp{st}, URLs use ST escape sequences.
4141 If set to @samp{bel}, the default, URLs use BEL escape sequences.
4142 Any other non-empty value enables the feature.
4143 If @env{GCC_URLS} is not set, use @env{TERM_URLS} as a fallback.
4144 Note: ST is an ANSI escape sequence, string terminator @samp{ESC \},
4145 BEL is an ASCII character, CTRL-G that usually sounds like a beep.
4146
4147 At this time GCC tries to detect also a few terminals that are known to
4148 not implement the URL feature, and have bugs or at least had bugs in
4149 some versions that are still in use, where the URL escapes are likely
4150 to misbehave, i.e. print garbage on the screen.
4151 That list is currently xfce4-terminal, certain known to be buggy
4152 gnome-terminal versions, the linux console, and mingw.
4153 This check can be skipped with the @option{-fdiagnostics-urls=always}.
4154
4155 @item -fno-diagnostics-show-option
4156 @opindex fno-diagnostics-show-option
4157 @opindex fdiagnostics-show-option
4158 By default, each diagnostic emitted includes text indicating the
4159 command-line option that directly controls the diagnostic (if such an
4160 option is known to the diagnostic machinery). Specifying the
4161 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
4162
4163 @item -fno-diagnostics-show-caret
4164 @opindex fno-diagnostics-show-caret
4165 @opindex fdiagnostics-show-caret
4166 By default, each diagnostic emitted includes the original source line
4167 and a caret @samp{^} indicating the column. This option suppresses this
4168 information. The source line is truncated to @var{n} characters, if
4169 the @option{-fmessage-length=n} option is given. When the output is done
4170 to the terminal, the width is limited to the width given by the
4171 @env{COLUMNS} environment variable or, if not set, to the terminal width.
4172
4173 @item -fno-diagnostics-show-labels
4174 @opindex fno-diagnostics-show-labels
4175 @opindex fdiagnostics-show-labels
4176 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4177 diagnostics can label ranges of source code with pertinent information, such
4178 as the types of expressions:
4179
4180 @smallexample
4181 printf ("foo %s bar", long_i + long_j);
4182 ~^ ~~~~~~~~~~~~~~~
4183 | |
4184 char * long int
4185 @end smallexample
4186
4187 This option suppresses the printing of these labels (in the example above,
4188 the vertical bars and the ``char *'' and ``long int'' text).
4189
4190 @item -fno-diagnostics-show-cwe
4191 @opindex fno-diagnostics-show-cwe
4192 @opindex fdiagnostics-show-cwe
4193 Diagnostic messages can optionally have an associated
4194 @url{https://cwe.mitre.org/index.html, CWE} identifier.
4195 GCC itself only provides such metadata for some of the @option{-fanalyzer}
4196 diagnostics. GCC plugins may also provide diagnostics with such metadata.
4197 By default, if this information is present, it will be printed with
4198 the diagnostic. This option suppresses the printing of this metadata.
4199
4200 @item -fno-diagnostics-show-line-numbers
4201 @opindex fno-diagnostics-show-line-numbers
4202 @opindex fdiagnostics-show-line-numbers
4203 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
4204 a left margin is printed, showing line numbers. This option suppresses this
4205 left margin.
4206
4207 @item -fdiagnostics-minimum-margin-width=@var{width}
4208 @opindex fdiagnostics-minimum-margin-width
4209 This option controls the minimum width of the left margin printed by
4210 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
4211
4212 @item -fdiagnostics-parseable-fixits
4213 @opindex fdiagnostics-parseable-fixits
4214 Emit fix-it hints in a machine-parseable format, suitable for consumption
4215 by IDEs. For each fix-it, a line will be printed after the relevant
4216 diagnostic, starting with the string ``fix-it:''. For example:
4217
4218 @smallexample
4219 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
4220 @end smallexample
4221
4222 The location is expressed as a half-open range, expressed as a count of
4223 bytes, starting at byte 1 for the initial column. In the above example,
4224 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
4225 given string:
4226
4227 @smallexample
4228 00000000011111111112222222222
4229 12345678901234567890123456789
4230 gtk_widget_showall (dlg);
4231 ^^^^^^^^^^^^^^^^^^
4232 gtk_widget_show_all
4233 @end smallexample
4234
4235 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
4236 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
4237 (e.g. vertical tab as ``\013'').
4238
4239 An empty replacement string indicates that the given range is to be removed.
4240 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
4241 be inserted at the given position.
4242
4243 @item -fdiagnostics-generate-patch
4244 @opindex fdiagnostics-generate-patch
4245 Print fix-it hints to stderr in unified diff format, after any diagnostics
4246 are printed. For example:
4247
4248 @smallexample
4249 --- test.c
4250 +++ test.c
4251 @@ -42,5 +42,5 @@
4252
4253 void show_cb(GtkDialog *dlg)
4254 @{
4255 - gtk_widget_showall(dlg);
4256 + gtk_widget_show_all(dlg);
4257 @}
4258
4259 @end smallexample
4260
4261 The diff may or may not be colorized, following the same rules
4262 as for diagnostics (see @option{-fdiagnostics-color}).
4263
4264 @item -fdiagnostics-show-template-tree
4265 @opindex fdiagnostics-show-template-tree
4266
4267 In the C++ frontend, when printing diagnostics showing mismatching
4268 template types, such as:
4269
4270 @smallexample
4271 could not convert 'std::map<int, std::vector<double> >()'
4272 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4273 @end smallexample
4274
4275 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4276 tree-like structure showing the common and differing parts of the types,
4277 such as:
4278
4279 @smallexample
4280 map<
4281 [...],
4282 vector<
4283 [double != float]>>
4284 @end smallexample
4285
4286 The parts that differ are highlighted with color (``double'' and
4287 ``float'' in this case).
4288
4289 @item -fno-elide-type
4290 @opindex fno-elide-type
4291 @opindex felide-type
4292 By default when the C++ frontend prints diagnostics showing mismatching
4293 template types, common parts of the types are printed as ``[...]'' to
4294 simplify the error message. For example:
4295
4296 @smallexample
4297 could not convert 'std::map<int, std::vector<double> >()'
4298 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4299 @end smallexample
4300
4301 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4302 This flag also affects the output of the
4303 @option{-fdiagnostics-show-template-tree} flag.
4304
4305 @item -fdiagnostics-path-format=@var{KIND}
4306 @opindex fdiagnostics-path-format
4307 Specify how to print paths of control-flow events for diagnostics that
4308 have such a path associated with them.
4309
4310 @var{KIND} is @samp{none}, @samp{separate-events}, or @samp{inline-events},
4311 the default.
4312
4313 @samp{none} means to not print diagnostic paths.
4314
4315 @samp{separate-events} means to print a separate ``note'' diagnostic for
4316 each event within the diagnostic. For example:
4317
4318 @smallexample
4319 test.c:29:5: error: passing NULL as argument 1 to 'PyList_Append' which requires a non-NULL parameter
4320 test.c:25:10: note: (1) when 'PyList_New' fails, returning NULL
4321 test.c:27:3: note: (2) when 'i < count'
4322 test.c:29:5: note: (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4323 @end smallexample
4324
4325 @samp{inline-events} means to print the events ``inline'' within the source
4326 code. This view attempts to consolidate the events into runs of
4327 sufficiently-close events, printing them as labelled ranges within the source.
4328
4329 For example, the same events as above might be printed as:
4330
4331 @smallexample
4332 'test': events 1-3
4333 |
4334 | 25 | list = PyList_New(0);
4335 | | ^~~~~~~~~~~~~
4336 | | |
4337 | | (1) when 'PyList_New' fails, returning NULL
4338 | 26 |
4339 | 27 | for (i = 0; i < count; i++) @{
4340 | | ~~~
4341 | | |
4342 | | (2) when 'i < count'
4343 | 28 | item = PyLong_FromLong(random());
4344 | 29 | PyList_Append(list, item);
4345 | | ~~~~~~~~~~~~~~~~~~~~~~~~~
4346 | | |
4347 | | (3) when calling 'PyList_Append', passing NULL from (1) as argument 1
4348 |
4349 @end smallexample
4350
4351 Interprocedural control flow is shown by grouping the events by stack frame,
4352 and using indentation to show how stack frames are nested, pushed, and popped.
4353
4354 For example:
4355
4356 @smallexample
4357 'test': events 1-2
4358 |
4359 | 133 | @{
4360 | | ^
4361 | | |
4362 | | (1) entering 'test'
4363 | 134 | boxed_int *obj = make_boxed_int (i);
4364 | | ~~~~~~~~~~~~~~~~~~
4365 | | |
4366 | | (2) calling 'make_boxed_int'
4367 |
4368 +--> 'make_boxed_int': events 3-4
4369 |
4370 | 120 | @{
4371 | | ^
4372 | | |
4373 | | (3) entering 'make_boxed_int'
4374 | 121 | boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
4375 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4376 | | |
4377 | | (4) calling 'wrapped_malloc'
4378 |
4379 +--> 'wrapped_malloc': events 5-6
4380 |
4381 | 7 | @{
4382 | | ^
4383 | | |
4384 | | (5) entering 'wrapped_malloc'
4385 | 8 | return malloc (size);
4386 | | ~~~~~~~~~~~~~
4387 | | |
4388 | | (6) calling 'malloc'
4389 |
4390 <-------------+
4391 |
4392 'test': event 7
4393 |
4394 | 138 | free_boxed_int (obj);
4395 | | ^~~~~~~~~~~~~~~~~~~~
4396 | | |
4397 | | (7) calling 'free_boxed_int'
4398 |
4399 (etc)
4400 @end smallexample
4401
4402 @item -fdiagnostics-show-path-depths
4403 @opindex fdiagnostics-show-path-depths
4404 This option provides additional information when printing control-flow paths
4405 associated with a diagnostic.
4406
4407 If this is option is provided then the stack depth will be printed for
4408 each run of events within @option{-fdiagnostics-path-format=separate-events}.
4409
4410 This is intended for use by GCC developers and plugin developers when
4411 debugging diagnostics that report interprocedural control flow.
4412
4413 @item -fno-show-column
4414 @opindex fno-show-column
4415 @opindex fshow-column
4416 Do not print column numbers in diagnostics. This may be necessary if
4417 diagnostics are being scanned by a program that does not understand the
4418 column numbers, such as @command{dejagnu}.
4419
4420 @item -fdiagnostics-format=@var{FORMAT}
4421 @opindex fdiagnostics-format
4422 Select a different format for printing diagnostics.
4423 @var{FORMAT} is @samp{text} or @samp{json}.
4424 The default is @samp{text}.
4425
4426 The @samp{json} format consists of a top-level JSON array containing JSON
4427 objects representing the diagnostics.
4428
4429 The JSON is emitted as one line, without formatting; the examples below
4430 have been formatted for clarity.
4431
4432 Diagnostics can have child diagnostics. For example, this error and note:
4433
4434 @smallexample
4435 misleading-indentation.c:15:3: warning: this 'if' clause does not
4436 guard... [-Wmisleading-indentation]
4437 15 | if (flag)
4438 | ^~
4439 misleading-indentation.c:17:5: note: ...this statement, but the latter
4440 is misleadingly indented as if it were guarded by the 'if'
4441 17 | y = 2;
4442 | ^
4443 @end smallexample
4444
4445 @noindent
4446 might be printed in JSON form (after formatting) like this:
4447
4448 @smallexample
4449 [
4450 @{
4451 "kind": "warning",
4452 "locations": [
4453 @{
4454 "caret": @{
4455 "column": 3,
4456 "file": "misleading-indentation.c",
4457 "line": 15
4458 @},
4459 "finish": @{
4460 "column": 4,
4461 "file": "misleading-indentation.c",
4462 "line": 15
4463 @}
4464 @}
4465 ],
4466 "message": "this \u2018if\u2019 clause does not guard...",
4467 "option": "-Wmisleading-indentation",
4468 "option_url": "https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmisleading-indentation",
4469 "children": [
4470 @{
4471 "kind": "note",
4472 "locations": [
4473 @{
4474 "caret": @{
4475 "column": 5,
4476 "file": "misleading-indentation.c",
4477 "line": 17
4478 @}
4479 @}
4480 ],
4481 "message": "...this statement, but the latter is @dots{}"
4482 @}
4483 ]
4484 @},
4485 @dots{}
4486 ]
4487 @end smallexample
4488
4489 @noindent
4490 where the @code{note} is a child of the @code{warning}.
4491
4492 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4493 an @code{option} key describing the command-line option controlling the
4494 warning.
4495
4496 A diagnostic can contain zero or more locations. Each location has up
4497 to three positions within it: a @code{caret} position and optional
4498 @code{start} and @code{finish} positions. A location can also have
4499 an optional @code{label} string. For example, this error:
4500
4501 @smallexample
4502 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4503 'struct s'@} and 'T' @{aka 'struct t'@})
4504 64 | return callee_4a () + callee_4b ();
4505 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4506 | | |
4507 | | T @{aka struct t@}
4508 | S @{aka struct s@}
4509 @end smallexample
4510
4511 @noindent
4512 has three locations. Its primary location is at the ``+'' token at column
4513 23. It has two secondary locations, describing the left and right-hand sides
4514 of the expression, which have labels. It might be printed in JSON form as:
4515
4516 @smallexample
4517 @{
4518 "children": [],
4519 "kind": "error",
4520 "locations": [
4521 @{
4522 "caret": @{
4523 "column": 23, "file": "bad-binary-ops.c", "line": 64
4524 @}
4525 @},
4526 @{
4527 "caret": @{
4528 "column": 10, "file": "bad-binary-ops.c", "line": 64
4529 @},
4530 "finish": @{
4531 "column": 21, "file": "bad-binary-ops.c", "line": 64
4532 @},
4533 "label": "S @{aka struct s@}"
4534 @},
4535 @{
4536 "caret": @{
4537 "column": 25, "file": "bad-binary-ops.c", "line": 64
4538 @},
4539 "finish": @{
4540 "column": 36, "file": "bad-binary-ops.c", "line": 64
4541 @},
4542 "label": "T @{aka struct t@}"
4543 @}
4544 ],
4545 "message": "invalid operands to binary + @dots{}"
4546 @}
4547 @end smallexample
4548
4549 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4550 consisting of half-open intervals, similar to the output of
4551 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4552 with a replacement fix-it hint:
4553
4554 @smallexample
4555 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4556 mean 'color'?
4557 8 | return ptr->colour;
4558 | ^~~~~~
4559 | color
4560 @end smallexample
4561
4562 @noindent
4563 might be printed in JSON form as:
4564
4565 @smallexample
4566 @{
4567 "children": [],
4568 "fixits": [
4569 @{
4570 "next": @{
4571 "column": 21,
4572 "file": "demo.c",
4573 "line": 8
4574 @},
4575 "start": @{
4576 "column": 15,
4577 "file": "demo.c",
4578 "line": 8
4579 @},
4580 "string": "color"
4581 @}
4582 ],
4583 "kind": "error",
4584 "locations": [
4585 @{
4586 "caret": @{
4587 "column": 15,
4588 "file": "demo.c",
4589 "line": 8
4590 @},
4591 "finish": @{
4592 "column": 20,
4593 "file": "demo.c",
4594 "line": 8
4595 @}
4596 @}
4597 ],
4598 "message": "\u2018struct s\u2019 has no member named @dots{}"
4599 @}
4600 @end smallexample
4601
4602 @noindent
4603 where the fix-it hint suggests replacing the text from @code{start} up
4604 to but not including @code{next} with @code{string}'s value. Deletions
4605 are expressed via an empty value for @code{string}, insertions by
4606 having @code{start} equal @code{next}.
4607
4608 If the diagnostic has a path of control-flow events associated with it,
4609 it has a @code{path} array of objects representing the events. Each
4610 event object has a @code{description} string, a @code{location} object,
4611 along with a @code{function} string and a @code{depth} number for
4612 representing interprocedural paths. The @code{function} represents the
4613 current function at that event, and the @code{depth} represents the
4614 stack depth relative to some baseline: the higher, the more frames are
4615 within the stack.
4616
4617 For example, the intraprocedural example shown for
4618 @option{-fdiagnostics-path-format=} might have this JSON for its path:
4619
4620 @smallexample
4621 "path": [
4622 @{
4623 "depth": 0,
4624 "description": "when 'PyList_New' fails, returning NULL",
4625 "function": "test",
4626 "location": @{
4627 "column": 10,
4628 "file": "test.c",
4629 "line": 25
4630 @}
4631 @},
4632 @{
4633 "depth": 0,
4634 "description": "when 'i < count'",
4635 "function": "test",
4636 "location": @{
4637 "column": 3,
4638 "file": "test.c",
4639 "line": 27
4640 @}
4641 @},
4642 @{
4643 "depth": 0,
4644 "description": "when calling 'PyList_Append', passing NULL from (1) as argument 1",
4645 "function": "test",
4646 "location": @{
4647 "column": 5,
4648 "file": "test.c",
4649 "line": 29
4650 @}
4651 @}
4652 ]
4653 @end smallexample
4654
4655 @end table
4656
4657 @node Warning Options
4658 @section Options to Request or Suppress Warnings
4659 @cindex options to control warnings
4660 @cindex warning messages
4661 @cindex messages, warning
4662 @cindex suppressing warnings
4663
4664 Warnings are diagnostic messages that report constructions that
4665 are not inherently erroneous but that are risky or suggest there
4666 may have been an error.
4667
4668 The following language-independent options do not enable specific
4669 warnings but control the kinds of diagnostics produced by GCC@.
4670
4671 @table @gcctabopt
4672 @cindex syntax checking
4673 @item -fsyntax-only
4674 @opindex fsyntax-only
4675 Check the code for syntax errors, but don't do anything beyond that.
4676
4677 @item -fmax-errors=@var{n}
4678 @opindex fmax-errors
4679 Limits the maximum number of error messages to @var{n}, at which point
4680 GCC bails out rather than attempting to continue processing the source
4681 code. If @var{n} is 0 (the default), there is no limit on the number
4682 of error messages produced. If @option{-Wfatal-errors} is also
4683 specified, then @option{-Wfatal-errors} takes precedence over this
4684 option.
4685
4686 @item -w
4687 @opindex w
4688 Inhibit all warning messages.
4689
4690 @item -Werror
4691 @opindex Werror
4692 @opindex Wno-error
4693 Make all warnings into errors.
4694
4695 @item -Werror=
4696 @opindex Werror=
4697 @opindex Wno-error=
4698 Make the specified warning into an error. The specifier for a warning
4699 is appended; for example @option{-Werror=switch} turns the warnings
4700 controlled by @option{-Wswitch} into errors. This switch takes a
4701 negative form, to be used to negate @option{-Werror} for specific
4702 warnings; for example @option{-Wno-error=switch} makes
4703 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4704 is in effect.
4705
4706 The warning message for each controllable warning includes the
4707 option that controls the warning. That option can then be used with
4708 @option{-Werror=} and @option{-Wno-error=} as described above.
4709 (Printing of the option in the warning message can be disabled using the
4710 @option{-fno-diagnostics-show-option} flag.)
4711
4712 Note that specifying @option{-Werror=}@var{foo} automatically implies
4713 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4714 imply anything.
4715
4716 @item -Wfatal-errors
4717 @opindex Wfatal-errors
4718 @opindex Wno-fatal-errors
4719 This option causes the compiler to abort compilation on the first error
4720 occurred rather than trying to keep going and printing further error
4721 messages.
4722
4723 @end table
4724
4725 You can request many specific warnings with options beginning with
4726 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4727 implicit declarations. Each of these specific warning options also
4728 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4729 example, @option{-Wno-implicit}. This manual lists only one of the
4730 two forms, whichever is not the default. For further
4731 language-specific options also refer to @ref{C++ Dialect Options} and
4732 @ref{Objective-C and Objective-C++ Dialect Options}.
4733 Additional warnings can be produced by enabling the static analyzer;
4734 @xref{Static Analyzer Options}.
4735
4736 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4737 options, such as @option{-Wunused}, which may turn on further options,
4738 such as @option{-Wunused-value}. The combined effect of positive and
4739 negative forms is that more specific options have priority over less
4740 specific ones, independently of their position in the command-line. For
4741 options of the same specificity, the last one takes effect. Options
4742 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4743 as if they appeared at the end of the command-line.
4744
4745 When an unrecognized warning option is requested (e.g.,
4746 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4747 that the option is not recognized. However, if the @option{-Wno-} form
4748 is used, the behavior is slightly different: no diagnostic is
4749 produced for @option{-Wno-unknown-warning} unless other diagnostics
4750 are being produced. This allows the use of new @option{-Wno-} options
4751 with old compilers, but if something goes wrong, the compiler
4752 warns that an unrecognized option is present.
4753
4754 The effectiveness of some warnings depends on optimizations also being
4755 enabled. For example @option{-Wsuggest-final-types} is more effective
4756 with link-time optimization and @option{-Wmaybe-uninitialized} does not
4757 warn at all unless optimization is enabled.
4758
4759 @table @gcctabopt
4760 @item -Wpedantic
4761 @itemx -pedantic
4762 @opindex pedantic
4763 @opindex Wpedantic
4764 @opindex Wno-pedantic
4765 Issue all the warnings demanded by strict ISO C and ISO C++;
4766 reject all programs that use forbidden extensions, and some other
4767 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4768 version of the ISO C standard specified by any @option{-std} option used.
4769
4770 Valid ISO C and ISO C++ programs should compile properly with or without
4771 this option (though a rare few require @option{-ansi} or a
4772 @option{-std} option specifying the required version of ISO C)@. However,
4773 without this option, certain GNU extensions and traditional C and C++
4774 features are supported as well. With this option, they are rejected.
4775
4776 @option{-Wpedantic} does not cause warning messages for use of the
4777 alternate keywords whose names begin and end with @samp{__}. This alternate
4778 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4779 i.e. @samp{__intN__}.
4780 Pedantic warnings are also disabled in the expression that follows
4781 @code{__extension__}. However, only system header files should use
4782 these escape routes; application programs should avoid them.
4783 @xref{Alternate Keywords}.
4784
4785 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4786 C conformance. They soon find that it does not do quite what they want:
4787 it finds some non-ISO practices, but not all---only those for which
4788 ISO C @emph{requires} a diagnostic, and some others for which
4789 diagnostics have been added.
4790
4791 A feature to report any failure to conform to ISO C might be useful in
4792 some instances, but would require considerable additional work and would
4793 be quite different from @option{-Wpedantic}. We don't have plans to
4794 support such a feature in the near future.
4795
4796 Where the standard specified with @option{-std} represents a GNU
4797 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4798 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4799 extended dialect is based. Warnings from @option{-Wpedantic} are given
4800 where they are required by the base standard. (It does not make sense
4801 for such warnings to be given only for features not in the specified GNU
4802 C dialect, since by definition the GNU dialects of C include all
4803 features the compiler supports with the given option, and there would be
4804 nothing to warn about.)
4805
4806 @item -pedantic-errors
4807 @opindex pedantic-errors
4808 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4809 requires a diagnostic, in some cases where there is undefined behavior
4810 at compile-time and in some other cases that do not prevent compilation
4811 of programs that are valid according to the standard. This is not
4812 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4813 by this option and not enabled by the latter and vice versa.
4814
4815 @item -Wall
4816 @opindex Wall
4817 @opindex Wno-all
4818 This enables all the warnings about constructions that some users
4819 consider questionable, and that are easy to avoid (or modify to
4820 prevent the warning), even in conjunction with macros. This also
4821 enables some language-specific warnings described in @ref{C++ Dialect
4822 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4823
4824 @option{-Wall} turns on the following warning flags:
4825
4826 @gccoptlist{-Waddress @gol
4827 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4828 -Wbool-compare @gol
4829 -Wbool-operation @gol
4830 -Wc++11-compat -Wc++14-compat @gol
4831 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4832 -Wchar-subscripts @gol
4833 -Wcomment @gol
4834 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4835 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4836 -Wenum-conversion @r{in C/ObjC;} @gol
4837 -Wformat @gol
4838 -Wint-in-bool-context @gol
4839 -Wimplicit @r{(C and Objective-C only)} @gol
4840 -Wimplicit-int @r{(C and Objective-C only)} @gol
4841 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4842 -Winit-self @r{(only for C++)} @gol
4843 -Wzero-length-bounds @gol
4844 -Wlogical-not-parentheses @gol
4845 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4846 -Wmaybe-uninitialized @gol
4847 -Wmemset-elt-size @gol
4848 -Wmemset-transposed-args @gol
4849 -Wmisleading-indentation @r{(only for C/C++)} @gol
4850 -Wmissing-attributes @gol
4851 -Wmissing-braces @r{(only for C/ObjC)} @gol
4852 -Wmultistatement-macros @gol
4853 -Wnarrowing @r{(only for C++)} @gol
4854 -Wnonnull @gol
4855 -Wnonnull-compare @gol
4856 -Wopenmp-simd @gol
4857 -Wparentheses @gol
4858 -Wpessimizing-move @r{(only for C++)} @gol
4859 -Wpointer-sign @gol
4860 -Wreorder @gol
4861 -Wrestrict @gol
4862 -Wreturn-type @gol
4863 -Wsequence-point @gol
4864 -Wsign-compare @r{(only in C++)} @gol
4865 -Wsizeof-pointer-div @gol
4866 -Wsizeof-pointer-memaccess @gol
4867 -Wstrict-aliasing @gol
4868 -Wstrict-overflow=1 @gol
4869 -Wswitch @gol
4870 -Wtautological-compare @gol
4871 -Wtrigraphs @gol
4872 -Wuninitialized @gol
4873 -Wunknown-pragmas @gol
4874 -Wunused-function @gol
4875 -Wunused-label @gol
4876 -Wunused-value @gol
4877 -Wunused-variable @gol
4878 -Wvolatile-register-var}
4879
4880 Note that some warning flags are not implied by @option{-Wall}. Some of
4881 them warn about constructions that users generally do not consider
4882 questionable, but which occasionally you might wish to check for;
4883 others warn about constructions that are necessary or hard to avoid in
4884 some cases, and there is no simple way to modify the code to suppress
4885 the warning. Some of them are enabled by @option{-Wextra} but many of
4886 them must be enabled individually.
4887
4888 @item -Wextra
4889 @opindex W
4890 @opindex Wextra
4891 @opindex Wno-extra
4892 This enables some extra warning flags that are not enabled by
4893 @option{-Wall}. (This option used to be called @option{-W}. The older
4894 name is still supported, but the newer name is more descriptive.)
4895
4896 @gccoptlist{-Wclobbered @gol
4897 -Wcast-function-type @gol
4898 -Wdeprecated-copy @r{(C++ only)} @gol
4899 -Wempty-body @gol
4900 -Wignored-qualifiers @gol
4901 -Wimplicit-fallthrough=3 @gol
4902 -Wmissing-field-initializers @gol
4903 -Wmissing-parameter-type @r{(C only)} @gol
4904 -Wold-style-declaration @r{(C only)} @gol
4905 -Woverride-init @gol
4906 -Wsign-compare @r{(C only)} @gol
4907 -Wstring-compare @gol
4908 -Wredundant-move @r{(only for C++)} @gol
4909 -Wtype-limits @gol
4910 -Wuninitialized @gol
4911 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4912 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4913 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4914
4915
4916 The option @option{-Wextra} also prints warning messages for the
4917 following cases:
4918
4919 @itemize @bullet
4920
4921 @item
4922 A pointer is compared against integer zero with @code{<}, @code{<=},
4923 @code{>}, or @code{>=}.
4924
4925 @item
4926 (C++ only) An enumerator and a non-enumerator both appear in a
4927 conditional expression.
4928
4929 @item
4930 (C++ only) Ambiguous virtual bases.
4931
4932 @item
4933 (C++ only) Subscripting an array that has been declared @code{register}.
4934
4935 @item
4936 (C++ only) Taking the address of a variable that has been declared
4937 @code{register}.
4938
4939 @item
4940 (C++ only) A base class is not initialized in the copy constructor
4941 of a derived class.
4942
4943 @end itemize
4944
4945 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
4946 @opindex Wabi
4947 @opindex Wno-abi
4948
4949 Warn about code affected by ABI changes. This includes code that may
4950 not be compatible with the vendor-neutral C++ ABI as well as the psABI
4951 for the particular target.
4952
4953 Since G++ now defaults to updating the ABI with each major release,
4954 normally @option{-Wabi} warns only about C++ ABI compatibility
4955 problems if there is a check added later in a release series for an
4956 ABI issue discovered since the initial release. @option{-Wabi} warns
4957 about more things if an older ABI version is selected (with
4958 @option{-fabi-version=@var{n}}).
4959
4960 @option{-Wabi} can also be used with an explicit version number to
4961 warn about C++ ABI compatibility with a particular @option{-fabi-version}
4962 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
4963 @option{-fabi-version=2}.
4964
4965 If an explicit version number is provided and
4966 @option{-fabi-compat-version} is not specified, the version number
4967 from this option is used for compatibility aliases. If no explicit
4968 version number is provided with this option, but
4969 @option{-fabi-compat-version} is specified, that version number is
4970 used for C++ ABI warnings.
4971
4972 Although an effort has been made to warn about
4973 all such cases, there are probably some cases that are not warned about,
4974 even though G++ is generating incompatible code. There may also be
4975 cases where warnings are emitted even though the code that is generated
4976 is compatible.
4977
4978 You should rewrite your code to avoid these warnings if you are
4979 concerned about the fact that code generated by G++ may not be binary
4980 compatible with code generated by other compilers.
4981
4982 Known incompatibilities in @option{-fabi-version=2} (which was the
4983 default from GCC 3.4 to 4.9) include:
4984
4985 @itemize @bullet
4986
4987 @item
4988 A template with a non-type template parameter of reference type was
4989 mangled incorrectly:
4990 @smallexample
4991 extern int N;
4992 template <int &> struct S @{@};
4993 void n (S<N>) @{2@}
4994 @end smallexample
4995
4996 This was fixed in @option{-fabi-version=3}.
4997
4998 @item
4999 SIMD vector types declared using @code{__attribute ((vector_size))} were
5000 mangled in a non-standard way that does not allow for overloading of
5001 functions taking vectors of different sizes.
5002
5003 The mangling was changed in @option{-fabi-version=4}.
5004
5005 @item
5006 @code{__attribute ((const))} and @code{noreturn} were mangled as type
5007 qualifiers, and @code{decltype} of a plain declaration was folded away.
5008
5009 These mangling issues were fixed in @option{-fabi-version=5}.
5010
5011 @item
5012 Scoped enumerators passed as arguments to a variadic function are
5013 promoted like unscoped enumerators, causing @code{va_arg} to complain.
5014 On most targets this does not actually affect the parameter passing
5015 ABI, as there is no way to pass an argument smaller than @code{int}.
5016
5017 Also, the ABI changed the mangling of template argument packs,
5018 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
5019 a class scope function used as a template argument.
5020
5021 These issues were corrected in @option{-fabi-version=6}.
5022
5023 @item
5024 Lambdas in default argument scope were mangled incorrectly, and the
5025 ABI changed the mangling of @code{nullptr_t}.
5026
5027 These issues were corrected in @option{-fabi-version=7}.
5028
5029 @item
5030 When mangling a function type with function-cv-qualifiers, the
5031 un-qualified function type was incorrectly treated as a substitution
5032 candidate.
5033
5034 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
5035
5036 @item
5037 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
5038 unaligned accesses. Note that this did not affect the ABI of a
5039 function with a @code{nullptr_t} parameter, as parameters have a
5040 minimum alignment.
5041
5042 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
5043
5044 @item
5045 Target-specific attributes that affect the identity of a type, such as
5046 ia32 calling conventions on a function type (stdcall, regparm, etc.),
5047 did not affect the mangled name, leading to name collisions when
5048 function pointers were used as template arguments.
5049
5050 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
5051
5052 @end itemize
5053
5054 This option also enables warnings about psABI-related changes.
5055 The known psABI changes at this point include:
5056
5057 @itemize @bullet
5058
5059 @item
5060 For SysV/x86-64, unions with @code{long double} members are
5061 passed in memory as specified in psABI. Prior to GCC 4.4, this was not
5062 the case. For example:
5063
5064 @smallexample
5065 union U @{
5066 long double ld;
5067 int i;
5068 @};
5069 @end smallexample
5070
5071 @noindent
5072 @code{union U} is now always passed in memory.
5073
5074 @end itemize
5075
5076 @item -Wchar-subscripts
5077 @opindex Wchar-subscripts
5078 @opindex Wno-char-subscripts
5079 Warn if an array subscript has type @code{char}. This is a common cause
5080 of error, as programmers often forget that this type is signed on some
5081 machines.
5082 This warning is enabled by @option{-Wall}.
5083
5084 @item -Wno-coverage-mismatch
5085 @opindex Wno-coverage-mismatch
5086 @opindex Wcoverage-mismatch
5087 Warn if feedback profiles do not match when using the
5088 @option{-fprofile-use} option.
5089 If a source file is changed between compiling with @option{-fprofile-generate}
5090 and with @option{-fprofile-use}, the files with the profile feedback can fail
5091 to match the source file and GCC cannot use the profile feedback
5092 information. By default, this warning is enabled and is treated as an
5093 error. @option{-Wno-coverage-mismatch} can be used to disable the
5094 warning or @option{-Wno-error=coverage-mismatch} can be used to
5095 disable the error. Disabling the error for this warning can result in
5096 poorly optimized code and is useful only in the
5097 case of very minor changes such as bug fixes to an existing code-base.
5098 Completely disabling the warning is not recommended.
5099
5100 @item -Wno-cpp
5101 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
5102 @opindex Wno-cpp
5103 @opindex Wcpp
5104 Suppress warning messages emitted by @code{#warning} directives.
5105
5106 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
5107 @opindex Wdouble-promotion
5108 @opindex Wno-double-promotion
5109 Give a warning when a value of type @code{float} is implicitly
5110 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
5111 floating-point unit implement @code{float} in hardware, but emulate
5112 @code{double} in software. On such a machine, doing computations
5113 using @code{double} values is much more expensive because of the
5114 overhead required for software emulation.
5115
5116 It is easy to accidentally do computations with @code{double} because
5117 floating-point literals are implicitly of type @code{double}. For
5118 example, in:
5119 @smallexample
5120 @group
5121 float area(float radius)
5122 @{
5123 return 3.14159 * radius * radius;
5124 @}
5125 @end group
5126 @end smallexample
5127 the compiler performs the entire computation with @code{double}
5128 because the floating-point literal is a @code{double}.
5129
5130 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
5131 @opindex Wduplicate-decl-specifier
5132 @opindex Wno-duplicate-decl-specifier
5133 Warn if a declaration has duplicate @code{const}, @code{volatile},
5134 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
5135 @option{-Wall}.
5136
5137 @item -Wformat
5138 @itemx -Wformat=@var{n}
5139 @opindex Wformat
5140 @opindex Wno-format
5141 @opindex ffreestanding
5142 @opindex fno-builtin
5143 @opindex Wformat=
5144 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
5145 the arguments supplied have types appropriate to the format string
5146 specified, and that the conversions specified in the format string make
5147 sense. This includes standard functions, and others specified by format
5148 attributes (@pxref{Function Attributes}), in the @code{printf},
5149 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
5150 not in the C standard) families (or other target-specific families).
5151 Which functions are checked without format attributes having been
5152 specified depends on the standard version selected, and such checks of
5153 functions without the attribute specified are disabled by
5154 @option{-ffreestanding} or @option{-fno-builtin}.
5155
5156 The formats are checked against the format features supported by GNU
5157 libc version 2.2. These include all ISO C90 and C99 features, as well
5158 as features from the Single Unix Specification and some BSD and GNU
5159 extensions. Other library implementations may not support all these
5160 features; GCC does not support warning about features that go beyond a
5161 particular library's limitations. However, if @option{-Wpedantic} is used
5162 with @option{-Wformat}, warnings are given about format features not
5163 in the selected standard version (but not for @code{strfmon} formats,
5164 since those are not in any version of the C standard). @xref{C Dialect
5165 Options,,Options Controlling C Dialect}.
5166
5167 @table @gcctabopt
5168 @item -Wformat=1
5169 @itemx -Wformat
5170 @opindex Wformat
5171 @opindex Wformat=1
5172 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
5173 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
5174 @option{-Wformat} also checks for null format arguments for several
5175 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
5176 aspects of this level of format checking can be disabled by the
5177 options: @option{-Wno-format-contains-nul},
5178 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
5179 @option{-Wformat} is enabled by @option{-Wall}.
5180
5181 @item -Wformat=2
5182 @opindex Wformat=2
5183 Enable @option{-Wformat} plus additional format checks. Currently
5184 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
5185 -Wformat-y2k}.
5186 @end table
5187
5188 @item -Wno-format-contains-nul
5189 @opindex Wno-format-contains-nul
5190 @opindex Wformat-contains-nul
5191 If @option{-Wformat} is specified, do not warn about format strings that
5192 contain NUL bytes.
5193
5194 @item -Wno-format-extra-args
5195 @opindex Wno-format-extra-args
5196 @opindex Wformat-extra-args
5197 If @option{-Wformat} is specified, do not warn about excess arguments to a
5198 @code{printf} or @code{scanf} format function. The C standard specifies
5199 that such arguments are ignored.
5200
5201 Where the unused arguments lie between used arguments that are
5202 specified with @samp{$} operand number specifications, normally
5203 warnings are still given, since the implementation could not know what
5204 type to pass to @code{va_arg} to skip the unused arguments. However,
5205 in the case of @code{scanf} formats, this option suppresses the
5206 warning if the unused arguments are all pointers, since the Single
5207 Unix Specification says that such unused arguments are allowed.
5208
5209 @item -Wformat-overflow
5210 @itemx -Wformat-overflow=@var{level}
5211 @opindex Wformat-overflow
5212 @opindex Wno-format-overflow
5213 Warn about calls to formatted input/output functions such as @code{sprintf}
5214 and @code{vsprintf} that might overflow the destination buffer. When the
5215 exact number of bytes written by a format directive cannot be determined
5216 at compile-time it is estimated based on heuristics that depend on the
5217 @var{level} argument and on optimization. While enabling optimization
5218 will in most cases improve the accuracy of the warning, it may also
5219 result in false positives.
5220
5221 @table @gcctabopt
5222 @item -Wformat-overflow
5223 @itemx -Wformat-overflow=1
5224 @opindex Wformat-overflow
5225 @opindex Wno-format-overflow
5226 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
5227 employs a conservative approach that warns only about calls that most
5228 likely overflow the buffer. At this level, numeric arguments to format
5229 directives with unknown values are assumed to have the value of one, and
5230 strings of unknown length to be empty. Numeric arguments that are known
5231 to be bounded to a subrange of their type, or string arguments whose output
5232 is bounded either by their directive's precision or by a finite set of
5233 string literals, are assumed to take on the value within the range that
5234 results in the most bytes on output. For example, the call to @code{sprintf}
5235 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
5236 the terminating NUL character (@code{'\0'}) appended by the function
5237 to the destination buffer will be written past its end. Increasing
5238 the size of the buffer by a single byte is sufficient to avoid the
5239 warning, though it may not be sufficient to avoid the overflow.
5240
5241 @smallexample
5242 void f (int a, int b)
5243 @{
5244 char buf [13];
5245 sprintf (buf, "a = %i, b = %i\n", a, b);
5246 @}
5247 @end smallexample
5248
5249 @item -Wformat-overflow=2
5250 Level @var{2} warns also about calls that might overflow the destination
5251 buffer given an argument of sufficient length or magnitude. At level
5252 @var{2}, unknown numeric arguments are assumed to have the minimum
5253 representable value for signed types with a precision greater than 1, and
5254 the maximum representable value otherwise. Unknown string arguments whose
5255 length cannot be assumed to be bounded either by the directive's precision,
5256 or by a finite set of string literals they may evaluate to, or the character
5257 array they may point to, are assumed to be 1 character long.
5258
5259 At level @var{2}, the call in the example above is again diagnosed, but
5260 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
5261 @code{%i} directive will write some of its digits beyond the end of
5262 the destination buffer. To make the call safe regardless of the values
5263 of the two variables, the size of the destination buffer must be increased
5264 to at least 34 bytes. GCC includes the minimum size of the buffer in
5265 an informational note following the warning.
5266
5267 An alternative to increasing the size of the destination buffer is to
5268 constrain the range of formatted values. The maximum length of string
5269 arguments can be bounded by specifying the precision in the format
5270 directive. When numeric arguments of format directives can be assumed
5271 to be bounded by less than the precision of their type, choosing
5272 an appropriate length modifier to the format specifier will reduce
5273 the required buffer size. For example, if @var{a} and @var{b} in the
5274 example above can be assumed to be within the precision of
5275 the @code{short int} type then using either the @code{%hi} format
5276 directive or casting the argument to @code{short} reduces the maximum
5277 required size of the buffer to 24 bytes.
5278
5279 @smallexample
5280 void f (int a, int b)
5281 @{
5282 char buf [23];
5283 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
5284 @}
5285 @end smallexample
5286 @end table
5287
5288 @item -Wno-format-zero-length
5289 @opindex Wno-format-zero-length
5290 @opindex Wformat-zero-length
5291 If @option{-Wformat} is specified, do not warn about zero-length formats.
5292 The C standard specifies that zero-length formats are allowed.
5293
5294 @item -Wformat-nonliteral
5295 @opindex Wformat-nonliteral
5296 @opindex Wno-format-nonliteral
5297 If @option{-Wformat} is specified, also warn if the format string is not a
5298 string literal and so cannot be checked, unless the format function
5299 takes its format arguments as a @code{va_list}.
5300
5301 @item -Wformat-security
5302 @opindex Wformat-security
5303 @opindex Wno-format-security
5304 If @option{-Wformat} is specified, also warn about uses of format
5305 functions that represent possible security problems. At present, this
5306 warns about calls to @code{printf} and @code{scanf} functions where the
5307 format string is not a string literal and there are no format arguments,
5308 as in @code{printf (foo);}. This may be a security hole if the format
5309 string came from untrusted input and contains @samp{%n}. (This is
5310 currently a subset of what @option{-Wformat-nonliteral} warns about, but
5311 in future warnings may be added to @option{-Wformat-security} that are not
5312 included in @option{-Wformat-nonliteral}.)
5313
5314 @item -Wformat-signedness
5315 @opindex Wformat-signedness
5316 @opindex Wno-format-signedness
5317 If @option{-Wformat} is specified, also warn if the format string
5318 requires an unsigned argument and the argument is signed and vice versa.
5319
5320 @item -Wformat-truncation
5321 @itemx -Wformat-truncation=@var{level}
5322 @opindex Wformat-truncation
5323 @opindex Wno-format-truncation
5324 Warn about calls to formatted input/output functions such as @code{snprintf}
5325 and @code{vsnprintf} that might result in output truncation. When the exact
5326 number of bytes written by a format directive cannot be determined at
5327 compile-time it is estimated based on heuristics that depend on
5328 the @var{level} argument and on optimization. While enabling optimization
5329 will in most cases improve the accuracy of the warning, it may also result
5330 in false positives. Except as noted otherwise, the option uses the same
5331 logic @option{-Wformat-overflow}.
5332
5333 @table @gcctabopt
5334 @item -Wformat-truncation
5335 @itemx -Wformat-truncation=1
5336 @opindex Wformat-truncation
5337 @opindex Wno-format-truncation
5338 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
5339 employs a conservative approach that warns only about calls to bounded
5340 functions whose return value is unused and that will most likely result
5341 in output truncation.
5342
5343 @item -Wformat-truncation=2
5344 Level @var{2} warns also about calls to bounded functions whose return
5345 value is used and that might result in truncation given an argument of
5346 sufficient length or magnitude.
5347 @end table
5348
5349 @item -Wformat-y2k
5350 @opindex Wformat-y2k
5351 @opindex Wno-format-y2k
5352 If @option{-Wformat} is specified, also warn about @code{strftime}
5353 formats that may yield only a two-digit year.
5354
5355 @item -Wnonnull
5356 @opindex Wnonnull
5357 @opindex Wno-nonnull
5358 Warn about passing a null pointer for arguments marked as
5359 requiring a non-null value by the @code{nonnull} function attribute.
5360
5361 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
5362 can be disabled with the @option{-Wno-nonnull} option.
5363
5364 @item -Wnonnull-compare
5365 @opindex Wnonnull-compare
5366 @opindex Wno-nonnull-compare
5367 Warn when comparing an argument marked with the @code{nonnull}
5368 function attribute against null inside the function.
5369
5370 @option{-Wnonnull-compare} is included in @option{-Wall}. It
5371 can be disabled with the @option{-Wno-nonnull-compare} option.
5372
5373 @item -Wnull-dereference
5374 @opindex Wnull-dereference
5375 @opindex Wno-null-dereference
5376 Warn if the compiler detects paths that trigger erroneous or
5377 undefined behavior due to dereferencing a null pointer. This option
5378 is only active when @option{-fdelete-null-pointer-checks} is active,
5379 which is enabled by optimizations in most targets. The precision of
5380 the warnings depends on the optimization options used.
5381
5382 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
5383 @opindex Winit-self
5384 @opindex Wno-init-self
5385 Warn about uninitialized variables that are initialized with themselves.
5386 Note this option can only be used with the @option{-Wuninitialized} option.
5387
5388 For example, GCC warns about @code{i} being uninitialized in the
5389 following snippet only when @option{-Winit-self} has been specified:
5390 @smallexample
5391 @group
5392 int f()
5393 @{
5394 int i = i;
5395 return i;
5396 @}
5397 @end group
5398 @end smallexample
5399
5400 This warning is enabled by @option{-Wall} in C++.
5401
5402 @item -Wno-implicit-int @r{(C and Objective-C only)}
5403 @opindex Wimplicit-int
5404 @opindex Wno-implicit-int
5405 This option controls warnings when a declaration does not specify a type.
5406 This warning is enabled by default in C99 and later dialects of C,
5407 and also by @option{-Wall}.
5408
5409 @item -Wno-implicit-function-declaration @r{(C and Objective-C only)}
5410 @opindex Wimplicit-function-declaration
5411 @opindex Wno-implicit-function-declaration
5412 This option controls warnings when a function is used before being declared.
5413 This warning is enabled by default in C99 and later dialects of C,
5414 and also by @option{-Wall}.
5415 The warning is made into an error by @option{-pedantic-errors}.
5416
5417 @item -Wimplicit @r{(C and Objective-C only)}
5418 @opindex Wimplicit
5419 @opindex Wno-implicit
5420 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
5421 This warning is enabled by @option{-Wall}.
5422
5423 @item -Wimplicit-fallthrough
5424 @opindex Wimplicit-fallthrough
5425 @opindex Wno-implicit-fallthrough
5426 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
5427 and @option{-Wno-implicit-fallthrough} is the same as
5428 @option{-Wimplicit-fallthrough=0}.
5429
5430 @item -Wimplicit-fallthrough=@var{n}
5431 @opindex Wimplicit-fallthrough=
5432 Warn when a switch case falls through. For example:
5433
5434 @smallexample
5435 @group
5436 switch (cond)
5437 @{
5438 case 1:
5439 a = 1;
5440 break;
5441 case 2:
5442 a = 2;
5443 case 3:
5444 a = 3;
5445 break;
5446 @}
5447 @end group
5448 @end smallexample
5449
5450 This warning does not warn when the last statement of a case cannot
5451 fall through, e.g. when there is a return statement or a call to function
5452 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
5453 also takes into account control flow statements, such as ifs, and only
5454 warns when appropriate. E.g.@:
5455
5456 @smallexample
5457 @group
5458 switch (cond)
5459 @{
5460 case 1:
5461 if (i > 3) @{
5462 bar (5);
5463 break;
5464 @} else if (i < 1) @{
5465 bar (0);
5466 @} else
5467 return;
5468 default:
5469 @dots{}
5470 @}
5471 @end group
5472 @end smallexample
5473
5474 Since there are occasions where a switch case fall through is desirable,
5475 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
5476 to be used along with a null statement to suppress this warning that
5477 would normally occur:
5478
5479 @smallexample
5480 @group
5481 switch (cond)
5482 @{
5483 case 1:
5484 bar (0);
5485 __attribute__ ((fallthrough));
5486 default:
5487 @dots{}
5488 @}
5489 @end group
5490 @end smallexample
5491
5492 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
5493 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
5494 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
5495 Instead of these attributes, it is also possible to add a fallthrough comment
5496 to silence the warning. The whole body of the C or C++ style comment should
5497 match the given regular expressions listed below. The option argument @var{n}
5498 specifies what kind of comments are accepted:
5499
5500 @itemize @bullet
5501
5502 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
5503
5504 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
5505 expression, any comment is used as fallthrough comment.
5506
5507 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
5508 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
5509
5510 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
5511 following regular expressions:
5512
5513 @itemize @bullet
5514
5515 @item @code{-fallthrough}
5516
5517 @item @code{@@fallthrough@@}
5518
5519 @item @code{lint -fallthrough[ \t]*}
5520
5521 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
5522
5523 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5524
5525 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
5526
5527 @end itemize
5528
5529 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
5530 following regular expressions:
5531
5532 @itemize @bullet
5533
5534 @item @code{-fallthrough}
5535
5536 @item @code{@@fallthrough@@}
5537
5538 @item @code{lint -fallthrough[ \t]*}
5539
5540 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5541
5542 @end itemize
5543
5544 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5545 fallthrough comments, only attributes disable the warning.
5546
5547 @end itemize
5548
5549 The comment needs to be followed after optional whitespace and other comments
5550 by @code{case} or @code{default} keywords or by a user label that precedes some
5551 @code{case} or @code{default} label.
5552
5553 @smallexample
5554 @group
5555 switch (cond)
5556 @{
5557 case 1:
5558 bar (0);
5559 /* FALLTHRU */
5560 default:
5561 @dots{}
5562 @}
5563 @end group
5564 @end smallexample
5565
5566 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5567
5568 @item -Wno-if-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5569 @opindex Wif-not-aligned
5570 @opindex Wno-if-not-aligned
5571 Control if warnings triggered by the @code{warn_if_not_aligned} attribute
5572 should be issued. These warnings are enabled by default.
5573
5574 @item -Wignored-qualifiers @r{(C and C++ only)}
5575 @opindex Wignored-qualifiers
5576 @opindex Wno-ignored-qualifiers
5577 Warn if the return type of a function has a type qualifier
5578 such as @code{const}. For ISO C such a type qualifier has no effect,
5579 since the value returned by a function is not an lvalue.
5580 For C++, the warning is only emitted for scalar types or @code{void}.
5581 ISO C prohibits qualified @code{void} return types on function
5582 definitions, so such return types always receive a warning
5583 even without this option.
5584
5585 This warning is also enabled by @option{-Wextra}.
5586
5587 @item -Wno-ignored-attributes @r{(C and C++ only)}
5588 @opindex Wignored-attributes
5589 @opindex Wno-ignored-attributes
5590 This option controls warnings when an attribute is ignored.
5591 This is different from the
5592 @option{-Wattributes} option in that it warns whenever the compiler decides
5593 to drop an attribute, not that the attribute is either unknown, used in a
5594 wrong place, etc. This warning is enabled by default.
5595
5596 @item -Wmain
5597 @opindex Wmain
5598 @opindex Wno-main
5599 Warn if the type of @code{main} is suspicious. @code{main} should be
5600 a function with external linkage, returning int, taking either zero
5601 arguments, two, or three arguments of appropriate types. This warning
5602 is enabled by default in C++ and is enabled by either @option{-Wall}
5603 or @option{-Wpedantic}.
5604
5605 @item -Wmisleading-indentation @r{(C and C++ only)}
5606 @opindex Wmisleading-indentation
5607 @opindex Wno-misleading-indentation
5608 Warn when the indentation of the code does not reflect the block structure.
5609 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5610 @code{for} clauses with a guarded statement that does not use braces,
5611 followed by an unguarded statement with the same indentation.
5612
5613 In the following example, the call to ``bar'' is misleadingly indented as
5614 if it were guarded by the ``if'' conditional.
5615
5616 @smallexample
5617 if (some_condition ())
5618 foo ();
5619 bar (); /* Gotcha: this is not guarded by the "if". */
5620 @end smallexample
5621
5622 In the case of mixed tabs and spaces, the warning uses the
5623 @option{-ftabstop=} option to determine if the statements line up
5624 (defaulting to 8).
5625
5626 The warning is not issued for code involving multiline preprocessor logic
5627 such as the following example.
5628
5629 @smallexample
5630 if (flagA)
5631 foo (0);
5632 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5633 if (flagB)
5634 #endif
5635 foo (1);
5636 @end smallexample
5637
5638 The warning is not issued after a @code{#line} directive, since this
5639 typically indicates autogenerated code, and no assumptions can be made
5640 about the layout of the file that the directive references.
5641
5642 This warning is enabled by @option{-Wall} in C and C++.
5643
5644 @item -Wmissing-attributes
5645 @opindex Wmissing-attributes
5646 @opindex Wno-missing-attributes
5647 Warn when a declaration of a function is missing one or more attributes
5648 that a related function is declared with and whose absence may adversely
5649 affect the correctness or efficiency of generated code. For example,
5650 the warning is issued for declarations of aliases that use attributes
5651 to specify less restrictive requirements than those of their targets.
5652 This typically represents a potential optimization opportunity.
5653 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5654 issued when the alias is more restrictive than the target, which could
5655 lead to incorrect code generation.
5656 Attributes considered include @code{alloc_align}, @code{alloc_size},
5657 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5658 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5659 @code{returns_nonnull}, and @code{returns_twice}.
5660
5661 In C++, the warning is issued when an explicit specialization of a primary
5662 template declared with attribute @code{alloc_align}, @code{alloc_size},
5663 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5664 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5665 @code{error}, and @code{warning} suppress the warning.
5666 (@pxref{Function Attributes}).
5667
5668 You can use the @code{copy} attribute to apply the same
5669 set of attributes to a declaration as that on another declaration without
5670 explicitly enumerating the attributes. This attribute can be applied
5671 to declarations of functions (@pxref{Common Function Attributes}),
5672 variables (@pxref{Common Variable Attributes}), or types
5673 (@pxref{Common Type Attributes}).
5674
5675 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5676
5677 For example, since the declaration of the primary function template
5678 below makes use of both attribute @code{malloc} and @code{alloc_size}
5679 the declaration of the explicit specialization of the template is
5680 diagnosed because it is missing one of the attributes.
5681
5682 @smallexample
5683 template <class T>
5684 T* __attribute__ ((malloc, alloc_size (1)))
5685 allocate (size_t);
5686
5687 template <>
5688 void* __attribute__ ((malloc)) // missing alloc_size
5689 allocate<void> (size_t);
5690 @end smallexample
5691
5692 @item -Wmissing-braces
5693 @opindex Wmissing-braces
5694 @opindex Wno-missing-braces
5695 Warn if an aggregate or union initializer is not fully bracketed. In
5696 the following example, the initializer for @code{a} is not fully
5697 bracketed, but that for @code{b} is fully bracketed.
5698
5699 @smallexample
5700 int a[2][2] = @{ 0, 1, 2, 3 @};
5701 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5702 @end smallexample
5703
5704 This warning is enabled by @option{-Wall}.
5705
5706 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5707 @opindex Wmissing-include-dirs
5708 @opindex Wno-missing-include-dirs
5709 Warn if a user-supplied include directory does not exist.
5710
5711 @item -Wno-missing-profile
5712 @opindex Wmissing-profile
5713 @opindex Wno-missing-profile
5714 This option controls warnings if feedback profiles are missing when using the
5715 @option{-fprofile-use} option.
5716 This option diagnoses those cases where a new function or a new file is added
5717 between compiling with @option{-fprofile-generate} and with
5718 @option{-fprofile-use}, without regenerating the profiles.
5719 In these cases, the profile feedback data files do not contain any
5720 profile feedback information for
5721 the newly added function or file respectively. Also, in the case when profile
5722 count data (.gcda) files are removed, GCC cannot use any profile feedback
5723 information. In all these cases, warnings are issued to inform you that a
5724 profile generation step is due.
5725 Ignoring the warning can result in poorly optimized code.
5726 @option{-Wno-missing-profile} can be used to
5727 disable the warning, but this is not recommended and should be done only
5728 when non-existent profile data is justified.
5729
5730 @item -Wmultistatement-macros
5731 @opindex Wmultistatement-macros
5732 @opindex Wno-multistatement-macros
5733 Warn about unsafe multiple statement macros that appear to be guarded
5734 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5735 @code{while}, in which only the first statement is actually guarded after
5736 the macro is expanded.
5737
5738 For example:
5739
5740 @smallexample
5741 #define DOIT x++; y++
5742 if (c)
5743 DOIT;
5744 @end smallexample
5745
5746 will increment @code{y} unconditionally, not just when @code{c} holds.
5747 The can usually be fixed by wrapping the macro in a do-while loop:
5748 @smallexample
5749 #define DOIT do @{ x++; y++; @} while (0)
5750 if (c)
5751 DOIT;
5752 @end smallexample
5753
5754 This warning is enabled by @option{-Wall} in C and C++.
5755
5756 @item -Wparentheses
5757 @opindex Wparentheses
5758 @opindex Wno-parentheses
5759 Warn if parentheses are omitted in certain contexts, such
5760 as when there is an assignment in a context where a truth value
5761 is expected, or when operators are nested whose precedence people
5762 often get confused about.
5763
5764 Also warn if a comparison like @code{x<=y<=z} appears; this is
5765 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5766 interpretation from that of ordinary mathematical notation.
5767
5768 Also warn for dangerous uses of the GNU extension to
5769 @code{?:} with omitted middle operand. When the condition
5770 in the @code{?}: operator is a boolean expression, the omitted value is
5771 always 1. Often programmers expect it to be a value computed
5772 inside the conditional expression instead.
5773
5774 For C++ this also warns for some cases of unnecessary parentheses in
5775 declarations, which can indicate an attempt at a function call instead
5776 of a declaration:
5777 @smallexample
5778 @{
5779 // Declares a local variable called mymutex.
5780 std::unique_lock<std::mutex> (mymutex);
5781 // User meant std::unique_lock<std::mutex> lock (mymutex);
5782 @}
5783 @end smallexample
5784
5785 This warning is enabled by @option{-Wall}.
5786
5787 @item -Wsequence-point
5788 @opindex Wsequence-point
5789 @opindex Wno-sequence-point
5790 Warn about code that may have undefined semantics because of violations
5791 of sequence point rules in the C and C++ standards.
5792
5793 The C and C++ standards define the order in which expressions in a C/C++
5794 program are evaluated in terms of @dfn{sequence points}, which represent
5795 a partial ordering between the execution of parts of the program: those
5796 executed before the sequence point, and those executed after it. These
5797 occur after the evaluation of a full expression (one which is not part
5798 of a larger expression), after the evaluation of the first operand of a
5799 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5800 function is called (but after the evaluation of its arguments and the
5801 expression denoting the called function), and in certain other places.
5802 Other than as expressed by the sequence point rules, the order of
5803 evaluation of subexpressions of an expression is not specified. All
5804 these rules describe only a partial order rather than a total order,
5805 since, for example, if two functions are called within one expression
5806 with no sequence point between them, the order in which the functions
5807 are called is not specified. However, the standards committee have
5808 ruled that function calls do not overlap.
5809
5810 It is not specified when between sequence points modifications to the
5811 values of objects take effect. Programs whose behavior depends on this
5812 have undefined behavior; the C and C++ standards specify that ``Between
5813 the previous and next sequence point an object shall have its stored
5814 value modified at most once by the evaluation of an expression.
5815 Furthermore, the prior value shall be read only to determine the value
5816 to be stored.''. If a program breaks these rules, the results on any
5817 particular implementation are entirely unpredictable.
5818
5819 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5820 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5821 diagnosed by this option, and it may give an occasional false positive
5822 result, but in general it has been found fairly effective at detecting
5823 this sort of problem in programs.
5824
5825 The C++17 standard will define the order of evaluation of operands in
5826 more cases: in particular it requires that the right-hand side of an
5827 assignment be evaluated before the left-hand side, so the above
5828 examples are no longer undefined. But this option will still warn
5829 about them, to help people avoid writing code that is undefined in C
5830 and earlier revisions of C++.
5831
5832 The standard is worded confusingly, therefore there is some debate
5833 over the precise meaning of the sequence point rules in subtle cases.
5834 Links to discussions of the problem, including proposed formal
5835 definitions, may be found on the GCC readings page, at
5836 @uref{http://gcc.gnu.org/@/readings.html}.
5837
5838 This warning is enabled by @option{-Wall} for C and C++.
5839
5840 @item -Wno-return-local-addr
5841 @opindex Wno-return-local-addr
5842 @opindex Wreturn-local-addr
5843 Do not warn about returning a pointer (or in C++, a reference) to a
5844 variable that goes out of scope after the function returns.
5845
5846 @item -Wreturn-type
5847 @opindex Wreturn-type
5848 @opindex Wno-return-type
5849 Warn whenever a function is defined with a return type that defaults
5850 to @code{int}. Also warn about any @code{return} statement with no
5851 return value in a function whose return type is not @code{void}
5852 (falling off the end of the function body is considered returning
5853 without a value).
5854
5855 For C only, warn about a @code{return} statement with an expression in a
5856 function whose return type is @code{void}, unless the expression type is
5857 also @code{void}. As a GNU extension, the latter case is accepted
5858 without a warning unless @option{-Wpedantic} is used. Attempting
5859 to use the return value of a non-@code{void} function other than @code{main}
5860 that flows off the end by reaching the closing curly brace that terminates
5861 the function is undefined.
5862
5863 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5864 than @code{main} results in undefined behavior even when the value of
5865 the function is not used.
5866
5867 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5868
5869 @item -Wno-shift-count-negative
5870 @opindex Wshift-count-negative
5871 @opindex Wno-shift-count-negative
5872 Controls warnings if a shift count is negative.
5873 This warning is enabled by default.
5874
5875 @item -Wno-shift-count-overflow
5876 @opindex Wshift-count-overflow
5877 @opindex Wno-shift-count-overflow
5878 Controls warnings if a shift count is greater than or equal to the bit width
5879 of the type. This warning is enabled by default.
5880
5881 @item -Wshift-negative-value
5882 @opindex Wshift-negative-value
5883 @opindex Wno-shift-negative-value
5884 Warn if left shifting a negative value. This warning is enabled by
5885 @option{-Wextra} in C99 and C++11 modes (and newer).
5886
5887 @item -Wno-shift-overflow
5888 @itemx -Wshift-overflow=@var{n}
5889 @opindex Wshift-overflow
5890 @opindex Wno-shift-overflow
5891 These options control warnings about left shift overflows.
5892
5893 @table @gcctabopt
5894 @item -Wshift-overflow=1
5895 This is the warning level of @option{-Wshift-overflow} and is enabled
5896 by default in C99 and C++11 modes (and newer). This warning level does
5897 not warn about left-shifting 1 into the sign bit. (However, in C, such
5898 an overflow is still rejected in contexts where an integer constant expression
5899 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5900 shifts always wrap.
5901
5902 @item -Wshift-overflow=2
5903 This warning level also warns about left-shifting 1 into the sign bit,
5904 unless C++14 mode (or newer) is active.
5905 @end table
5906
5907 @item -Wswitch
5908 @opindex Wswitch
5909 @opindex Wno-switch
5910 Warn whenever a @code{switch} statement has an index of enumerated type
5911 and lacks a @code{case} for one or more of the named codes of that
5912 enumeration. (The presence of a @code{default} label prevents this
5913 warning.) @code{case} labels outside the enumeration range also
5914 provoke warnings when this option is used (even if there is a
5915 @code{default} label).
5916 This warning is enabled by @option{-Wall}.
5917
5918 @item -Wswitch-default
5919 @opindex Wswitch-default
5920 @opindex Wno-switch-default
5921 Warn whenever a @code{switch} statement does not have a @code{default}
5922 case.
5923
5924 @item -Wswitch-enum
5925 @opindex Wswitch-enum
5926 @opindex Wno-switch-enum
5927 Warn whenever a @code{switch} statement has an index of enumerated type
5928 and lacks a @code{case} for one or more of the named codes of that
5929 enumeration. @code{case} labels outside the enumeration range also
5930 provoke warnings when this option is used. The only difference
5931 between @option{-Wswitch} and this option is that this option gives a
5932 warning about an omitted enumeration code even if there is a
5933 @code{default} label.
5934
5935 @item -Wno-switch-bool
5936 @opindex Wswitch-bool
5937 @opindex Wno-switch-bool
5938 Do not warn when a @code{switch} statement has an index of boolean type
5939 and the case values are outside the range of a boolean type.
5940 It is possible to suppress this warning by casting the controlling
5941 expression to a type other than @code{bool}. For example:
5942 @smallexample
5943 @group
5944 switch ((int) (a == 4))
5945 @{
5946 @dots{}
5947 @}
5948 @end group
5949 @end smallexample
5950 This warning is enabled by default for C and C++ programs.
5951
5952 @item -Wno-switch-outside-range
5953 @opindex Wswitch-outside-range
5954 @opindex Wno-switch-outside-range
5955 This option controls warnings when a @code{switch} case has a value
5956 that is outside of its
5957 respective type range. This warning is enabled by default for
5958 C and C++ programs.
5959
5960 @item -Wno-switch-unreachable
5961 @opindex Wswitch-unreachable
5962 @opindex Wno-switch-unreachable
5963 Do not warn when a @code{switch} statement contains statements between the
5964 controlling expression and the first case label, which will never be
5965 executed. For example:
5966 @smallexample
5967 @group
5968 switch (cond)
5969 @{
5970 i = 15;
5971 @dots{}
5972 case 5:
5973 @dots{}
5974 @}
5975 @end group
5976 @end smallexample
5977 @option{-Wswitch-unreachable} does not warn if the statement between the
5978 controlling expression and the first case label is just a declaration:
5979 @smallexample
5980 @group
5981 switch (cond)
5982 @{
5983 int i;
5984 @dots{}
5985 case 5:
5986 i = 5;
5987 @dots{}
5988 @}
5989 @end group
5990 @end smallexample
5991 This warning is enabled by default for C and C++ programs.
5992
5993 @item -Wsync-nand @r{(C and C++ only)}
5994 @opindex Wsync-nand
5995 @opindex Wno-sync-nand
5996 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5997 built-in functions are used. These functions changed semantics in GCC 4.4.
5998
5999 @item -Wunused-but-set-parameter
6000 @opindex Wunused-but-set-parameter
6001 @opindex Wno-unused-but-set-parameter
6002 Warn whenever a function parameter is assigned to, but otherwise unused
6003 (aside from its declaration).
6004
6005 To suppress this warning use the @code{unused} attribute
6006 (@pxref{Variable Attributes}).
6007
6008 This warning is also enabled by @option{-Wunused} together with
6009 @option{-Wextra}.
6010
6011 @item -Wunused-but-set-variable
6012 @opindex Wunused-but-set-variable
6013 @opindex Wno-unused-but-set-variable
6014 Warn whenever a local variable is assigned to, but otherwise unused
6015 (aside from its declaration).
6016 This warning is enabled by @option{-Wall}.
6017
6018 To suppress this warning use the @code{unused} attribute
6019 (@pxref{Variable Attributes}).
6020
6021 This warning is also enabled by @option{-Wunused}, which is enabled
6022 by @option{-Wall}.
6023
6024 @item -Wunused-function
6025 @opindex Wunused-function
6026 @opindex Wno-unused-function
6027 Warn whenever a static function is declared but not defined or a
6028 non-inline static function is unused.
6029 This warning is enabled by @option{-Wall}.
6030
6031 @item -Wunused-label
6032 @opindex Wunused-label
6033 @opindex Wno-unused-label
6034 Warn whenever a label is declared but not used.
6035 This warning is enabled by @option{-Wall}.
6036
6037 To suppress this warning use the @code{unused} attribute
6038 (@pxref{Variable Attributes}).
6039
6040 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
6041 @opindex Wunused-local-typedefs
6042 @opindex Wno-unused-local-typedefs
6043 Warn when a typedef locally defined in a function is not used.
6044 This warning is enabled by @option{-Wall}.
6045
6046 @item -Wunused-parameter
6047 @opindex Wunused-parameter
6048 @opindex Wno-unused-parameter
6049 Warn whenever a function parameter is unused aside from its declaration.
6050
6051 To suppress this warning use the @code{unused} attribute
6052 (@pxref{Variable Attributes}).
6053
6054 @item -Wno-unused-result
6055 @opindex Wunused-result
6056 @opindex Wno-unused-result
6057 Do not warn if a caller of a function marked with attribute
6058 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
6059 its return value. The default is @option{-Wunused-result}.
6060
6061 @item -Wunused-variable
6062 @opindex Wunused-variable
6063 @opindex Wno-unused-variable
6064 Warn whenever a local or static variable is unused aside from its
6065 declaration. This option implies @option{-Wunused-const-variable=1} for C,
6066 but not for C++. This warning is enabled by @option{-Wall}.
6067
6068 To suppress this warning use the @code{unused} attribute
6069 (@pxref{Variable Attributes}).
6070
6071 @item -Wunused-const-variable
6072 @itemx -Wunused-const-variable=@var{n}
6073 @opindex Wunused-const-variable
6074 @opindex Wno-unused-const-variable
6075 Warn whenever a constant static variable is unused aside from its declaration.
6076 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
6077 for C, but not for C++. In C this declares variable storage, but in C++ this
6078 is not an error since const variables take the place of @code{#define}s.
6079
6080 To suppress this warning use the @code{unused} attribute
6081 (@pxref{Variable Attributes}).
6082
6083 @table @gcctabopt
6084 @item -Wunused-const-variable=1
6085 This is the warning level that is enabled by @option{-Wunused-variable} for
6086 C. It warns only about unused static const variables defined in the main
6087 compilation unit, but not about static const variables declared in any
6088 header included.
6089
6090 @item -Wunused-const-variable=2
6091 This warning level also warns for unused constant static variables in
6092 headers (excluding system headers). This is the warning level of
6093 @option{-Wunused-const-variable} and must be explicitly requested since
6094 in C++ this isn't an error and in C it might be harder to clean up all
6095 headers included.
6096 @end table
6097
6098 @item -Wunused-value
6099 @opindex Wunused-value
6100 @opindex Wno-unused-value
6101 Warn whenever a statement computes a result that is explicitly not
6102 used. To suppress this warning cast the unused expression to
6103 @code{void}. This includes an expression-statement or the left-hand
6104 side of a comma expression that contains no side effects. For example,
6105 an expression such as @code{x[i,j]} causes a warning, while
6106 @code{x[(void)i,j]} does not.
6107
6108 This warning is enabled by @option{-Wall}.
6109
6110 @item -Wunused
6111 @opindex Wunused
6112 @opindex Wno-unused
6113 All the above @option{-Wunused} options combined.
6114
6115 In order to get a warning about an unused function parameter, you must
6116 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
6117 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
6118
6119 @item -Wuninitialized
6120 @opindex Wuninitialized
6121 @opindex Wno-uninitialized
6122 Warn if an automatic variable is used without first being initialized.
6123 In C++, warn if a non-static reference or non-static @code{const}
6124 member appears in a class without constructors.
6125
6126 If you want to warn about code that uses the uninitialized value of the
6127 variable in its own initializer, use the @option{-Winit-self} option.
6128
6129 These warnings occur for individual uninitialized elements of
6130 structure, union or array variables as well as for variables that are
6131 uninitialized as a whole. They do not occur for variables or elements
6132 declared @code{volatile}. Because these warnings depend on
6133 optimization, the exact variables or elements for which there are
6134 warnings depend on the precise optimization options and version of GCC
6135 used.
6136
6137 Note that there may be no warning about a variable that is used only
6138 to compute a value that itself is never used, because such
6139 computations may be deleted by data flow analysis before the warnings
6140 are printed.
6141
6142 @item -Wno-invalid-memory-model
6143 @opindex Winvalid-memory-model
6144 @opindex Wno-invalid-memory-model
6145 This option controls warnings
6146 for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
6147 and the C11 atomic generic functions with a memory consistency argument
6148 that is either invalid for the operation or outside the range of values
6149 of the @code{memory_order} enumeration. For example, since the
6150 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
6151 defined for the relaxed, release, and sequentially consistent memory
6152 orders the following code is diagnosed:
6153
6154 @smallexample
6155 void store (int *i)
6156 @{
6157 __atomic_store_n (i, 0, memory_order_consume);
6158 @}
6159 @end smallexample
6160
6161 @option{-Winvalid-memory-model} is enabled by default.
6162
6163 @item -Wmaybe-uninitialized
6164 @opindex Wmaybe-uninitialized
6165 @opindex Wno-maybe-uninitialized
6166 For an automatic (i.e.@: local) variable, if there exists a path from the
6167 function entry to a use of the variable that is initialized, but there exist
6168 some other paths for which the variable is not initialized, the compiler
6169 emits a warning if it cannot prove the uninitialized paths are not
6170 executed at run time.
6171
6172 These warnings are only possible in optimizing compilation, because otherwise
6173 GCC does not keep track of the state of variables.
6174
6175 These warnings are made optional because GCC may not be able to determine when
6176 the code is correct in spite of appearing to have an error. Here is one
6177 example of how this can happen:
6178
6179 @smallexample
6180 @group
6181 @{
6182 int x;
6183 switch (y)
6184 @{
6185 case 1: x = 1;
6186 break;
6187 case 2: x = 4;
6188 break;
6189 case 3: x = 5;
6190 @}
6191 foo (x);
6192 @}
6193 @end group
6194 @end smallexample
6195
6196 @noindent
6197 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
6198 always initialized, but GCC doesn't know this. To suppress the
6199 warning, you need to provide a default case with assert(0) or
6200 similar code.
6201
6202 @cindex @code{longjmp} warnings
6203 This option also warns when a non-volatile automatic variable might be
6204 changed by a call to @code{longjmp}.
6205 The compiler sees only the calls to @code{setjmp}. It cannot know
6206 where @code{longjmp} will be called; in fact, a signal handler could
6207 call it at any point in the code. As a result, you may get a warning
6208 even when there is in fact no problem because @code{longjmp} cannot
6209 in fact be called at the place that would cause a problem.
6210
6211 Some spurious warnings can be avoided if you declare all the functions
6212 you use that never return as @code{noreturn}. @xref{Function
6213 Attributes}.
6214
6215 This warning is enabled by @option{-Wall} or @option{-Wextra}.
6216
6217 @item -Wunknown-pragmas
6218 @opindex Wunknown-pragmas
6219 @opindex Wno-unknown-pragmas
6220 @cindex warning for unknown pragmas
6221 @cindex unknown pragmas, warning
6222 @cindex pragmas, warning of unknown
6223 Warn when a @code{#pragma} directive is encountered that is not understood by
6224 GCC@. If this command-line option is used, warnings are even issued
6225 for unknown pragmas in system header files. This is not the case if
6226 the warnings are only enabled by the @option{-Wall} command-line option.
6227
6228 @item -Wno-pragmas
6229 @opindex Wno-pragmas
6230 @opindex Wpragmas
6231 Do not warn about misuses of pragmas, such as incorrect parameters,
6232 invalid syntax, or conflicts between pragmas. See also
6233 @option{-Wunknown-pragmas}.
6234
6235 @item -Wno-prio-ctor-dtor
6236 @opindex Wno-prio-ctor-dtor
6237 @opindex Wprio-ctor-dtor
6238 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
6239 The use of constructor and destructor attributes allow you to assign a
6240 priority to the constructor/destructor to control its order of execution
6241 before @code{main} is called or after it returns. The priority values must be
6242 greater than 100 as the compiler reserves priority values between 0--100 for
6243 the implementation.
6244
6245 @item -Wstrict-aliasing
6246 @opindex Wstrict-aliasing
6247 @opindex Wno-strict-aliasing
6248 This option is only active when @option{-fstrict-aliasing} is active.
6249 It warns about code that might break the strict aliasing rules that the
6250 compiler is using for optimization. The warning does not catch all
6251 cases, but does attempt to catch the more common pitfalls. It is
6252 included in @option{-Wall}.
6253 It is equivalent to @option{-Wstrict-aliasing=3}
6254
6255 @item -Wstrict-aliasing=n
6256 @opindex Wstrict-aliasing=n
6257 This option is only active when @option{-fstrict-aliasing} is active.
6258 It warns about code that might break the strict aliasing rules that the
6259 compiler is using for optimization.
6260 Higher levels correspond to higher accuracy (fewer false positives).
6261 Higher levels also correspond to more effort, similar to the way @option{-O}
6262 works.
6263 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
6264
6265 Level 1: Most aggressive, quick, least accurate.
6266 Possibly useful when higher levels
6267 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
6268 false negatives. However, it has many false positives.
6269 Warns for all pointer conversions between possibly incompatible types,
6270 even if never dereferenced. Runs in the front end only.
6271
6272 Level 2: Aggressive, quick, not too precise.
6273 May still have many false positives (not as many as level 1 though),
6274 and few false negatives (but possibly more than level 1).
6275 Unlike level 1, it only warns when an address is taken. Warns about
6276 incomplete types. Runs in the front end only.
6277
6278 Level 3 (default for @option{-Wstrict-aliasing}):
6279 Should have very few false positives and few false
6280 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
6281 Takes care of the common pun+dereference pattern in the front end:
6282 @code{*(int*)&some_float}.
6283 If optimization is enabled, it also runs in the back end, where it deals
6284 with multiple statement cases using flow-sensitive points-to information.
6285 Only warns when the converted pointer is dereferenced.
6286 Does not warn about incomplete types.
6287
6288 @item -Wstrict-overflow
6289 @itemx -Wstrict-overflow=@var{n}
6290 @opindex Wstrict-overflow
6291 @opindex Wno-strict-overflow
6292 This option is only active when signed overflow is undefined.
6293 It warns about cases where the compiler optimizes based on the
6294 assumption that signed overflow does not occur. Note that it does not
6295 warn about all cases where the code might overflow: it only warns
6296 about cases where the compiler implements some optimization. Thus
6297 this warning depends on the optimization level.
6298
6299 An optimization that assumes that signed overflow does not occur is
6300 perfectly safe if the values of the variables involved are such that
6301 overflow never does, in fact, occur. Therefore this warning can
6302 easily give a false positive: a warning about code that is not
6303 actually a problem. To help focus on important issues, several
6304 warning levels are defined. No warnings are issued for the use of
6305 undefined signed overflow when estimating how many iterations a loop
6306 requires, in particular when determining whether a loop will be
6307 executed at all.
6308
6309 @table @gcctabopt
6310 @item -Wstrict-overflow=1
6311 Warn about cases that are both questionable and easy to avoid. For
6312 example the compiler simplifies
6313 @code{x + 1 > x} to @code{1}. This level of
6314 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
6315 are not, and must be explicitly requested.
6316
6317 @item -Wstrict-overflow=2
6318 Also warn about other cases where a comparison is simplified to a
6319 constant. For example: @code{abs (x) >= 0}. This can only be
6320 simplified when signed integer overflow is undefined, because
6321 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
6322 zero. @option{-Wstrict-overflow} (with no level) is the same as
6323 @option{-Wstrict-overflow=2}.
6324
6325 @item -Wstrict-overflow=3
6326 Also warn about other cases where a comparison is simplified. For
6327 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
6328
6329 @item -Wstrict-overflow=4
6330 Also warn about other simplifications not covered by the above cases.
6331 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
6332
6333 @item -Wstrict-overflow=5
6334 Also warn about cases where the compiler reduces the magnitude of a
6335 constant involved in a comparison. For example: @code{x + 2 > y} is
6336 simplified to @code{x + 1 >= y}. This is reported only at the
6337 highest warning level because this simplification applies to many
6338 comparisons, so this warning level gives a very large number of
6339 false positives.
6340 @end table
6341
6342 @item -Wstring-compare
6343 @opindex Wstring-compare
6344 @opindex Wno-string-compare
6345 Warn for calls to @code{strcmp} and @code{strncmp} whose result is
6346 determined to be either zero or non-zero in tests for such equality
6347 owing to the length of one argument being greater than the size of
6348 the array the other argument is stored in (or the bound in the case
6349 of @code{strncmp}). Such calls could be mistakes. For example,
6350 the call to @code{strcmp} below is diagnosed because its result is
6351 necessarily non-zero irrespective of the contents of the array @code{a}.
6352
6353 @smallexample
6354 extern char a[4];
6355 void f (char *d)
6356 @{
6357 strcpy (d, "string");
6358 @dots{}
6359 if (0 == strcmp (a, d)) // cannot be true
6360 puts ("a and d are the same");
6361 @}
6362 @end smallexample
6363
6364 @option{-Wstring-compare} is enabled by @option{-Wextra}.
6365
6366 @item -Wstringop-overflow
6367 @itemx -Wstringop-overflow=@var{type}
6368 @opindex Wstringop-overflow
6369 @opindex Wno-stringop-overflow
6370 Warn for calls to string manipulation functions such as @code{memcpy} and
6371 @code{strcpy} that are determined to overflow the destination buffer. The
6372 optional argument is one greater than the type of Object Size Checking to
6373 perform to determine the size of the destination. @xref{Object Size Checking}.
6374 The argument is meaningful only for functions that operate on character arrays
6375 but not for raw memory functions like @code{memcpy} which always make use
6376 of Object Size type-0. The option also warns for calls that specify a size
6377 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
6378 The option produces the best results with optimization enabled but can detect
6379 a small subset of simple buffer overflows even without optimization in
6380 calls to the GCC built-in functions like @code{__builtin_memcpy} that
6381 correspond to the standard functions. In any case, the option warns about
6382 just a subset of buffer overflows detected by the corresponding overflow
6383 checking built-ins. For example, the option issues a warning for
6384 the @code{strcpy} call below because it copies at least 5 characters
6385 (the string @code{"blue"} including the terminating NUL) into the buffer
6386 of size 4.
6387
6388 @smallexample
6389 enum Color @{ blue, purple, yellow @};
6390 const char* f (enum Color clr)
6391 @{
6392 static char buf [4];
6393 const char *str;
6394 switch (clr)
6395 @{
6396 case blue: str = "blue"; break;
6397 case purple: str = "purple"; break;
6398 case yellow: str = "yellow"; break;
6399 @}
6400
6401 return strcpy (buf, str); // warning here
6402 @}
6403 @end smallexample
6404
6405 Option @option{-Wstringop-overflow=2} is enabled by default.
6406
6407 @table @gcctabopt
6408 @item -Wstringop-overflow
6409 @itemx -Wstringop-overflow=1
6410 @opindex Wstringop-overflow
6411 @opindex Wno-stringop-overflow
6412 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
6413 to determine the sizes of destination objects. This is the default setting
6414 of the option. At this setting the option does not warn for writes past
6415 the end of subobjects of larger objects accessed by pointers unless the
6416 size of the largest surrounding object is known. When the destination may
6417 be one of several objects it is assumed to be the largest one of them. On
6418 Linux systems, when optimization is enabled at this setting the option warns
6419 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
6420 a non-zero value.
6421
6422 @item -Wstringop-overflow=2
6423 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
6424 to determine the sizes of destination objects. At this setting the option
6425 warna about overflows when writing to members of the largest complete
6426 objects whose exact size is known. However, it does not warn for excessive
6427 writes to the same members of unknown objects referenced by pointers since
6428 they may point to arrays containing unknown numbers of elements.
6429
6430 @item -Wstringop-overflow=3
6431 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
6432 to determine the sizes of destination objects. At this setting the option
6433 warns about overflowing the smallest object or data member. This is the
6434 most restrictive setting of the option that may result in warnings for safe
6435 code.
6436
6437 @item -Wstringop-overflow=4
6438 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
6439 to determine the sizes of destination objects. At this setting the option
6440 warns about overflowing any data members, and when the destination is
6441 one of several objects it uses the size of the largest of them to decide
6442 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
6443 setting of the option may result in warnings for benign code.
6444 @end table
6445
6446 @item -Wno-stringop-truncation
6447 @opindex Wstringop-truncation
6448 @opindex Wno-stringop-truncation
6449 Do not warn for calls to bounded string manipulation functions
6450 such as @code{strncat},
6451 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
6452 or leave the destination unchanged.
6453
6454 In the following example, the call to @code{strncat} specifies a bound that
6455 is less than the length of the source string. As a result, the copy of
6456 the source will be truncated and so the call is diagnosed. To avoid the
6457 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
6458
6459 @smallexample
6460 void append (char *buf, size_t bufsize)
6461 @{
6462 strncat (buf, ".txt", 3);
6463 @}
6464 @end smallexample
6465
6466 As another example, the following call to @code{strncpy} results in copying
6467 to @code{d} just the characters preceding the terminating NUL, without
6468 appending the NUL to the end. Assuming the result of @code{strncpy} is
6469 necessarily a NUL-terminated string is a common mistake, and so the call
6470 is diagnosed. To avoid the warning when the result is not expected to be
6471 NUL-terminated, call @code{memcpy} instead.
6472
6473 @smallexample
6474 void copy (char *d, const char *s)
6475 @{
6476 strncpy (d, s, strlen (s));
6477 @}
6478 @end smallexample
6479
6480 In the following example, the call to @code{strncpy} specifies the size
6481 of the destination buffer as the bound. If the length of the source
6482 string is equal to or greater than this size the result of the copy will
6483 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
6484 the warning, specify @code{sizeof buf - 1} as the bound and set the last
6485 element of the buffer to @code{NUL}.
6486
6487 @smallexample
6488 void copy (const char *s)
6489 @{
6490 char buf[80];
6491 strncpy (buf, s, sizeof buf);
6492 @dots{}
6493 @}
6494 @end smallexample
6495
6496 In situations where a character array is intended to store a sequence
6497 of bytes with no terminating @code{NUL} such an array may be annotated
6498 with attribute @code{nonstring} to avoid this warning. Such arrays,
6499 however, are not suitable arguments to functions that expect
6500 @code{NUL}-terminated strings. To help detect accidental misuses of
6501 such arrays GCC issues warnings unless it can prove that the use is
6502 safe. @xref{Common Variable Attributes}.
6503
6504 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
6505 @opindex Wsuggest-attribute=
6506 @opindex Wno-suggest-attribute=
6507 Warn for cases where adding an attribute may be beneficial. The
6508 attributes currently supported are listed below.
6509
6510 @table @gcctabopt
6511 @item -Wsuggest-attribute=pure
6512 @itemx -Wsuggest-attribute=const
6513 @itemx -Wsuggest-attribute=noreturn
6514 @itemx -Wmissing-noreturn
6515 @itemx -Wsuggest-attribute=malloc
6516 @opindex Wsuggest-attribute=pure
6517 @opindex Wno-suggest-attribute=pure
6518 @opindex Wsuggest-attribute=const
6519 @opindex Wno-suggest-attribute=const
6520 @opindex Wsuggest-attribute=noreturn
6521 @opindex Wno-suggest-attribute=noreturn
6522 @opindex Wmissing-noreturn
6523 @opindex Wno-missing-noreturn
6524 @opindex Wsuggest-attribute=malloc
6525 @opindex Wno-suggest-attribute=malloc
6526
6527 Warn about functions that might be candidates for attributes
6528 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
6529 only warns for functions visible in other compilation units or (in the case of
6530 @code{pure} and @code{const}) if it cannot prove that the function returns
6531 normally. A function returns normally if it doesn't contain an infinite loop or
6532 return abnormally by throwing, calling @code{abort} or trapping. This analysis
6533 requires option @option{-fipa-pure-const}, which is enabled by default at
6534 @option{-O} and higher. Higher optimization levels improve the accuracy
6535 of the analysis.
6536
6537 @item -Wsuggest-attribute=format
6538 @itemx -Wmissing-format-attribute
6539 @opindex Wsuggest-attribute=format
6540 @opindex Wmissing-format-attribute
6541 @opindex Wno-suggest-attribute=format
6542 @opindex Wno-missing-format-attribute
6543 @opindex Wformat
6544 @opindex Wno-format
6545
6546 Warn about function pointers that might be candidates for @code{format}
6547 attributes. Note these are only possible candidates, not absolute ones.
6548 GCC guesses that function pointers with @code{format} attributes that
6549 are used in assignment, initialization, parameter passing or return
6550 statements should have a corresponding @code{format} attribute in the
6551 resulting type. I.e.@: the left-hand side of the assignment or
6552 initialization, the type of the parameter variable, or the return type
6553 of the containing function respectively should also have a @code{format}
6554 attribute to avoid the warning.
6555
6556 GCC also warns about function definitions that might be
6557 candidates for @code{format} attributes. Again, these are only
6558 possible candidates. GCC guesses that @code{format} attributes
6559 might be appropriate for any function that calls a function like
6560 @code{vprintf} or @code{vscanf}, but this might not always be the
6561 case, and some functions for which @code{format} attributes are
6562 appropriate may not be detected.
6563
6564 @item -Wsuggest-attribute=cold
6565 @opindex Wsuggest-attribute=cold
6566 @opindex Wno-suggest-attribute=cold
6567
6568 Warn about functions that might be candidates for @code{cold} attribute. This
6569 is based on static detection and generally only warns about functions which
6570 always leads to a call to another @code{cold} function such as wrappers of
6571 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6572 @end table
6573
6574 @item -Walloc-zero
6575 @opindex Wno-alloc-zero
6576 @opindex Walloc-zero
6577 Warn about calls to allocation functions decorated with attribute
6578 @code{alloc_size} that specify zero bytes, including those to the built-in
6579 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6580 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6581 when called with a zero size differs among implementations (and in the case
6582 of @code{realloc} has been deprecated) relying on it may result in subtle
6583 portability bugs and should be avoided.
6584
6585 @item -Walloc-size-larger-than=@var{byte-size}
6586 @opindex Walloc-size-larger-than=
6587 @opindex Wno-alloc-size-larger-than
6588 Warn about calls to functions decorated with attribute @code{alloc_size}
6589 that attempt to allocate objects larger than the specified number of bytes,
6590 or where the result of the size computation in an integer type with infinite
6591 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6592 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6593 Warnings controlled by the option can be disabled either by specifying
6594 @var{byte-size} of @samp{SIZE_MAX} or more or by
6595 @option{-Wno-alloc-size-larger-than}.
6596 @xref{Function Attributes}.
6597
6598 @item -Wno-alloc-size-larger-than
6599 @opindex Wno-alloc-size-larger-than
6600 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6601 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6602 larger.
6603
6604 @item -Walloca
6605 @opindex Wno-alloca
6606 @opindex Walloca
6607 This option warns on all uses of @code{alloca} in the source.
6608
6609 @item -Walloca-larger-than=@var{byte-size}
6610 @opindex Walloca-larger-than=
6611 @opindex Wno-alloca-larger-than
6612 This option warns on calls to @code{alloca} with an integer argument whose
6613 value is either zero, or that is not bounded by a controlling predicate
6614 that limits its value to at most @var{byte-size}. It also warns for calls
6615 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6616 types are considered unbounded even if they appear to be constrained to
6617 the expected range.
6618
6619 For example, a bounded case of @code{alloca} could be:
6620
6621 @smallexample
6622 void func (size_t n)
6623 @{
6624 void *p;
6625 if (n <= 1000)
6626 p = alloca (n);
6627 else
6628 p = malloc (n);
6629 f (p);
6630 @}
6631 @end smallexample
6632
6633 In the above example, passing @code{-Walloca-larger-than=1000} would not
6634 issue a warning because the call to @code{alloca} is known to be at most
6635 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6636 the compiler would emit a warning.
6637
6638 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6639 controlling predicate constraining its integer argument. For example:
6640
6641 @smallexample
6642 void func ()
6643 @{
6644 void *p = alloca (n);
6645 f (p);
6646 @}
6647 @end smallexample
6648
6649 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6650 a warning, but this time because of the lack of bounds checking.
6651
6652 Note, that even seemingly correct code involving signed integers could
6653 cause a warning:
6654
6655 @smallexample
6656 void func (signed int n)
6657 @{
6658 if (n < 500)
6659 @{
6660 p = alloca (n);
6661 f (p);
6662 @}
6663 @}
6664 @end smallexample
6665
6666 In the above example, @var{n} could be negative, causing a larger than
6667 expected argument to be implicitly cast into the @code{alloca} call.
6668
6669 This option also warns when @code{alloca} is used in a loop.
6670
6671 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6672 but is usually only effective when @option{-ftree-vrp} is active (default
6673 for @option{-O2} and above).
6674
6675 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6676
6677 @item -Wno-alloca-larger-than
6678 @opindex Wno-alloca-larger-than
6679 Disable @option{-Walloca-larger-than=} warnings. The option is
6680 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6681
6682 @item -Warith-conversion
6683 @opindex Warith-conversion
6684 @opindex Wno-arith-conversion
6685 Do warn about implicit conversions from arithmetic operations even
6686 when conversion of the operands to the same type cannot change their
6687 values. This affects warnings from @option{-Wconversion},
6688 @option{-Wfloat-conversion}, and @option{-Wsign-conversion}.
6689
6690 @smallexample
6691 @group
6692 void f (char c, int i)
6693 @{
6694 c = c + i; // warns with @option{-Wconversion}
6695 c = c + 1; // only warns with @option{-Warith-conversion}
6696 @}
6697 @end group
6698 @end smallexample
6699
6700 @item -Warray-bounds
6701 @itemx -Warray-bounds=@var{n}
6702 @opindex Wno-array-bounds
6703 @opindex Warray-bounds
6704 This option is only active when @option{-ftree-vrp} is active
6705 (default for @option{-O2} and above). It warns about subscripts to arrays
6706 that are always out of bounds. This warning is enabled by @option{-Wall}.
6707
6708 @table @gcctabopt
6709 @item -Warray-bounds=1
6710 This is the warning level of @option{-Warray-bounds} and is enabled
6711 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6712
6713 @item -Warray-bounds=2
6714 This warning level also warns about out of bounds access for
6715 arrays at the end of a struct and for arrays accessed through
6716 pointers. This warning level may give a larger number of
6717 false positives and is deactivated by default.
6718 @end table
6719
6720 @item -Wattribute-alias=@var{n}
6721 @itemx -Wno-attribute-alias
6722 @opindex Wattribute-alias
6723 @opindex Wno-attribute-alias
6724 Warn about declarations using the @code{alias} and similar attributes whose
6725 target is incompatible with the type of the alias.
6726 @xref{Function Attributes,,Declaring Attributes of Functions}.
6727
6728 @table @gcctabopt
6729 @item -Wattribute-alias=1
6730 The default warning level of the @option{-Wattribute-alias} option diagnoses
6731 incompatibilities between the type of the alias declaration and that of its
6732 target. Such incompatibilities are typically indicative of bugs.
6733
6734 @item -Wattribute-alias=2
6735
6736 At this level @option{-Wattribute-alias} also diagnoses cases where
6737 the attributes of the alias declaration are more restrictive than the
6738 attributes applied to its target. These mismatches can potentially
6739 result in incorrect code generation. In other cases they may be
6740 benign and could be resolved simply by adding the missing attribute to
6741 the target. For comparison, see the @option{-Wmissing-attributes}
6742 option, which controls diagnostics when the alias declaration is less
6743 restrictive than the target, rather than more restrictive.
6744
6745 Attributes considered include @code{alloc_align}, @code{alloc_size},
6746 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6747 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6748 @code{returns_nonnull}, and @code{returns_twice}.
6749 @end table
6750
6751 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6752 This is the default. You can disable these warnings with either
6753 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6754
6755 @item -Wbool-compare
6756 @opindex Wno-bool-compare
6757 @opindex Wbool-compare
6758 Warn about boolean expression compared with an integer value different from
6759 @code{true}/@code{false}. For instance, the following comparison is
6760 always false:
6761 @smallexample
6762 int n = 5;
6763 @dots{}
6764 if ((n > 1) == 2) @{ @dots{} @}
6765 @end smallexample
6766 This warning is enabled by @option{-Wall}.
6767
6768 @item -Wbool-operation
6769 @opindex Wno-bool-operation
6770 @opindex Wbool-operation
6771 Warn about suspicious operations on expressions of a boolean type. For
6772 instance, bitwise negation of a boolean is very likely a bug in the program.
6773 For C, this warning also warns about incrementing or decrementing a boolean,
6774 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6775 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6776
6777 This warning is enabled by @option{-Wall}.
6778
6779 @item -Wduplicated-branches
6780 @opindex Wno-duplicated-branches
6781 @opindex Wduplicated-branches
6782 Warn when an if-else has identical branches. This warning detects cases like
6783 @smallexample
6784 if (p != NULL)
6785 return 0;
6786 else
6787 return 0;
6788 @end smallexample
6789 It doesn't warn when both branches contain just a null statement. This warning
6790 also warn for conditional operators:
6791 @smallexample
6792 int i = x ? *p : *p;
6793 @end smallexample
6794
6795 @item -Wduplicated-cond
6796 @opindex Wno-duplicated-cond
6797 @opindex Wduplicated-cond
6798 Warn about duplicated conditions in an if-else-if chain. For instance,
6799 warn for the following code:
6800 @smallexample
6801 if (p->q != NULL) @{ @dots{} @}
6802 else if (p->q != NULL) @{ @dots{} @}
6803 @end smallexample
6804
6805 @item -Wframe-address
6806 @opindex Wno-frame-address
6807 @opindex Wframe-address
6808 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6809 is called with an argument greater than 0. Such calls may return indeterminate
6810 values or crash the program. The warning is included in @option{-Wall}.
6811
6812 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6813 @opindex Wno-discarded-qualifiers
6814 @opindex Wdiscarded-qualifiers
6815 Do not warn if type qualifiers on pointers are being discarded.
6816 Typically, the compiler warns if a @code{const char *} variable is
6817 passed to a function that takes a @code{char *} parameter. This option
6818 can be used to suppress such a warning.
6819
6820 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6821 @opindex Wno-discarded-array-qualifiers
6822 @opindex Wdiscarded-array-qualifiers
6823 Do not warn if type qualifiers on arrays which are pointer targets
6824 are being discarded. Typically, the compiler warns if a
6825 @code{const int (*)[]} variable is passed to a function that
6826 takes a @code{int (*)[]} parameter. This option can be used to
6827 suppress such a warning.
6828
6829 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6830 @opindex Wno-incompatible-pointer-types
6831 @opindex Wincompatible-pointer-types
6832 Do not warn when there is a conversion between pointers that have incompatible
6833 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6834 which warns for pointer argument passing or assignment with different
6835 signedness.
6836
6837 @item -Wno-int-conversion @r{(C and Objective-C only)}
6838 @opindex Wno-int-conversion
6839 @opindex Wint-conversion
6840 Do not warn about incompatible integer to pointer and pointer to integer
6841 conversions. This warning is about implicit conversions; for explicit
6842 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6843 @option{-Wno-pointer-to-int-cast} may be used.
6844
6845 @item -Wzero-length-bounds
6846 @opindex Wzero-length-bounds
6847 @opindex Wzero-length-bounds
6848 Warn about accesses to elements of zero-length array members that might
6849 overlap other members of the same object. Declaring interior zero-length
6850 arrays is discouraged because accesses to them are undefined. See
6851 @xref{Zero Length}.
6852
6853 For example, the first two stores in function @code{bad} are diagnosed
6854 because the array elements overlap the subsequent members @code{b} and
6855 @code{c}. The third store is diagnosed by @option{-Warray-bounds}
6856 because it is beyond the bounds of the enclosing object.
6857
6858 @smallexample
6859 struct X @{ int a[0]; int b, c; @};
6860 struct X x;
6861
6862 void bad (void)
6863 @{
6864 x.a[0] = 0; // -Wzero-length-bounds
6865 x.a[1] = 1; // -Wzero-length-bounds
6866 x.a[2] = 2; // -Warray-bounds
6867 @}
6868 @end smallexample
6869
6870 Option @option{-Wzero-length-bounds} is enabled by @option{-Warray-bounds}.
6871
6872 @item -Wno-div-by-zero
6873 @opindex Wno-div-by-zero
6874 @opindex Wdiv-by-zero
6875 Do not warn about compile-time integer division by zero. Floating-point
6876 division by zero is not warned about, as it can be a legitimate way of
6877 obtaining infinities and NaNs.
6878
6879 @item -Wsystem-headers
6880 @opindex Wsystem-headers
6881 @opindex Wno-system-headers
6882 @cindex warnings from system headers
6883 @cindex system headers, warnings from
6884 Print warning messages for constructs found in system header files.
6885 Warnings from system headers are normally suppressed, on the assumption
6886 that they usually do not indicate real problems and would only make the
6887 compiler output harder to read. Using this command-line option tells
6888 GCC to emit warnings from system headers as if they occurred in user
6889 code. However, note that using @option{-Wall} in conjunction with this
6890 option does @emph{not} warn about unknown pragmas in system
6891 headers---for that, @option{-Wunknown-pragmas} must also be used.
6892
6893 @item -Wtautological-compare
6894 @opindex Wtautological-compare
6895 @opindex Wno-tautological-compare
6896 Warn if a self-comparison always evaluates to true or false. This
6897 warning detects various mistakes such as:
6898 @smallexample
6899 int i = 1;
6900 @dots{}
6901 if (i > i) @{ @dots{} @}
6902 @end smallexample
6903
6904 This warning also warns about bitwise comparisons that always evaluate
6905 to true or false, for instance:
6906 @smallexample
6907 if ((a & 16) == 10) @{ @dots{} @}
6908 @end smallexample
6909 will always be false.
6910
6911 This warning is enabled by @option{-Wall}.
6912
6913 @item -Wtrampolines
6914 @opindex Wtrampolines
6915 @opindex Wno-trampolines
6916 Warn about trampolines generated for pointers to nested functions.
6917 A trampoline is a small piece of data or code that is created at run
6918 time on the stack when the address of a nested function is taken, and is
6919 used to call the nested function indirectly. For some targets, it is
6920 made up of data only and thus requires no special treatment. But, for
6921 most targets, it is made up of code and thus requires the stack to be
6922 made executable in order for the program to work properly.
6923
6924 @item -Wfloat-equal
6925 @opindex Wfloat-equal
6926 @opindex Wno-float-equal
6927 Warn if floating-point values are used in equality comparisons.
6928
6929 The idea behind this is that sometimes it is convenient (for the
6930 programmer) to consider floating-point values as approximations to
6931 infinitely precise real numbers. If you are doing this, then you need
6932 to compute (by analyzing the code, or in some other way) the maximum or
6933 likely maximum error that the computation introduces, and allow for it
6934 when performing comparisons (and when producing output, but that's a
6935 different problem). In particular, instead of testing for equality, you
6936 should check to see whether the two values have ranges that overlap; and
6937 this is done with the relational operators, so equality comparisons are
6938 probably mistaken.
6939
6940 @item -Wtraditional @r{(C and Objective-C only)}
6941 @opindex Wtraditional
6942 @opindex Wno-traditional
6943 Warn about certain constructs that behave differently in traditional and
6944 ISO C@. Also warn about ISO C constructs that have no traditional C
6945 equivalent, and/or problematic constructs that should be avoided.
6946
6947 @itemize @bullet
6948 @item
6949 Macro parameters that appear within string literals in the macro body.
6950 In traditional C macro replacement takes place within string literals,
6951 but in ISO C it does not.
6952
6953 @item
6954 In traditional C, some preprocessor directives did not exist.
6955 Traditional preprocessors only considered a line to be a directive
6956 if the @samp{#} appeared in column 1 on the line. Therefore
6957 @option{-Wtraditional} warns about directives that traditional C
6958 understands but ignores because the @samp{#} does not appear as the
6959 first character on the line. It also suggests you hide directives like
6960 @code{#pragma} not understood by traditional C by indenting them. Some
6961 traditional implementations do not recognize @code{#elif}, so this option
6962 suggests avoiding it altogether.
6963
6964 @item
6965 A function-like macro that appears without arguments.
6966
6967 @item
6968 The unary plus operator.
6969
6970 @item
6971 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6972 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6973 constants.) Note, these suffixes appear in macros defined in the system
6974 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6975 Use of these macros in user code might normally lead to spurious
6976 warnings, however GCC's integrated preprocessor has enough context to
6977 avoid warning in these cases.
6978
6979 @item
6980 A function declared external in one block and then used after the end of
6981 the block.
6982
6983 @item
6984 A @code{switch} statement has an operand of type @code{long}.
6985
6986 @item
6987 A non-@code{static} function declaration follows a @code{static} one.
6988 This construct is not accepted by some traditional C compilers.
6989
6990 @item
6991 The ISO type of an integer constant has a different width or
6992 signedness from its traditional type. This warning is only issued if
6993 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6994 typically represent bit patterns, are not warned about.
6995
6996 @item
6997 Usage of ISO string concatenation is detected.
6998
6999 @item
7000 Initialization of automatic aggregates.
7001
7002 @item
7003 Identifier conflicts with labels. Traditional C lacks a separate
7004 namespace for labels.
7005
7006 @item
7007 Initialization of unions. If the initializer is zero, the warning is
7008 omitted. This is done under the assumption that the zero initializer in
7009 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
7010 initializer warnings and relies on default initialization to zero in the
7011 traditional C case.
7012
7013 @item
7014 Conversions by prototypes between fixed/floating-point values and vice
7015 versa. The absence of these prototypes when compiling with traditional
7016 C causes serious problems. This is a subset of the possible
7017 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
7018
7019 @item
7020 Use of ISO C style function definitions. This warning intentionally is
7021 @emph{not} issued for prototype declarations or variadic functions
7022 because these ISO C features appear in your code when using
7023 libiberty's traditional C compatibility macros, @code{PARAMS} and
7024 @code{VPARAMS}. This warning is also bypassed for nested functions
7025 because that feature is already a GCC extension and thus not relevant to
7026 traditional C compatibility.
7027 @end itemize
7028
7029 @item -Wtraditional-conversion @r{(C and Objective-C only)}
7030 @opindex Wtraditional-conversion
7031 @opindex Wno-traditional-conversion
7032 Warn if a prototype causes a type conversion that is different from what
7033 would happen to the same argument in the absence of a prototype. This
7034 includes conversions of fixed point to floating and vice versa, and
7035 conversions changing the width or signedness of a fixed-point argument
7036 except when the same as the default promotion.
7037
7038 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
7039 @opindex Wdeclaration-after-statement
7040 @opindex Wno-declaration-after-statement
7041 Warn when a declaration is found after a statement in a block. This
7042 construct, known from C++, was introduced with ISO C99 and is by default
7043 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
7044
7045 @item -Wshadow
7046 @opindex Wshadow
7047 @opindex Wno-shadow
7048 Warn whenever a local variable or type declaration shadows another
7049 variable, parameter, type, class member (in C++), or instance variable
7050 (in Objective-C) or whenever a built-in function is shadowed. Note
7051 that in C++, the compiler warns if a local variable shadows an
7052 explicit typedef, but not if it shadows a struct/class/enum.
7053 If this warning is enabled, it includes also all instances of
7054 local shadowing. This means that @option{-Wno-shadow=local}
7055 and @option{-Wno-shadow=compatible-local} are ignored when
7056 @option{-Wshadow} is used.
7057 Same as @option{-Wshadow=global}.
7058
7059 @item -Wno-shadow-ivar @r{(Objective-C only)}
7060 @opindex Wno-shadow-ivar
7061 @opindex Wshadow-ivar
7062 Do not warn whenever a local variable shadows an instance variable in an
7063 Objective-C method.
7064
7065 @item -Wshadow=global
7066 @opindex Wshadow=global
7067 Warn for any shadowing.
7068 Same as @option{-Wshadow}.
7069
7070 @item -Wshadow=local
7071 @opindex Wshadow=local
7072 Warn when a local variable shadows another local variable or parameter.
7073
7074 @item -Wshadow=compatible-local
7075 @opindex Wshadow=compatible-local
7076 Warn when a local variable shadows another local variable or parameter
7077 whose type is compatible with that of the shadowing variable. In C++,
7078 type compatibility here means the type of the shadowing variable can be
7079 converted to that of the shadowed variable. The creation of this flag
7080 (in addition to @option{-Wshadow=local}) is based on the idea that when
7081 a local variable shadows another one of incompatible type, it is most
7082 likely intentional, not a bug or typo, as shown in the following example:
7083
7084 @smallexample
7085 @group
7086 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
7087 @{
7088 for (int i = 0; i < N; ++i)
7089 @{
7090 ...
7091 @}
7092 ...
7093 @}
7094 @end group
7095 @end smallexample
7096
7097 Since the two variable @code{i} in the example above have incompatible types,
7098 enabling only @option{-Wshadow=compatible-local} does not emit a warning.
7099 Because their types are incompatible, if a programmer accidentally uses one
7100 in place of the other, type checking is expected to catch that and emit an
7101 error or warning. Use of this flag instead of @option{-Wshadow=local} can
7102 possibly reduce the number of warnings triggered by intentional shadowing.
7103 Note that this also means that shadowing @code{const char *i} by
7104 @code{char *i} does not emit a warning.
7105
7106 This warning is also enabled by @option{-Wshadow=local}.
7107
7108 @item -Wlarger-than=@var{byte-size}
7109 @opindex Wlarger-than=
7110 @opindex Wlarger-than-@var{byte-size}
7111 Warn whenever an object is defined whose size exceeds @var{byte-size}.
7112 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7113 Warnings controlled by the option can be disabled either by specifying
7114 @var{byte-size} of @samp{SIZE_MAX} or more or by
7115 @option{-Wno-larger-than}.
7116
7117 @item -Wno-larger-than
7118 @opindex Wno-larger-than
7119 Disable @option{-Wlarger-than=} warnings. The option is equivalent
7120 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
7121
7122 @item -Wframe-larger-than=@var{byte-size}
7123 @opindex Wframe-larger-than=
7124 @opindex Wno-frame-larger-than
7125 Warn if the size of a function frame exceeds @var{byte-size}.
7126 The computation done to determine the stack frame size is approximate
7127 and not conservative.
7128 The actual requirements may be somewhat greater than @var{byte-size}
7129 even if you do not get a warning. In addition, any space allocated
7130 via @code{alloca}, variable-length arrays, or related constructs
7131 is not included by the compiler when determining
7132 whether or not to issue a warning.
7133 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
7134 Warnings controlled by the option can be disabled either by specifying
7135 @var{byte-size} of @samp{SIZE_MAX} or more or by
7136 @option{-Wno-frame-larger-than}.
7137
7138 @item -Wno-frame-larger-than
7139 @opindex Wno-frame-larger-than
7140 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
7141 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
7142
7143 @item -Wno-free-nonheap-object
7144 @opindex Wno-free-nonheap-object
7145 @opindex Wfree-nonheap-object
7146 Do not warn when attempting to free an object that was not allocated
7147 on the heap.
7148
7149 @item -Wstack-usage=@var{byte-size}
7150 @opindex Wstack-usage
7151 @opindex Wno-stack-usage
7152 Warn if the stack usage of a function might exceed @var{byte-size}.
7153 The computation done to determine the stack usage is conservative.
7154 Any space allocated via @code{alloca}, variable-length arrays, or related
7155 constructs is included by the compiler when determining whether or not to
7156 issue a warning.
7157
7158 The message is in keeping with the output of @option{-fstack-usage}.
7159
7160 @itemize
7161 @item
7162 If the stack usage is fully static but exceeds the specified amount, it's:
7163
7164 @smallexample
7165 warning: stack usage is 1120 bytes
7166 @end smallexample
7167 @item
7168 If the stack usage is (partly) dynamic but bounded, it's:
7169
7170 @smallexample
7171 warning: stack usage might be 1648 bytes
7172 @end smallexample
7173 @item
7174 If the stack usage is (partly) dynamic and not bounded, it's:
7175
7176 @smallexample
7177 warning: stack usage might be unbounded
7178 @end smallexample
7179 @end itemize
7180
7181 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
7182 Warnings controlled by the option can be disabled either by specifying
7183 @var{byte-size} of @samp{SIZE_MAX} or more or by
7184 @option{-Wno-stack-usage}.
7185
7186 @item -Wno-stack-usage
7187 @opindex Wno-stack-usage
7188 Disable @option{-Wstack-usage=} warnings. The option is equivalent
7189 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
7190
7191 @item -Wunsafe-loop-optimizations
7192 @opindex Wunsafe-loop-optimizations
7193 @opindex Wno-unsafe-loop-optimizations
7194 Warn if the loop cannot be optimized because the compiler cannot
7195 assume anything on the bounds of the loop indices. With
7196 @option{-funsafe-loop-optimizations} warn if the compiler makes
7197 such assumptions.
7198
7199 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
7200 @opindex Wno-pedantic-ms-format
7201 @opindex Wpedantic-ms-format
7202 When used in combination with @option{-Wformat}
7203 and @option{-pedantic} without GNU extensions, this option
7204 disables the warnings about non-ISO @code{printf} / @code{scanf} format
7205 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
7206 which depend on the MS runtime.
7207
7208 @item -Wpointer-arith
7209 @opindex Wpointer-arith
7210 @opindex Wno-pointer-arith
7211 Warn about anything that depends on the ``size of'' a function type or
7212 of @code{void}. GNU C assigns these types a size of 1, for
7213 convenience in calculations with @code{void *} pointers and pointers
7214 to functions. In C++, warn also when an arithmetic operation involves
7215 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
7216
7217 @item -Wno-pointer-compare
7218 @opindex Wpointer-compare
7219 @opindex Wno-pointer-compare
7220 Do not warn if a pointer is compared with a zero character constant.
7221 This usually
7222 means that the pointer was meant to be dereferenced. For example:
7223
7224 @smallexample
7225 const char *p = foo ();
7226 if (p == '\0')
7227 return 42;
7228 @end smallexample
7229
7230 Note that the code above is invalid in C++11.
7231
7232 This warning is enabled by default.
7233
7234 @item -Wtype-limits
7235 @opindex Wtype-limits
7236 @opindex Wno-type-limits
7237 Warn if a comparison is always true or always false due to the limited
7238 range of the data type, but do not warn for constant expressions. For
7239 example, warn if an unsigned variable is compared against zero with
7240 @code{<} or @code{>=}. This warning is also enabled by
7241 @option{-Wextra}.
7242
7243 @item -Wabsolute-value @r{(C and Objective-C only)}
7244 @opindex Wabsolute-value
7245 @opindex Wno-absolute-value
7246 Warn for calls to standard functions that compute the absolute value
7247 of an argument when a more appropriate standard function is available.
7248 For example, calling @code{abs(3.14)} triggers the warning because the
7249 appropriate function to call to compute the absolute value of a double
7250 argument is @code{fabs}. The option also triggers warnings when the
7251 argument in a call to such a function has an unsigned type. This
7252 warning can be suppressed with an explicit type cast and it is also
7253 enabled by @option{-Wextra}.
7254
7255 @include cppwarnopts.texi
7256
7257 @item -Wbad-function-cast @r{(C and Objective-C only)}
7258 @opindex Wbad-function-cast
7259 @opindex Wno-bad-function-cast
7260 Warn when a function call is cast to a non-matching type.
7261 For example, warn if a call to a function returning an integer type
7262 is cast to a pointer type.
7263
7264 @item -Wc90-c99-compat @r{(C and Objective-C only)}
7265 @opindex Wc90-c99-compat
7266 @opindex Wno-c90-c99-compat
7267 Warn about features not present in ISO C90, but present in ISO C99.
7268 For instance, warn about use of variable length arrays, @code{long long}
7269 type, @code{bool} type, compound literals, designated initializers, and so
7270 on. This option is independent of the standards mode. Warnings are disabled
7271 in the expression that follows @code{__extension__}.
7272
7273 @item -Wc99-c11-compat @r{(C and Objective-C only)}
7274 @opindex Wc99-c11-compat
7275 @opindex Wno-c99-c11-compat
7276 Warn about features not present in ISO C99, but present in ISO C11.
7277 For instance, warn about use of anonymous structures and unions,
7278 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
7279 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
7280 and so on. This option is independent of the standards mode. Warnings are
7281 disabled in the expression that follows @code{__extension__}.
7282
7283 @item -Wc11-c2x-compat @r{(C and Objective-C only)}
7284 @opindex Wc11-c2x-compat
7285 @opindex Wno-c11-c2x-compat
7286 Warn about features not present in ISO C11, but present in ISO C2X.
7287 For instance, warn about omitting the string in @code{_Static_assert},
7288 use of @samp{[[]]} syntax for attributes, use of decimal
7289 floating-point types, and so on. This option is independent of the
7290 standards mode. Warnings are disabled in the expression that follows
7291 @code{__extension__}.
7292
7293 @item -Wc++-compat @r{(C and Objective-C only)}
7294 @opindex Wc++-compat
7295 @opindex Wno-c++-compat
7296 Warn about ISO C constructs that are outside of the common subset of
7297 ISO C and ISO C++, e.g.@: request for implicit conversion from
7298 @code{void *} to a pointer to non-@code{void} type.
7299
7300 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
7301 @opindex Wc++11-compat
7302 @opindex Wno-c++11-compat
7303 Warn about C++ constructs whose meaning differs between ISO C++ 1998
7304 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
7305 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
7306 enabled by @option{-Wall}.
7307
7308 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
7309 @opindex Wc++14-compat
7310 @opindex Wno-c++14-compat
7311 Warn about C++ constructs whose meaning differs between ISO C++ 2011
7312 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
7313
7314 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
7315 @opindex Wc++17-compat
7316 @opindex Wno-c++17-compat
7317 Warn about C++ constructs whose meaning differs between ISO C++ 2014
7318 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
7319
7320 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
7321 @opindex Wc++20-compat
7322 @opindex Wno-c++20-compat
7323 Warn about C++ constructs whose meaning differs between ISO C++ 2017
7324 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
7325
7326 @item -Wcast-qual
7327 @opindex Wcast-qual
7328 @opindex Wno-cast-qual
7329 Warn whenever a pointer is cast so as to remove a type qualifier from
7330 the target type. For example, warn if a @code{const char *} is cast
7331 to an ordinary @code{char *}.
7332
7333 Also warn when making a cast that introduces a type qualifier in an
7334 unsafe way. For example, casting @code{char **} to @code{const char **}
7335 is unsafe, as in this example:
7336
7337 @smallexample
7338 /* p is char ** value. */
7339 const char **q = (const char **) p;
7340 /* Assignment of readonly string to const char * is OK. */
7341 *q = "string";
7342 /* Now char** pointer points to read-only memory. */
7343 **p = 'b';
7344 @end smallexample
7345
7346 @item -Wcast-align
7347 @opindex Wcast-align
7348 @opindex Wno-cast-align
7349 Warn whenever a pointer is cast such that the required alignment of the
7350 target is increased. For example, warn if a @code{char *} is cast to
7351 an @code{int *} on machines where integers can only be accessed at
7352 two- or four-byte boundaries.
7353
7354 @item -Wcast-align=strict
7355 @opindex Wcast-align=strict
7356 Warn whenever a pointer is cast such that the required alignment of the
7357 target is increased. For example, warn if a @code{char *} is cast to
7358 an @code{int *} regardless of the target machine.
7359
7360 @item -Wcast-function-type
7361 @opindex Wcast-function-type
7362 @opindex Wno-cast-function-type
7363 Warn when a function pointer is cast to an incompatible function pointer.
7364 In a cast involving function types with a variable argument list only
7365 the types of initial arguments that are provided are considered.
7366 Any parameter of pointer-type matches any other pointer-type. Any benign
7367 differences in integral types are ignored, like @code{int} vs.@: @code{long}
7368 on ILP32 targets. Likewise type qualifiers are ignored. The function
7369 type @code{void (*) (void)} is special and matches everything, which can
7370 be used to suppress this warning.
7371 In a cast involving pointer to member types this warning warns whenever
7372 the type cast is changing the pointer to member type.
7373 This warning is enabled by @option{-Wextra}.
7374
7375 @item -Wwrite-strings
7376 @opindex Wwrite-strings
7377 @opindex Wno-write-strings
7378 When compiling C, give string constants the type @code{const
7379 char[@var{length}]} so that copying the address of one into a
7380 non-@code{const} @code{char *} pointer produces a warning. These
7381 warnings help you find at compile time code that can try to write
7382 into a string constant, but only if you have been very careful about
7383 using @code{const} in declarations and prototypes. Otherwise, it is
7384 just a nuisance. This is why we did not make @option{-Wall} request
7385 these warnings.
7386
7387 When compiling C++, warn about the deprecated conversion from string
7388 literals to @code{char *}. This warning is enabled by default for C++
7389 programs.
7390
7391 @item -Wclobbered
7392 @opindex Wclobbered
7393 @opindex Wno-clobbered
7394 Warn for variables that might be changed by @code{longjmp} or
7395 @code{vfork}. This warning is also enabled by @option{-Wextra}.
7396
7397 @item -Wconversion
7398 @opindex Wconversion
7399 @opindex Wno-conversion
7400 Warn for implicit conversions that may alter a value. This includes
7401 conversions between real and integer, like @code{abs (x)} when
7402 @code{x} is @code{double}; conversions between signed and unsigned,
7403 like @code{unsigned ui = -1}; and conversions to smaller types, like
7404 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
7405 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
7406 changed by the conversion like in @code{abs (2.0)}. Warnings about
7407 conversions between signed and unsigned integers can be disabled by
7408 using @option{-Wno-sign-conversion}.
7409
7410 For C++, also warn for confusing overload resolution for user-defined
7411 conversions; and conversions that never use a type conversion
7412 operator: conversions to @code{void}, the same type, a base class or a
7413 reference to them. Warnings about conversions between signed and
7414 unsigned integers are disabled by default in C++ unless
7415 @option{-Wsign-conversion} is explicitly enabled.
7416
7417 Warnings about conversion from arithmetic on a small type back to that
7418 type are only given with @option{-Warith-conversion}.
7419
7420 @item -Wdangling-else
7421 @opindex Wdangling-else
7422 @opindex Wno-dangling-else
7423 Warn about constructions where there may be confusion to which
7424 @code{if} statement an @code{else} branch belongs. Here is an example of
7425 such a case:
7426
7427 @smallexample
7428 @group
7429 @{
7430 if (a)
7431 if (b)
7432 foo ();
7433 else
7434 bar ();
7435 @}
7436 @end group
7437 @end smallexample
7438
7439 In C/C++, every @code{else} branch belongs to the innermost possible
7440 @code{if} statement, which in this example is @code{if (b)}. This is
7441 often not what the programmer expected, as illustrated in the above
7442 example by indentation the programmer chose. When there is the
7443 potential for this confusion, GCC issues a warning when this flag
7444 is specified. To eliminate the warning, add explicit braces around
7445 the innermost @code{if} statement so there is no way the @code{else}
7446 can belong to the enclosing @code{if}. The resulting code
7447 looks like this:
7448
7449 @smallexample
7450 @group
7451 @{
7452 if (a)
7453 @{
7454 if (b)
7455 foo ();
7456 else
7457 bar ();
7458 @}
7459 @}
7460 @end group
7461 @end smallexample
7462
7463 This warning is enabled by @option{-Wparentheses}.
7464
7465 @item -Wdate-time
7466 @opindex Wdate-time
7467 @opindex Wno-date-time
7468 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
7469 are encountered as they might prevent bit-wise-identical reproducible
7470 compilations.
7471
7472 @item -Wempty-body
7473 @opindex Wempty-body
7474 @opindex Wno-empty-body
7475 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
7476 while} statement. This warning is also enabled by @option{-Wextra}.
7477
7478 @item -Wno-endif-labels
7479 @opindex Wendif-labels
7480 @opindex Wno-endif-labels
7481 Do not warn about stray tokens after @code{#else} and @code{#endif}.
7482
7483 @item -Wenum-compare
7484 @opindex Wenum-compare
7485 @opindex Wno-enum-compare
7486 Warn about a comparison between values of different enumerated types.
7487 In C++ enumerated type mismatches in conditional expressions are also
7488 diagnosed and the warning is enabled by default. In C this warning is
7489 enabled by @option{-Wall}.
7490
7491 @item -Wenum-conversion @r{(C, Objective-C only)}
7492 @opindex Wenum-conversion
7493 @opindex Wno-enum-conversion
7494 Warn when a value of enumerated type is implicitly converted to a
7495 different enumerated type. This warning is enabled by @option{-Wextra}.
7496
7497 @item -Wjump-misses-init @r{(C, Objective-C only)}
7498 @opindex Wjump-misses-init
7499 @opindex Wno-jump-misses-init
7500 Warn if a @code{goto} statement or a @code{switch} statement jumps
7501 forward across the initialization of a variable, or jumps backward to a
7502 label after the variable has been initialized. This only warns about
7503 variables that are initialized when they are declared. This warning is
7504 only supported for C and Objective-C; in C++ this sort of branch is an
7505 error in any case.
7506
7507 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7508 can be disabled with the @option{-Wno-jump-misses-init} option.
7509
7510 @item -Wsign-compare
7511 @opindex Wsign-compare
7512 @opindex Wno-sign-compare
7513 @cindex warning for comparison of signed and unsigned values
7514 @cindex comparison of signed and unsigned values, warning
7515 @cindex signed and unsigned values, comparison warning
7516 Warn when a comparison between signed and unsigned values could produce
7517 an incorrect result when the signed value is converted to unsigned.
7518 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7519 also enabled by @option{-Wextra}.
7520
7521 @item -Wsign-conversion
7522 @opindex Wsign-conversion
7523 @opindex Wno-sign-conversion
7524 Warn for implicit conversions that may change the sign of an integer
7525 value, like assigning a signed integer expression to an unsigned
7526 integer variable. An explicit cast silences the warning. In C, this
7527 option is enabled also by @option{-Wconversion}.
7528
7529 @item -Wfloat-conversion
7530 @opindex Wfloat-conversion
7531 @opindex Wno-float-conversion
7532 Warn for implicit conversions that reduce the precision of a real value.
7533 This includes conversions from real to integer, and from higher precision
7534 real to lower precision real values. This option is also enabled by
7535 @option{-Wconversion}.
7536
7537 @item -Wno-scalar-storage-order
7538 @opindex Wno-scalar-storage-order
7539 @opindex Wscalar-storage-order
7540 Do not warn on suspicious constructs involving reverse scalar storage order.
7541
7542 @item -Wsizeof-pointer-div
7543 @opindex Wsizeof-pointer-div
7544 @opindex Wno-sizeof-pointer-div
7545 Warn for suspicious divisions of two sizeof expressions that divide
7546 the pointer size by the element size, which is the usual way to compute
7547 the array size but won't work out correctly with pointers. This warning
7548 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7549 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7550
7551 @item -Wsizeof-pointer-memaccess
7552 @opindex Wsizeof-pointer-memaccess
7553 @opindex Wno-sizeof-pointer-memaccess
7554 Warn for suspicious length parameters to certain string and memory built-in
7555 functions if the argument uses @code{sizeof}. This warning triggers for
7556 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7557 an array, but a pointer, and suggests a possible fix, or about
7558 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7559 also warns about calls to bounded string copy functions like @code{strncat}
7560 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7561 the source array. For example, in the following function the call to
7562 @code{strncat} specifies the size of the source string as the bound. That
7563 is almost certainly a mistake and so the call is diagnosed.
7564 @smallexample
7565 void make_file (const char *name)
7566 @{
7567 char path[PATH_MAX];
7568 strncpy (path, name, sizeof path - 1);
7569 strncat (path, ".text", sizeof ".text");
7570 @dots{}
7571 @}
7572 @end smallexample
7573
7574 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7575
7576 @item -Wno-sizeof-array-argument
7577 @opindex Wsizeof-array-argument
7578 @opindex Wno-sizeof-array-argument
7579 Do not warn when the @code{sizeof} operator is applied to a parameter that is
7580 declared as an array in a function definition. This warning is enabled by
7581 default for C and C++ programs.
7582
7583 @item -Wmemset-elt-size
7584 @opindex Wmemset-elt-size
7585 @opindex Wno-memset-elt-size
7586 Warn for suspicious calls to the @code{memset} built-in function, if the
7587 first argument references an array, and the third argument is a number
7588 equal to the number of elements, but not equal to the size of the array
7589 in memory. This indicates that the user has omitted a multiplication by
7590 the element size. This warning is enabled by @option{-Wall}.
7591
7592 @item -Wmemset-transposed-args
7593 @opindex Wmemset-transposed-args
7594 @opindex Wno-memset-transposed-args
7595 Warn for suspicious calls to the @code{memset} built-in function where
7596 the second argument is not zero and the third argument is zero. For
7597 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7598 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7599 is only emitted if the third argument is a literal zero. Otherwise, if
7600 it is an expression that is folded to zero, or a cast of zero to some
7601 type, it is far less likely that the arguments have been mistakenly
7602 transposed and no warning is emitted. This warning is enabled
7603 by @option{-Wall}.
7604
7605 @item -Waddress
7606 @opindex Waddress
7607 @opindex Wno-address
7608 Warn about suspicious uses of memory addresses. These include using
7609 the address of a function in a conditional expression, such as
7610 @code{void func(void); if (func)}, and comparisons against the memory
7611 address of a string literal, such as @code{if (x == "abc")}. Such
7612 uses typically indicate a programmer error: the address of a function
7613 always evaluates to true, so their use in a conditional usually
7614 indicate that the programmer forgot the parentheses in a function
7615 call; and comparisons against string literals result in unspecified
7616 behavior and are not portable in C, so they usually indicate that the
7617 programmer intended to use @code{strcmp}. This warning is enabled by
7618 @option{-Wall}.
7619
7620 @item -Wno-address-of-packed-member
7621 @opindex Waddress-of-packed-member
7622 @opindex Wno-address-of-packed-member
7623 Do not warn when the address of packed member of struct or union is taken,
7624 which usually results in an unaligned pointer value. This is
7625 enabled by default.
7626
7627 @item -Wlogical-op
7628 @opindex Wlogical-op
7629 @opindex Wno-logical-op
7630 Warn about suspicious uses of logical operators in expressions.
7631 This includes using logical operators in contexts where a
7632 bit-wise operator is likely to be expected. Also warns when
7633 the operands of a logical operator are the same:
7634 @smallexample
7635 extern int a;
7636 if (a < 0 && a < 0) @{ @dots{} @}
7637 @end smallexample
7638
7639 @item -Wlogical-not-parentheses
7640 @opindex Wlogical-not-parentheses
7641 @opindex Wno-logical-not-parentheses
7642 Warn about logical not used on the left hand side operand of a comparison.
7643 This option does not warn if the right operand is considered to be a boolean
7644 expression. Its purpose is to detect suspicious code like the following:
7645 @smallexample
7646 int a;
7647 @dots{}
7648 if (!a > 1) @{ @dots{} @}
7649 @end smallexample
7650
7651 It is possible to suppress the warning by wrapping the LHS into
7652 parentheses:
7653 @smallexample
7654 if ((!a) > 1) @{ @dots{} @}
7655 @end smallexample
7656
7657 This warning is enabled by @option{-Wall}.
7658
7659 @item -Waggregate-return
7660 @opindex Waggregate-return
7661 @opindex Wno-aggregate-return
7662 Warn if any functions that return structures or unions are defined or
7663 called. (In languages where you can return an array, this also elicits
7664 a warning.)
7665
7666 @item -Wno-aggressive-loop-optimizations
7667 @opindex Wno-aggressive-loop-optimizations
7668 @opindex Waggressive-loop-optimizations
7669 Warn if in a loop with constant number of iterations the compiler detects
7670 undefined behavior in some statement during one or more of the iterations.
7671
7672 @item -Wno-attributes
7673 @opindex Wno-attributes
7674 @opindex Wattributes
7675 Do not warn if an unexpected @code{__attribute__} is used, such as
7676 unrecognized attributes, function attributes applied to variables,
7677 etc. This does not stop errors for incorrect use of supported
7678 attributes.
7679
7680 @item -Wno-builtin-declaration-mismatch
7681 @opindex Wno-builtin-declaration-mismatch
7682 @opindex Wbuiltin-declaration-mismatch
7683 Warn if a built-in function is declared with an incompatible signature
7684 or as a non-function, or when a built-in function declared with a type
7685 that does not include a prototype is called with arguments whose promoted
7686 types do not match those expected by the function. When @option{-Wextra}
7687 is specified, also warn when a built-in function that takes arguments is
7688 declared without a prototype. The @option{-Wbuiltin-declaration-mismatch}
7689 warning is enabled by default. To avoid the warning include the appropriate
7690 header to bring the prototypes of built-in functions into scope.
7691
7692 For example, the call to @code{memset} below is diagnosed by the warning
7693 because the function expects a value of type @code{size_t} as its argument
7694 but the type of @code{32} is @code{int}. With @option{-Wextra},
7695 the declaration of the function is diagnosed as well.
7696 @smallexample
7697 extern void* memset ();
7698 void f (void *d)
7699 @{
7700 memset (d, '\0', 32);
7701 @}
7702 @end smallexample
7703
7704 @item -Wno-builtin-macro-redefined
7705 @opindex Wno-builtin-macro-redefined
7706 @opindex Wbuiltin-macro-redefined
7707 Do not warn if certain built-in macros are redefined. This suppresses
7708 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7709 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7710
7711 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7712 @opindex Wstrict-prototypes
7713 @opindex Wno-strict-prototypes
7714 Warn if a function is declared or defined without specifying the
7715 argument types. (An old-style function definition is permitted without
7716 a warning if preceded by a declaration that specifies the argument
7717 types.)
7718
7719 @item -Wold-style-declaration @r{(C and Objective-C only)}
7720 @opindex Wold-style-declaration
7721 @opindex Wno-old-style-declaration
7722 Warn for obsolescent usages, according to the C Standard, in a
7723 declaration. For example, warn if storage-class specifiers like
7724 @code{static} are not the first things in a declaration. This warning
7725 is also enabled by @option{-Wextra}.
7726
7727 @item -Wold-style-definition @r{(C and Objective-C only)}
7728 @opindex Wold-style-definition
7729 @opindex Wno-old-style-definition
7730 Warn if an old-style function definition is used. A warning is given
7731 even if there is a previous prototype. A definition using @samp{()}
7732 is not considered an old-style definition in C2X mode, because it is
7733 equivalent to @samp{(void)} in that case, but is considered an
7734 old-style definition for older standards.
7735
7736 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7737 @opindex Wmissing-parameter-type
7738 @opindex Wno-missing-parameter-type
7739 A function parameter is declared without a type specifier in K&R-style
7740 functions:
7741
7742 @smallexample
7743 void foo(bar) @{ @}
7744 @end smallexample
7745
7746 This warning is also enabled by @option{-Wextra}.
7747
7748 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7749 @opindex Wmissing-prototypes
7750 @opindex Wno-missing-prototypes
7751 Warn if a global function is defined without a previous prototype
7752 declaration. This warning is issued even if the definition itself
7753 provides a prototype. Use this option to detect global functions
7754 that do not have a matching prototype declaration in a header file.
7755 This option is not valid for C++ because all function declarations
7756 provide prototypes and a non-matching declaration declares an
7757 overload rather than conflict with an earlier declaration.
7758 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7759
7760 @item -Wmissing-declarations
7761 @opindex Wmissing-declarations
7762 @opindex Wno-missing-declarations
7763 Warn if a global function is defined without a previous declaration.
7764 Do so even if the definition itself provides a prototype.
7765 Use this option to detect global functions that are not declared in
7766 header files. In C, no warnings are issued for functions with previous
7767 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7768 missing prototypes. In C++, no warnings are issued for function templates,
7769 or for inline functions, or for functions in anonymous namespaces.
7770
7771 @item -Wmissing-field-initializers
7772 @opindex Wmissing-field-initializers
7773 @opindex Wno-missing-field-initializers
7774 @opindex W
7775 @opindex Wextra
7776 @opindex Wno-extra
7777 Warn if a structure's initializer has some fields missing. For
7778 example, the following code causes such a warning, because
7779 @code{x.h} is implicitly zero:
7780
7781 @smallexample
7782 struct s @{ int f, g, h; @};
7783 struct s x = @{ 3, 4 @};
7784 @end smallexample
7785
7786 This option does not warn about designated initializers, so the following
7787 modification does not trigger a warning:
7788
7789 @smallexample
7790 struct s @{ int f, g, h; @};
7791 struct s x = @{ .f = 3, .g = 4 @};
7792 @end smallexample
7793
7794 In C this option does not warn about the universal zero initializer
7795 @samp{@{ 0 @}}:
7796
7797 @smallexample
7798 struct s @{ int f, g, h; @};
7799 struct s x = @{ 0 @};
7800 @end smallexample
7801
7802 Likewise, in C++ this option does not warn about the empty @{ @}
7803 initializer, for example:
7804
7805 @smallexample
7806 struct s @{ int f, g, h; @};
7807 s x = @{ @};
7808 @end smallexample
7809
7810 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7811 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7812
7813 @item -Wno-multichar
7814 @opindex Wno-multichar
7815 @opindex Wmultichar
7816 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7817 Usually they indicate a typo in the user's code, as they have
7818 implementation-defined values, and should not be used in portable code.
7819
7820 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7821 @opindex Wnormalized=
7822 @opindex Wnormalized
7823 @opindex Wno-normalized
7824 @cindex NFC
7825 @cindex NFKC
7826 @cindex character set, input normalization
7827 In ISO C and ISO C++, two identifiers are different if they are
7828 different sequences of characters. However, sometimes when characters
7829 outside the basic ASCII character set are used, you can have two
7830 different character sequences that look the same. To avoid confusion,
7831 the ISO 10646 standard sets out some @dfn{normalization rules} which
7832 when applied ensure that two sequences that look the same are turned into
7833 the same sequence. GCC can warn you if you are using identifiers that
7834 have not been normalized; this option controls that warning.
7835
7836 There are four levels of warning supported by GCC@. The default is
7837 @option{-Wnormalized=nfc}, which warns about any identifier that is
7838 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7839 recommended form for most uses. It is equivalent to
7840 @option{-Wnormalized}.
7841
7842 Unfortunately, there are some characters allowed in identifiers by
7843 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7844 identifiers. That is, there's no way to use these symbols in portable
7845 ISO C or C++ and have all your identifiers in NFC@.
7846 @option{-Wnormalized=id} suppresses the warning for these characters.
7847 It is hoped that future versions of the standards involved will correct
7848 this, which is why this option is not the default.
7849
7850 You can switch the warning off for all characters by writing
7851 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7852 only do this if you are using some other normalization scheme (like
7853 ``D''), because otherwise you can easily create bugs that are
7854 literally impossible to see.
7855
7856 Some characters in ISO 10646 have distinct meanings but look identical
7857 in some fonts or display methodologies, especially once formatting has
7858 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7859 LETTER N'', displays just like a regular @code{n} that has been
7860 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7861 normalization scheme to convert all these into a standard form as
7862 well, and GCC warns if your code is not in NFKC if you use
7863 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7864 about every identifier that contains the letter O because it might be
7865 confused with the digit 0, and so is not the default, but may be
7866 useful as a local coding convention if the programming environment
7867 cannot be fixed to display these characters distinctly.
7868
7869 @item -Wno-attribute-warning
7870 @opindex Wno-attribute-warning
7871 @opindex Wattribute-warning
7872 Do not warn about usage of functions (@pxref{Function Attributes})
7873 declared with @code{warning} attribute. By default, this warning is
7874 enabled. @option{-Wno-attribute-warning} can be used to disable the
7875 warning or @option{-Wno-error=attribute-warning} can be used to
7876 disable the error when compiled with @option{-Werror} flag.
7877
7878 @item -Wno-deprecated
7879 @opindex Wno-deprecated
7880 @opindex Wdeprecated
7881 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7882
7883 @item -Wno-deprecated-declarations
7884 @opindex Wno-deprecated-declarations
7885 @opindex Wdeprecated-declarations
7886 Do not warn about uses of functions (@pxref{Function Attributes}),
7887 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7888 Attributes}) marked as deprecated by using the @code{deprecated}
7889 attribute.
7890
7891 @item -Wno-overflow
7892 @opindex Wno-overflow
7893 @opindex Woverflow
7894 Do not warn about compile-time overflow in constant expressions.
7895
7896 @item -Wno-odr
7897 @opindex Wno-odr
7898 @opindex Wodr
7899 Warn about One Definition Rule violations during link-time optimization.
7900 Enabled by default.
7901
7902 @item -Wopenmp-simd
7903 @opindex Wopenmp-simd
7904 @opindex Wno-openmp-simd
7905 Warn if the vectorizer cost model overrides the OpenMP
7906 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7907 option can be used to relax the cost model.
7908
7909 @item -Woverride-init @r{(C and Objective-C only)}
7910 @opindex Woverride-init
7911 @opindex Wno-override-init
7912 @opindex W
7913 @opindex Wextra
7914 @opindex Wno-extra
7915 Warn if an initialized field without side effects is overridden when
7916 using designated initializers (@pxref{Designated Inits, , Designated
7917 Initializers}).
7918
7919 This warning is included in @option{-Wextra}. To get other
7920 @option{-Wextra} warnings without this one, use @option{-Wextra
7921 -Wno-override-init}.
7922
7923 @item -Wno-override-init-side-effects @r{(C and Objective-C only)}
7924 @opindex Woverride-init-side-effects
7925 @opindex Wno-override-init-side-effects
7926 Do not warn if an initialized field with side effects is overridden when
7927 using designated initializers (@pxref{Designated Inits, , Designated
7928 Initializers}). This warning is enabled by default.
7929
7930 @item -Wpacked
7931 @opindex Wpacked
7932 @opindex Wno-packed
7933 Warn if a structure is given the packed attribute, but the packed
7934 attribute has no effect on the layout or size of the structure.
7935 Such structures may be mis-aligned for little benefit. For
7936 instance, in this code, the variable @code{f.x} in @code{struct bar}
7937 is misaligned even though @code{struct bar} does not itself
7938 have the packed attribute:
7939
7940 @smallexample
7941 @group
7942 struct foo @{
7943 int x;
7944 char a, b, c, d;
7945 @} __attribute__((packed));
7946 struct bar @{
7947 char z;
7948 struct foo f;
7949 @};
7950 @end group
7951 @end smallexample
7952
7953 @item -Wnopacked-bitfield-compat
7954 @opindex Wpacked-bitfield-compat
7955 @opindex Wno-packed-bitfield-compat
7956 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7957 on bit-fields of type @code{char}. This was fixed in GCC 4.4 but
7958 the change can lead to differences in the structure layout. GCC
7959 informs you when the offset of such a field has changed in GCC 4.4.
7960 For example there is no longer a 4-bit padding between field @code{a}
7961 and @code{b} in this structure:
7962
7963 @smallexample
7964 struct foo
7965 @{
7966 char a:4;
7967 char b:8;
7968 @} __attribute__ ((packed));
7969 @end smallexample
7970
7971 This warning is enabled by default. Use
7972 @option{-Wno-packed-bitfield-compat} to disable this warning.
7973
7974 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7975 @opindex Wpacked-not-aligned
7976 @opindex Wno-packed-not-aligned
7977 Warn if a structure field with explicitly specified alignment in a
7978 packed struct or union is misaligned. For example, a warning will
7979 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7980 'struct S' is less than 8}, in this code:
7981
7982 @smallexample
7983 @group
7984 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7985 struct __attribute__ ((packed)) S @{
7986 struct S8 s8;
7987 @};
7988 @end group
7989 @end smallexample
7990
7991 This warning is enabled by @option{-Wall}.
7992
7993 @item -Wpadded
7994 @opindex Wpadded
7995 @opindex Wno-padded
7996 Warn if padding is included in a structure, either to align an element
7997 of the structure or to align the whole structure. Sometimes when this
7998 happens it is possible to rearrange the fields of the structure to
7999 reduce the padding and so make the structure smaller.
8000
8001 @item -Wredundant-decls
8002 @opindex Wredundant-decls
8003 @opindex Wno-redundant-decls
8004 Warn if anything is declared more than once in the same scope, even in
8005 cases where multiple declaration is valid and changes nothing.
8006
8007 @item -Wno-restrict
8008 @opindex Wrestrict
8009 @opindex Wno-restrict
8010 Warn when an object referenced by a @code{restrict}-qualified parameter
8011 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
8012 argument, or when copies between such objects overlap. For example,
8013 the call to the @code{strcpy} function below attempts to truncate the string
8014 by replacing its initial characters with the last four. However, because
8015 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
8016 the call is diagnosed.
8017
8018 @smallexample
8019 void foo (void)
8020 @{
8021 char a[] = "abcd1234";
8022 strcpy (a, a + 4);
8023 @dots{}
8024 @}
8025 @end smallexample
8026 The @option{-Wrestrict} option detects some instances of simple overlap
8027 even without optimization but works best at @option{-O2} and above. It
8028 is included in @option{-Wall}.
8029
8030 @item -Wnested-externs @r{(C and Objective-C only)}
8031 @opindex Wnested-externs
8032 @opindex Wno-nested-externs
8033 Warn if an @code{extern} declaration is encountered within a function.
8034
8035 @item -Winline
8036 @opindex Winline
8037 @opindex Wno-inline
8038 Warn if a function that is declared as inline cannot be inlined.
8039 Even with this option, the compiler does not warn about failures to
8040 inline functions declared in system headers.
8041
8042 The compiler uses a variety of heuristics to determine whether or not
8043 to inline a function. For example, the compiler takes into account
8044 the size of the function being inlined and the amount of inlining
8045 that has already been done in the current function. Therefore,
8046 seemingly insignificant changes in the source program can cause the
8047 warnings produced by @option{-Winline} to appear or disappear.
8048
8049 @item -Wint-in-bool-context
8050 @opindex Wint-in-bool-context
8051 @opindex Wno-int-in-bool-context
8052 Warn for suspicious use of integer values where boolean values are expected,
8053 such as conditional expressions (?:) using non-boolean integer constants in
8054 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
8055 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
8056 for all kinds of multiplications regardless of the data type.
8057 This warning is enabled by @option{-Wall}.
8058
8059 @item -Wno-int-to-pointer-cast
8060 @opindex Wno-int-to-pointer-cast
8061 @opindex Wint-to-pointer-cast
8062 Suppress warnings from casts to pointer type of an integer of a
8063 different size. In C++, casting to a pointer type of smaller size is
8064 an error. @option{Wint-to-pointer-cast} is enabled by default.
8065
8066
8067 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
8068 @opindex Wno-pointer-to-int-cast
8069 @opindex Wpointer-to-int-cast
8070 Suppress warnings from casts from a pointer to an integer type of a
8071 different size.
8072
8073 @item -Winvalid-pch
8074 @opindex Winvalid-pch
8075 @opindex Wno-invalid-pch
8076 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
8077 the search path but cannot be used.
8078
8079 @item -Wlong-long
8080 @opindex Wlong-long
8081 @opindex Wno-long-long
8082 Warn if @code{long long} type is used. This is enabled by either
8083 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
8084 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
8085
8086 @item -Wvariadic-macros
8087 @opindex Wvariadic-macros
8088 @opindex Wno-variadic-macros
8089 Warn if variadic macros are used in ISO C90 mode, or if the GNU
8090 alternate syntax is used in ISO C99 mode. This is enabled by either
8091 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
8092 messages, use @option{-Wno-variadic-macros}.
8093
8094 @item -Wno-varargs
8095 @opindex Wvarargs
8096 @opindex Wno-varargs
8097 Do not warn upon questionable usage of the macros used to handle variable
8098 arguments like @code{va_start}. These warnings are enabled by default.
8099
8100 @item -Wvector-operation-performance
8101 @opindex Wvector-operation-performance
8102 @opindex Wno-vector-operation-performance
8103 Warn if vector operation is not implemented via SIMD capabilities of the
8104 architecture. Mainly useful for the performance tuning.
8105 Vector operation can be implemented @code{piecewise}, which means that the
8106 scalar operation is performed on every vector element;
8107 @code{in parallel}, which means that the vector operation is implemented
8108 using scalars of wider type, which normally is more performance efficient;
8109 and @code{as a single scalar}, which means that vector fits into a
8110 scalar type.
8111
8112 @item -Wvla
8113 @opindex Wvla
8114 @opindex Wno-vla
8115 Warn if a variable-length array is used in the code.
8116 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
8117 the variable-length array.
8118
8119 @item -Wvla-larger-than=@var{byte-size}
8120 @opindex Wvla-larger-than=
8121 @opindex Wno-vla-larger-than
8122 If this option is used, the compiler warns for declarations of
8123 variable-length arrays whose size is either unbounded, or bounded
8124 by an argument that allows the array size to exceed @var{byte-size}
8125 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
8126 works, but with variable-length arrays.
8127
8128 Note that GCC may optimize small variable-length arrays of a known
8129 value into plain arrays, so this warning may not get triggered for
8130 such arrays.
8131
8132 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
8133 is typically only effective when @option{-ftree-vrp} is active (default
8134 for @option{-O2} and above).
8135
8136 See also @option{-Walloca-larger-than=@var{byte-size}}.
8137
8138 @item -Wno-vla-larger-than
8139 @opindex Wno-vla-larger-than
8140 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
8141 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
8142
8143 @item -Wvolatile-register-var
8144 @opindex Wvolatile-register-var
8145 @opindex Wno-volatile-register-var
8146 Warn if a register variable is declared volatile. The volatile
8147 modifier does not inhibit all optimizations that may eliminate reads
8148 and/or writes to register variables. This warning is enabled by
8149 @option{-Wall}.
8150
8151 @item -Wdisabled-optimization
8152 @opindex Wdisabled-optimization
8153 @opindex Wno-disabled-optimization
8154 Warn if a requested optimization pass is disabled. This warning does
8155 not generally indicate that there is anything wrong with your code; it
8156 merely indicates that GCC's optimizers are unable to handle the code
8157 effectively. Often, the problem is that your code is too big or too
8158 complex; GCC refuses to optimize programs when the optimization
8159 itself is likely to take inordinate amounts of time.
8160
8161 @item -Wpointer-sign @r{(C and Objective-C only)}
8162 @opindex Wpointer-sign
8163 @opindex Wno-pointer-sign
8164 Warn for pointer argument passing or assignment with different signedness.
8165 This option is only supported for C and Objective-C@. It is implied by
8166 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
8167 @option{-Wno-pointer-sign}.
8168
8169 @item -Wstack-protector
8170 @opindex Wstack-protector
8171 @opindex Wno-stack-protector
8172 This option is only active when @option{-fstack-protector} is active. It
8173 warns about functions that are not protected against stack smashing.
8174
8175 @item -Woverlength-strings
8176 @opindex Woverlength-strings
8177 @opindex Wno-overlength-strings
8178 Warn about string constants that are longer than the ``minimum
8179 maximum'' length specified in the C standard. Modern compilers
8180 generally allow string constants that are much longer than the
8181 standard's minimum limit, but very portable programs should avoid
8182 using longer strings.
8183
8184 The limit applies @emph{after} string constant concatenation, and does
8185 not count the trailing NUL@. In C90, the limit was 509 characters; in
8186 C99, it was raised to 4095. C++98 does not specify a normative
8187 minimum maximum, so we do not diagnose overlength strings in C++@.
8188
8189 This option is implied by @option{-Wpedantic}, and can be disabled with
8190 @option{-Wno-overlength-strings}.
8191
8192 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
8193 @opindex Wunsuffixed-float-constants
8194 @opindex Wno-unsuffixed-float-constants
8195
8196 Issue a warning for any floating constant that does not have
8197 a suffix. When used together with @option{-Wsystem-headers} it
8198 warns about such constants in system header files. This can be useful
8199 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
8200 from the decimal floating-point extension to C99.
8201
8202 @item -Wno-lto-type-mismatch
8203 @opindex Wlto-type-mismatch
8204 @opindex Wno-lto-type-mismatch
8205
8206 During the link-time optimization, do not warn about type mismatches in
8207 global declarations from different compilation units.
8208 Requires @option{-flto} to be enabled. Enabled by default.
8209
8210 @item -Wno-designated-init @r{(C and Objective-C only)}
8211 @opindex Wdesignated-init
8212 @opindex Wno-designated-init
8213 Suppress warnings when a positional initializer is used to initialize
8214 a structure that has been marked with the @code{designated_init}
8215 attribute.
8216
8217 @item -Wno-hsa
8218 @opindex Whsa
8219 @opindex Wno-hsa
8220 Do not warn when HSAIL cannot be emitted for the compiled function or
8221 OpenMP construct. These warnings are enabled by default.
8222
8223 @end table
8224
8225 @node Static Analyzer Options
8226 @section Options That Control Static Analysis
8227
8228 @table @gcctabopt
8229 @item -fanalyzer
8230 @opindex analyzer
8231 @opindex fanalyzer
8232 @opindex fno-analyzer
8233 This option enables an static analysis of program flow which looks
8234 for ``interesting'' interprocedural paths through the
8235 code, and issues warnings for problems found on them.
8236
8237 This analysis is much more expensive than other GCC warnings.
8238
8239 Enabling this option effectively enables the following warnings:
8240
8241 @gccoptlist{ @gol
8242 -Wanalyzer-double-fclose @gol
8243 -Wanalyzer-double-free @gol
8244 -Wanalyzer-exposure-through-output-file @gol
8245 -Wanalyzer-file-leak @gol
8246 -Wanalyzer-free-of-non-heap @gol
8247 -Wanalyzer-malloc-leak @gol
8248 -Wanalyzer-possible-null-argument @gol
8249 -Wanalyzer-possible-null-dereference @gol
8250 -Wanalyzer-null-argument @gol
8251 -Wanalyzer-null-dereference @gol
8252 -Wanalyzer-stale-setjmp-buffer @gol
8253 -Wanalyzer-tainted-array-index @gol
8254 -Wanalyzer-unsafe-call-within-signal-handler @gol
8255 -Wanalyzer-use-after-free @gol
8256 -Wanalyzer-use-of-uninitialized-value @gol
8257 -Wanalyzer-use-of-pointer-in-stale-stack-frame @gol
8258 }
8259
8260 This option is only available if GCC was configured with analyzer
8261 support enabled.
8262
8263 @item -Wanalyzer-too-complex
8264 @opindex Wanalyzer-too-complex
8265 @opindex Wno-analyzer-too-complex
8266 If @option{-fanalyzer} is enabled, the analyzer uses various heuristics
8267 to attempt to explore the control flow and data flow in the program,
8268 but these can be defeated by sufficiently complicated code.
8269
8270 By default, the analysis silently stops if the code is too
8271 complicated for the analyzer to fully explore and it reaches an internal
8272 limit. The @option{-Wanalyzer-too-complex} option warns if this occurs.
8273
8274 @item -Wno-analyzer-double-fclose
8275 @opindex Wanalyzer-double-fclose
8276 @opindex Wno-analyzer-double-fclose
8277 This warning requires @option{-fanalyzer}, which enables it; use
8278 @option{-Wno-analyzer-double-fclose} to disable it.
8279
8280 This diagnostic warns for paths through the code in which a @code{FILE *}
8281 can have @code{fclose} called on it more than once.
8282
8283 @item -Wno-analyzer-double-free
8284 @opindex Wanalyzer-double-free
8285 @opindex Wno-analyzer-double-free
8286 This warning requires @option{-fanalyzer}, which enables it; use
8287 @option{-Wno-analyzer-double-free} to disable it.
8288
8289 This diagnostic warns for paths through the code in which a pointer
8290 can have @code{free} called on it more than once.
8291
8292 @item -Wno-analyzer-exposure-through-output-file
8293 @opindex Wanalyzer-exposure-through-output-file
8294 @opindex Wno-analyzer-exposure-through-output-file
8295 This warning requires @option{-fanalyzer}, which enables it; use
8296 @option{-Wno-analyzer-exposure-through-output-file}
8297 to disable it.
8298
8299 This diagnostic warns for paths through the code in which a
8300 security-sensitive value is written to an output file
8301 (such as writing a password to a log file).
8302
8303 @item -Wno-analyzer-file-leak
8304 @opindex Wanalyzer-file-leak
8305 @opindex Wno-analyzer-file-leak
8306 This warning requires @option{-fanalyzer}, which enables it; use
8307 @option{-Wno-analyzer-file-leak}
8308 to disable it.
8309
8310 This diagnostic warns for paths through the code in which a
8311 @code{<stdio.h>} @code{FILE *} stream object is leaked.
8312
8313 @item -Wno-analyzer-free-of-non-heap
8314 @opindex Wanalyzer-free-of-non-heap
8315 @opindex Wno-analyzer-free-of-non-heap
8316 This warning requires @option{-fanalyzer}, which enables it; use
8317 @option{-Wno-analyzer-free-of-non-heap}
8318 to disable it.
8319
8320 This diagnostic warns for paths through the code in which @code{free}
8321 is called on a non-heap pointer (e.g. an on-stack buffer, or a global).
8322
8323 @item -Wno-analyzer-malloc-leak
8324 @opindex Wanalyzer-malloc-leak
8325 @opindex Wno-analyzer-malloc-leak
8326 This warning requires @option{-fanalyzer}, which enables it; use
8327 @option{-Wno-analyzer-malloc-leak}
8328 to disable it.
8329
8330 This diagnostic warns for paths through the code in which a
8331 pointer allocated via @code{malloc} is leaked.
8332
8333 @item -Wno-analyzer-possible-null-argument
8334 @opindex Wanalyzer-possible-null-argument
8335 @opindex Wno-analyzer-possible-null-argument
8336 This warning requires @option{-fanalyzer}, which enables it; use
8337 @option{-Wno-analyzer-possible-null-argument} to disable it.
8338
8339 This diagnostic warns for paths through the code in which a
8340 possibly-NULL value is passed to a function argument marked
8341 with @code{__attribute__((nonnull))} as requiring a non-NULL
8342 value.
8343
8344 @item -Wno-analyzer-possible-null-dereference
8345 @opindex Wanalyzer-possible-null-dereference
8346 @opindex Wno-analyzer-possible-null-dereference
8347 This warning requires @option{-fanalyzer}, which enables it; use
8348 @option{-Wno-analyzer-possible-null-dereference} to disable it.
8349
8350 This diagnostic warns for paths through the code in which a
8351 possibly-NULL value is dereferenced.
8352
8353 @item -Wno-analyzer-null-argument
8354 @opindex Wanalyzer-null-argument
8355 @opindex Wno-analyzer-null-argument
8356 This warning requires @option{-fanalyzer}, which enables it; use
8357 @option{-Wno-analyzer-null-argument} to disable it.
8358
8359 This diagnostic warns for paths through the code in which a
8360 value known to be NULL is passed to a function argument marked
8361 with @code{__attribute__((nonnull))} as requiring a non-NULL
8362 value.
8363
8364 @item -Wno-analyzer-null-dereference
8365 @opindex Wanalyzer-null-dereference
8366 @opindex Wno-analyzer-null-dereference
8367 This warning requires @option{-fanalyzer}, which enables it; use
8368 @option{-Wno-analyzer-null-dereference} to disable it.
8369
8370 This diagnostic warns for paths through the code in which a
8371 value known to be NULL is dereferenced.
8372
8373 @item -Wno-analyzer-stale-setjmp-buffer
8374 @opindex Wanalyzer-stale-setjmp-buffer
8375 @opindex Wno-analyzer-stale-setjmp-buffer
8376 This warning requires @option{-fanalyzer}, which enables it; use
8377 @option{-Wno-analyzer-stale-setjmp-buffer} to disable it.
8378
8379 This diagnostic warns for paths through the code in which
8380 @code{longjmp} is called to rewind to a @code{jmp_buf} relating
8381 to a @code{setjmp} call in a function that has returned.
8382
8383 When @code{setjmp} is called on a @code{jmp_buf} to record a rewind
8384 location, it records the stack frame. The stack frame becomes invalid
8385 when the function containing the @code{setjmp} call returns. Attempting
8386 to rewind to it via @code{longjmp} would reference a stack frame that
8387 no longer exists, and likely lead to a crash (or worse).
8388
8389 @item -Wno-analyzer-tainted-array-index
8390 @opindex Wanalyzer-tainted-array-index
8391 @opindex Wno-analyzer-tainted-array-index
8392 This warning requires both @option{-fanalyzer} and
8393 @option{-fanalyzer-checker=taint} to enable it;
8394 use @option{-Wno-analyzer-tainted-array-index} to disable it.
8395
8396 This diagnostic warns for paths through the code in which a value
8397 that could be under an attacker's control is used as the index
8398 of an array access without being sanitized.
8399
8400 @item -Wno-analyzer-unsafe-call-within-signal-handler
8401 @opindex Wanalyzer-unsafe-call-within-signal-handler
8402 @opindex Wno-analyzer-unsafe-call-within-signal-handler
8403 This warning requires @option{-fanalyzer}, which enables it; use
8404 @option{-Wno-analyzer-unsafe-call-within-signal-handler} to disable it.
8405
8406 This diagnostic warns for paths through the code in which a
8407 function known to be async-signal-unsafe (such as @code{fprintf}) is
8408 called from a signal handler.
8409
8410 @item -Wno-analyzer-use-after-free
8411 @opindex Wanalyzer-use-after-free
8412 @opindex Wno-analyzer-use-after-free
8413 This warning requires @option{-fanalyzer}, which enables it; use
8414 @option{-Wno-analyzer-use-after-free} to disable it.
8415
8416 This diagnostic warns for paths through the code in which a
8417 pointer is used after @code{free} is called on it.
8418
8419 @item -Wno-analyzer-use-of-pointer-in-stale-stack-frame
8420 @opindex Wanalyzer-use-of-pointer-in-stale-stack-frame
8421 @opindex Wno-analyzer-use-of-pointer-in-stale-stack-frame
8422 This warning requires @option{-fanalyzer}, which enables it; use
8423 @option{-Wno-analyzer-use-of-pointer-in-stale-stack-frame}
8424 to disable it.
8425
8426 This diagnostic warns for paths through the code in which a pointer
8427 is dereferenced that points to a variable in a stale stack frame.
8428
8429 @item -Wno-analyzer-use-of-uninitialized-value
8430 @opindex Wanalyzer-use-of-uninitialized-value
8431 @opindex Wno-analyzer-use-of-uninitialized-value
8432 This warning requires @option{-fanalyzer}, which enables it; use
8433 @option{-Wno-analyzer-use-of-uninitialized-value} to disable it.
8434
8435 This diagnostic warns for paths through the code in which an uninitialized
8436 value is used.
8437
8438 @end table
8439
8440 Pertinent parameters for controlling the exploration are:
8441 @option{--param analyzer-bb-explosion-factor=@var{value}},
8442 @option{--param analyzer-max-enodes-per-program-point=@var{value}},
8443 @option{--param analyzer-max-recursion-depth=@var{value}}, and
8444 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}.
8445
8446 The following options control the analyzer.
8447
8448 @table @gcctabopt
8449
8450 @item -fanalyzer-call-summaries
8451 @opindex fanalyzer-call-summaries
8452 @opindex fno-analyzer-call-summaries
8453 Simplify interprocedural analysis by computing the effect of certain calls,
8454 rather than exploring all paths through the function from callsite to each
8455 possible return.
8456
8457 If enabled, call summaries are only used for functions with more than one
8458 call site, and that are sufficiently complicated (as per
8459 @option{--param analyzer-min-snodes-for-call-summary=@var{value}}).
8460
8461 @item -fanalyzer-checker=@var{name}
8462 @opindex fanalyzer-checker
8463 Restrict the analyzer to run just the named checker, and enable it.
8464
8465 Some checkers are disabled by default (even with @option{-fanalyzer}),
8466 such as the @code{taint} checker that implements
8467 @option{-Wanalyzer-tainted-array-index}, and this option is required
8468 to enable them.
8469
8470 @item -fanalyzer-fine-grained
8471 @opindex fanalyzer-fine-grained
8472 @opindex fno-analyzer-fine-grained
8473 This option is intended for analyzer developers.
8474
8475 Internally the analyzer builds an ``exploded graph'' that combines
8476 control flow graphs with data flow information.
8477
8478 By default, an edge in this graph can contain the effects of a run
8479 of multiple statements within a basic block. With
8480 @option{-fanalyzer-fine-grained}, each statement gets its own edge.
8481
8482 @item -fanalyzer-show-duplicate-count
8483 @opindex fanalyzer-show-duplicate-count
8484 @opindex fno-analyzer-show-duplicate-count
8485 This option is intended for analyzer developers: if multiple diagnostics
8486 have been detected as being duplicates of each other, it emits a note when
8487 reporting the best diagnostic, giving the number of additional diagnostics
8488 that were suppressed by the deduplication logic.
8489
8490 @item -fno-analyzer-state-merge
8491 @opindex fanalyzer-state-merge
8492 @opindex fno-analyzer-state-merge
8493 This option is intended for analyzer developers.
8494
8495 By default the analyzer attempts to simplify analysis by merging
8496 sufficiently similar states at each program point as it builds its
8497 ``exploded graph''. With @option{-fno-analyzer-state-merge} this
8498 merging can be suppressed, for debugging state-handling issues.
8499
8500 @item -fno-analyzer-state-purge
8501 @opindex fanalyzer-state-purge
8502 @opindex fno-analyzer-state-purge
8503 This option is intended for analyzer developers.
8504
8505 By default the analyzer attempts to simplify analysis by purging
8506 aspects of state at a program point that appear to no longer be relevant
8507 e.g. the values of locals that aren't accessed later in the function
8508 and which aren't relevant to leak analysis.
8509
8510 With @option{-fno-analyzer-state-purge} this purging of state can
8511 be suppressed, for debugging state-handling issues.
8512
8513 @item -fanalyzer-transitivity
8514 @opindex fanalyzer-transitivity
8515 @opindex fno-analyzer-transitivity
8516 This option enables transitivity of constraints within the analyzer.
8517
8518 @item -fanalyzer-verbose-edges
8519 This option is intended for analyzer developers. It enables more
8520 verbose, lower-level detail in the descriptions of control flow
8521 within diagnostic paths.
8522
8523 @item -fanalyzer-verbose-state-changes
8524 This option is intended for analyzer developers. It enables more
8525 verbose, lower-level detail in the descriptions of events relating
8526 to state machines within diagnostic paths.
8527
8528 @item -fanalyzer-verbosity=@var{level}
8529 This option controls the complexity of the control flow paths that are
8530 emitted for analyzer diagnostics.
8531
8532 The @var{level} can be one of:
8533
8534 @table @samp
8535 @item 0
8536 At this level, interprocedural call and return events are displayed,
8537 along with the most pertinent state-change events relating to
8538 a diagnostic. For example, for a double-@code{free} diagnostic,
8539 both calls to @code{free} will be shown.
8540
8541 @item 1
8542 As per the previous level, but also show events for the entry
8543 to each function.
8544
8545 @item 2
8546 As per the previous level, but also show events relating to
8547 control flow that are significant to triggering the issue
8548 (e.g. ``true path taken'' at a conditional).
8549
8550 This level is the default.
8551
8552 @item 3
8553 As per the previous level, but show all control flow events, not
8554 just significant ones.
8555
8556 @item 4
8557 This level is intended for analyzer developers; it adds various
8558 other events intended for debugging the analyzer.
8559
8560 @end table
8561
8562 @item -fdump-analyzer
8563 @opindex fdump-analyzer
8564 Dump internal details about what the analyzer is doing to
8565 @file{@var{file}.analyzer.txt}.
8566 This option is overridden by @option{-fdump-analyzer-stderr}.
8567
8568 @item -fdump-analyzer-stderr
8569 @opindex fdump-analyzer-stderr
8570 Dump internal details about what the analyzer is doing to stderr.
8571 This option overrides @option{-fdump-analyzer}.
8572
8573 @item -fdump-analyzer-callgraph
8574 @opindex fdump-analyzer-callgraph
8575 Dump a representation of the call graph suitable for viewing with
8576 GraphViz to @file{@var{file}.callgraph.dot}.
8577
8578 @item -fdump-analyzer-exploded-graph
8579 @opindex fdump-analyzer-exploded-graph
8580 Dump a representation of the ``exploded graph'' suitable for viewing with
8581 GraphViz to @file{@var{file}.eg.dot}.
8582 Nodes are color-coded based on state-machine states to emphasize
8583 state changes.
8584
8585 @item -fdump-analyzer-exploded-nodes
8586 @opindex dump-analyzer-exploded-nodes
8587 Emit diagnostics showing where nodes in the ``exploded graph'' are
8588 in relation to the program source.
8589
8590 @item -fdump-analyzer-exploded-nodes-2
8591 @opindex dump-analyzer-exploded-nodes-2
8592 Dump a textual representation of the ``exploded graph'' to
8593 @file{@var{file}.eg.txt}.
8594
8595 @item -fdump-analyzer-exploded-nodes-3
8596 @opindex dump-analyzer-exploded-nodes-3
8597 Dump a textual representation of the ``exploded graph'' to
8598 one dump file per node, to @file{@var{file}.eg-@var{id}.txt}.
8599 This is typically a large number of dump files.
8600
8601 @item -fdump-analyzer-state-purge
8602 @opindex fdump-analyzer-state-purge
8603 As per @option{-fdump-analyzer-supergraph}, dump a representation of the
8604 ``supergraph'' suitable for viewing with GraphViz, but annotate the
8605 graph with information on what state will be purged at each node.
8606 The graph is written to @file{@var{file}.state-purge.dot}.
8607
8608 @item -fdump-analyzer-supergraph
8609 @opindex fdump-analyzer-supergraph
8610 Dump a representation of the ``supergraph'' suitable for viewing with
8611 GraphViz to @file{@var{file}.supergraph.dot}. This shows all of the
8612 control flow graphs in the program, with interprocedural edges for
8613 calls and returns.
8614
8615 @end table
8616
8617 @node Debugging Options
8618 @section Options for Debugging Your Program
8619 @cindex options, debugging
8620 @cindex debugging information options
8621
8622 To tell GCC to emit extra information for use by a debugger, in almost
8623 all cases you need only to add @option{-g} to your other options.
8624
8625 GCC allows you to use @option{-g} with
8626 @option{-O}. The shortcuts taken by optimized code may occasionally
8627 be surprising: some variables you declared may not exist
8628 at all; flow of control may briefly move where you did not expect it;
8629 some statements may not be executed because they compute constant
8630 results or their values are already at hand; some statements may
8631 execute in different places because they have been moved out of loops.
8632 Nevertheless it is possible to debug optimized output. This makes
8633 it reasonable to use the optimizer for programs that might have bugs.
8634
8635 If you are not using some other optimization option, consider
8636 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
8637 With no @option{-O} option at all, some compiler passes that collect
8638 information useful for debugging do not run at all, so that
8639 @option{-Og} may result in a better debugging experience.
8640
8641 @table @gcctabopt
8642 @item -g
8643 @opindex g
8644 Produce debugging information in the operating system's native format
8645 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
8646 information.
8647
8648 On most systems that use stabs format, @option{-g} enables use of extra
8649 debugging information that only GDB can use; this extra information
8650 makes debugging work better in GDB but probably makes other debuggers
8651 crash or
8652 refuse to read the program. If you want to control for certain whether
8653 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
8654 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
8655
8656 @item -ggdb
8657 @opindex ggdb
8658 Produce debugging information for use by GDB@. This means to use the
8659 most expressive format available (DWARF, stabs, or the native format
8660 if neither of those are supported), including GDB extensions if at all
8661 possible.
8662
8663 @item -gdwarf
8664 @itemx -gdwarf-@var{version}
8665 @opindex gdwarf
8666 Produce debugging information in DWARF format (if that is supported).
8667 The value of @var{version} may be either 2, 3, 4 or 5; the default version
8668 for most targets is 4. DWARF Version 5 is only experimental.
8669
8670 Note that with DWARF Version 2, some ports require and always
8671 use some non-conflicting DWARF 3 extensions in the unwind tables.
8672
8673 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
8674 for maximum benefit.
8675
8676 GCC no longer supports DWARF Version 1, which is substantially
8677 different than Version 2 and later. For historical reasons, some
8678 other DWARF-related options such as
8679 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
8680 in their names, but apply to all currently-supported versions of DWARF.
8681
8682 @item -gstabs
8683 @opindex gstabs
8684 Produce debugging information in stabs format (if that is supported),
8685 without GDB extensions. This is the format used by DBX on most BSD
8686 systems. On MIPS, Alpha and System V Release 4 systems this option
8687 produces stabs debugging output that is not understood by DBX@.
8688 On System V Release 4 systems this option requires the GNU assembler.
8689
8690 @item -gstabs+
8691 @opindex gstabs+
8692 Produce debugging information in stabs format (if that is supported),
8693 using GNU extensions understood only by the GNU debugger (GDB)@. The
8694 use of these extensions is likely to make other debuggers crash or
8695 refuse to read the program.
8696
8697 @item -gxcoff
8698 @opindex gxcoff
8699 Produce debugging information in XCOFF format (if that is supported).
8700 This is the format used by the DBX debugger on IBM RS/6000 systems.
8701
8702 @item -gxcoff+
8703 @opindex gxcoff+
8704 Produce debugging information in XCOFF format (if that is supported),
8705 using GNU extensions understood only by the GNU debugger (GDB)@. The
8706 use of these extensions is likely to make other debuggers crash or
8707 refuse to read the program, and may cause assemblers other than the GNU
8708 assembler (GAS) to fail with an error.
8709
8710 @item -gvms
8711 @opindex gvms
8712 Produce debugging information in Alpha/VMS debug format (if that is
8713 supported). This is the format used by DEBUG on Alpha/VMS systems.
8714
8715 @item -g@var{level}
8716 @itemx -ggdb@var{level}
8717 @itemx -gstabs@var{level}
8718 @itemx -gxcoff@var{level}
8719 @itemx -gvms@var{level}
8720 Request debugging information and also use @var{level} to specify how
8721 much information. The default level is 2.
8722
8723 Level 0 produces no debug information at all. Thus, @option{-g0} negates
8724 @option{-g}.
8725
8726 Level 1 produces minimal information, enough for making backtraces in
8727 parts of the program that you don't plan to debug. This includes
8728 descriptions of functions and external variables, and line number
8729 tables, but no information about local variables.
8730
8731 Level 3 includes extra information, such as all the macro definitions
8732 present in the program. Some debuggers support macro expansion when
8733 you use @option{-g3}.
8734
8735 If you use multiple @option{-g} options, with or without level numbers,
8736 the last such option is the one that is effective.
8737
8738 @option{-gdwarf} does not accept a concatenated debug level, to avoid
8739 confusion with @option{-gdwarf-@var{level}}.
8740 Instead use an additional @option{-g@var{level}} option to change the
8741 debug level for DWARF.
8742
8743 @item -fno-eliminate-unused-debug-symbols
8744 @opindex feliminate-unused-debug-symbols
8745 @opindex fno-eliminate-unused-debug-symbols
8746 By default, no debug information is produced for symbols that are not actually
8747 used. Use this option if you want debug information for all symbols.
8748
8749 @item -femit-class-debug-always
8750 @opindex femit-class-debug-always
8751 Instead of emitting debugging information for a C++ class in only one
8752 object file, emit it in all object files using the class. This option
8753 should be used only with debuggers that are unable to handle the way GCC
8754 normally emits debugging information for classes because using this
8755 option increases the size of debugging information by as much as a
8756 factor of two.
8757
8758 @item -fno-merge-debug-strings
8759 @opindex fmerge-debug-strings
8760 @opindex fno-merge-debug-strings
8761 Direct the linker to not merge together strings in the debugging
8762 information that are identical in different object files. Merging is
8763 not supported by all assemblers or linkers. Merging decreases the size
8764 of the debug information in the output file at the cost of increasing
8765 link processing time. Merging is enabled by default.
8766
8767 @item -fdebug-prefix-map=@var{old}=@var{new}
8768 @opindex fdebug-prefix-map
8769 When compiling files residing in directory @file{@var{old}}, record
8770 debugging information describing them as if the files resided in
8771 directory @file{@var{new}} instead. This can be used to replace a
8772 build-time path with an install-time path in the debug info. It can
8773 also be used to change an absolute path to a relative path by using
8774 @file{.} for @var{new}. This can give more reproducible builds, which
8775 are location independent, but may require an extra command to tell GDB
8776 where to find the source files. See also @option{-ffile-prefix-map}.
8777
8778 @item -fvar-tracking
8779 @opindex fvar-tracking
8780 Run variable tracking pass. It computes where variables are stored at each
8781 position in code. Better debugging information is then generated
8782 (if the debugging information format supports this information).
8783
8784 It is enabled by default when compiling with optimization (@option{-Os},
8785 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
8786 the debug info format supports it.
8787
8788 @item -fvar-tracking-assignments
8789 @opindex fvar-tracking-assignments
8790 @opindex fno-var-tracking-assignments
8791 Annotate assignments to user variables early in the compilation and
8792 attempt to carry the annotations over throughout the compilation all the
8793 way to the end, in an attempt to improve debug information while
8794 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
8795
8796 It can be enabled even if var-tracking is disabled, in which case
8797 annotations are created and maintained, but discarded at the end.
8798 By default, this flag is enabled together with @option{-fvar-tracking},
8799 except when selective scheduling is enabled.
8800
8801 @item -gsplit-dwarf
8802 @opindex gsplit-dwarf
8803 Separate as much DWARF debugging information as possible into a
8804 separate output file with the extension @file{.dwo}. This option allows
8805 the build system to avoid linking files with debug information. To
8806 be useful, this option requires a debugger capable of reading @file{.dwo}
8807 files.
8808
8809 @item -gdescribe-dies
8810 @opindex gdescribe-dies
8811 Add description attributes to some DWARF DIEs that have no name attribute,
8812 such as artificial variables, external references and call site
8813 parameter DIEs.
8814
8815 @item -gpubnames
8816 @opindex gpubnames
8817 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
8818
8819 @item -ggnu-pubnames
8820 @opindex ggnu-pubnames
8821 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
8822 suitable for conversion into a GDB@ index. This option is only useful
8823 with a linker that can produce GDB@ index version 7.
8824
8825 @item -fdebug-types-section
8826 @opindex fdebug-types-section
8827 @opindex fno-debug-types-section
8828 When using DWARF Version 4 or higher, type DIEs can be put into
8829 their own @code{.debug_types} section instead of making them part of the
8830 @code{.debug_info} section. It is more efficient to put them in a separate
8831 comdat section since the linker can then remove duplicates.
8832 But not all DWARF consumers support @code{.debug_types} sections yet
8833 and on some objects @code{.debug_types} produces larger instead of smaller
8834 debugging information.
8835
8836 @item -grecord-gcc-switches
8837 @itemx -gno-record-gcc-switches
8838 @opindex grecord-gcc-switches
8839 @opindex gno-record-gcc-switches
8840 This switch causes the command-line options used to invoke the
8841 compiler that may affect code generation to be appended to the
8842 DW_AT_producer attribute in DWARF debugging information. The options
8843 are concatenated with spaces separating them from each other and from
8844 the compiler version.
8845 It is enabled by default.
8846 See also @option{-frecord-gcc-switches} for another
8847 way of storing compiler options into the object file.
8848
8849 @item -gstrict-dwarf
8850 @opindex gstrict-dwarf
8851 Disallow using extensions of later DWARF standard version than selected
8852 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8853 DWARF extensions from later standard versions is allowed.
8854
8855 @item -gno-strict-dwarf
8856 @opindex gno-strict-dwarf
8857 Allow using extensions of later DWARF standard version than selected with
8858 @option{-gdwarf-@var{version}}.
8859
8860 @item -gas-loc-support
8861 @opindex gas-loc-support
8862 Inform the compiler that the assembler supports @code{.loc} directives.
8863 It may then use them for the assembler to generate DWARF2+ line number
8864 tables.
8865
8866 This is generally desirable, because assembler-generated line-number
8867 tables are a lot more compact than those the compiler can generate
8868 itself.
8869
8870 This option will be enabled by default if, at GCC configure time, the
8871 assembler was found to support such directives.
8872
8873 @item -gno-as-loc-support
8874 @opindex gno-as-loc-support
8875 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8876 line number tables are to be generated.
8877
8878 @item -gas-locview-support
8879 @opindex gas-locview-support
8880 Inform the compiler that the assembler supports @code{view} assignment
8881 and reset assertion checking in @code{.loc} directives.
8882
8883 This option will be enabled by default if, at GCC configure time, the
8884 assembler was found to support them.
8885
8886 @item -gno-as-locview-support
8887 Force GCC to assign view numbers internally, if
8888 @option{-gvariable-location-views} are explicitly requested.
8889
8890 @item -gcolumn-info
8891 @itemx -gno-column-info
8892 @opindex gcolumn-info
8893 @opindex gno-column-info
8894 Emit location column information into DWARF debugging information, rather
8895 than just file and line.
8896 This option is enabled by default.
8897
8898 @item -gstatement-frontiers
8899 @itemx -gno-statement-frontiers
8900 @opindex gstatement-frontiers
8901 @opindex gno-statement-frontiers
8902 This option causes GCC to create markers in the internal representation
8903 at the beginning of statements, and to keep them roughly in place
8904 throughout compilation, using them to guide the output of @code{is_stmt}
8905 markers in the line number table. This is enabled by default when
8906 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8907 @dots{}), and outputting DWARF 2 debug information at the normal level.
8908
8909 @item -gvariable-location-views
8910 @itemx -gvariable-location-views=incompat5
8911 @itemx -gno-variable-location-views
8912 @opindex gvariable-location-views
8913 @opindex gvariable-location-views=incompat5
8914 @opindex gno-variable-location-views
8915 Augment variable location lists with progressive view numbers implied
8916 from the line number table. This enables debug information consumers to
8917 inspect state at certain points of the program, even if no instructions
8918 associated with the corresponding source locations are present at that
8919 point. If the assembler lacks support for view numbers in line number
8920 tables, this will cause the compiler to emit the line number table,
8921 which generally makes them somewhat less compact. The augmented line
8922 number tables and location lists are fully backward-compatible, so they
8923 can be consumed by debug information consumers that are not aware of
8924 these augmentations, but they won't derive any benefit from them either.
8925
8926 This is enabled by default when outputting DWARF 2 debug information at
8927 the normal level, as long as there is assembler support,
8928 @option{-fvar-tracking-assignments} is enabled and
8929 @option{-gstrict-dwarf} is not. When assembler support is not
8930 available, this may still be enabled, but it will force GCC to output
8931 internal line number tables, and if
8932 @option{-ginternal-reset-location-views} is not enabled, that will most
8933 certainly lead to silently mismatching location views.
8934
8935 There is a proposed representation for view numbers that is not backward
8936 compatible with the location list format introduced in DWARF 5, that can
8937 be enabled with @option{-gvariable-location-views=incompat5}. This
8938 option may be removed in the future, is only provided as a reference
8939 implementation of the proposed representation. Debug information
8940 consumers are not expected to support this extended format, and they
8941 would be rendered unable to decode location lists using it.
8942
8943 @item -ginternal-reset-location-views
8944 @itemx -gno-internal-reset-location-views
8945 @opindex ginternal-reset-location-views
8946 @opindex gno-internal-reset-location-views
8947 Attempt to determine location views that can be omitted from location
8948 view lists. This requires the compiler to have very accurate insn
8949 length estimates, which isn't always the case, and it may cause
8950 incorrect view lists to be generated silently when using an assembler
8951 that does not support location view lists. The GNU assembler will flag
8952 any such error as a @code{view number mismatch}. This is only enabled
8953 on ports that define a reliable estimation function.
8954
8955 @item -ginline-points
8956 @itemx -gno-inline-points
8957 @opindex ginline-points
8958 @opindex gno-inline-points
8959 Generate extended debug information for inlined functions. Location
8960 view tracking markers are inserted at inlined entry points, so that
8961 address and view numbers can be computed and output in debug
8962 information. This can be enabled independently of location views, in
8963 which case the view numbers won't be output, but it can only be enabled
8964 along with statement frontiers, and it is only enabled by default if
8965 location views are enabled.
8966
8967 @item -gz@r{[}=@var{type}@r{]}
8968 @opindex gz
8969 Produce compressed debug sections in DWARF format, if that is supported.
8970 If @var{type} is not given, the default type depends on the capabilities
8971 of the assembler and linker used. @var{type} may be one of
8972 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8973 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8974 compression in traditional GNU format). If the linker doesn't support
8975 writing compressed debug sections, the option is rejected. Otherwise,
8976 if the assembler does not support them, @option{-gz} is silently ignored
8977 when producing object files.
8978
8979 @item -femit-struct-debug-baseonly
8980 @opindex femit-struct-debug-baseonly
8981 Emit debug information for struct-like types
8982 only when the base name of the compilation source file
8983 matches the base name of file in which the struct is defined.
8984
8985 This option substantially reduces the size of debugging information,
8986 but at significant potential loss in type information to the debugger.
8987 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8988 See @option{-femit-struct-debug-detailed} for more detailed control.
8989
8990 This option works only with DWARF debug output.
8991
8992 @item -femit-struct-debug-reduced
8993 @opindex femit-struct-debug-reduced
8994 Emit debug information for struct-like types
8995 only when the base name of the compilation source file
8996 matches the base name of file in which the type is defined,
8997 unless the struct is a template or defined in a system header.
8998
8999 This option significantly reduces the size of debugging information,
9000 with some potential loss in type information to the debugger.
9001 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
9002 See @option{-femit-struct-debug-detailed} for more detailed control.
9003
9004 This option works only with DWARF debug output.
9005
9006 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
9007 @opindex femit-struct-debug-detailed
9008 Specify the struct-like types
9009 for which the compiler generates debug information.
9010 The intent is to reduce duplicate struct debug information
9011 between different object files within the same program.
9012
9013 This option is a detailed version of
9014 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
9015 which serves for most needs.
9016
9017 A specification has the syntax@*
9018 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
9019
9020 The optional first word limits the specification to
9021 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
9022 A struct type is used directly when it is the type of a variable, member.
9023 Indirect uses arise through pointers to structs.
9024 That is, when use of an incomplete struct is valid, the use is indirect.
9025 An example is
9026 @samp{struct one direct; struct two * indirect;}.
9027
9028 The optional second word limits the specification to
9029 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
9030 Generic structs are a bit complicated to explain.
9031 For C++, these are non-explicit specializations of template classes,
9032 or non-template classes within the above.
9033 Other programming languages have generics,
9034 but @option{-femit-struct-debug-detailed} does not yet implement them.
9035
9036 The third word specifies the source files for those
9037 structs for which the compiler should emit debug information.
9038 The values @samp{none} and @samp{any} have the normal meaning.
9039 The value @samp{base} means that
9040 the base of name of the file in which the type declaration appears
9041 must match the base of the name of the main compilation file.
9042 In practice, this means that when compiling @file{foo.c}, debug information
9043 is generated for types declared in that file and @file{foo.h},
9044 but not other header files.
9045 The value @samp{sys} means those types satisfying @samp{base}
9046 or declared in system or compiler headers.
9047
9048 You may need to experiment to determine the best settings for your application.
9049
9050 The default is @option{-femit-struct-debug-detailed=all}.
9051
9052 This option works only with DWARF debug output.
9053
9054 @item -fno-dwarf2-cfi-asm
9055 @opindex fdwarf2-cfi-asm
9056 @opindex fno-dwarf2-cfi-asm
9057 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
9058 instead of using GAS @code{.cfi_*} directives.
9059
9060 @item -fno-eliminate-unused-debug-types
9061 @opindex feliminate-unused-debug-types
9062 @opindex fno-eliminate-unused-debug-types
9063 Normally, when producing DWARF output, GCC avoids producing debug symbol
9064 output for types that are nowhere used in the source file being compiled.
9065 Sometimes it is useful to have GCC emit debugging
9066 information for all types declared in a compilation
9067 unit, regardless of whether or not they are actually used
9068 in that compilation unit, for example
9069 if, in the debugger, you want to cast a value to a type that is
9070 not actually used in your program (but is declared). More often,
9071 however, this results in a significant amount of wasted space.
9072 @end table
9073
9074 @node Optimize Options
9075 @section Options That Control Optimization
9076 @cindex optimize options
9077 @cindex options, optimization
9078
9079 These options control various sorts of optimizations.
9080
9081 Without any optimization option, the compiler's goal is to reduce the
9082 cost of compilation and to make debugging produce the expected
9083 results. Statements are independent: if you stop the program with a
9084 breakpoint between statements, you can then assign a new value to any
9085 variable or change the program counter to any other statement in the
9086 function and get exactly the results you expect from the source
9087 code.
9088
9089 Turning on optimization flags makes the compiler attempt to improve
9090 the performance and/or code size at the expense of compilation time
9091 and possibly the ability to debug the program.
9092
9093 The compiler performs optimization based on the knowledge it has of the
9094 program. Compiling multiple files at once to a single output file mode allows
9095 the compiler to use information gained from all of the files when compiling
9096 each of them.
9097
9098 Not all optimizations are controlled directly by a flag. Only
9099 optimizations that have a flag are listed in this section.
9100
9101 Most optimizations are completely disabled at @option{-O0} or if an
9102 @option{-O} level is not set on the command line, even if individual
9103 optimization flags are specified. Similarly, @option{-Og} suppresses
9104 many optimization passes.
9105
9106 Depending on the target and how GCC was configured, a slightly different
9107 set of optimizations may be enabled at each @option{-O} level than
9108 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
9109 to find out the exact set of optimizations that are enabled at each level.
9110 @xref{Overall Options}, for examples.
9111
9112 @table @gcctabopt
9113 @item -O
9114 @itemx -O1
9115 @opindex O
9116 @opindex O1
9117 Optimize. Optimizing compilation takes somewhat more time, and a lot
9118 more memory for a large function.
9119
9120 With @option{-O}, the compiler tries to reduce code size and execution
9121 time, without performing any optimizations that take a great deal of
9122 compilation time.
9123
9124 @c Note that in addition to the default_options_table list in opts.c,
9125 @c several optimization flags default to true but control optimization
9126 @c passes that are explicitly disabled at -O0.
9127
9128 @option{-O} turns on the following optimization flags:
9129
9130 @c Please keep the following list alphabetized.
9131 @gccoptlist{-fauto-inc-dec @gol
9132 -fbranch-count-reg @gol
9133 -fcombine-stack-adjustments @gol
9134 -fcompare-elim @gol
9135 -fcprop-registers @gol
9136 -fdce @gol
9137 -fdefer-pop @gol
9138 -fdelayed-branch @gol
9139 -fdse @gol
9140 -fforward-propagate @gol
9141 -fguess-branch-probability @gol
9142 -fif-conversion @gol
9143 -fif-conversion2 @gol
9144 -finline-functions-called-once @gol
9145 -fipa-profile @gol
9146 -fipa-pure-const @gol
9147 -fipa-reference @gol
9148 -fipa-reference-addressable @gol
9149 -fmerge-constants @gol
9150 -fmove-loop-invariants @gol
9151 -fomit-frame-pointer @gol
9152 -freorder-blocks @gol
9153 -fshrink-wrap @gol
9154 -fshrink-wrap-separate @gol
9155 -fsplit-wide-types @gol
9156 -fssa-backprop @gol
9157 -fssa-phiopt @gol
9158 -ftree-bit-ccp @gol
9159 -ftree-ccp @gol
9160 -ftree-ch @gol
9161 -ftree-coalesce-vars @gol
9162 -ftree-copy-prop @gol
9163 -ftree-dce @gol
9164 -ftree-dominator-opts @gol
9165 -ftree-dse @gol
9166 -ftree-forwprop @gol
9167 -ftree-fre @gol
9168 -ftree-phiprop @gol
9169 -ftree-pta @gol
9170 -ftree-scev-cprop @gol
9171 -ftree-sink @gol
9172 -ftree-slsr @gol
9173 -ftree-sra @gol
9174 -ftree-ter @gol
9175 -funit-at-a-time}
9176
9177 @item -O2
9178 @opindex O2
9179 Optimize even more. GCC performs nearly all supported optimizations
9180 that do not involve a space-speed tradeoff.
9181 As compared to @option{-O}, this option increases both compilation time
9182 and the performance of the generated code.
9183
9184 @option{-O2} turns on all optimization flags specified by @option{-O}. It
9185 also turns on the following optimization flags:
9186
9187 @c Please keep the following list alphabetized!
9188 @gccoptlist{-falign-functions -falign-jumps @gol
9189 -falign-labels -falign-loops @gol
9190 -fcaller-saves @gol
9191 -fcode-hoisting @gol
9192 -fcrossjumping @gol
9193 -fcse-follow-jumps -fcse-skip-blocks @gol
9194 -fdelete-null-pointer-checks @gol
9195 -fdevirtualize -fdevirtualize-speculatively @gol
9196 -fexpensive-optimizations @gol
9197 -ffinite-loops @gol
9198 -fgcse -fgcse-lm @gol
9199 -fhoist-adjacent-loads @gol
9200 -finline-functions @gol
9201 -finline-small-functions @gol
9202 -findirect-inlining @gol
9203 -fipa-bit-cp -fipa-cp -fipa-icf @gol
9204 -fipa-ra -fipa-sra -fipa-vrp @gol
9205 -fisolate-erroneous-paths-dereference @gol
9206 -flra-remat @gol
9207 -foptimize-sibling-calls @gol
9208 -foptimize-strlen @gol
9209 -fpartial-inlining @gol
9210 -fpeephole2 @gol
9211 -freorder-blocks-algorithm=stc @gol
9212 -freorder-blocks-and-partition -freorder-functions @gol
9213 -frerun-cse-after-loop @gol
9214 -fschedule-insns -fschedule-insns2 @gol
9215 -fsched-interblock -fsched-spec @gol
9216 -fstore-merging @gol
9217 -fstrict-aliasing @gol
9218 -fthread-jumps @gol
9219 -ftree-builtin-call-dce @gol
9220 -ftree-pre @gol
9221 -ftree-switch-conversion -ftree-tail-merge @gol
9222 -ftree-vrp}
9223
9224 Please note the warning under @option{-fgcse} about
9225 invoking @option{-O2} on programs that use computed gotos.
9226
9227 @item -O3
9228 @opindex O3
9229 Optimize yet more. @option{-O3} turns on all optimizations specified
9230 by @option{-O2} and also turns on the following optimization flags:
9231
9232 @c Please keep the following list alphabetized!
9233 @gccoptlist{-fgcse-after-reload @gol
9234 -fipa-cp-clone
9235 -floop-interchange @gol
9236 -floop-unroll-and-jam @gol
9237 -fpeel-loops @gol
9238 -fpredictive-commoning @gol
9239 -fsplit-paths @gol
9240 -ftree-loop-distribute-patterns @gol
9241 -ftree-loop-distribution @gol
9242 -ftree-loop-vectorize @gol
9243 -ftree-partial-pre @gol
9244 -ftree-slp-vectorize @gol
9245 -funswitch-loops @gol
9246 -fvect-cost-model @gol
9247 -fversion-loops-for-strides}
9248
9249 @item -O0
9250 @opindex O0
9251 Reduce compilation time and make debugging produce the expected
9252 results. This is the default.
9253
9254 @item -Os
9255 @opindex Os
9256 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
9257 except those that often increase code size:
9258
9259 @gccoptlist{-falign-functions -falign-jumps @gol
9260 -falign-labels -falign-loops @gol
9261 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
9262
9263 It also enables @option{-finline-functions}, causes the compiler to tune for
9264 code size rather than execution speed, and performs further optimizations
9265 designed to reduce code size.
9266
9267 @item -Ofast
9268 @opindex Ofast
9269 Disregard strict standards compliance. @option{-Ofast} enables all
9270 @option{-O3} optimizations. It also enables optimizations that are not
9271 valid for all standard-compliant programs.
9272 It turns on @option{-ffast-math}, @option{-fallow-store-data-races}
9273 and the Fortran-specific @option{-fstack-arrays}, unless
9274 @option{-fmax-stack-var-size} is specified, and @option{-fno-protect-parens}.
9275
9276 @item -Og
9277 @opindex Og
9278 Optimize debugging experience. @option{-Og} should be the optimization
9279 level of choice for the standard edit-compile-debug cycle, offering
9280 a reasonable level of optimization while maintaining fast compilation
9281 and a good debugging experience. It is a better choice than @option{-O0}
9282 for producing debuggable code because some compiler passes
9283 that collect debug information are disabled at @option{-O0}.
9284
9285 Like @option{-O0}, @option{-Og} completely disables a number of
9286 optimization passes so that individual options controlling them have
9287 no effect. Otherwise @option{-Og} enables all @option{-O1}
9288 optimization flags except for those that may interfere with debugging:
9289
9290 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
9291 -fdse -fif-conversion -fif-conversion2 @gol
9292 -finline-functions-called-once @gol
9293 -fmove-loop-invariants -fssa-phiopt @gol
9294 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
9295
9296 @end table
9297
9298 If you use multiple @option{-O} options, with or without level numbers,
9299 the last such option is the one that is effective.
9300
9301 Options of the form @option{-f@var{flag}} specify machine-independent
9302 flags. Most flags have both positive and negative forms; the negative
9303 form of @option{-ffoo} is @option{-fno-foo}. In the table
9304 below, only one of the forms is listed---the one you typically
9305 use. You can figure out the other form by either removing @samp{no-}
9306 or adding it.
9307
9308 The following options control specific optimizations. They are either
9309 activated by @option{-O} options or are related to ones that are. You
9310 can use the following flags in the rare cases when ``fine-tuning'' of
9311 optimizations to be performed is desired.
9312
9313 @table @gcctabopt
9314 @item -fno-defer-pop
9315 @opindex fno-defer-pop
9316 @opindex fdefer-pop
9317 For machines that must pop arguments after a function call, always pop
9318 the arguments as soon as each function returns.
9319 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
9320 this allows the compiler to let arguments accumulate on the stack for several
9321 function calls and pop them all at once.
9322
9323 @item -fforward-propagate
9324 @opindex fforward-propagate
9325 Perform a forward propagation pass on RTL@. The pass tries to combine two
9326 instructions and checks if the result can be simplified. If loop unrolling
9327 is active, two passes are performed and the second is scheduled after
9328 loop unrolling.
9329
9330 This option is enabled by default at optimization levels @option{-O},
9331 @option{-O2}, @option{-O3}, @option{-Os}.
9332
9333 @item -ffp-contract=@var{style}
9334 @opindex ffp-contract
9335 @option{-ffp-contract=off} disables floating-point expression contraction.
9336 @option{-ffp-contract=fast} enables floating-point expression contraction
9337 such as forming of fused multiply-add operations if the target has
9338 native support for them.
9339 @option{-ffp-contract=on} enables floating-point expression contraction
9340 if allowed by the language standard. This is currently not implemented
9341 and treated equal to @option{-ffp-contract=off}.
9342
9343 The default is @option{-ffp-contract=fast}.
9344
9345 @item -fomit-frame-pointer
9346 @opindex fomit-frame-pointer
9347 Omit the frame pointer in functions that don't need one. This avoids the
9348 instructions to save, set up and restore the frame pointer; on many targets
9349 it also makes an extra register available.
9350
9351 On some targets this flag has no effect because the standard calling sequence
9352 always uses a frame pointer, so it cannot be omitted.
9353
9354 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
9355 is used in all functions. Several targets always omit the frame pointer in
9356 leaf functions.
9357
9358 Enabled by default at @option{-O} and higher.
9359
9360 @item -foptimize-sibling-calls
9361 @opindex foptimize-sibling-calls
9362 Optimize sibling and tail recursive calls.
9363
9364 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9365
9366 @item -foptimize-strlen
9367 @opindex foptimize-strlen
9368 Optimize various standard C string functions (e.g.@: @code{strlen},
9369 @code{strchr} or @code{strcpy}) and
9370 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
9371
9372 Enabled at levels @option{-O2}, @option{-O3}.
9373
9374 @item -fno-inline
9375 @opindex fno-inline
9376 @opindex finline
9377 Do not expand any functions inline apart from those marked with
9378 the @code{always_inline} attribute. This is the default when not
9379 optimizing.
9380
9381 Single functions can be exempted from inlining by marking them
9382 with the @code{noinline} attribute.
9383
9384 @item -finline-small-functions
9385 @opindex finline-small-functions
9386 Integrate functions into their callers when their body is smaller than expected
9387 function call code (so overall size of program gets smaller). The compiler
9388 heuristically decides which functions are simple enough to be worth integrating
9389 in this way. This inlining applies to all functions, even those not declared
9390 inline.
9391
9392 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9393
9394 @item -findirect-inlining
9395 @opindex findirect-inlining
9396 Inline also indirect calls that are discovered to be known at compile
9397 time thanks to previous inlining. This option has any effect only
9398 when inlining itself is turned on by the @option{-finline-functions}
9399 or @option{-finline-small-functions} options.
9400
9401 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9402
9403 @item -finline-functions
9404 @opindex finline-functions
9405 Consider all functions for inlining, even if they are not declared inline.
9406 The compiler heuristically decides which functions are worth integrating
9407 in this way.
9408
9409 If all calls to a given function are integrated, and the function is
9410 declared @code{static}, then the function is normally not output as
9411 assembler code in its own right.
9412
9413 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
9414 by @option{-fprofile-use} and @option{-fauto-profile}.
9415
9416 @item -finline-functions-called-once
9417 @opindex finline-functions-called-once
9418 Consider all @code{static} functions called once for inlining into their
9419 caller even if they are not marked @code{inline}. If a call to a given
9420 function is integrated, then the function is not output as assembler code
9421 in its own right.
9422
9423 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
9424 but not @option{-Og}.
9425
9426 @item -fearly-inlining
9427 @opindex fearly-inlining
9428 Inline functions marked by @code{always_inline} and functions whose body seems
9429 smaller than the function call overhead early before doing
9430 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
9431 makes profiling significantly cheaper and usually inlining faster on programs
9432 having large chains of nested wrapper functions.
9433
9434 Enabled by default.
9435
9436 @item -fipa-sra
9437 @opindex fipa-sra
9438 Perform interprocedural scalar replacement of aggregates, removal of
9439 unused parameters and replacement of parameters passed by reference
9440 by parameters passed by value.
9441
9442 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
9443
9444 @item -finline-limit=@var{n}
9445 @opindex finline-limit
9446 By default, GCC limits the size of functions that can be inlined. This flag
9447 allows coarse control of this limit. @var{n} is the size of functions that
9448 can be inlined in number of pseudo instructions.
9449
9450 Inlining is actually controlled by a number of parameters, which may be
9451 specified individually by using @option{--param @var{name}=@var{value}}.
9452 The @option{-finline-limit=@var{n}} option sets some of these parameters
9453 as follows:
9454
9455 @table @gcctabopt
9456 @item max-inline-insns-single
9457 is set to @var{n}/2.
9458 @item max-inline-insns-auto
9459 is set to @var{n}/2.
9460 @end table
9461
9462 See below for a documentation of the individual
9463 parameters controlling inlining and for the defaults of these parameters.
9464
9465 @emph{Note:} there may be no value to @option{-finline-limit} that results
9466 in default behavior.
9467
9468 @emph{Note:} pseudo instruction represents, in this particular context, an
9469 abstract measurement of function's size. In no way does it represent a count
9470 of assembly instructions and as such its exact meaning might change from one
9471 release to an another.
9472
9473 @item -fno-keep-inline-dllexport
9474 @opindex fno-keep-inline-dllexport
9475 @opindex fkeep-inline-dllexport
9476 This is a more fine-grained version of @option{-fkeep-inline-functions},
9477 which applies only to functions that are declared using the @code{dllexport}
9478 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
9479 Functions}.
9480
9481 @item -fkeep-inline-functions
9482 @opindex fkeep-inline-functions
9483 In C, emit @code{static} functions that are declared @code{inline}
9484 into the object file, even if the function has been inlined into all
9485 of its callers. This switch does not affect functions using the
9486 @code{extern inline} extension in GNU C90@. In C++, emit any and all
9487 inline functions into the object file.
9488
9489 @item -fkeep-static-functions
9490 @opindex fkeep-static-functions
9491 Emit @code{static} functions into the object file, even if the function
9492 is never used.
9493
9494 @item -fkeep-static-consts
9495 @opindex fkeep-static-consts
9496 Emit variables declared @code{static const} when optimization isn't turned
9497 on, even if the variables aren't referenced.
9498
9499 GCC enables this option by default. If you want to force the compiler to
9500 check if a variable is referenced, regardless of whether or not
9501 optimization is turned on, use the @option{-fno-keep-static-consts} option.
9502
9503 @item -fmerge-constants
9504 @opindex fmerge-constants
9505 Attempt to merge identical constants (string constants and floating-point
9506 constants) across compilation units.
9507
9508 This option is the default for optimized compilation if the assembler and
9509 linker support it. Use @option{-fno-merge-constants} to inhibit this
9510 behavior.
9511
9512 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9513
9514 @item -fmerge-all-constants
9515 @opindex fmerge-all-constants
9516 Attempt to merge identical constants and identical variables.
9517
9518 This option implies @option{-fmerge-constants}. In addition to
9519 @option{-fmerge-constants} this considers e.g.@: even constant initialized
9520 arrays or initialized constant variables with integral or floating-point
9521 types. Languages like C or C++ require each variable, including multiple
9522 instances of the same variable in recursive calls, to have distinct locations,
9523 so using this option results in non-conforming
9524 behavior.
9525
9526 @item -fmodulo-sched
9527 @opindex fmodulo-sched
9528 Perform swing modulo scheduling immediately before the first scheduling
9529 pass. This pass looks at innermost loops and reorders their
9530 instructions by overlapping different iterations.
9531
9532 @item -fmodulo-sched-allow-regmoves
9533 @opindex fmodulo-sched-allow-regmoves
9534 Perform more aggressive SMS-based modulo scheduling with register moves
9535 allowed. By setting this flag certain anti-dependences edges are
9536 deleted, which triggers the generation of reg-moves based on the
9537 life-range analysis. This option is effective only with
9538 @option{-fmodulo-sched} enabled.
9539
9540 @item -fno-branch-count-reg
9541 @opindex fno-branch-count-reg
9542 @opindex fbranch-count-reg
9543 Disable the optimization pass that scans for opportunities to use
9544 ``decrement and branch'' instructions on a count register instead of
9545 instruction sequences that decrement a register, compare it against zero, and
9546 then branch based upon the result. This option is only meaningful on
9547 architectures that support such instructions, which include x86, PowerPC,
9548 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
9549 doesn't remove the decrement and branch instructions from the generated
9550 instruction stream introduced by other optimization passes.
9551
9552 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
9553 except for @option{-Og}.
9554
9555 @item -fno-function-cse
9556 @opindex fno-function-cse
9557 @opindex ffunction-cse
9558 Do not put function addresses in registers; make each instruction that
9559 calls a constant function contain the function's address explicitly.
9560
9561 This option results in less efficient code, but some strange hacks
9562 that alter the assembler output may be confused by the optimizations
9563 performed when this option is not used.
9564
9565 The default is @option{-ffunction-cse}
9566
9567 @item -fno-zero-initialized-in-bss
9568 @opindex fno-zero-initialized-in-bss
9569 @opindex fzero-initialized-in-bss
9570 If the target supports a BSS section, GCC by default puts variables that
9571 are initialized to zero into BSS@. This can save space in the resulting
9572 code.
9573
9574 This option turns off this behavior because some programs explicitly
9575 rely on variables going to the data section---e.g., so that the
9576 resulting executable can find the beginning of that section and/or make
9577 assumptions based on that.
9578
9579 The default is @option{-fzero-initialized-in-bss}.
9580
9581 @item -fthread-jumps
9582 @opindex fthread-jumps
9583 Perform optimizations that check to see if a jump branches to a
9584 location where another comparison subsumed by the first is found. If
9585 so, the first branch is redirected to either the destination of the
9586 second branch or a point immediately following it, depending on whether
9587 the condition is known to be true or false.
9588
9589 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9590
9591 @item -fsplit-wide-types
9592 @opindex fsplit-wide-types
9593 When using a type that occupies multiple registers, such as @code{long
9594 long} on a 32-bit system, split the registers apart and allocate them
9595 independently. This normally generates better code for those types,
9596 but may make debugging more difficult.
9597
9598 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
9599 @option{-Os}.
9600
9601 @item -fsplit-wide-types-early
9602 @opindex fsplit-wide-types-early
9603 Fully split wide types early, instead of very late.
9604 This option has no effect unless @option{-fsplit-wide-types} is turned on.
9605
9606 This is the default on some targets.
9607
9608 @item -fcse-follow-jumps
9609 @opindex fcse-follow-jumps
9610 In common subexpression elimination (CSE), scan through jump instructions
9611 when the target of the jump is not reached by any other path. For
9612 example, when CSE encounters an @code{if} statement with an
9613 @code{else} clause, CSE follows the jump when the condition
9614 tested is false.
9615
9616 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9617
9618 @item -fcse-skip-blocks
9619 @opindex fcse-skip-blocks
9620 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
9621 follow jumps that conditionally skip over blocks. When CSE
9622 encounters a simple @code{if} statement with no else clause,
9623 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
9624 body of the @code{if}.
9625
9626 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9627
9628 @item -frerun-cse-after-loop
9629 @opindex frerun-cse-after-loop
9630 Re-run common subexpression elimination after loop optimizations are
9631 performed.
9632
9633 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9634
9635 @item -fgcse
9636 @opindex fgcse
9637 Perform a global common subexpression elimination pass.
9638 This pass also performs global constant and copy propagation.
9639
9640 @emph{Note:} When compiling a program using computed gotos, a GCC
9641 extension, you may get better run-time performance if you disable
9642 the global common subexpression elimination pass by adding
9643 @option{-fno-gcse} to the command line.
9644
9645 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9646
9647 @item -fgcse-lm
9648 @opindex fgcse-lm
9649 When @option{-fgcse-lm} is enabled, global common subexpression elimination
9650 attempts to move loads that are only killed by stores into themselves. This
9651 allows a loop containing a load/store sequence to be changed to a load outside
9652 the loop, and a copy/store within the loop.
9653
9654 Enabled by default when @option{-fgcse} is enabled.
9655
9656 @item -fgcse-sm
9657 @opindex fgcse-sm
9658 When @option{-fgcse-sm} is enabled, a store motion pass is run after
9659 global common subexpression elimination. This pass attempts to move
9660 stores out of loops. When used in conjunction with @option{-fgcse-lm},
9661 loops containing a load/store sequence can be changed to a load before
9662 the loop and a store after the loop.
9663
9664 Not enabled at any optimization level.
9665
9666 @item -fgcse-las
9667 @opindex fgcse-las
9668 When @option{-fgcse-las} is enabled, the global common subexpression
9669 elimination pass eliminates redundant loads that come after stores to the
9670 same memory location (both partial and full redundancies).
9671
9672 Not enabled at any optimization level.
9673
9674 @item -fgcse-after-reload
9675 @opindex fgcse-after-reload
9676 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
9677 pass is performed after reload. The purpose of this pass is to clean up
9678 redundant spilling.
9679
9680 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9681
9682 @item -faggressive-loop-optimizations
9683 @opindex faggressive-loop-optimizations
9684 This option tells the loop optimizer to use language constraints to
9685 derive bounds for the number of iterations of a loop. This assumes that
9686 loop code does not invoke undefined behavior by for example causing signed
9687 integer overflows or out-of-bound array accesses. The bounds for the
9688 number of iterations of a loop are used to guide loop unrolling and peeling
9689 and loop exit test optimizations.
9690 This option is enabled by default.
9691
9692 @item -funconstrained-commons
9693 @opindex funconstrained-commons
9694 This option tells the compiler that variables declared in common blocks
9695 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
9696 prevents certain optimizations that depend on knowing the array bounds.
9697
9698 @item -fcrossjumping
9699 @opindex fcrossjumping
9700 Perform cross-jumping transformation.
9701 This transformation unifies equivalent code and saves code size. The
9702 resulting code may or may not perform better than without cross-jumping.
9703
9704 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9705
9706 @item -fauto-inc-dec
9707 @opindex fauto-inc-dec
9708 Combine increments or decrements of addresses with memory accesses.
9709 This pass is always skipped on architectures that do not have
9710 instructions to support this. Enabled by default at @option{-O} and
9711 higher on architectures that support this.
9712
9713 @item -fdce
9714 @opindex fdce
9715 Perform dead code elimination (DCE) on RTL@.
9716 Enabled by default at @option{-O} and higher.
9717
9718 @item -fdse
9719 @opindex fdse
9720 Perform dead store elimination (DSE) on RTL@.
9721 Enabled by default at @option{-O} and higher.
9722
9723 @item -fif-conversion
9724 @opindex fif-conversion
9725 Attempt to transform conditional jumps into branch-less equivalents. This
9726 includes use of conditional moves, min, max, set flags and abs instructions, and
9727 some tricks doable by standard arithmetics. The use of conditional execution
9728 on chips where it is available is controlled by @option{-fif-conversion2}.
9729
9730 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9731 not with @option{-Og}.
9732
9733 @item -fif-conversion2
9734 @opindex fif-conversion2
9735 Use conditional execution (where available) to transform conditional jumps into
9736 branch-less equivalents.
9737
9738 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
9739 not with @option{-Og}.
9740
9741 @item -fdeclone-ctor-dtor
9742 @opindex fdeclone-ctor-dtor
9743 The C++ ABI requires multiple entry points for constructors and
9744 destructors: one for a base subobject, one for a complete object, and
9745 one for a virtual destructor that calls operator delete afterwards.
9746 For a hierarchy with virtual bases, the base and complete variants are
9747 clones, which means two copies of the function. With this option, the
9748 base and complete variants are changed to be thunks that call a common
9749 implementation.
9750
9751 Enabled by @option{-Os}.
9752
9753 @item -fdelete-null-pointer-checks
9754 @opindex fdelete-null-pointer-checks
9755 Assume that programs cannot safely dereference null pointers, and that
9756 no code or data element resides at address zero.
9757 This option enables simple constant
9758 folding optimizations at all optimization levels. In addition, other
9759 optimization passes in GCC use this flag to control global dataflow
9760 analyses that eliminate useless checks for null pointers; these assume
9761 that a memory access to address zero always results in a trap, so
9762 that if a pointer is checked after it has already been dereferenced,
9763 it cannot be null.
9764
9765 Note however that in some environments this assumption is not true.
9766 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
9767 for programs that depend on that behavior.
9768
9769 This option is enabled by default on most targets. On Nios II ELF, it
9770 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
9771
9772 Passes that use the dataflow information
9773 are enabled independently at different optimization levels.
9774
9775 @item -fdevirtualize
9776 @opindex fdevirtualize
9777 Attempt to convert calls to virtual functions to direct calls. This
9778 is done both within a procedure and interprocedurally as part of
9779 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
9780 propagation (@option{-fipa-cp}).
9781 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9782
9783 @item -fdevirtualize-speculatively
9784 @opindex fdevirtualize-speculatively
9785 Attempt to convert calls to virtual functions to speculative direct calls.
9786 Based on the analysis of the type inheritance graph, determine for a given call
9787 the set of likely targets. If the set is small, preferably of size 1, change
9788 the call into a conditional deciding between direct and indirect calls. The
9789 speculative calls enable more optimizations, such as inlining. When they seem
9790 useless after further optimization, they are converted back into original form.
9791
9792 @item -fdevirtualize-at-ltrans
9793 @opindex fdevirtualize-at-ltrans
9794 Stream extra information needed for aggressive devirtualization when running
9795 the link-time optimizer in local transformation mode.
9796 This option enables more devirtualization but
9797 significantly increases the size of streamed data. For this reason it is
9798 disabled by default.
9799
9800 @item -fexpensive-optimizations
9801 @opindex fexpensive-optimizations
9802 Perform a number of minor optimizations that are relatively expensive.
9803
9804 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9805
9806 @item -free
9807 @opindex free
9808 Attempt to remove redundant extension instructions. This is especially
9809 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
9810 registers after writing to their lower 32-bit half.
9811
9812 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
9813 @option{-O3}, @option{-Os}.
9814
9815 @item -fno-lifetime-dse
9816 @opindex fno-lifetime-dse
9817 @opindex flifetime-dse
9818 In C++ the value of an object is only affected by changes within its
9819 lifetime: when the constructor begins, the object has an indeterminate
9820 value, and any changes during the lifetime of the object are dead when
9821 the object is destroyed. Normally dead store elimination will take
9822 advantage of this; if your code relies on the value of the object
9823 storage persisting beyond the lifetime of the object, you can use this
9824 flag to disable this optimization. To preserve stores before the
9825 constructor starts (e.g.@: because your operator new clears the object
9826 storage) but still treat the object as dead after the destructor, you
9827 can use @option{-flifetime-dse=1}. The default behavior can be
9828 explicitly selected with @option{-flifetime-dse=2}.
9829 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
9830
9831 @item -flive-range-shrinkage
9832 @opindex flive-range-shrinkage
9833 Attempt to decrease register pressure through register live range
9834 shrinkage. This is helpful for fast processors with small or moderate
9835 size register sets.
9836
9837 @item -fira-algorithm=@var{algorithm}
9838 @opindex fira-algorithm
9839 Use the specified coloring algorithm for the integrated register
9840 allocator. The @var{algorithm} argument can be @samp{priority}, which
9841 specifies Chow's priority coloring, or @samp{CB}, which specifies
9842 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
9843 for all architectures, but for those targets that do support it, it is
9844 the default because it generates better code.
9845
9846 @item -fira-region=@var{region}
9847 @opindex fira-region
9848 Use specified regions for the integrated register allocator. The
9849 @var{region} argument should be one of the following:
9850
9851 @table @samp
9852
9853 @item all
9854 Use all loops as register allocation regions.
9855 This can give the best results for machines with a small and/or
9856 irregular register set.
9857
9858 @item mixed
9859 Use all loops except for loops with small register pressure
9860 as the regions. This value usually gives
9861 the best results in most cases and for most architectures,
9862 and is enabled by default when compiling with optimization for speed
9863 (@option{-O}, @option{-O2}, @dots{}).
9864
9865 @item one
9866 Use all functions as a single region.
9867 This typically results in the smallest code size, and is enabled by default for
9868 @option{-Os} or @option{-O0}.
9869
9870 @end table
9871
9872 @item -fira-hoist-pressure
9873 @opindex fira-hoist-pressure
9874 Use IRA to evaluate register pressure in the code hoisting pass for
9875 decisions to hoist expressions. This option usually results in smaller
9876 code, but it can slow the compiler down.
9877
9878 This option is enabled at level @option{-Os} for all targets.
9879
9880 @item -fira-loop-pressure
9881 @opindex fira-loop-pressure
9882 Use IRA to evaluate register pressure in loops for decisions to move
9883 loop invariants. This option usually results in generation
9884 of faster and smaller code on machines with large register files (>= 32
9885 registers), but it can slow the compiler down.
9886
9887 This option is enabled at level @option{-O3} for some targets.
9888
9889 @item -fno-ira-share-save-slots
9890 @opindex fno-ira-share-save-slots
9891 @opindex fira-share-save-slots
9892 Disable sharing of stack slots used for saving call-used hard
9893 registers living through a call. Each hard register gets a
9894 separate stack slot, and as a result function stack frames are
9895 larger.
9896
9897 @item -fno-ira-share-spill-slots
9898 @opindex fno-ira-share-spill-slots
9899 @opindex fira-share-spill-slots
9900 Disable sharing of stack slots allocated for pseudo-registers. Each
9901 pseudo-register that does not get a hard register gets a separate
9902 stack slot, and as a result function stack frames are larger.
9903
9904 @item -flra-remat
9905 @opindex flra-remat
9906 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9907 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9908 values if it is profitable.
9909
9910 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9911
9912 @item -fdelayed-branch
9913 @opindex fdelayed-branch
9914 If supported for the target machine, attempt to reorder instructions
9915 to exploit instruction slots available after delayed branch
9916 instructions.
9917
9918 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9919 but not at @option{-Og}.
9920
9921 @item -fschedule-insns
9922 @opindex fschedule-insns
9923 If supported for the target machine, attempt to reorder instructions to
9924 eliminate execution stalls due to required data being unavailable. This
9925 helps machines that have slow floating point or memory load instructions
9926 by allowing other instructions to be issued until the result of the load
9927 or floating-point instruction is required.
9928
9929 Enabled at levels @option{-O2}, @option{-O3}.
9930
9931 @item -fschedule-insns2
9932 @opindex fschedule-insns2
9933 Similar to @option{-fschedule-insns}, but requests an additional pass of
9934 instruction scheduling after register allocation has been done. This is
9935 especially useful on machines with a relatively small number of
9936 registers and where memory load instructions take more than one cycle.
9937
9938 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9939
9940 @item -fno-sched-interblock
9941 @opindex fno-sched-interblock
9942 @opindex fsched-interblock
9943 Disable instruction scheduling across basic blocks, which
9944 is normally enabled when scheduling before register allocation, i.e.@:
9945 with @option{-fschedule-insns} or at @option{-O2} or higher.
9946
9947 @item -fno-sched-spec
9948 @opindex fno-sched-spec
9949 @opindex fsched-spec
9950 Disable speculative motion of non-load instructions, which
9951 is normally enabled when scheduling before register allocation, i.e.@:
9952 with @option{-fschedule-insns} or at @option{-O2} or higher.
9953
9954 @item -fsched-pressure
9955 @opindex fsched-pressure
9956 Enable register pressure sensitive insn scheduling before register
9957 allocation. This only makes sense when scheduling before register
9958 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9959 @option{-O2} or higher. Usage of this option can improve the
9960 generated code and decrease its size by preventing register pressure
9961 increase above the number of available hard registers and subsequent
9962 spills in register allocation.
9963
9964 @item -fsched-spec-load
9965 @opindex fsched-spec-load
9966 Allow speculative motion of some load instructions. This only makes
9967 sense when scheduling before register allocation, i.e.@: with
9968 @option{-fschedule-insns} or at @option{-O2} or higher.
9969
9970 @item -fsched-spec-load-dangerous
9971 @opindex fsched-spec-load-dangerous
9972 Allow speculative motion of more load instructions. This only makes
9973 sense when scheduling before register allocation, i.e.@: with
9974 @option{-fschedule-insns} or at @option{-O2} or higher.
9975
9976 @item -fsched-stalled-insns
9977 @itemx -fsched-stalled-insns=@var{n}
9978 @opindex fsched-stalled-insns
9979 Define how many insns (if any) can be moved prematurely from the queue
9980 of stalled insns into the ready list during the second scheduling pass.
9981 @option{-fno-sched-stalled-insns} means that no insns are moved
9982 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9983 on how many queued insns can be moved prematurely.
9984 @option{-fsched-stalled-insns} without a value is equivalent to
9985 @option{-fsched-stalled-insns=1}.
9986
9987 @item -fsched-stalled-insns-dep
9988 @itemx -fsched-stalled-insns-dep=@var{n}
9989 @opindex fsched-stalled-insns-dep
9990 Define how many insn groups (cycles) are examined for a dependency
9991 on a stalled insn that is a candidate for premature removal from the queue
9992 of stalled insns. This has an effect only during the second scheduling pass,
9993 and only if @option{-fsched-stalled-insns} is used.
9994 @option{-fno-sched-stalled-insns-dep} is equivalent to
9995 @option{-fsched-stalled-insns-dep=0}.
9996 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9997 @option{-fsched-stalled-insns-dep=1}.
9998
9999 @item -fsched2-use-superblocks
10000 @opindex fsched2-use-superblocks
10001 When scheduling after register allocation, use superblock scheduling.
10002 This allows motion across basic block boundaries,
10003 resulting in faster schedules. This option is experimental, as not all machine
10004 descriptions used by GCC model the CPU closely enough to avoid unreliable
10005 results from the algorithm.
10006
10007 This only makes sense when scheduling after register allocation, i.e.@: with
10008 @option{-fschedule-insns2} or at @option{-O2} or higher.
10009
10010 @item -fsched-group-heuristic
10011 @opindex fsched-group-heuristic
10012 Enable the group heuristic in the scheduler. This heuristic favors
10013 the instruction that belongs to a schedule group. This is enabled
10014 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10015 or @option{-fschedule-insns2} or at @option{-O2} or higher.
10016
10017 @item -fsched-critical-path-heuristic
10018 @opindex fsched-critical-path-heuristic
10019 Enable the critical-path heuristic in the scheduler. This heuristic favors
10020 instructions on the critical path. This is enabled by default when
10021 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
10022 or @option{-fschedule-insns2} or at @option{-O2} or higher.
10023
10024 @item -fsched-spec-insn-heuristic
10025 @opindex fsched-spec-insn-heuristic
10026 Enable the speculative instruction heuristic in the scheduler. This
10027 heuristic favors speculative instructions with greater dependency weakness.
10028 This is enabled by default when scheduling is enabled, i.e.@:
10029 with @option{-fschedule-insns} or @option{-fschedule-insns2}
10030 or at @option{-O2} or higher.
10031
10032 @item -fsched-rank-heuristic
10033 @opindex fsched-rank-heuristic
10034 Enable the rank heuristic in the scheduler. This heuristic favors
10035 the instruction belonging to a basic block with greater size or frequency.
10036 This is enabled by default when scheduling is enabled, i.e.@:
10037 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10038 at @option{-O2} or higher.
10039
10040 @item -fsched-last-insn-heuristic
10041 @opindex fsched-last-insn-heuristic
10042 Enable the last-instruction heuristic in the scheduler. This heuristic
10043 favors the instruction that is less dependent on the last instruction
10044 scheduled. This is enabled by default when scheduling is enabled,
10045 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10046 at @option{-O2} or higher.
10047
10048 @item -fsched-dep-count-heuristic
10049 @opindex fsched-dep-count-heuristic
10050 Enable the dependent-count heuristic in the scheduler. This heuristic
10051 favors the instruction that has more instructions depending on it.
10052 This is enabled by default when scheduling is enabled, i.e.@:
10053 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
10054 at @option{-O2} or higher.
10055
10056 @item -freschedule-modulo-scheduled-loops
10057 @opindex freschedule-modulo-scheduled-loops
10058 Modulo scheduling is performed before traditional scheduling. If a loop
10059 is modulo scheduled, later scheduling passes may change its schedule.
10060 Use this option to control that behavior.
10061
10062 @item -fselective-scheduling
10063 @opindex fselective-scheduling
10064 Schedule instructions using selective scheduling algorithm. Selective
10065 scheduling runs instead of the first scheduler pass.
10066
10067 @item -fselective-scheduling2
10068 @opindex fselective-scheduling2
10069 Schedule instructions using selective scheduling algorithm. Selective
10070 scheduling runs instead of the second scheduler pass.
10071
10072 @item -fsel-sched-pipelining
10073 @opindex fsel-sched-pipelining
10074 Enable software pipelining of innermost loops during selective scheduling.
10075 This option has no effect unless one of @option{-fselective-scheduling} or
10076 @option{-fselective-scheduling2} is turned on.
10077
10078 @item -fsel-sched-pipelining-outer-loops
10079 @opindex fsel-sched-pipelining-outer-loops
10080 When pipelining loops during selective scheduling, also pipeline outer loops.
10081 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
10082
10083 @item -fsemantic-interposition
10084 @opindex fsemantic-interposition
10085 Some object formats, like ELF, allow interposing of symbols by the
10086 dynamic linker.
10087 This means that for symbols exported from the DSO, the compiler cannot perform
10088 interprocedural propagation, inlining and other optimizations in anticipation
10089 that the function or variable in question may change. While this feature is
10090 useful, for example, to rewrite memory allocation functions by a debugging
10091 implementation, it is expensive in the terms of code quality.
10092 With @option{-fno-semantic-interposition} the compiler assumes that
10093 if interposition happens for functions the overwriting function will have
10094 precisely the same semantics (and side effects).
10095 Similarly if interposition happens
10096 for variables, the constructor of the variable will be the same. The flag
10097 has no effect for functions explicitly declared inline
10098 (where it is never allowed for interposition to change semantics)
10099 and for symbols explicitly declared weak.
10100
10101 @item -fshrink-wrap
10102 @opindex fshrink-wrap
10103 Emit function prologues only before parts of the function that need it,
10104 rather than at the top of the function. This flag is enabled by default at
10105 @option{-O} and higher.
10106
10107 @item -fshrink-wrap-separate
10108 @opindex fshrink-wrap-separate
10109 Shrink-wrap separate parts of the prologue and epilogue separately, so that
10110 those parts are only executed when needed.
10111 This option is on by default, but has no effect unless @option{-fshrink-wrap}
10112 is also turned on and the target supports this.
10113
10114 @item -fcaller-saves
10115 @opindex fcaller-saves
10116 Enable allocation of values to registers that are clobbered by
10117 function calls, by emitting extra instructions to save and restore the
10118 registers around such calls. Such allocation is done only when it
10119 seems to result in better code.
10120
10121 This option is always enabled by default on certain machines, usually
10122 those which have no call-preserved registers to use instead.
10123
10124 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10125
10126 @item -fcombine-stack-adjustments
10127 @opindex fcombine-stack-adjustments
10128 Tracks stack adjustments (pushes and pops) and stack memory references
10129 and then tries to find ways to combine them.
10130
10131 Enabled by default at @option{-O1} and higher.
10132
10133 @item -fipa-ra
10134 @opindex fipa-ra
10135 Use caller save registers for allocation if those registers are not used by
10136 any called function. In that case it is not necessary to save and restore
10137 them around calls. This is only possible if called functions are part of
10138 same compilation unit as current function and they are compiled before it.
10139
10140 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
10141 is disabled if generated code will be instrumented for profiling
10142 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
10143 exactly (this happens on targets that do not expose prologues
10144 and epilogues in RTL).
10145
10146 @item -fconserve-stack
10147 @opindex fconserve-stack
10148 Attempt to minimize stack usage. The compiler attempts to use less
10149 stack space, even if that makes the program slower. This option
10150 implies setting the @option{large-stack-frame} parameter to 100
10151 and the @option{large-stack-frame-growth} parameter to 400.
10152
10153 @item -ftree-reassoc
10154 @opindex ftree-reassoc
10155 Perform reassociation on trees. This flag is enabled by default
10156 at @option{-O} and higher.
10157
10158 @item -fcode-hoisting
10159 @opindex fcode-hoisting
10160 Perform code hoisting. Code hoisting tries to move the
10161 evaluation of expressions executed on all paths to the function exit
10162 as early as possible. This is especially useful as a code size
10163 optimization, but it often helps for code speed as well.
10164 This flag is enabled by default at @option{-O2} and higher.
10165
10166 @item -ftree-pre
10167 @opindex ftree-pre
10168 Perform partial redundancy elimination (PRE) on trees. This flag is
10169 enabled by default at @option{-O2} and @option{-O3}.
10170
10171 @item -ftree-partial-pre
10172 @opindex ftree-partial-pre
10173 Make partial redundancy elimination (PRE) more aggressive. This flag is
10174 enabled by default at @option{-O3}.
10175
10176 @item -ftree-forwprop
10177 @opindex ftree-forwprop
10178 Perform forward propagation on trees. This flag is enabled by default
10179 at @option{-O} and higher.
10180
10181 @item -ftree-fre
10182 @opindex ftree-fre
10183 Perform full redundancy elimination (FRE) on trees. The difference
10184 between FRE and PRE is that FRE only considers expressions
10185 that are computed on all paths leading to the redundant computation.
10186 This analysis is faster than PRE, though it exposes fewer redundancies.
10187 This flag is enabled by default at @option{-O} and higher.
10188
10189 @item -ftree-phiprop
10190 @opindex ftree-phiprop
10191 Perform hoisting of loads from conditional pointers on trees. This
10192 pass is enabled by default at @option{-O} and higher.
10193
10194 @item -fhoist-adjacent-loads
10195 @opindex fhoist-adjacent-loads
10196 Speculatively hoist loads from both branches of an if-then-else if the
10197 loads are from adjacent locations in the same structure and the target
10198 architecture has a conditional move instruction. This flag is enabled
10199 by default at @option{-O2} and higher.
10200
10201 @item -ftree-copy-prop
10202 @opindex ftree-copy-prop
10203 Perform copy propagation on trees. This pass eliminates unnecessary
10204 copy operations. This flag is enabled by default at @option{-O} and
10205 higher.
10206
10207 @item -fipa-pure-const
10208 @opindex fipa-pure-const
10209 Discover which functions are pure or constant.
10210 Enabled by default at @option{-O} and higher.
10211
10212 @item -fipa-reference
10213 @opindex fipa-reference
10214 Discover which static variables do not escape the
10215 compilation unit.
10216 Enabled by default at @option{-O} and higher.
10217
10218 @item -fipa-reference-addressable
10219 @opindex fipa-reference-addressable
10220 Discover read-only, write-only and non-addressable static variables.
10221 Enabled by default at @option{-O} and higher.
10222
10223 @item -fipa-stack-alignment
10224 @opindex fipa-stack-alignment
10225 Reduce stack alignment on call sites if possible.
10226 Enabled by default.
10227
10228 @item -fipa-pta
10229 @opindex fipa-pta
10230 Perform interprocedural pointer analysis and interprocedural modification
10231 and reference analysis. This option can cause excessive memory and
10232 compile-time usage on large compilation units. It is not enabled by
10233 default at any optimization level.
10234
10235 @item -fipa-profile
10236 @opindex fipa-profile
10237 Perform interprocedural profile propagation. The functions called only from
10238 cold functions are marked as cold. Also functions executed once (such as
10239 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
10240 functions and loop less parts of functions executed once are then optimized for
10241 size.
10242 Enabled by default at @option{-O} and higher.
10243
10244 @item -fipa-cp
10245 @opindex fipa-cp
10246 Perform interprocedural constant propagation.
10247 This optimization analyzes the program to determine when values passed
10248 to functions are constants and then optimizes accordingly.
10249 This optimization can substantially increase performance
10250 if the application has constants passed to functions.
10251 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
10252 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10253
10254 @item -fipa-cp-clone
10255 @opindex fipa-cp-clone
10256 Perform function cloning to make interprocedural constant propagation stronger.
10257 When enabled, interprocedural constant propagation performs function cloning
10258 when externally visible function can be called with constant arguments.
10259 Because this optimization can create multiple copies of functions,
10260 it may significantly increase code size
10261 (see @option{--param ipcp-unit-growth=@var{value}}).
10262 This flag is enabled by default at @option{-O3}.
10263 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10264
10265 @item -fipa-bit-cp
10266 @opindex fipa-bit-cp
10267 When enabled, perform interprocedural bitwise constant
10268 propagation. This flag is enabled by default at @option{-O2} and
10269 by @option{-fprofile-use} and @option{-fauto-profile}.
10270 It requires that @option{-fipa-cp} is enabled.
10271
10272 @item -fipa-vrp
10273 @opindex fipa-vrp
10274 When enabled, perform interprocedural propagation of value
10275 ranges. This flag is enabled by default at @option{-O2}. It requires
10276 that @option{-fipa-cp} is enabled.
10277
10278 @item -fipa-icf
10279 @opindex fipa-icf
10280 Perform Identical Code Folding for functions and read-only variables.
10281 The optimization reduces code size and may disturb unwind stacks by replacing
10282 a function by equivalent one with a different name. The optimization works
10283 more effectively with link-time optimization enabled.
10284
10285 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
10286 works on different levels and thus the optimizations are not same - there are
10287 equivalences that are found only by GCC and equivalences found only by Gold.
10288
10289 This flag is enabled by default at @option{-O2} and @option{-Os}.
10290
10291 @item -flive-patching=@var{level}
10292 @opindex flive-patching
10293 Control GCC's optimizations to produce output suitable for live-patching.
10294
10295 If the compiler's optimization uses a function's body or information extracted
10296 from its body to optimize/change another function, the latter is called an
10297 impacted function of the former. If a function is patched, its impacted
10298 functions should be patched too.
10299
10300 The impacted functions are determined by the compiler's interprocedural
10301 optimizations. For example, a caller is impacted when inlining a function
10302 into its caller,
10303 cloning a function and changing its caller to call this new clone,
10304 or extracting a function's pureness/constness information to optimize
10305 its direct or indirect callers, etc.
10306
10307 Usually, the more IPA optimizations enabled, the larger the number of
10308 impacted functions for each function. In order to control the number of
10309 impacted functions and more easily compute the list of impacted function,
10310 IPA optimizations can be partially enabled at two different levels.
10311
10312 The @var{level} argument should be one of the following:
10313
10314 @table @samp
10315
10316 @item inline-clone
10317
10318 Only enable inlining and cloning optimizations, which includes inlining,
10319 cloning, interprocedural scalar replacement of aggregates and partial inlining.
10320 As a result, when patching a function, all its callers and its clones'
10321 callers are impacted, therefore need to be patched as well.
10322
10323 @option{-flive-patching=inline-clone} disables the following optimization flags:
10324 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
10325 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
10326 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
10327 -fipa-stack-alignment}
10328
10329 @item inline-only-static
10330
10331 Only enable inlining of static functions.
10332 As a result, when patching a static function, all its callers are impacted
10333 and so need to be patched as well.
10334
10335 In addition to all the flags that @option{-flive-patching=inline-clone}
10336 disables,
10337 @option{-flive-patching=inline-only-static} disables the following additional
10338 optimization flags:
10339 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
10340
10341 @end table
10342
10343 When @option{-flive-patching} is specified without any value, the default value
10344 is @var{inline-clone}.
10345
10346 This flag is disabled by default.
10347
10348 Note that @option{-flive-patching} is not supported with link-time optimization
10349 (@option{-flto}).
10350
10351 @item -fisolate-erroneous-paths-dereference
10352 @opindex fisolate-erroneous-paths-dereference
10353 Detect paths that trigger erroneous or undefined behavior due to
10354 dereferencing a null pointer. Isolate those paths from the main control
10355 flow and turn the statement with erroneous or undefined behavior into a trap.
10356 This flag is enabled by default at @option{-O2} and higher and depends on
10357 @option{-fdelete-null-pointer-checks} also being enabled.
10358
10359 @item -fisolate-erroneous-paths-attribute
10360 @opindex fisolate-erroneous-paths-attribute
10361 Detect paths that trigger erroneous or undefined behavior due to a null value
10362 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
10363 attribute. Isolate those paths from the main control flow and turn the
10364 statement with erroneous or undefined behavior into a trap. This is not
10365 currently enabled, but may be enabled by @option{-O2} in the future.
10366
10367 @item -ftree-sink
10368 @opindex ftree-sink
10369 Perform forward store motion on trees. This flag is
10370 enabled by default at @option{-O} and higher.
10371
10372 @item -ftree-bit-ccp
10373 @opindex ftree-bit-ccp
10374 Perform sparse conditional bit constant propagation on trees and propagate
10375 pointer alignment information.
10376 This pass only operates on local scalar variables and is enabled by default
10377 at @option{-O1} and higher, except for @option{-Og}.
10378 It requires that @option{-ftree-ccp} is enabled.
10379
10380 @item -ftree-ccp
10381 @opindex ftree-ccp
10382 Perform sparse conditional constant propagation (CCP) on trees. This
10383 pass only operates on local scalar variables and is enabled by default
10384 at @option{-O} and higher.
10385
10386 @item -fssa-backprop
10387 @opindex fssa-backprop
10388 Propagate information about uses of a value up the definition chain
10389 in order to simplify the definitions. For example, this pass strips
10390 sign operations if the sign of a value never matters. The flag is
10391 enabled by default at @option{-O} and higher.
10392
10393 @item -fssa-phiopt
10394 @opindex fssa-phiopt
10395 Perform pattern matching on SSA PHI nodes to optimize conditional
10396 code. This pass is enabled by default at @option{-O1} and higher,
10397 except for @option{-Og}.
10398
10399 @item -ftree-switch-conversion
10400 @opindex ftree-switch-conversion
10401 Perform conversion of simple initializations in a switch to
10402 initializations from a scalar array. This flag is enabled by default
10403 at @option{-O2} and higher.
10404
10405 @item -ftree-tail-merge
10406 @opindex ftree-tail-merge
10407 Look for identical code sequences. When found, replace one with a jump to the
10408 other. This optimization is known as tail merging or cross jumping. This flag
10409 is enabled by default at @option{-O2} and higher. The compilation time
10410 in this pass can
10411 be limited using @option{max-tail-merge-comparisons} parameter and
10412 @option{max-tail-merge-iterations} parameter.
10413
10414 @item -ftree-dce
10415 @opindex ftree-dce
10416 Perform dead code elimination (DCE) on trees. This flag is enabled by
10417 default at @option{-O} and higher.
10418
10419 @item -ftree-builtin-call-dce
10420 @opindex ftree-builtin-call-dce
10421 Perform conditional dead code elimination (DCE) for calls to built-in functions
10422 that may set @code{errno} but are otherwise free of side effects. This flag is
10423 enabled by default at @option{-O2} and higher if @option{-Os} is not also
10424 specified.
10425
10426 @item -ffinite-loops
10427 @opindex ffinite-loops
10428 @opindex fno-finite-loops
10429 Assume that a loop with an exit will eventually take the exit and not loop
10430 indefinitely. This allows the compiler to remove loops that otherwise have
10431 no side-effects, not considering eventual endless looping as such.
10432
10433 This option is enabled by default at @option{-O2}.
10434
10435 @item -ftree-dominator-opts
10436 @opindex ftree-dominator-opts
10437 Perform a variety of simple scalar cleanups (constant/copy
10438 propagation, redundancy elimination, range propagation and expression
10439 simplification) based on a dominator tree traversal. This also
10440 performs jump threading (to reduce jumps to jumps). This flag is
10441 enabled by default at @option{-O} and higher.
10442
10443 @item -ftree-dse
10444 @opindex ftree-dse
10445 Perform dead store elimination (DSE) on trees. A dead store is a store into
10446 a memory location that is later overwritten by another store without
10447 any intervening loads. In this case the earlier store can be deleted. This
10448 flag is enabled by default at @option{-O} and higher.
10449
10450 @item -ftree-ch
10451 @opindex ftree-ch
10452 Perform loop header copying on trees. This is beneficial since it increases
10453 effectiveness of code motion optimizations. It also saves one jump. This flag
10454 is enabled by default at @option{-O} and higher. It is not enabled
10455 for @option{-Os}, since it usually increases code size.
10456
10457 @item -ftree-loop-optimize
10458 @opindex ftree-loop-optimize
10459 Perform loop optimizations on trees. This flag is enabled by default
10460 at @option{-O} and higher.
10461
10462 @item -ftree-loop-linear
10463 @itemx -floop-strip-mine
10464 @itemx -floop-block
10465 @opindex ftree-loop-linear
10466 @opindex floop-strip-mine
10467 @opindex floop-block
10468 Perform loop nest optimizations. Same as
10469 @option{-floop-nest-optimize}. To use this code transformation, GCC has
10470 to be configured with @option{--with-isl} to enable the Graphite loop
10471 transformation infrastructure.
10472
10473 @item -fgraphite-identity
10474 @opindex fgraphite-identity
10475 Enable the identity transformation for graphite. For every SCoP we generate
10476 the polyhedral representation and transform it back to gimple. Using
10477 @option{-fgraphite-identity} we can check the costs or benefits of the
10478 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
10479 are also performed by the code generator isl, like index splitting and
10480 dead code elimination in loops.
10481
10482 @item -floop-nest-optimize
10483 @opindex floop-nest-optimize
10484 Enable the isl based loop nest optimizer. This is a generic loop nest
10485 optimizer based on the Pluto optimization algorithms. It calculates a loop
10486 structure optimized for data-locality and parallelism. This option
10487 is experimental.
10488
10489 @item -floop-parallelize-all
10490 @opindex floop-parallelize-all
10491 Use the Graphite data dependence analysis to identify loops that can
10492 be parallelized. Parallelize all the loops that can be analyzed to
10493 not contain loop carried dependences without checking that it is
10494 profitable to parallelize the loops.
10495
10496 @item -ftree-coalesce-vars
10497 @opindex ftree-coalesce-vars
10498 While transforming the program out of the SSA representation, attempt to
10499 reduce copying by coalescing versions of different user-defined
10500 variables, instead of just compiler temporaries. This may severely
10501 limit the ability to debug an optimized program compiled with
10502 @option{-fno-var-tracking-assignments}. In the negated form, this flag
10503 prevents SSA coalescing of user variables. This option is enabled by
10504 default if optimization is enabled, and it does very little otherwise.
10505
10506 @item -ftree-loop-if-convert
10507 @opindex ftree-loop-if-convert
10508 Attempt to transform conditional jumps in the innermost loops to
10509 branch-less equivalents. The intent is to remove control-flow from
10510 the innermost loops in order to improve the ability of the
10511 vectorization pass to handle these loops. This is enabled by default
10512 if vectorization is enabled.
10513
10514 @item -ftree-loop-distribution
10515 @opindex ftree-loop-distribution
10516 Perform loop distribution. This flag can improve cache performance on
10517 big loop bodies and allow further loop optimizations, like
10518 parallelization or vectorization, to take place. For example, the loop
10519 @smallexample
10520 DO I = 1, N
10521 A(I) = B(I) + C
10522 D(I) = E(I) * F
10523 ENDDO
10524 @end smallexample
10525 is transformed to
10526 @smallexample
10527 DO I = 1, N
10528 A(I) = B(I) + C
10529 ENDDO
10530 DO I = 1, N
10531 D(I) = E(I) * F
10532 ENDDO
10533 @end smallexample
10534 This flag is enabled by default at @option{-O3}.
10535 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10536
10537 @item -ftree-loop-distribute-patterns
10538 @opindex ftree-loop-distribute-patterns
10539 Perform loop distribution of patterns that can be code generated with
10540 calls to a library. This flag is enabled by default at @option{-O2} and
10541 higher, and by @option{-fprofile-use} and @option{-fauto-profile}.
10542
10543 This pass distributes the initialization loops and generates a call to
10544 memset zero. For example, the loop
10545 @smallexample
10546 DO I = 1, N
10547 A(I) = 0
10548 B(I) = A(I) + I
10549 ENDDO
10550 @end smallexample
10551 is transformed to
10552 @smallexample
10553 DO I = 1, N
10554 A(I) = 0
10555 ENDDO
10556 DO I = 1, N
10557 B(I) = A(I) + I
10558 ENDDO
10559 @end smallexample
10560 and the initialization loop is transformed into a call to memset zero.
10561 This flag is enabled by default at @option{-O3}.
10562 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10563
10564 @item -floop-interchange
10565 @opindex floop-interchange
10566 Perform loop interchange outside of graphite. This flag can improve cache
10567 performance on loop nest and allow further loop optimizations, like
10568 vectorization, to take place. For example, the loop
10569 @smallexample
10570 for (int i = 0; i < N; i++)
10571 for (int j = 0; j < N; j++)
10572 for (int k = 0; k < N; k++)
10573 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10574 @end smallexample
10575 is transformed to
10576 @smallexample
10577 for (int i = 0; i < N; i++)
10578 for (int k = 0; k < N; k++)
10579 for (int j = 0; j < N; j++)
10580 c[i][j] = c[i][j] + a[i][k]*b[k][j];
10581 @end smallexample
10582 This flag is enabled by default at @option{-O3}.
10583 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10584
10585 @item -floop-unroll-and-jam
10586 @opindex floop-unroll-and-jam
10587 Apply unroll and jam transformations on feasible loops. In a loop
10588 nest this unrolls the outer loop by some factor and fuses the resulting
10589 multiple inner loops. This flag is enabled by default at @option{-O3}.
10590 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10591
10592 @item -ftree-loop-im
10593 @opindex ftree-loop-im
10594 Perform loop invariant motion on trees. This pass moves only invariants that
10595 are hard to handle at RTL level (function calls, operations that expand to
10596 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
10597 operands of conditions that are invariant out of the loop, so that we can use
10598 just trivial invariantness analysis in loop unswitching. The pass also includes
10599 store motion.
10600
10601 @item -ftree-loop-ivcanon
10602 @opindex ftree-loop-ivcanon
10603 Create a canonical counter for number of iterations in loops for which
10604 determining number of iterations requires complicated analysis. Later
10605 optimizations then may determine the number easily. Useful especially
10606 in connection with unrolling.
10607
10608 @item -ftree-scev-cprop
10609 @opindex ftree-scev-cprop
10610 Perform final value replacement. If a variable is modified in a loop
10611 in such a way that its value when exiting the loop can be determined using
10612 only its initial value and the number of loop iterations, replace uses of
10613 the final value by such a computation, provided it is sufficiently cheap.
10614 This reduces data dependencies and may allow further simplifications.
10615 Enabled by default at @option{-O} and higher.
10616
10617 @item -fivopts
10618 @opindex fivopts
10619 Perform induction variable optimizations (strength reduction, induction
10620 variable merging and induction variable elimination) on trees.
10621
10622 @item -ftree-parallelize-loops=n
10623 @opindex ftree-parallelize-loops
10624 Parallelize loops, i.e., split their iteration space to run in n threads.
10625 This is only possible for loops whose iterations are independent
10626 and can be arbitrarily reordered. The optimization is only
10627 profitable on multiprocessor machines, for loops that are CPU-intensive,
10628 rather than constrained e.g.@: by memory bandwidth. This option
10629 implies @option{-pthread}, and thus is only supported on targets
10630 that have support for @option{-pthread}.
10631
10632 @item -ftree-pta
10633 @opindex ftree-pta
10634 Perform function-local points-to analysis on trees. This flag is
10635 enabled by default at @option{-O1} and higher, except for @option{-Og}.
10636
10637 @item -ftree-sra
10638 @opindex ftree-sra
10639 Perform scalar replacement of aggregates. This pass replaces structure
10640 references with scalars to prevent committing structures to memory too
10641 early. This flag is enabled by default at @option{-O1} and higher,
10642 except for @option{-Og}.
10643
10644 @item -fstore-merging
10645 @opindex fstore-merging
10646 Perform merging of narrow stores to consecutive memory addresses. This pass
10647 merges contiguous stores of immediate values narrower than a word into fewer
10648 wider stores to reduce the number of instructions. This is enabled by default
10649 at @option{-O2} and higher as well as @option{-Os}.
10650
10651 @item -ftree-ter
10652 @opindex ftree-ter
10653 Perform temporary expression replacement during the SSA->normal phase. Single
10654 use/single def temporaries are replaced at their use location with their
10655 defining expression. This results in non-GIMPLE code, but gives the expanders
10656 much more complex trees to work on resulting in better RTL generation. This is
10657 enabled by default at @option{-O} and higher.
10658
10659 @item -ftree-slsr
10660 @opindex ftree-slsr
10661 Perform straight-line strength reduction on trees. This recognizes related
10662 expressions involving multiplications and replaces them by less expensive
10663 calculations when possible. This is enabled by default at @option{-O} and
10664 higher.
10665
10666 @item -ftree-vectorize
10667 @opindex ftree-vectorize
10668 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
10669 and @option{-ftree-slp-vectorize} if not explicitly specified.
10670
10671 @item -ftree-loop-vectorize
10672 @opindex ftree-loop-vectorize
10673 Perform loop vectorization on trees. This flag is enabled by default at
10674 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10675 and @option{-fauto-profile}.
10676
10677 @item -ftree-slp-vectorize
10678 @opindex ftree-slp-vectorize
10679 Perform basic block vectorization on trees. This flag is enabled by default at
10680 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
10681 and @option{-fauto-profile}.
10682
10683 @item -fvect-cost-model=@var{model}
10684 @opindex fvect-cost-model
10685 Alter the cost model used for vectorization. The @var{model} argument
10686 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
10687 With the @samp{unlimited} model the vectorized code-path is assumed
10688 to be profitable while with the @samp{dynamic} model a runtime check
10689 guards the vectorized code-path to enable it only for iteration
10690 counts that will likely execute faster than when executing the original
10691 scalar loop. The @samp{cheap} model disables vectorization of
10692 loops where doing so would be cost prohibitive for example due to
10693 required runtime checks for data dependence or alignment but otherwise
10694 is equal to the @samp{dynamic} model.
10695 The default cost model depends on other optimization flags and is
10696 either @samp{dynamic} or @samp{cheap}.
10697
10698 @item -fsimd-cost-model=@var{model}
10699 @opindex fsimd-cost-model
10700 Alter the cost model used for vectorization of loops marked with the OpenMP
10701 simd directive. The @var{model} argument should be one of
10702 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
10703 have the same meaning as described in @option{-fvect-cost-model} and by
10704 default a cost model defined with @option{-fvect-cost-model} is used.
10705
10706 @item -ftree-vrp
10707 @opindex ftree-vrp
10708 Perform Value Range Propagation on trees. This is similar to the
10709 constant propagation pass, but instead of values, ranges of values are
10710 propagated. This allows the optimizers to remove unnecessary range
10711 checks like array bound checks and null pointer checks. This is
10712 enabled by default at @option{-O2} and higher. Null pointer check
10713 elimination is only done if @option{-fdelete-null-pointer-checks} is
10714 enabled.
10715
10716 @item -fsplit-paths
10717 @opindex fsplit-paths
10718 Split paths leading to loop backedges. This can improve dead code
10719 elimination and common subexpression elimination. This is enabled by
10720 default at @option{-O3} and above.
10721
10722 @item -fsplit-ivs-in-unroller
10723 @opindex fsplit-ivs-in-unroller
10724 Enables expression of values of induction variables in later iterations
10725 of the unrolled loop using the value in the first iteration. This breaks
10726 long dependency chains, thus improving efficiency of the scheduling passes.
10727
10728 A combination of @option{-fweb} and CSE is often sufficient to obtain the
10729 same effect. However, that is not reliable in cases where the loop body
10730 is more complicated than a single basic block. It also does not work at all
10731 on some architectures due to restrictions in the CSE pass.
10732
10733 This optimization is enabled by default.
10734
10735 @item -fvariable-expansion-in-unroller
10736 @opindex fvariable-expansion-in-unroller
10737 With this option, the compiler creates multiple copies of some
10738 local variables when unrolling a loop, which can result in superior code.
10739
10740 This optimization is enabled by default for PowerPC targets, but disabled
10741 by default otherwise.
10742
10743 @item -fpartial-inlining
10744 @opindex fpartial-inlining
10745 Inline parts of functions. This option has any effect only
10746 when inlining itself is turned on by the @option{-finline-functions}
10747 or @option{-finline-small-functions} options.
10748
10749 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10750
10751 @item -fpredictive-commoning
10752 @opindex fpredictive-commoning
10753 Perform predictive commoning optimization, i.e., reusing computations
10754 (especially memory loads and stores) performed in previous
10755 iterations of loops.
10756
10757 This option is enabled at level @option{-O3}.
10758 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10759
10760 @item -fprefetch-loop-arrays
10761 @opindex fprefetch-loop-arrays
10762 If supported by the target machine, generate instructions to prefetch
10763 memory to improve the performance of loops that access large arrays.
10764
10765 This option may generate better or worse code; results are highly
10766 dependent on the structure of loops within the source code.
10767
10768 Disabled at level @option{-Os}.
10769
10770 @item -fno-printf-return-value
10771 @opindex fno-printf-return-value
10772 @opindex fprintf-return-value
10773 Do not substitute constants for known return value of formatted output
10774 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
10775 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
10776 transformation allows GCC to optimize or even eliminate branches based
10777 on the known return value of these functions called with arguments that
10778 are either constant, or whose values are known to be in a range that
10779 makes determining the exact return value possible. For example, when
10780 @option{-fprintf-return-value} is in effect, both the branch and the
10781 body of the @code{if} statement (but not the call to @code{snprint})
10782 can be optimized away when @code{i} is a 32-bit or smaller integer
10783 because the return value is guaranteed to be at most 8.
10784
10785 @smallexample
10786 char buf[9];
10787 if (snprintf (buf, "%08x", i) >= sizeof buf)
10788 @dots{}
10789 @end smallexample
10790
10791 The @option{-fprintf-return-value} option relies on other optimizations
10792 and yields best results with @option{-O2} and above. It works in tandem
10793 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
10794 options. The @option{-fprintf-return-value} option is enabled by default.
10795
10796 @item -fno-peephole
10797 @itemx -fno-peephole2
10798 @opindex fno-peephole
10799 @opindex fpeephole
10800 @opindex fno-peephole2
10801 @opindex fpeephole2
10802 Disable any machine-specific peephole optimizations. The difference
10803 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
10804 are implemented in the compiler; some targets use one, some use the
10805 other, a few use both.
10806
10807 @option{-fpeephole} is enabled by default.
10808 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10809
10810 @item -fno-guess-branch-probability
10811 @opindex fno-guess-branch-probability
10812 @opindex fguess-branch-probability
10813 Do not guess branch probabilities using heuristics.
10814
10815 GCC uses heuristics to guess branch probabilities if they are
10816 not provided by profiling feedback (@option{-fprofile-arcs}). These
10817 heuristics are based on the control flow graph. If some branch probabilities
10818 are specified by @code{__builtin_expect}, then the heuristics are
10819 used to guess branch probabilities for the rest of the control flow graph,
10820 taking the @code{__builtin_expect} info into account. The interactions
10821 between the heuristics and @code{__builtin_expect} can be complex, and in
10822 some cases, it may be useful to disable the heuristics so that the effects
10823 of @code{__builtin_expect} are easier to understand.
10824
10825 It is also possible to specify expected probability of the expression
10826 with @code{__builtin_expect_with_probability} built-in function.
10827
10828 The default is @option{-fguess-branch-probability} at levels
10829 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10830
10831 @item -freorder-blocks
10832 @opindex freorder-blocks
10833 Reorder basic blocks in the compiled function in order to reduce number of
10834 taken branches and improve code locality.
10835
10836 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10837
10838 @item -freorder-blocks-algorithm=@var{algorithm}
10839 @opindex freorder-blocks-algorithm
10840 Use the specified algorithm for basic block reordering. The
10841 @var{algorithm} argument can be @samp{simple}, which does not increase
10842 code size (except sometimes due to secondary effects like alignment),
10843 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
10844 put all often executed code together, minimizing the number of branches
10845 executed by making extra copies of code.
10846
10847 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
10848 @samp{stc} at levels @option{-O2}, @option{-O3}.
10849
10850 @item -freorder-blocks-and-partition
10851 @opindex freorder-blocks-and-partition
10852 In addition to reordering basic blocks in the compiled function, in order
10853 to reduce number of taken branches, partitions hot and cold basic blocks
10854 into separate sections of the assembly and @file{.o} files, to improve
10855 paging and cache locality performance.
10856
10857 This optimization is automatically turned off in the presence of
10858 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10859 section attribute and on any architecture that does not support named
10860 sections. When @option{-fsplit-stack} is used this option is not
10861 enabled by default (to avoid linker errors), but may be enabled
10862 explicitly (if using a working linker).
10863
10864 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10865
10866 @item -freorder-functions
10867 @opindex freorder-functions
10868 Reorder functions in the object file in order to
10869 improve code locality. This is implemented by using special
10870 subsections @code{.text.hot} for most frequently executed functions and
10871 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10872 the linker so object file format must support named sections and linker must
10873 place them in a reasonable way.
10874
10875 This option isn't effective unless you either provide profile feedback
10876 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10877 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10878
10879 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10880
10881 @item -fstrict-aliasing
10882 @opindex fstrict-aliasing
10883 Allow the compiler to assume the strictest aliasing rules applicable to
10884 the language being compiled. For C (and C++), this activates
10885 optimizations based on the type of expressions. In particular, an
10886 object of one type is assumed never to reside at the same address as an
10887 object of a different type, unless the types are almost the same. For
10888 example, an @code{unsigned int} can alias an @code{int}, but not a
10889 @code{void*} or a @code{double}. A character type may alias any other
10890 type.
10891
10892 @anchor{Type-punning}Pay special attention to code like this:
10893 @smallexample
10894 union a_union @{
10895 int i;
10896 double d;
10897 @};
10898
10899 int f() @{
10900 union a_union t;
10901 t.d = 3.0;
10902 return t.i;
10903 @}
10904 @end smallexample
10905 The practice of reading from a different union member than the one most
10906 recently written to (called ``type-punning'') is common. Even with
10907 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10908 is accessed through the union type. So, the code above works as
10909 expected. @xref{Structures unions enumerations and bit-fields
10910 implementation}. However, this code might not:
10911 @smallexample
10912 int f() @{
10913 union a_union t;
10914 int* ip;
10915 t.d = 3.0;
10916 ip = &t.i;
10917 return *ip;
10918 @}
10919 @end smallexample
10920
10921 Similarly, access by taking the address, casting the resulting pointer
10922 and dereferencing the result has undefined behavior, even if the cast
10923 uses a union type, e.g.:
10924 @smallexample
10925 int f() @{
10926 double d = 3.0;
10927 return ((union a_union *) &d)->i;
10928 @}
10929 @end smallexample
10930
10931 The @option{-fstrict-aliasing} option is enabled at levels
10932 @option{-O2}, @option{-O3}, @option{-Os}.
10933
10934 @item -falign-functions
10935 @itemx -falign-functions=@var{n}
10936 @itemx -falign-functions=@var{n}:@var{m}
10937 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10938 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10939 @opindex falign-functions
10940 Align the start of functions to the next power-of-two greater than
10941 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10942 the first @var{m} bytes of the function can be fetched by the CPU
10943 without crossing an @var{n}-byte alignment boundary.
10944
10945 If @var{m} is not specified, it defaults to @var{n}.
10946
10947 Examples: @option{-falign-functions=32} aligns functions to the next
10948 32-byte boundary, @option{-falign-functions=24} aligns to the next
10949 32-byte boundary only if this can be done by skipping 23 bytes or less,
10950 @option{-falign-functions=32:7} aligns to the next
10951 32-byte boundary only if this can be done by skipping 6 bytes or less.
10952
10953 The second pair of @var{n2}:@var{m2} values allows you to specify
10954 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10955 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10956 otherwise aligns to the next 32-byte boundary if this can be done
10957 by skipping 2 bytes or less.
10958 If @var{m2} is not specified, it defaults to @var{n2}.
10959
10960 Some assemblers only support this flag when @var{n} is a power of two;
10961 in that case, it is rounded up.
10962
10963 @option{-fno-align-functions} and @option{-falign-functions=1} are
10964 equivalent and mean that functions are not aligned.
10965
10966 If @var{n} is not specified or is zero, use a machine-dependent default.
10967 The maximum allowed @var{n} option value is 65536.
10968
10969 Enabled at levels @option{-O2}, @option{-O3}.
10970
10971 @item -flimit-function-alignment
10972 If this option is enabled, the compiler tries to avoid unnecessarily
10973 overaligning functions. It attempts to instruct the assembler to align
10974 by the amount specified by @option{-falign-functions}, but not to
10975 skip more bytes than the size of the function.
10976
10977 @item -falign-labels
10978 @itemx -falign-labels=@var{n}
10979 @itemx -falign-labels=@var{n}:@var{m}
10980 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10981 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10982 @opindex falign-labels
10983 Align all branch targets to a power-of-two boundary.
10984
10985 Parameters of this option are analogous to the @option{-falign-functions} option.
10986 @option{-fno-align-labels} and @option{-falign-labels=1} are
10987 equivalent and mean that labels are not aligned.
10988
10989 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10990 are greater than this value, then their values are used instead.
10991
10992 If @var{n} is not specified or is zero, use a machine-dependent default
10993 which is very likely to be @samp{1}, meaning no alignment.
10994 The maximum allowed @var{n} option value is 65536.
10995
10996 Enabled at levels @option{-O2}, @option{-O3}.
10997
10998 @item -falign-loops
10999 @itemx -falign-loops=@var{n}
11000 @itemx -falign-loops=@var{n}:@var{m}
11001 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
11002 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
11003 @opindex falign-loops
11004 Align loops to a power-of-two boundary. If the loops are executed
11005 many times, this makes up for any execution of the dummy padding
11006 instructions.
11007
11008 Parameters of this option are analogous to the @option{-falign-functions} option.
11009 @option{-fno-align-loops} and @option{-falign-loops=1} are
11010 equivalent and mean that loops are not aligned.
11011 The maximum allowed @var{n} option value is 65536.
11012
11013 If @var{n} is not specified or is zero, use a machine-dependent default.
11014
11015 Enabled at levels @option{-O2}, @option{-O3}.
11016
11017 @item -falign-jumps
11018 @itemx -falign-jumps=@var{n}
11019 @itemx -falign-jumps=@var{n}:@var{m}
11020 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
11021 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
11022 @opindex falign-jumps
11023 Align branch targets to a power-of-two boundary, for branch targets
11024 where the targets can only be reached by jumping. In this case,
11025 no dummy operations need be executed.
11026
11027 Parameters of this option are analogous to the @option{-falign-functions} option.
11028 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
11029 equivalent and mean that loops are not aligned.
11030
11031 If @var{n} is not specified or is zero, use a machine-dependent default.
11032 The maximum allowed @var{n} option value is 65536.
11033
11034 Enabled at levels @option{-O2}, @option{-O3}.
11035
11036 @item -fno-allocation-dce
11037 @opindex fno-allocation-dce
11038 Do not remove unused C++ allocations in dead code elimination.
11039
11040 @item -fallow-store-data-races
11041 @opindex fallow-store-data-races
11042 Allow the compiler to introduce new data races on stores.
11043
11044 Enabled at level @option{-Ofast}.
11045
11046 @item -funit-at-a-time
11047 @opindex funit-at-a-time
11048 This option is left for compatibility reasons. @option{-funit-at-a-time}
11049 has no effect, while @option{-fno-unit-at-a-time} implies
11050 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
11051
11052 Enabled by default.
11053
11054 @item -fno-toplevel-reorder
11055 @opindex fno-toplevel-reorder
11056 @opindex ftoplevel-reorder
11057 Do not reorder top-level functions, variables, and @code{asm}
11058 statements. Output them in the same order that they appear in the
11059 input file. When this option is used, unreferenced static variables
11060 are not removed. This option is intended to support existing code
11061 that relies on a particular ordering. For new code, it is better to
11062 use attributes when possible.
11063
11064 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
11065 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
11066 Additionally @option{-fno-toplevel-reorder} implies
11067 @option{-fno-section-anchors}.
11068
11069 @item -fweb
11070 @opindex fweb
11071 Constructs webs as commonly used for register allocation purposes and assign
11072 each web individual pseudo register. This allows the register allocation pass
11073 to operate on pseudos directly, but also strengthens several other optimization
11074 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
11075 however, make debugging impossible, since variables no longer stay in a
11076 ``home register''.
11077
11078 Enabled by default with @option{-funroll-loops}.
11079
11080 @item -fwhole-program
11081 @opindex fwhole-program
11082 Assume that the current compilation unit represents the whole program being
11083 compiled. All public functions and variables with the exception of @code{main}
11084 and those merged by attribute @code{externally_visible} become static functions
11085 and in effect are optimized more aggressively by interprocedural optimizers.
11086
11087 This option should not be used in combination with @option{-flto}.
11088 Instead relying on a linker plugin should provide safer and more precise
11089 information.
11090
11091 @item -flto[=@var{n}]
11092 @opindex flto
11093 This option runs the standard link-time optimizer. When invoked
11094 with source code, it generates GIMPLE (one of GCC's internal
11095 representations) and writes it to special ELF sections in the object
11096 file. When the object files are linked together, all the function
11097 bodies are read from these ELF sections and instantiated as if they
11098 had been part of the same translation unit.
11099
11100 To use the link-time optimizer, @option{-flto} and optimization
11101 options should be specified at compile time and during the final link.
11102 It is recommended that you compile all the files participating in the
11103 same link with the same options and also specify those options at
11104 link time.
11105 For example:
11106
11107 @smallexample
11108 gcc -c -O2 -flto foo.c
11109 gcc -c -O2 -flto bar.c
11110 gcc -o myprog -flto -O2 foo.o bar.o
11111 @end smallexample
11112
11113 The first two invocations to GCC save a bytecode representation
11114 of GIMPLE into special ELF sections inside @file{foo.o} and
11115 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
11116 @file{foo.o} and @file{bar.o}, merges the two files into a single
11117 internal image, and compiles the result as usual. Since both
11118 @file{foo.o} and @file{bar.o} are merged into a single image, this
11119 causes all the interprocedural analyses and optimizations in GCC to
11120 work across the two files as if they were a single one. This means,
11121 for example, that the inliner is able to inline functions in
11122 @file{bar.o} into functions in @file{foo.o} and vice-versa.
11123
11124 Another (simpler) way to enable link-time optimization is:
11125
11126 @smallexample
11127 gcc -o myprog -flto -O2 foo.c bar.c
11128 @end smallexample
11129
11130 The above generates bytecode for @file{foo.c} and @file{bar.c},
11131 merges them together into a single GIMPLE representation and optimizes
11132 them as usual to produce @file{myprog}.
11133
11134 The important thing to keep in mind is that to enable link-time
11135 optimizations you need to use the GCC driver to perform the link step.
11136 GCC automatically performs link-time optimization if any of the
11137 objects involved were compiled with the @option{-flto} command-line option.
11138 You can always override
11139 the automatic decision to do link-time optimization
11140 by passing @option{-fno-lto} to the link command.
11141
11142 To make whole program optimization effective, it is necessary to make
11143 certain whole program assumptions. The compiler needs to know
11144 what functions and variables can be accessed by libraries and runtime
11145 outside of the link-time optimized unit. When supported by the linker,
11146 the linker plugin (see @option{-fuse-linker-plugin}) passes information
11147 to the compiler about used and externally visible symbols. When
11148 the linker plugin is not available, @option{-fwhole-program} should be
11149 used to allow the compiler to make these assumptions, which leads
11150 to more aggressive optimization decisions.
11151
11152 When a file is compiled with @option{-flto} without
11153 @option{-fuse-linker-plugin}, the generated object file is larger than
11154 a regular object file because it contains GIMPLE bytecodes and the usual
11155 final code (see @option{-ffat-lto-objects}. This means that
11156 object files with LTO information can be linked as normal object
11157 files; if @option{-fno-lto} is passed to the linker, no
11158 interprocedural optimizations are applied. Note that when
11159 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
11160 but you cannot perform a regular, non-LTO link on them.
11161
11162 When producing the final binary, GCC only
11163 applies link-time optimizations to those files that contain bytecode.
11164 Therefore, you can mix and match object files and libraries with
11165 GIMPLE bytecodes and final object code. GCC automatically selects
11166 which files to optimize in LTO mode and which files to link without
11167 further processing.
11168
11169 Generally, options specified at link time override those
11170 specified at compile time, although in some cases GCC attempts to infer
11171 link-time options from the settings used to compile the input files.
11172
11173 If you do not specify an optimization level option @option{-O} at
11174 link time, then GCC uses the highest optimization level
11175 used when compiling the object files. Note that it is generally
11176 ineffective to specify an optimization level option only at link time and
11177 not at compile time, for two reasons. First, compiling without
11178 optimization suppresses compiler passes that gather information
11179 needed for effective optimization at link time. Second, some early
11180 optimization passes can be performed only at compile time and
11181 not at link time.
11182
11183 There are some code generation flags preserved by GCC when
11184 generating bytecodes, as they need to be used during the final link.
11185 Currently, the following options and their settings are taken from
11186 the first object file that explicitly specifies them:
11187 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
11188 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
11189 and all the @option{-m} target flags.
11190
11191 Certain ABI-changing flags are required to match in all compilation units,
11192 and trying to override this at link time with a conflicting value
11193 is ignored. This includes options such as @option{-freg-struct-return}
11194 and @option{-fpcc-struct-return}.
11195
11196 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
11197 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
11198 are passed through to the link stage and merged conservatively for
11199 conflicting translation units. Specifically
11200 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
11201 precedence; and for example @option{-ffp-contract=off} takes precedence
11202 over @option{-ffp-contract=fast}. You can override them at link time.
11203
11204 When you need to pass options to the assembler via @option{-Wa} or
11205 @option{-Xassembler} make sure to either compile such translation
11206 units with @option{-fno-lto} or consistently use the same assembler
11207 options on all translation units. You can alternatively also
11208 specify assembler options at LTO link time.
11209
11210 To enable debug info generation you need to supply @option{-g} at
11211 compile time. If any of the input files at link time were built
11212 with debug info generation enabled the link will enable debug info
11213 generation as well. Any elaborate debug info settings
11214 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
11215 at the linker command line and mixing different settings in different
11216 translation units is discouraged.
11217
11218 If LTO encounters objects with C linkage declared with incompatible
11219 types in separate translation units to be linked together (undefined
11220 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
11221 issued. The behavior is still undefined at run time. Similar
11222 diagnostics may be raised for other languages.
11223
11224 Another feature of LTO is that it is possible to apply interprocedural
11225 optimizations on files written in different languages:
11226
11227 @smallexample
11228 gcc -c -flto foo.c
11229 g++ -c -flto bar.cc
11230 gfortran -c -flto baz.f90
11231 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
11232 @end smallexample
11233
11234 Notice that the final link is done with @command{g++} to get the C++
11235 runtime libraries and @option{-lgfortran} is added to get the Fortran
11236 runtime libraries. In general, when mixing languages in LTO mode, you
11237 should use the same link command options as when mixing languages in a
11238 regular (non-LTO) compilation.
11239
11240 If object files containing GIMPLE bytecode are stored in a library archive, say
11241 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
11242 are using a linker with plugin support. To create static libraries suitable
11243 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
11244 and @command{ranlib};
11245 to show the symbols of object files with GIMPLE bytecode, use
11246 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
11247 and @command{nm} have been compiled with plugin support. At link time, use the
11248 flag @option{-fuse-linker-plugin} to ensure that the library participates in
11249 the LTO optimization process:
11250
11251 @smallexample
11252 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
11253 @end smallexample
11254
11255 With the linker plugin enabled, the linker extracts the needed
11256 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
11257 to make them part of the aggregated GIMPLE image to be optimized.
11258
11259 If you are not using a linker with plugin support and/or do not
11260 enable the linker plugin, then the objects inside @file{libfoo.a}
11261 are extracted and linked as usual, but they do not participate
11262 in the LTO optimization process. In order to make a static library suitable
11263 for both LTO optimization and usual linkage, compile its object files with
11264 @option{-flto} @option{-ffat-lto-objects}.
11265
11266 Link-time optimizations do not require the presence of the whole program to
11267 operate. If the program does not require any symbols to be exported, it is
11268 possible to combine @option{-flto} and @option{-fwhole-program} to allow
11269 the interprocedural optimizers to use more aggressive assumptions which may
11270 lead to improved optimization opportunities.
11271 Use of @option{-fwhole-program} is not needed when linker plugin is
11272 active (see @option{-fuse-linker-plugin}).
11273
11274 The current implementation of LTO makes no
11275 attempt to generate bytecode that is portable between different
11276 types of hosts. The bytecode files are versioned and there is a
11277 strict version check, so bytecode files generated in one version of
11278 GCC do not work with an older or newer version of GCC.
11279
11280 Link-time optimization does not work well with generation of debugging
11281 information on systems other than those using a combination of ELF and
11282 DWARF.
11283
11284 If you specify the optional @var{n}, the optimization and code
11285 generation done at link time is executed in parallel using @var{n}
11286 parallel jobs by utilizing an installed @command{make} program. The
11287 environment variable @env{MAKE} may be used to override the program
11288 used.
11289
11290 You can also specify @option{-flto=jobserver} to use GNU make's
11291 job server mode to determine the number of parallel jobs. This
11292 is useful when the Makefile calling GCC is already executing in parallel.
11293 You must prepend a @samp{+} to the command recipe in the parent Makefile
11294 for this to work. This option likely only works if @env{MAKE} is
11295 GNU make. Even without the option value, GCC tries to automatically
11296 detect a running GNU make's job server.
11297
11298 Use @option{-flto=auto} to use GNU make's job server, if available,
11299 or otherwise fall back to autodetection of the number of CPU threads
11300 present in your system.
11301
11302 @item -flto-partition=@var{alg}
11303 @opindex flto-partition
11304 Specify the partitioning algorithm used by the link-time optimizer.
11305 The value is either @samp{1to1} to specify a partitioning mirroring
11306 the original source files or @samp{balanced} to specify partitioning
11307 into equally sized chunks (whenever possible) or @samp{max} to create
11308 new partition for every symbol where possible. Specifying @samp{none}
11309 as an algorithm disables partitioning and streaming completely.
11310 The default value is @samp{balanced}. While @samp{1to1} can be used
11311 as an workaround for various code ordering issues, the @samp{max}
11312 partitioning is intended for internal testing only.
11313 The value @samp{one} specifies that exactly one partition should be
11314 used while the value @samp{none} bypasses partitioning and executes
11315 the link-time optimization step directly from the WPA phase.
11316
11317 @item -flto-compression-level=@var{n}
11318 @opindex flto-compression-level
11319 This option specifies the level of compression used for intermediate
11320 language written to LTO object files, and is only meaningful in
11321 conjunction with LTO mode (@option{-flto}). Valid
11322 values are 0 (no compression) to 9 (maximum compression). Values
11323 outside this range are clamped to either 0 or 9. If the option is not
11324 given, a default balanced compression setting is used.
11325
11326 @item -fuse-linker-plugin
11327 @opindex fuse-linker-plugin
11328 Enables the use of a linker plugin during link-time optimization. This
11329 option relies on plugin support in the linker, which is available in gold
11330 or in GNU ld 2.21 or newer.
11331
11332 This option enables the extraction of object files with GIMPLE bytecode out
11333 of library archives. This improves the quality of optimization by exposing
11334 more code to the link-time optimizer. This information specifies what
11335 symbols can be accessed externally (by non-LTO object or during dynamic
11336 linking). Resulting code quality improvements on binaries (and shared
11337 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
11338 See @option{-flto} for a description of the effect of this flag and how to
11339 use it.
11340
11341 This option is enabled by default when LTO support in GCC is enabled
11342 and GCC was configured for use with
11343 a linker supporting plugins (GNU ld 2.21 or newer or gold).
11344
11345 @item -ffat-lto-objects
11346 @opindex ffat-lto-objects
11347 Fat LTO objects are object files that contain both the intermediate language
11348 and the object code. This makes them usable for both LTO linking and normal
11349 linking. This option is effective only when compiling with @option{-flto}
11350 and is ignored at link time.
11351
11352 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
11353 requires the complete toolchain to be aware of LTO. It requires a linker with
11354 linker plugin support for basic functionality. Additionally,
11355 @command{nm}, @command{ar} and @command{ranlib}
11356 need to support linker plugins to allow a full-featured build environment
11357 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
11358 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
11359 to these tools. With non fat LTO makefiles need to be modified to use them.
11360
11361 Note that modern binutils provide plugin auto-load mechanism.
11362 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
11363 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
11364 @command{gcc-ranlib}).
11365
11366 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
11367 support.
11368
11369 @item -fcompare-elim
11370 @opindex fcompare-elim
11371 After register allocation and post-register allocation instruction splitting,
11372 identify arithmetic instructions that compute processor flags similar to a
11373 comparison operation based on that arithmetic. If possible, eliminate the
11374 explicit comparison operation.
11375
11376 This pass only applies to certain targets that cannot explicitly represent
11377 the comparison operation before register allocation is complete.
11378
11379 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11380
11381 @item -fcprop-registers
11382 @opindex fcprop-registers
11383 After register allocation and post-register allocation instruction splitting,
11384 perform a copy-propagation pass to try to reduce scheduling dependencies
11385 and occasionally eliminate the copy.
11386
11387 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
11388
11389 @item -fprofile-correction
11390 @opindex fprofile-correction
11391 Profiles collected using an instrumented binary for multi-threaded programs may
11392 be inconsistent due to missed counter updates. When this option is specified,
11393 GCC uses heuristics to correct or smooth out such inconsistencies. By
11394 default, GCC emits an error message when an inconsistent profile is detected.
11395
11396 This option is enabled by @option{-fauto-profile}.
11397
11398 @item -fprofile-partial-training
11399 @opindex fprofile-use
11400 With @code{-fprofile-use} all portions of programs not executed during train
11401 run are optimized agressively for size rather than speed. In some cases it is
11402 not practical to train all possible hot paths in the program. (For
11403 example, program may contain functions specific for a given hardware and
11404 trianing may not cover all hardware configurations program is run on.) With
11405 @code{-fprofile-partial-training} profile feedback will be ignored for all
11406 functions not executed during the train run leading them to be optimized as if
11407 they were compiled without profile feedback. This leads to better performance
11408 when train run is not representative but also leads to significantly bigger
11409 code.
11410
11411 @item -fprofile-use
11412 @itemx -fprofile-use=@var{path}
11413 @opindex fprofile-use
11414 Enable profile feedback-directed optimizations,
11415 and the following optimizations, many of which
11416 are generally profitable only with profile feedback available:
11417
11418 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
11419 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
11420 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
11421 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
11422 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
11423 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
11424 -fprofile-reorder-functions}
11425
11426 Before you can use this option, you must first generate profiling information.
11427 @xref{Instrumentation Options}, for information about the
11428 @option{-fprofile-generate} option.
11429
11430 By default, GCC emits an error message if the feedback profiles do not
11431 match the source code. This error can be turned into a warning by using
11432 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
11433 optimized code. Additionally, by default, GCC also emits a warning message if
11434 the feedback profiles do not exist (see @option{-Wmissing-profile}).
11435
11436 If @var{path} is specified, GCC looks at the @var{path} to find
11437 the profile feedback data files. See @option{-fprofile-dir}.
11438
11439 @item -fauto-profile
11440 @itemx -fauto-profile=@var{path}
11441 @opindex fauto-profile
11442 Enable sampling-based feedback-directed optimizations,
11443 and the following optimizations,
11444 many of which are generally profitable only with profile feedback available:
11445
11446 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
11447 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
11448 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
11449 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
11450 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
11451 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
11452 -fprofile-correction}
11453
11454 @var{path} is the name of a file containing AutoFDO profile information.
11455 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
11456
11457 Producing an AutoFDO profile data file requires running your program
11458 with the @command{perf} utility on a supported GNU/Linux target system.
11459 For more information, see @uref{https://perf.wiki.kernel.org/}.
11460
11461 E.g.
11462 @smallexample
11463 perf record -e br_inst_retired:near_taken -b -o perf.data \
11464 -- your_program
11465 @end smallexample
11466
11467 Then use the @command{create_gcov} tool to convert the raw profile data
11468 to a format that can be used by GCC.@ You must also supply the
11469 unstripped binary for your program to this tool.
11470 See @uref{https://github.com/google/autofdo}.
11471
11472 E.g.
11473 @smallexample
11474 create_gcov --binary=your_program.unstripped --profile=perf.data \
11475 --gcov=profile.afdo
11476 @end smallexample
11477 @end table
11478
11479 The following options control compiler behavior regarding floating-point
11480 arithmetic. These options trade off between speed and
11481 correctness. All must be specifically enabled.
11482
11483 @table @gcctabopt
11484 @item -ffloat-store
11485 @opindex ffloat-store
11486 Do not store floating-point variables in registers, and inhibit other
11487 options that might change whether a floating-point value is taken from a
11488 register or memory.
11489
11490 @cindex floating-point precision
11491 This option prevents undesirable excess precision on machines such as
11492 the 68000 where the floating registers (of the 68881) keep more
11493 precision than a @code{double} is supposed to have. Similarly for the
11494 x86 architecture. For most programs, the excess precision does only
11495 good, but a few programs rely on the precise definition of IEEE floating
11496 point. Use @option{-ffloat-store} for such programs, after modifying
11497 them to store all pertinent intermediate computations into variables.
11498
11499 @item -fexcess-precision=@var{style}
11500 @opindex fexcess-precision
11501 This option allows further control over excess precision on machines
11502 where floating-point operations occur in a format with more precision or
11503 range than the IEEE standard and interchange floating-point types. By
11504 default, @option{-fexcess-precision=fast} is in effect; this means that
11505 operations may be carried out in a wider precision than the types specified
11506 in the source if that would result in faster code, and it is unpredictable
11507 when rounding to the types specified in the source code takes place.
11508 When compiling C, if @option{-fexcess-precision=standard} is specified then
11509 excess precision follows the rules specified in ISO C99; in particular,
11510 both casts and assignments cause values to be rounded to their
11511 semantic types (whereas @option{-ffloat-store} only affects
11512 assignments). This option is enabled by default for C if a strict
11513 conformance option such as @option{-std=c99} is used.
11514 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
11515 regardless of whether a strict conformance option is used.
11516
11517 @opindex mfpmath
11518 @option{-fexcess-precision=standard} is not implemented for languages
11519 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
11520 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
11521 semantics apply without excess precision, and in the latter, rounding
11522 is unpredictable.
11523
11524 @item -ffast-math
11525 @opindex ffast-math
11526 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
11527 @option{-ffinite-math-only}, @option{-fno-rounding-math},
11528 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
11529 @option{-fexcess-precision=fast}.
11530
11531 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
11532
11533 This option is not turned on by any @option{-O} option besides
11534 @option{-Ofast} since it can result in incorrect output for programs
11535 that depend on an exact implementation of IEEE or ISO rules/specifications
11536 for math functions. It may, however, yield faster code for programs
11537 that do not require the guarantees of these specifications.
11538
11539 @item -fno-math-errno
11540 @opindex fno-math-errno
11541 @opindex fmath-errno
11542 Do not set @code{errno} after calling math functions that are executed
11543 with a single instruction, e.g., @code{sqrt}. A program that relies on
11544 IEEE exceptions for math error handling may want to use this flag
11545 for speed while maintaining IEEE arithmetic compatibility.
11546
11547 This option is not turned on by any @option{-O} option since
11548 it can result in incorrect output for programs that depend on
11549 an exact implementation of IEEE or ISO rules/specifications for
11550 math functions. It may, however, yield faster code for programs
11551 that do not require the guarantees of these specifications.
11552
11553 The default is @option{-fmath-errno}.
11554
11555 On Darwin systems, the math library never sets @code{errno}. There is
11556 therefore no reason for the compiler to consider the possibility that
11557 it might, and @option{-fno-math-errno} is the default.
11558
11559 @item -funsafe-math-optimizations
11560 @opindex funsafe-math-optimizations
11561
11562 Allow optimizations for floating-point arithmetic that (a) assume
11563 that arguments and results are valid and (b) may violate IEEE or
11564 ANSI standards. When used at link time, it may include libraries
11565 or startup files that change the default FPU control word or other
11566 similar optimizations.
11567
11568 This option is not turned on by any @option{-O} option since
11569 it can result in incorrect output for programs that depend on
11570 an exact implementation of IEEE or ISO rules/specifications for
11571 math functions. It may, however, yield faster code for programs
11572 that do not require the guarantees of these specifications.
11573 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
11574 @option{-fassociative-math} and @option{-freciprocal-math}.
11575
11576 The default is @option{-fno-unsafe-math-optimizations}.
11577
11578 @item -fassociative-math
11579 @opindex fassociative-math
11580
11581 Allow re-association of operands in series of floating-point operations.
11582 This violates the ISO C and C++ language standard by possibly changing
11583 computation result. NOTE: re-ordering may change the sign of zero as
11584 well as ignore NaNs and inhibit or create underflow or overflow (and
11585 thus cannot be used on code that relies on rounding behavior like
11586 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
11587 and thus may not be used when ordered comparisons are required.
11588 This option requires that both @option{-fno-signed-zeros} and
11589 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
11590 much sense with @option{-frounding-math}. For Fortran the option
11591 is automatically enabled when both @option{-fno-signed-zeros} and
11592 @option{-fno-trapping-math} are in effect.
11593
11594 The default is @option{-fno-associative-math}.
11595
11596 @item -freciprocal-math
11597 @opindex freciprocal-math
11598
11599 Allow the reciprocal of a value to be used instead of dividing by
11600 the value if this enables optimizations. For example @code{x / y}
11601 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
11602 is subject to common subexpression elimination. Note that this loses
11603 precision and increases the number of flops operating on the value.
11604
11605 The default is @option{-fno-reciprocal-math}.
11606
11607 @item -ffinite-math-only
11608 @opindex ffinite-math-only
11609 Allow optimizations for floating-point arithmetic that assume
11610 that arguments and results are not NaNs or +-Infs.
11611
11612 This option is not turned on by any @option{-O} option since
11613 it can result in incorrect output for programs that depend on
11614 an exact implementation of IEEE or ISO rules/specifications for
11615 math functions. It may, however, yield faster code for programs
11616 that do not require the guarantees of these specifications.
11617
11618 The default is @option{-fno-finite-math-only}.
11619
11620 @item -fno-signed-zeros
11621 @opindex fno-signed-zeros
11622 @opindex fsigned-zeros
11623 Allow optimizations for floating-point arithmetic that ignore the
11624 signedness of zero. IEEE arithmetic specifies the behavior of
11625 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
11626 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
11627 This option implies that the sign of a zero result isn't significant.
11628
11629 The default is @option{-fsigned-zeros}.
11630
11631 @item -fno-trapping-math
11632 @opindex fno-trapping-math
11633 @opindex ftrapping-math
11634 Compile code assuming that floating-point operations cannot generate
11635 user-visible traps. These traps include division by zero, overflow,
11636 underflow, inexact result and invalid operation. This option requires
11637 that @option{-fno-signaling-nans} be in effect. Setting this option may
11638 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
11639
11640 This option should never be turned on by any @option{-O} option since
11641 it can result in incorrect output for programs that depend on
11642 an exact implementation of IEEE or ISO rules/specifications for
11643 math functions.
11644
11645 The default is @option{-ftrapping-math}.
11646
11647 @item -frounding-math
11648 @opindex frounding-math
11649 Disable transformations and optimizations that assume default floating-point
11650 rounding behavior. This is round-to-zero for all floating point
11651 to integer conversions, and round-to-nearest for all other arithmetic
11652 truncations. This option should be specified for programs that change
11653 the FP rounding mode dynamically, or that may be executed with a
11654 non-default rounding mode. This option disables constant folding of
11655 floating-point expressions at compile time (which may be affected by
11656 rounding mode) and arithmetic transformations that are unsafe in the
11657 presence of sign-dependent rounding modes.
11658
11659 The default is @option{-fno-rounding-math}.
11660
11661 This option is experimental and does not currently guarantee to
11662 disable all GCC optimizations that are affected by rounding mode.
11663 Future versions of GCC may provide finer control of this setting
11664 using C99's @code{FENV_ACCESS} pragma. This command-line option
11665 will be used to specify the default state for @code{FENV_ACCESS}.
11666
11667 @item -fsignaling-nans
11668 @opindex fsignaling-nans
11669 Compile code assuming that IEEE signaling NaNs may generate user-visible
11670 traps during floating-point operations. Setting this option disables
11671 optimizations that may change the number of exceptions visible with
11672 signaling NaNs. This option implies @option{-ftrapping-math}.
11673
11674 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
11675 be defined.
11676
11677 The default is @option{-fno-signaling-nans}.
11678
11679 This option is experimental and does not currently guarantee to
11680 disable all GCC optimizations that affect signaling NaN behavior.
11681
11682 @item -fno-fp-int-builtin-inexact
11683 @opindex fno-fp-int-builtin-inexact
11684 @opindex ffp-int-builtin-inexact
11685 Do not allow the built-in functions @code{ceil}, @code{floor},
11686 @code{round} and @code{trunc}, and their @code{float} and @code{long
11687 double} variants, to generate code that raises the ``inexact''
11688 floating-point exception for noninteger arguments. ISO C99 and C11
11689 allow these functions to raise the ``inexact'' exception, but ISO/IEC
11690 TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into
11691 ISO C2X, does not allow these functions to do so.
11692
11693 The default is @option{-ffp-int-builtin-inexact}, allowing the
11694 exception to be raised, unless C2X or a later C standard is selected.
11695 This option does nothing unless @option{-ftrapping-math} is in effect.
11696
11697 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
11698 generate a call to a library function then the ``inexact'' exception
11699 may be raised if the library implementation does not follow TS 18661.
11700
11701 @item -fsingle-precision-constant
11702 @opindex fsingle-precision-constant
11703 Treat floating-point constants as single precision instead of
11704 implicitly converting them to double-precision constants.
11705
11706 @item -fcx-limited-range
11707 @opindex fcx-limited-range
11708 When enabled, this option states that a range reduction step is not
11709 needed when performing complex division. Also, there is no checking
11710 whether the result of a complex multiplication or division is @code{NaN
11711 + I*NaN}, with an attempt to rescue the situation in that case. The
11712 default is @option{-fno-cx-limited-range}, but is enabled by
11713 @option{-ffast-math}.
11714
11715 This option controls the default setting of the ISO C99
11716 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
11717 all languages.
11718
11719 @item -fcx-fortran-rules
11720 @opindex fcx-fortran-rules
11721 Complex multiplication and division follow Fortran rules. Range
11722 reduction is done as part of complex division, but there is no checking
11723 whether the result of a complex multiplication or division is @code{NaN
11724 + I*NaN}, with an attempt to rescue the situation in that case.
11725
11726 The default is @option{-fno-cx-fortran-rules}.
11727
11728 @end table
11729
11730 The following options control optimizations that may improve
11731 performance, but are not enabled by any @option{-O} options. This
11732 section includes experimental options that may produce broken code.
11733
11734 @table @gcctabopt
11735 @item -fbranch-probabilities
11736 @opindex fbranch-probabilities
11737 After running a program compiled with @option{-fprofile-arcs}
11738 (@pxref{Instrumentation Options}),
11739 you can compile it a second time using
11740 @option{-fbranch-probabilities}, to improve optimizations based on
11741 the number of times each branch was taken. When a program
11742 compiled with @option{-fprofile-arcs} exits, it saves arc execution
11743 counts to a file called @file{@var{sourcename}.gcda} for each source
11744 file. The information in this data file is very dependent on the
11745 structure of the generated code, so you must use the same source code
11746 and the same optimization options for both compilations.
11747
11748 With @option{-fbranch-probabilities}, GCC puts a
11749 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
11750 These can be used to improve optimization. Currently, they are only
11751 used in one place: in @file{reorg.c}, instead of guessing which path a
11752 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
11753 exactly determine which path is taken more often.
11754
11755 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11756
11757 @item -fprofile-values
11758 @opindex fprofile-values
11759 If combined with @option{-fprofile-arcs}, it adds code so that some
11760 data about values of expressions in the program is gathered.
11761
11762 With @option{-fbranch-probabilities}, it reads back the data gathered
11763 from profiling values of expressions for usage in optimizations.
11764
11765 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
11766 @option{-fauto-profile}.
11767
11768 @item -fprofile-reorder-functions
11769 @opindex fprofile-reorder-functions
11770 Function reordering based on profile instrumentation collects
11771 first time of execution of a function and orders these functions
11772 in ascending order.
11773
11774 Enabled with @option{-fprofile-use}.
11775
11776 @item -fvpt
11777 @opindex fvpt
11778 If combined with @option{-fprofile-arcs}, this option instructs the compiler
11779 to add code to gather information about values of expressions.
11780
11781 With @option{-fbranch-probabilities}, it reads back the data gathered
11782 and actually performs the optimizations based on them.
11783 Currently the optimizations include specialization of division operations
11784 using the knowledge about the value of the denominator.
11785
11786 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
11787
11788 @item -frename-registers
11789 @opindex frename-registers
11790 Attempt to avoid false dependencies in scheduled code by making use
11791 of registers left over after register allocation. This optimization
11792 most benefits processors with lots of registers. Depending on the
11793 debug information format adopted by the target, however, it can
11794 make debugging impossible, since variables no longer stay in
11795 a ``home register''.
11796
11797 Enabled by default with @option{-funroll-loops}.
11798
11799 @item -fschedule-fusion
11800 @opindex fschedule-fusion
11801 Performs a target dependent pass over the instruction stream to schedule
11802 instructions of same type together because target machine can execute them
11803 more efficiently if they are adjacent to each other in the instruction flow.
11804
11805 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
11806
11807 @item -ftracer
11808 @opindex ftracer
11809 Perform tail duplication to enlarge superblock size. This transformation
11810 simplifies the control flow of the function allowing other optimizations to do
11811 a better job.
11812
11813 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11814
11815 @item -funroll-loops
11816 @opindex funroll-loops
11817 Unroll loops whose number of iterations can be determined at compile time or
11818 upon entry to the loop. @option{-funroll-loops} implies
11819 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
11820 It also turns on complete loop peeling (i.e.@: complete removal of loops with
11821 a small constant number of iterations). This option makes code larger, and may
11822 or may not make it run faster.
11823
11824 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11825
11826 @item -funroll-all-loops
11827 @opindex funroll-all-loops
11828 Unroll all loops, even if their number of iterations is uncertain when
11829 the loop is entered. This usually makes programs run more slowly.
11830 @option{-funroll-all-loops} implies the same options as
11831 @option{-funroll-loops}.
11832
11833 @item -fpeel-loops
11834 @opindex fpeel-loops
11835 Peels loops for which there is enough information that they do not
11836 roll much (from profile feedback or static analysis). It also turns on
11837 complete loop peeling (i.e.@: complete removal of loops with small constant
11838 number of iterations).
11839
11840 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
11841
11842 @item -fmove-loop-invariants
11843 @opindex fmove-loop-invariants
11844 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
11845 at level @option{-O1} and higher, except for @option{-Og}.
11846
11847 @item -fsplit-loops
11848 @opindex fsplit-loops
11849 Split a loop into two if it contains a condition that's always true
11850 for one side of the iteration space and false for the other.
11851
11852 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11853
11854 @item -funswitch-loops
11855 @opindex funswitch-loops
11856 Move branches with loop invariant conditions out of the loop, with duplicates
11857 of the loop on both branches (modified according to result of the condition).
11858
11859 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11860
11861 @item -fversion-loops-for-strides
11862 @opindex fversion-loops-for-strides
11863 If a loop iterates over an array with a variable stride, create another
11864 version of the loop that assumes the stride is always one. For example:
11865
11866 @smallexample
11867 for (int i = 0; i < n; ++i)
11868 x[i * stride] = @dots{};
11869 @end smallexample
11870
11871 becomes:
11872
11873 @smallexample
11874 if (stride == 1)
11875 for (int i = 0; i < n; ++i)
11876 x[i] = @dots{};
11877 else
11878 for (int i = 0; i < n; ++i)
11879 x[i * stride] = @dots{};
11880 @end smallexample
11881
11882 This is particularly useful for assumed-shape arrays in Fortran where
11883 (for example) it allows better vectorization assuming contiguous accesses.
11884 This flag is enabled by default at @option{-O3}.
11885 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11886
11887 @item -ffunction-sections
11888 @itemx -fdata-sections
11889 @opindex ffunction-sections
11890 @opindex fdata-sections
11891 Place each function or data item into its own section in the output
11892 file if the target supports arbitrary sections. The name of the
11893 function or the name of the data item determines the section's name
11894 in the output file.
11895
11896 Use these options on systems where the linker can perform optimizations to
11897 improve locality of reference in the instruction space. Most systems using the
11898 ELF object format have linkers with such optimizations. On AIX, the linker
11899 rearranges sections (CSECTs) based on the call graph. The performance impact
11900 varies.
11901
11902 Together with a linker garbage collection (linker @option{--gc-sections}
11903 option) these options may lead to smaller statically-linked executables (after
11904 stripping).
11905
11906 On ELF/DWARF systems these options do not degenerate the quality of the debug
11907 information. There could be issues with other object files/debug info formats.
11908
11909 Only use these options when there are significant benefits from doing so. When
11910 you specify these options, the assembler and linker create larger object and
11911 executable files and are also slower. These options affect code generation.
11912 They prevent optimizations by the compiler and assembler using relative
11913 locations inside a translation unit since the locations are unknown until
11914 link time. An example of such an optimization is relaxing calls to short call
11915 instructions.
11916
11917 @item -fstdarg-opt
11918 @opindex fstdarg-opt
11919 Optimize the prologue of variadic argument functions with respect to usage of
11920 those arguments.
11921
11922 @item -fsection-anchors
11923 @opindex fsection-anchors
11924 Try to reduce the number of symbolic address calculations by using
11925 shared ``anchor'' symbols to address nearby objects. This transformation
11926 can help to reduce the number of GOT entries and GOT accesses on some
11927 targets.
11928
11929 For example, the implementation of the following function @code{foo}:
11930
11931 @smallexample
11932 static int a, b, c;
11933 int foo (void) @{ return a + b + c; @}
11934 @end smallexample
11935
11936 @noindent
11937 usually calculates the addresses of all three variables, but if you
11938 compile it with @option{-fsection-anchors}, it accesses the variables
11939 from a common anchor point instead. The effect is similar to the
11940 following pseudocode (which isn't valid C):
11941
11942 @smallexample
11943 int foo (void)
11944 @{
11945 register int *xr = &x;
11946 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11947 @}
11948 @end smallexample
11949
11950 Not all targets support this option.
11951
11952 @item --param @var{name}=@var{value}
11953 @opindex param
11954 In some places, GCC uses various constants to control the amount of
11955 optimization that is done. For example, GCC does not inline functions
11956 that contain more than a certain number of instructions. You can
11957 control some of these constants on the command line using the
11958 @option{--param} option.
11959
11960 The names of specific parameters, and the meaning of the values, are
11961 tied to the internals of the compiler, and are subject to change
11962 without notice in future releases.
11963
11964 In order to get minimal, maximal and default value of a parameter,
11965 one can use @option{--help=param -Q} options.
11966
11967 In each case, the @var{value} is an integer. The following choices
11968 of @var{name} are recognized for all targets:
11969
11970 @table @gcctabopt
11971 @item predictable-branch-outcome
11972 When branch is predicted to be taken with probability lower than this threshold
11973 (in percent), then it is considered well predictable.
11974
11975 @item max-rtl-if-conversion-insns
11976 RTL if-conversion tries to remove conditional branches around a block and
11977 replace them with conditionally executed instructions. This parameter
11978 gives the maximum number of instructions in a block which should be
11979 considered for if-conversion. The compiler will
11980 also use other heuristics to decide whether if-conversion is likely to be
11981 profitable.
11982
11983 @item max-rtl-if-conversion-predictable-cost
11984 @itemx max-rtl-if-conversion-unpredictable-cost
11985 RTL if-conversion will try to remove conditional branches around a block
11986 and replace them with conditionally executed instructions. These parameters
11987 give the maximum permissible cost for the sequence that would be generated
11988 by if-conversion depending on whether the branch is statically determined
11989 to be predictable or not. The units for this parameter are the same as
11990 those for the GCC internal seq_cost metric. The compiler will try to
11991 provide a reasonable default for this parameter using the BRANCH_COST
11992 target macro.
11993
11994 @item max-crossjump-edges
11995 The maximum number of incoming edges to consider for cross-jumping.
11996 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11997 the number of edges incoming to each block. Increasing values mean
11998 more aggressive optimization, making the compilation time increase with
11999 probably small improvement in executable size.
12000
12001 @item min-crossjump-insns
12002 The minimum number of instructions that must be matched at the end
12003 of two blocks before cross-jumping is performed on them. This
12004 value is ignored in the case where all instructions in the block being
12005 cross-jumped from are matched.
12006
12007 @item max-grow-copy-bb-insns
12008 The maximum code size expansion factor when copying basic blocks
12009 instead of jumping. The expansion is relative to a jump instruction.
12010
12011 @item max-goto-duplication-insns
12012 The maximum number of instructions to duplicate to a block that jumps
12013 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
12014 passes, GCC factors computed gotos early in the compilation process,
12015 and unfactors them as late as possible. Only computed jumps at the
12016 end of a basic blocks with no more than max-goto-duplication-insns are
12017 unfactored.
12018
12019 @item max-delay-slot-insn-search
12020 The maximum number of instructions to consider when looking for an
12021 instruction to fill a delay slot. If more than this arbitrary number of
12022 instructions are searched, the time savings from filling the delay slot
12023 are minimal, so stop searching. Increasing values mean more
12024 aggressive optimization, making the compilation time increase with probably
12025 small improvement in execution time.
12026
12027 @item max-delay-slot-live-search
12028 When trying to fill delay slots, the maximum number of instructions to
12029 consider when searching for a block with valid live register
12030 information. Increasing this arbitrarily chosen value means more
12031 aggressive optimization, increasing the compilation time. This parameter
12032 should be removed when the delay slot code is rewritten to maintain the
12033 control-flow graph.
12034
12035 @item max-gcse-memory
12036 The approximate maximum amount of memory that can be allocated in
12037 order to perform the global common subexpression elimination
12038 optimization. If more memory than specified is required, the
12039 optimization is not done.
12040
12041 @item max-gcse-insertion-ratio
12042 If the ratio of expression insertions to deletions is larger than this value
12043 for any expression, then RTL PRE inserts or removes the expression and thus
12044 leaves partially redundant computations in the instruction stream.
12045
12046 @item max-pending-list-length
12047 The maximum number of pending dependencies scheduling allows
12048 before flushing the current state and starting over. Large functions
12049 with few branches or calls can create excessively large lists which
12050 needlessly consume memory and resources.
12051
12052 @item max-modulo-backtrack-attempts
12053 The maximum number of backtrack attempts the scheduler should make
12054 when modulo scheduling a loop. Larger values can exponentially increase
12055 compilation time.
12056
12057 @item max-inline-insns-single
12058 Several parameters control the tree inliner used in GCC@. This number sets the
12059 maximum number of instructions (counted in GCC's internal representation) in a
12060 single function that the tree inliner considers for inlining. This only
12061 affects functions declared inline and methods implemented in a class
12062 declaration (C++).
12063
12064
12065 @item max-inline-insns-auto
12066 When you use @option{-finline-functions} (included in @option{-O3}),
12067 a lot of functions that would otherwise not be considered for inlining
12068 by the compiler are investigated. To those functions, a different
12069 (more restrictive) limit compared to functions declared inline can
12070 be applied (@option{--param max-inline-insns-auto}).
12071
12072 @item max-inline-insns-small
12073 This is bound applied to calls which are considered relevant with
12074 @option{-finline-small-functions}.
12075
12076 @item max-inline-insns-size
12077 This is bound applied to calls which are optimized for size. Small growth
12078 may be desirable to anticipate optimization oppurtunities exposed by inlining.
12079
12080 @item uninlined-function-insns
12081 Number of instructions accounted by inliner for function overhead such as
12082 function prologue and epilogue.
12083
12084 @item uninlined-function-time
12085 Extra time accounted by inliner for function overhead such as time needed to
12086 execute function prologue and epilogue
12087
12088 @item inline-heuristics-hint-percent
12089 The scale (in percents) applied to @option{inline-insns-single},
12090 @option{inline-insns-single-O2}, @option{inline-insns-auto}
12091 when inline heuristics hints that inlining is
12092 very profitable (will enable later optimizations).
12093
12094 @item uninlined-thunk-insns
12095 @item uninlined-thunk-time
12096 Same as @option{--param uninlined-function-insns} and
12097 @option{--param uninlined-function-time} but applied to function thunks
12098
12099 @item inline-min-speedup
12100 When estimated performance improvement of caller + callee runtime exceeds this
12101 threshold (in percent), the function can be inlined regardless of the limit on
12102 @option{--param max-inline-insns-single} and @option{--param
12103 max-inline-insns-auto}.
12104
12105 @item large-function-insns
12106 The limit specifying really large functions. For functions larger than this
12107 limit after inlining, inlining is constrained by
12108 @option{--param large-function-growth}. This parameter is useful primarily
12109 to avoid extreme compilation time caused by non-linear algorithms used by the
12110 back end.
12111
12112 @item large-function-growth
12113 Specifies maximal growth of large function caused by inlining in percents.
12114 For example, parameter value 100 limits large function growth to 2.0 times
12115 the original size.
12116
12117 @item large-unit-insns
12118 The limit specifying large translation unit. Growth caused by inlining of
12119 units larger than this limit is limited by @option{--param inline-unit-growth}.
12120 For small units this might be too tight.
12121 For example, consider a unit consisting of function A
12122 that is inline and B that just calls A three times. If B is small relative to
12123 A, the growth of unit is 300\% and yet such inlining is very sane. For very
12124 large units consisting of small inlineable functions, however, the overall unit
12125 growth limit is needed to avoid exponential explosion of code size. Thus for
12126 smaller units, the size is increased to @option{--param large-unit-insns}
12127 before applying @option{--param inline-unit-growth}.
12128
12129 @item inline-unit-growth
12130 Specifies maximal overall growth of the compilation unit caused by inlining.
12131 For example, parameter value 20 limits unit growth to 1.2 times the original
12132 size. Cold functions (either marked cold via an attribute or by profile
12133 feedback) are not accounted into the unit size.
12134
12135 @item ipcp-unit-growth
12136 Specifies maximal overall growth of the compilation unit caused by
12137 interprocedural constant propagation. For example, parameter value 10 limits
12138 unit growth to 1.1 times the original size.
12139
12140 @item large-stack-frame
12141 The limit specifying large stack frames. While inlining the algorithm is trying
12142 to not grow past this limit too much.
12143
12144 @item large-stack-frame-growth
12145 Specifies maximal growth of large stack frames caused by inlining in percents.
12146 For example, parameter value 1000 limits large stack frame growth to 11 times
12147 the original size.
12148
12149 @item max-inline-insns-recursive
12150 @itemx max-inline-insns-recursive-auto
12151 Specifies the maximum number of instructions an out-of-line copy of a
12152 self-recursive inline
12153 function can grow into by performing recursive inlining.
12154
12155 @option{--param max-inline-insns-recursive} applies to functions
12156 declared inline.
12157 For functions not declared inline, recursive inlining
12158 happens only when @option{-finline-functions} (included in @option{-O3}) is
12159 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
12160
12161 @item max-inline-recursive-depth
12162 @itemx max-inline-recursive-depth-auto
12163 Specifies the maximum recursion depth used for recursive inlining.
12164
12165 @option{--param max-inline-recursive-depth} applies to functions
12166 declared inline. For functions not declared inline, recursive inlining
12167 happens only when @option{-finline-functions} (included in @option{-O3}) is
12168 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
12169
12170 @item min-inline-recursive-probability
12171 Recursive inlining is profitable only for function having deep recursion
12172 in average and can hurt for function having little recursion depth by
12173 increasing the prologue size or complexity of function body to other
12174 optimizers.
12175
12176 When profile feedback is available (see @option{-fprofile-generate}) the actual
12177 recursion depth can be guessed from the probability that function recurses
12178 via a given call expression. This parameter limits inlining only to call
12179 expressions whose probability exceeds the given threshold (in percents).
12180
12181 @item early-inlining-insns
12182 Specify growth that the early inliner can make. In effect it increases
12183 the amount of inlining for code having a large abstraction penalty.
12184
12185 @item max-early-inliner-iterations
12186 Limit of iterations of the early inliner. This basically bounds
12187 the number of nested indirect calls the early inliner can resolve.
12188 Deeper chains are still handled by late inlining.
12189
12190 @item comdat-sharing-probability
12191 Probability (in percent) that C++ inline function with comdat visibility
12192 are shared across multiple compilation units.
12193
12194 @item profile-func-internal-id
12195 A parameter to control whether to use function internal id in profile
12196 database lookup. If the value is 0, the compiler uses an id that
12197 is based on function assembler name and filename, which makes old profile
12198 data more tolerant to source changes such as function reordering etc.
12199
12200 @item min-vect-loop-bound
12201 The minimum number of iterations under which loops are not vectorized
12202 when @option{-ftree-vectorize} is used. The number of iterations after
12203 vectorization needs to be greater than the value specified by this option
12204 to allow vectorization.
12205
12206 @item gcse-cost-distance-ratio
12207 Scaling factor in calculation of maximum distance an expression
12208 can be moved by GCSE optimizations. This is currently supported only in the
12209 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
12210 is with simple expressions, i.e., the expressions that have cost
12211 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
12212 hoisting of simple expressions.
12213
12214 @item gcse-unrestricted-cost
12215 Cost, roughly measured as the cost of a single typical machine
12216 instruction, at which GCSE optimizations do not constrain
12217 the distance an expression can travel. This is currently
12218 supported only in the code hoisting pass. The lesser the cost,
12219 the more aggressive code hoisting is. Specifying 0
12220 allows all expressions to travel unrestricted distances.
12221
12222 @item max-hoist-depth
12223 The depth of search in the dominator tree for expressions to hoist.
12224 This is used to avoid quadratic behavior in hoisting algorithm.
12225 The value of 0 does not limit on the search, but may slow down compilation
12226 of huge functions.
12227
12228 @item max-tail-merge-comparisons
12229 The maximum amount of similar bbs to compare a bb with. This is used to
12230 avoid quadratic behavior in tree tail merging.
12231
12232 @item max-tail-merge-iterations
12233 The maximum amount of iterations of the pass over the function. This is used to
12234 limit compilation time in tree tail merging.
12235
12236 @item store-merging-allow-unaligned
12237 Allow the store merging pass to introduce unaligned stores if it is legal to
12238 do so.
12239
12240 @item max-stores-to-merge
12241 The maximum number of stores to attempt to merge into wider stores in the store
12242 merging pass.
12243
12244 @item max-unrolled-insns
12245 The maximum number of instructions that a loop may have to be unrolled.
12246 If a loop is unrolled, this parameter also determines how many times
12247 the loop code is unrolled.
12248
12249 @item max-average-unrolled-insns
12250 The maximum number of instructions biased by probabilities of their execution
12251 that a loop may have to be unrolled. If a loop is unrolled,
12252 this parameter also determines how many times the loop code is unrolled.
12253
12254 @item max-unroll-times
12255 The maximum number of unrollings of a single loop.
12256
12257 @item max-peeled-insns
12258 The maximum number of instructions that a loop may have to be peeled.
12259 If a loop is peeled, this parameter also determines how many times
12260 the loop code is peeled.
12261
12262 @item max-peel-times
12263 The maximum number of peelings of a single loop.
12264
12265 @item max-peel-branches
12266 The maximum number of branches on the hot path through the peeled sequence.
12267
12268 @item max-completely-peeled-insns
12269 The maximum number of insns of a completely peeled loop.
12270
12271 @item max-completely-peel-times
12272 The maximum number of iterations of a loop to be suitable for complete peeling.
12273
12274 @item max-completely-peel-loop-nest-depth
12275 The maximum depth of a loop nest suitable for complete peeling.
12276
12277 @item max-unswitch-insns
12278 The maximum number of insns of an unswitched loop.
12279
12280 @item max-unswitch-level
12281 The maximum number of branches unswitched in a single loop.
12282
12283 @item lim-expensive
12284 The minimum cost of an expensive expression in the loop invariant motion.
12285
12286 @item min-loop-cond-split-prob
12287 When FDO profile information is available, @option{min-loop-cond-split-prob}
12288 specifies minimum threshold for probability of semi-invariant condition
12289 statement to trigger loop split.
12290
12291 @item iv-consider-all-candidates-bound
12292 Bound on number of candidates for induction variables, below which
12293 all candidates are considered for each use in induction variable
12294 optimizations. If there are more candidates than this,
12295 only the most relevant ones are considered to avoid quadratic time complexity.
12296
12297 @item iv-max-considered-uses
12298 The induction variable optimizations give up on loops that contain more
12299 induction variable uses.
12300
12301 @item iv-always-prune-cand-set-bound
12302 If the number of candidates in the set is smaller than this value,
12303 always try to remove unnecessary ivs from the set
12304 when adding a new one.
12305
12306 @item avg-loop-niter
12307 Average number of iterations of a loop.
12308
12309 @item dse-max-object-size
12310 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
12311 Larger values may result in larger compilation times.
12312
12313 @item dse-max-alias-queries-per-store
12314 Maximum number of queries into the alias oracle per store.
12315 Larger values result in larger compilation times and may result in more
12316 removed dead stores.
12317
12318 @item scev-max-expr-size
12319 Bound on size of expressions used in the scalar evolutions analyzer.
12320 Large expressions slow the analyzer.
12321
12322 @item scev-max-expr-complexity
12323 Bound on the complexity of the expressions in the scalar evolutions analyzer.
12324 Complex expressions slow the analyzer.
12325
12326 @item max-tree-if-conversion-phi-args
12327 Maximum number of arguments in a PHI supported by TREE if conversion
12328 unless the loop is marked with simd pragma.
12329
12330 @item vect-max-version-for-alignment-checks
12331 The maximum number of run-time checks that can be performed when
12332 doing loop versioning for alignment in the vectorizer.
12333
12334 @item vect-max-version-for-alias-checks
12335 The maximum number of run-time checks that can be performed when
12336 doing loop versioning for alias in the vectorizer.
12337
12338 @item vect-max-peeling-for-alignment
12339 The maximum number of loop peels to enhance access alignment
12340 for vectorizer. Value -1 means no limit.
12341
12342 @item max-iterations-to-track
12343 The maximum number of iterations of a loop the brute-force algorithm
12344 for analysis of the number of iterations of the loop tries to evaluate.
12345
12346 @item hot-bb-count-fraction
12347 The denominator n of fraction 1/n of the maximal execution count of a
12348 basic block in the entire program that a basic block needs to at least
12349 have in order to be considered hot. The default is 10000, which means
12350 that a basic block is considered hot if its execution count is greater
12351 than 1/10000 of the maximal execution count. 0 means that it is never
12352 considered hot. Used in non-LTO mode.
12353
12354 @item hot-bb-count-ws-permille
12355 The number of most executed permilles, ranging from 0 to 1000, of the
12356 profiled execution of the entire program to which the execution count
12357 of a basic block must be part of in order to be considered hot. The
12358 default is 990, which means that a basic block is considered hot if
12359 its execution count contributes to the upper 990 permilles, or 99.0%,
12360 of the profiled execution of the entire program. 0 means that it is
12361 never considered hot. Used in LTO mode.
12362
12363 @item hot-bb-frequency-fraction
12364 The denominator n of fraction 1/n of the execution frequency of the
12365 entry block of a function that a basic block of this function needs
12366 to at least have in order to be considered hot. The default is 1000,
12367 which means that a basic block is considered hot in a function if it
12368 is executed more frequently than 1/1000 of the frequency of the entry
12369 block of the function. 0 means that it is never considered hot.
12370
12371 @item unlikely-bb-count-fraction
12372 The denominator n of fraction 1/n of the number of profiled runs of
12373 the entire program below which the execution count of a basic block
12374 must be in order for the basic block to be considered unlikely executed.
12375 The default is 20, which means that a basic block is considered unlikely
12376 executed if it is executed in fewer than 1/20, or 5%, of the runs of
12377 the program. 0 means that it is always considered unlikely executed.
12378
12379 @item max-predicted-iterations
12380 The maximum number of loop iterations we predict statically. This is useful
12381 in cases where a function contains a single loop with known bound and
12382 another loop with unknown bound.
12383 The known number of iterations is predicted correctly, while
12384 the unknown number of iterations average to roughly 10. This means that the
12385 loop without bounds appears artificially cold relative to the other one.
12386
12387 @item builtin-expect-probability
12388 Control the probability of the expression having the specified value. This
12389 parameter takes a percentage (i.e.@: 0 ... 100) as input.
12390
12391 @item builtin-string-cmp-inline-length
12392 The maximum length of a constant string for a builtin string cmp call
12393 eligible for inlining.
12394
12395 @item align-threshold
12396
12397 Select fraction of the maximal frequency of executions of a basic block in
12398 a function to align the basic block.
12399
12400 @item align-loop-iterations
12401
12402 A loop expected to iterate at least the selected number of iterations is
12403 aligned.
12404
12405 @item tracer-dynamic-coverage
12406 @itemx tracer-dynamic-coverage-feedback
12407
12408 This value is used to limit superblock formation once the given percentage of
12409 executed instructions is covered. This limits unnecessary code size
12410 expansion.
12411
12412 The @option{tracer-dynamic-coverage-feedback} parameter
12413 is used only when profile
12414 feedback is available. The real profiles (as opposed to statically estimated
12415 ones) are much less balanced allowing the threshold to be larger value.
12416
12417 @item tracer-max-code-growth
12418 Stop tail duplication once code growth has reached given percentage. This is
12419 a rather artificial limit, as most of the duplicates are eliminated later in
12420 cross jumping, so it may be set to much higher values than is the desired code
12421 growth.
12422
12423 @item tracer-min-branch-ratio
12424
12425 Stop reverse growth when the reverse probability of best edge is less than this
12426 threshold (in percent).
12427
12428 @item tracer-min-branch-probability
12429 @itemx tracer-min-branch-probability-feedback
12430
12431 Stop forward growth if the best edge has probability lower than this
12432 threshold.
12433
12434 Similarly to @option{tracer-dynamic-coverage} two parameters are
12435 provided. @option{tracer-min-branch-probability-feedback} is used for
12436 compilation with profile feedback and @option{tracer-min-branch-probability}
12437 compilation without. The value for compilation with profile feedback
12438 needs to be more conservative (higher) in order to make tracer
12439 effective.
12440
12441 @item stack-clash-protection-guard-size
12442 Specify the size of the operating system provided stack guard as
12443 2 raised to @var{num} bytes. Higher values may reduce the
12444 number of explicit probes, but a value larger than the operating system
12445 provided guard will leave code vulnerable to stack clash style attacks.
12446
12447 @item stack-clash-protection-probe-interval
12448 Stack clash protection involves probing stack space as it is allocated. This
12449 param controls the maximum distance between probes into the stack as 2 raised
12450 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
12451 larger than the operating system provided guard will leave code vulnerable to
12452 stack clash style attacks.
12453
12454 @item max-cse-path-length
12455
12456 The maximum number of basic blocks on path that CSE considers.
12457
12458 @item max-cse-insns
12459 The maximum number of instructions CSE processes before flushing.
12460
12461 @item ggc-min-expand
12462
12463 GCC uses a garbage collector to manage its own memory allocation. This
12464 parameter specifies the minimum percentage by which the garbage
12465 collector's heap should be allowed to expand between collections.
12466 Tuning this may improve compilation speed; it has no effect on code
12467 generation.
12468
12469 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
12470 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
12471 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
12472 GCC is not able to calculate RAM on a particular platform, the lower
12473 bound of 30% is used. Setting this parameter and
12474 @option{ggc-min-heapsize} to zero causes a full collection to occur at
12475 every opportunity. This is extremely slow, but can be useful for
12476 debugging.
12477
12478 @item ggc-min-heapsize
12479
12480 Minimum size of the garbage collector's heap before it begins bothering
12481 to collect garbage. The first collection occurs after the heap expands
12482 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
12483 tuning this may improve compilation speed, and has no effect on code
12484 generation.
12485
12486 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
12487 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
12488 with a lower bound of 4096 (four megabytes) and an upper bound of
12489 131072 (128 megabytes). If GCC is not able to calculate RAM on a
12490 particular platform, the lower bound is used. Setting this parameter
12491 very large effectively disables garbage collection. Setting this
12492 parameter and @option{ggc-min-expand} to zero causes a full collection
12493 to occur at every opportunity.
12494
12495 @item max-reload-search-insns
12496 The maximum number of instruction reload should look backward for equivalent
12497 register. Increasing values mean more aggressive optimization, making the
12498 compilation time increase with probably slightly better performance.
12499
12500 @item max-cselib-memory-locations
12501 The maximum number of memory locations cselib should take into account.
12502 Increasing values mean more aggressive optimization, making the compilation time
12503 increase with probably slightly better performance.
12504
12505 @item max-sched-ready-insns
12506 The maximum number of instructions ready to be issued the scheduler should
12507 consider at any given time during the first scheduling pass. Increasing
12508 values mean more thorough searches, making the compilation time increase
12509 with probably little benefit.
12510
12511 @item max-sched-region-blocks
12512 The maximum number of blocks in a region to be considered for
12513 interblock scheduling.
12514
12515 @item max-pipeline-region-blocks
12516 The maximum number of blocks in a region to be considered for
12517 pipelining in the selective scheduler.
12518
12519 @item max-sched-region-insns
12520 The maximum number of insns in a region to be considered for
12521 interblock scheduling.
12522
12523 @item max-pipeline-region-insns
12524 The maximum number of insns in a region to be considered for
12525 pipelining in the selective scheduler.
12526
12527 @item min-spec-prob
12528 The minimum probability (in percents) of reaching a source block
12529 for interblock speculative scheduling.
12530
12531 @item max-sched-extend-regions-iters
12532 The maximum number of iterations through CFG to extend regions.
12533 A value of 0 disables region extensions.
12534
12535 @item max-sched-insn-conflict-delay
12536 The maximum conflict delay for an insn to be considered for speculative motion.
12537
12538 @item sched-spec-prob-cutoff
12539 The minimal probability of speculation success (in percents), so that
12540 speculative insns are scheduled.
12541
12542 @item sched-state-edge-prob-cutoff
12543 The minimum probability an edge must have for the scheduler to save its
12544 state across it.
12545
12546 @item sched-mem-true-dep-cost
12547 Minimal distance (in CPU cycles) between store and load targeting same
12548 memory locations.
12549
12550 @item selsched-max-lookahead
12551 The maximum size of the lookahead window of selective scheduling. It is a
12552 depth of search for available instructions.
12553
12554 @item selsched-max-sched-times
12555 The maximum number of times that an instruction is scheduled during
12556 selective scheduling. This is the limit on the number of iterations
12557 through which the instruction may be pipelined.
12558
12559 @item selsched-insns-to-rename
12560 The maximum number of best instructions in the ready list that are considered
12561 for renaming in the selective scheduler.
12562
12563 @item sms-min-sc
12564 The minimum value of stage count that swing modulo scheduler
12565 generates.
12566
12567 @item max-last-value-rtl
12568 The maximum size measured as number of RTLs that can be recorded in an expression
12569 in combiner for a pseudo register as last known value of that register.
12570
12571 @item max-combine-insns
12572 The maximum number of instructions the RTL combiner tries to combine.
12573
12574 @item integer-share-limit
12575 Small integer constants can use a shared data structure, reducing the
12576 compiler's memory usage and increasing its speed. This sets the maximum
12577 value of a shared integer constant.
12578
12579 @item ssp-buffer-size
12580 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
12581 protection when @option{-fstack-protection} is used.
12582
12583 @item min-size-for-stack-sharing
12584 The minimum size of variables taking part in stack slot sharing when not
12585 optimizing.
12586
12587 @item max-jump-thread-duplication-stmts
12588 Maximum number of statements allowed in a block that needs to be
12589 duplicated when threading jumps.
12590
12591 @item max-fields-for-field-sensitive
12592 Maximum number of fields in a structure treated in
12593 a field sensitive manner during pointer analysis.
12594
12595 @item prefetch-latency
12596 Estimate on average number of instructions that are executed before
12597 prefetch finishes. The distance prefetched ahead is proportional
12598 to this constant. Increasing this number may also lead to less
12599 streams being prefetched (see @option{simultaneous-prefetches}).
12600
12601 @item simultaneous-prefetches
12602 Maximum number of prefetches that can run at the same time.
12603
12604 @item l1-cache-line-size
12605 The size of cache line in L1 data cache, in bytes.
12606
12607 @item l1-cache-size
12608 The size of L1 data cache, in kilobytes.
12609
12610 @item l2-cache-size
12611 The size of L2 data cache, in kilobytes.
12612
12613 @item prefetch-dynamic-strides
12614 Whether the loop array prefetch pass should issue software prefetch hints
12615 for strides that are non-constant. In some cases this may be
12616 beneficial, though the fact the stride is non-constant may make it
12617 hard to predict when there is clear benefit to issuing these hints.
12618
12619 Set to 1 if the prefetch hints should be issued for non-constant
12620 strides. Set to 0 if prefetch hints should be issued only for strides that
12621 are known to be constant and below @option{prefetch-minimum-stride}.
12622
12623 @item prefetch-minimum-stride
12624 Minimum constant stride, in bytes, to start using prefetch hints for. If
12625 the stride is less than this threshold, prefetch hints will not be issued.
12626
12627 This setting is useful for processors that have hardware prefetchers, in
12628 which case there may be conflicts between the hardware prefetchers and
12629 the software prefetchers. If the hardware prefetchers have a maximum
12630 stride they can handle, it should be used here to improve the use of
12631 software prefetchers.
12632
12633 A value of -1 means we don't have a threshold and therefore
12634 prefetch hints can be issued for any constant stride.
12635
12636 This setting is only useful for strides that are known and constant.
12637
12638 @item loop-interchange-max-num-stmts
12639 The maximum number of stmts in a loop to be interchanged.
12640
12641 @item loop-interchange-stride-ratio
12642 The minimum ratio between stride of two loops for interchange to be profitable.
12643
12644 @item min-insn-to-prefetch-ratio
12645 The minimum ratio between the number of instructions and the
12646 number of prefetches to enable prefetching in a loop.
12647
12648 @item prefetch-min-insn-to-mem-ratio
12649 The minimum ratio between the number of instructions and the
12650 number of memory references to enable prefetching in a loop.
12651
12652 @item use-canonical-types
12653 Whether the compiler should use the ``canonical'' type system.
12654 Should always be 1, which uses a more efficient internal
12655 mechanism for comparing types in C++ and Objective-C++. However, if
12656 bugs in the canonical type system are causing compilation failures,
12657 set this value to 0 to disable canonical types.
12658
12659 @item switch-conversion-max-branch-ratio
12660 Switch initialization conversion refuses to create arrays that are
12661 bigger than @option{switch-conversion-max-branch-ratio} times the number of
12662 branches in the switch.
12663
12664 @item max-partial-antic-length
12665 Maximum length of the partial antic set computed during the tree
12666 partial redundancy elimination optimization (@option{-ftree-pre}) when
12667 optimizing at @option{-O3} and above. For some sorts of source code
12668 the enhanced partial redundancy elimination optimization can run away,
12669 consuming all of the memory available on the host machine. This
12670 parameter sets a limit on the length of the sets that are computed,
12671 which prevents the runaway behavior. Setting a value of 0 for
12672 this parameter allows an unlimited set length.
12673
12674 @item rpo-vn-max-loop-depth
12675 Maximum loop depth that is value-numbered optimistically.
12676 When the limit hits the innermost
12677 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
12678 loop nest are value-numbered optimistically and the remaining ones not.
12679
12680 @item sccvn-max-alias-queries-per-access
12681 Maximum number of alias-oracle queries we perform when looking for
12682 redundancies for loads and stores. If this limit is hit the search
12683 is aborted and the load or store is not considered redundant. The
12684 number of queries is algorithmically limited to the number of
12685 stores on all paths from the load to the function entry.
12686
12687 @item ira-max-loops-num
12688 IRA uses regional register allocation by default. If a function
12689 contains more loops than the number given by this parameter, only at most
12690 the given number of the most frequently-executed loops form regions
12691 for regional register allocation.
12692
12693 @item ira-max-conflict-table-size
12694 Although IRA uses a sophisticated algorithm to compress the conflict
12695 table, the table can still require excessive amounts of memory for
12696 huge functions. If the conflict table for a function could be more
12697 than the size in MB given by this parameter, the register allocator
12698 instead uses a faster, simpler, and lower-quality
12699 algorithm that does not require building a pseudo-register conflict table.
12700
12701 @item ira-loop-reserved-regs
12702 IRA can be used to evaluate more accurate register pressure in loops
12703 for decisions to move loop invariants (see @option{-O3}). The number
12704 of available registers reserved for some other purposes is given
12705 by this parameter. Default of the parameter
12706 is the best found from numerous experiments.
12707
12708 @item lra-inheritance-ebb-probability-cutoff
12709 LRA tries to reuse values reloaded in registers in subsequent insns.
12710 This optimization is called inheritance. EBB is used as a region to
12711 do this optimization. The parameter defines a minimal fall-through
12712 edge probability in percentage used to add BB to inheritance EBB in
12713 LRA. The default value was chosen
12714 from numerous runs of SPEC2000 on x86-64.
12715
12716 @item loop-invariant-max-bbs-in-loop
12717 Loop invariant motion can be very expensive, both in compilation time and
12718 in amount of needed compile-time memory, with very large loops. Loops
12719 with more basic blocks than this parameter won't have loop invariant
12720 motion optimization performed on them.
12721
12722 @item loop-max-datarefs-for-datadeps
12723 Building data dependencies is expensive for very large loops. This
12724 parameter limits the number of data references in loops that are
12725 considered for data dependence analysis. These large loops are no
12726 handled by the optimizations using loop data dependencies.
12727
12728 @item max-vartrack-size
12729 Sets a maximum number of hash table slots to use during variable
12730 tracking dataflow analysis of any function. If this limit is exceeded
12731 with variable tracking at assignments enabled, analysis for that
12732 function is retried without it, after removing all debug insns from
12733 the function. If the limit is exceeded even without debug insns, var
12734 tracking analysis is completely disabled for the function. Setting
12735 the parameter to zero makes it unlimited.
12736
12737 @item max-vartrack-expr-depth
12738 Sets a maximum number of recursion levels when attempting to map
12739 variable names or debug temporaries to value expressions. This trades
12740 compilation time for more complete debug information. If this is set too
12741 low, value expressions that are available and could be represented in
12742 debug information may end up not being used; setting this higher may
12743 enable the compiler to find more complex debug expressions, but compile
12744 time and memory use may grow.
12745
12746 @item max-debug-marker-count
12747 Sets a threshold on the number of debug markers (e.g.@: begin stmt
12748 markers) to avoid complexity explosion at inlining or expanding to RTL.
12749 If a function has more such gimple stmts than the set limit, such stmts
12750 will be dropped from the inlined copy of a function, and from its RTL
12751 expansion.
12752
12753 @item min-nondebug-insn-uid
12754 Use uids starting at this parameter for nondebug insns. The range below
12755 the parameter is reserved exclusively for debug insns created by
12756 @option{-fvar-tracking-assignments}, but debug insns may get
12757 (non-overlapping) uids above it if the reserved range is exhausted.
12758
12759 @item ipa-sra-ptr-growth-factor
12760 IPA-SRA replaces a pointer to an aggregate with one or more new
12761 parameters only when their cumulative size is less or equal to
12762 @option{ipa-sra-ptr-growth-factor} times the size of the original
12763 pointer parameter.
12764
12765 @item ipa-sra-max-replacements
12766 Maximum pieces of an aggregate that IPA-SRA tracks. As a
12767 consequence, it is also the maximum number of replacements of a formal
12768 parameter.
12769
12770 @item sra-max-scalarization-size-Ospeed
12771 @itemx sra-max-scalarization-size-Osize
12772 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
12773 replace scalar parts of aggregates with uses of independent scalar
12774 variables. These parameters control the maximum size, in storage units,
12775 of aggregate which is considered for replacement when compiling for
12776 speed
12777 (@option{sra-max-scalarization-size-Ospeed}) or size
12778 (@option{sra-max-scalarization-size-Osize}) respectively.
12779
12780 @item tm-max-aggregate-size
12781 When making copies of thread-local variables in a transaction, this
12782 parameter specifies the size in bytes after which variables are
12783 saved with the logging functions as opposed to save/restore code
12784 sequence pairs. This option only applies when using
12785 @option{-fgnu-tm}.
12786
12787 @item graphite-max-nb-scop-params
12788 To avoid exponential effects in the Graphite loop transforms, the
12789 number of parameters in a Static Control Part (SCoP) is bounded.
12790 A value of zero can be used to lift
12791 the bound. A variable whose value is unknown at compilation time and
12792 defined outside a SCoP is a parameter of the SCoP.
12793
12794 @item loop-block-tile-size
12795 Loop blocking or strip mining transforms, enabled with
12796 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
12797 loop in the loop nest by a given number of iterations. The strip
12798 length can be changed using the @option{loop-block-tile-size}
12799 parameter.
12800
12801 @item ipa-cp-value-list-size
12802 IPA-CP attempts to track all possible values and types passed to a function's
12803 parameter in order to propagate them and perform devirtualization.
12804 @option{ipa-cp-value-list-size} is the maximum number of values and types it
12805 stores per one formal parameter of a function.
12806
12807 @item ipa-cp-eval-threshold
12808 IPA-CP calculates its own score of cloning profitability heuristics
12809 and performs those cloning opportunities with scores that exceed
12810 @option{ipa-cp-eval-threshold}.
12811
12812 @item ipa-cp-max-recursive-depth
12813 Maximum depth of recursive cloning for self-recursive function.
12814
12815 @item ipa-cp-min-recursive-probability
12816 Recursive cloning only when the probability of call being executed exceeds
12817 the parameter.
12818
12819 @item ipa-cp-recursion-penalty
12820 Percentage penalty the recursive functions will receive when they
12821 are evaluated for cloning.
12822
12823 @item ipa-cp-single-call-penalty
12824 Percentage penalty functions containing a single call to another
12825 function will receive when they are evaluated for cloning.
12826
12827 @item ipa-max-agg-items
12828 IPA-CP is also capable to propagate a number of scalar values passed
12829 in an aggregate. @option{ipa-max-agg-items} controls the maximum
12830 number of such values per one parameter.
12831
12832 @item ipa-cp-loop-hint-bonus
12833 When IPA-CP determines that a cloning candidate would make the number
12834 of iterations of a loop known, it adds a bonus of
12835 @option{ipa-cp-loop-hint-bonus} to the profitability score of
12836 the candidate.
12837
12838 @item ipa-max-aa-steps
12839 During its analysis of function bodies, IPA-CP employs alias analysis
12840 in order to track values pointed to by function parameters. In order
12841 not spend too much time analyzing huge functions, it gives up and
12842 consider all memory clobbered after examining
12843 @option{ipa-max-aa-steps} statements modifying memory.
12844
12845 @item ipa-max-switch-predicate-bounds
12846 Maximal number of boundary endpoints of case ranges of switch statement.
12847 For switch exceeding this limit, IPA-CP will not construct cloning cost
12848 predicate, which is used to estimate cloning benefit, for default case
12849 of the switch statement.
12850
12851 @item ipa-max-param-expr-ops
12852 IPA-CP will analyze conditional statement that references some function
12853 parameter to estimate benefit for cloning upon certain constant value.
12854 But if number of operations in a parameter expression exceeds
12855 @option{ipa-max-param-expr-ops}, the expression is treated as complicated
12856 one, and is not handled by IPA analysis.
12857
12858 @item lto-partitions
12859 Specify desired number of partitions produced during WHOPR compilation.
12860 The number of partitions should exceed the number of CPUs used for compilation.
12861
12862 @item lto-min-partition
12863 Size of minimal partition for WHOPR (in estimated instructions).
12864 This prevents expenses of splitting very small programs into too many
12865 partitions.
12866
12867 @item lto-max-partition
12868 Size of max partition for WHOPR (in estimated instructions).
12869 to provide an upper bound for individual size of partition.
12870 Meant to be used only with balanced partitioning.
12871
12872 @item lto-max-streaming-parallelism
12873 Maximal number of parallel processes used for LTO streaming.
12874
12875 @item cxx-max-namespaces-for-diagnostic-help
12876 The maximum number of namespaces to consult for suggestions when C++
12877 name lookup fails for an identifier.
12878
12879 @item sink-frequency-threshold
12880 The maximum relative execution frequency (in percents) of the target block
12881 relative to a statement's original block to allow statement sinking of a
12882 statement. Larger numbers result in more aggressive statement sinking.
12883 A small positive adjustment is applied for
12884 statements with memory operands as those are even more profitable so sink.
12885
12886 @item max-stores-to-sink
12887 The maximum number of conditional store pairs that can be sunk. Set to 0
12888 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12889 (@option{-ftree-loop-if-convert}) is disabled.
12890
12891 @item case-values-threshold
12892 The smallest number of different values for which it is best to use a
12893 jump-table instead of a tree of conditional branches. If the value is
12894 0, use the default for the machine.
12895
12896 @item jump-table-max-growth-ratio-for-size
12897 The maximum code size growth ratio when expanding
12898 into a jump table (in percent). The parameter is used when
12899 optimizing for size.
12900
12901 @item jump-table-max-growth-ratio-for-speed
12902 The maximum code size growth ratio when expanding
12903 into a jump table (in percent). The parameter is used when
12904 optimizing for speed.
12905
12906 @item tree-reassoc-width
12907 Set the maximum number of instructions executed in parallel in
12908 reassociated tree. This parameter overrides target dependent
12909 heuristics used by default if has non zero value.
12910
12911 @item sched-pressure-algorithm
12912 Choose between the two available implementations of
12913 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12914 and is the more likely to prevent instructions from being reordered.
12915 Algorithm 2 was designed to be a compromise between the relatively
12916 conservative approach taken by algorithm 1 and the rather aggressive
12917 approach taken by the default scheduler. It relies more heavily on
12918 having a regular register file and accurate register pressure classes.
12919 See @file{haifa-sched.c} in the GCC sources for more details.
12920
12921 The default choice depends on the target.
12922
12923 @item max-slsr-cand-scan
12924 Set the maximum number of existing candidates that are considered when
12925 seeking a basis for a new straight-line strength reduction candidate.
12926
12927 @item asan-globals
12928 Enable buffer overflow detection for global objects. This kind
12929 of protection is enabled by default if you are using
12930 @option{-fsanitize=address} option.
12931 To disable global objects protection use @option{--param asan-globals=0}.
12932
12933 @item asan-stack
12934 Enable buffer overflow detection for stack objects. This kind of
12935 protection is enabled by default when using @option{-fsanitize=address}.
12936 To disable stack protection use @option{--param asan-stack=0} option.
12937
12938 @item asan-instrument-reads
12939 Enable buffer overflow detection for memory reads. This kind of
12940 protection is enabled by default when using @option{-fsanitize=address}.
12941 To disable memory reads protection use
12942 @option{--param asan-instrument-reads=0}.
12943
12944 @item asan-instrument-writes
12945 Enable buffer overflow detection for memory writes. This kind of
12946 protection is enabled by default when using @option{-fsanitize=address}.
12947 To disable memory writes protection use
12948 @option{--param asan-instrument-writes=0} option.
12949
12950 @item asan-memintrin
12951 Enable detection for built-in functions. This kind of protection
12952 is enabled by default when using @option{-fsanitize=address}.
12953 To disable built-in functions protection use
12954 @option{--param asan-memintrin=0}.
12955
12956 @item asan-use-after-return
12957 Enable detection of use-after-return. This kind of protection
12958 is enabled by default when using the @option{-fsanitize=address} option.
12959 To disable it use @option{--param asan-use-after-return=0}.
12960
12961 Note: By default the check is disabled at run time. To enable it,
12962 add @code{detect_stack_use_after_return=1} to the environment variable
12963 @env{ASAN_OPTIONS}.
12964
12965 @item asan-instrumentation-with-call-threshold
12966 If number of memory accesses in function being instrumented
12967 is greater or equal to this number, use callbacks instead of inline checks.
12968 E.g. to disable inline code use
12969 @option{--param asan-instrumentation-with-call-threshold=0}.
12970
12971 @item use-after-scope-direct-emission-threshold
12972 If the size of a local variable in bytes is smaller or equal to this
12973 number, directly poison (or unpoison) shadow memory instead of using
12974 run-time callbacks.
12975
12976 @item max-fsm-thread-path-insns
12977 Maximum number of instructions to copy when duplicating blocks on a
12978 finite state automaton jump thread path.
12979
12980 @item max-fsm-thread-length
12981 Maximum number of basic blocks on a finite state automaton jump thread
12982 path.
12983
12984 @item max-fsm-thread-paths
12985 Maximum number of new jump thread paths to create for a finite state
12986 automaton.
12987
12988 @item parloops-chunk-size
12989 Chunk size of omp schedule for loops parallelized by parloops.
12990
12991 @item parloops-schedule
12992 Schedule type of omp schedule for loops parallelized by parloops (static,
12993 dynamic, guided, auto, runtime).
12994
12995 @item parloops-min-per-thread
12996 The minimum number of iterations per thread of an innermost parallelized
12997 loop for which the parallelized variant is preferred over the single threaded
12998 one. Note that for a parallelized loop nest the
12999 minimum number of iterations of the outermost loop per thread is two.
13000
13001 @item max-ssa-name-query-depth
13002 Maximum depth of recursion when querying properties of SSA names in things
13003 like fold routines. One level of recursion corresponds to following a
13004 use-def chain.
13005
13006 @item hsa-gen-debug-stores
13007 Enable emission of special debug stores within HSA kernels which are
13008 then read and reported by libgomp plugin. Generation of these stores
13009 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
13010 enable it.
13011
13012 @item max-speculative-devirt-maydefs
13013 The maximum number of may-defs we analyze when looking for a must-def
13014 specifying the dynamic type of an object that invokes a virtual call
13015 we may be able to devirtualize speculatively.
13016
13017 @item max-vrp-switch-assertions
13018 The maximum number of assertions to add along the default edge of a switch
13019 statement during VRP.
13020
13021 @item unroll-jam-min-percent
13022 The minimum percentage of memory references that must be optimized
13023 away for the unroll-and-jam transformation to be considered profitable.
13024
13025 @item unroll-jam-max-unroll
13026 The maximum number of times the outer loop should be unrolled by
13027 the unroll-and-jam transformation.
13028
13029 @item max-rtl-if-conversion-unpredictable-cost
13030 Maximum permissible cost for the sequence that would be generated
13031 by the RTL if-conversion pass for a branch that is considered unpredictable.
13032
13033 @item max-variable-expansions-in-unroller
13034 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
13035 of times that an individual variable will be expanded during loop unrolling.
13036
13037 @item tracer-min-branch-probability-feedback
13038 Stop forward growth if the probability of best edge is less than
13039 this threshold (in percent). Used when profile feedback is available.
13040
13041 @item partial-inlining-entry-probability
13042 Maximum probability of the entry BB of split region
13043 (in percent relative to entry BB of the function)
13044 to make partial inlining happen.
13045
13046 @item max-tracked-strlens
13047 Maximum number of strings for which strlen optimization pass will
13048 track string lengths.
13049
13050 @item gcse-after-reload-partial-fraction
13051 The threshold ratio for performing partial redundancy
13052 elimination after reload.
13053
13054 @item gcse-after-reload-critical-fraction
13055 The threshold ratio of critical edges execution count that
13056 permit performing redundancy elimination after reload.
13057
13058 @item max-loop-header-insns
13059 The maximum number of insns in loop header duplicated
13060 by the copy loop headers pass.
13061
13062 @item vect-epilogues-nomask
13063 Enable loop epilogue vectorization using smaller vector size.
13064
13065 @item slp-max-insns-in-bb
13066 Maximum number of instructions in basic block to be
13067 considered for SLP vectorization.
13068
13069 @item avoid-fma-max-bits
13070 Maximum number of bits for which we avoid creating FMAs.
13071
13072 @item sms-loop-average-count-threshold
13073 A threshold on the average loop count considered by the swing modulo scheduler.
13074
13075 @item sms-dfa-history
13076 The number of cycles the swing modulo scheduler considers when checking
13077 conflicts using DFA.
13078
13079 @item max-inline-insns-recursive-auto
13080 The maximum number of instructions non-inline function
13081 can grow to via recursive inlining.
13082
13083 @item graphite-allow-codegen-errors
13084 Whether codegen errors should be ICEs when @option{-fchecking}.
13085
13086 @item sms-max-ii-factor
13087 A factor for tuning the upper bound that swing modulo scheduler
13088 uses for scheduling a loop.
13089
13090 @item lra-max-considered-reload-pseudos
13091 The max number of reload pseudos which are considered during
13092 spilling a non-reload pseudo.
13093
13094 @item max-pow-sqrt-depth
13095 Maximum depth of sqrt chains to use when synthesizing exponentiation
13096 by a real constant.
13097
13098 @item max-dse-active-local-stores
13099 Maximum number of active local stores in RTL dead store elimination.
13100
13101 @item asan-instrument-allocas
13102 Enable asan allocas/VLAs protection.
13103
13104 @item max-iterations-computation-cost
13105 Bound on the cost of an expression to compute the number of iterations.
13106
13107 @item max-isl-operations
13108 Maximum number of isl operations, 0 means unlimited.
13109
13110 @item graphite-max-arrays-per-scop
13111 Maximum number of arrays per scop.
13112
13113 @item max-vartrack-reverse-op-size
13114 Max. size of loc list for which reverse ops should be added.
13115
13116 @item tracer-dynamic-coverage-feedback
13117 The percentage of function, weighted by execution frequency,
13118 that must be covered by trace formation.
13119 Used when profile feedback is available.
13120
13121 @item max-inline-recursive-depth-auto
13122 The maximum depth of recursive inlining for non-inline functions.
13123
13124 @item fsm-scale-path-stmts
13125 Scale factor to apply to the number of statements in a threading path
13126 when comparing to the number of (scaled) blocks.
13127
13128 @item fsm-maximum-phi-arguments
13129 Maximum number of arguments a PHI may have before the FSM threader
13130 will not try to thread through its block.
13131
13132 @item uninit-control-dep-attempts
13133 Maximum number of nested calls to search for control dependencies
13134 during uninitialized variable analysis.
13135
13136 @item max-once-peeled-insns
13137 The maximum number of insns of a peeled loop that rolls only once.
13138
13139 @item sra-max-scalarization-size-Osize
13140 Maximum size, in storage units, of an aggregate
13141 which should be considered for scalarization when compiling for size.
13142
13143 @item fsm-scale-path-blocks
13144 Scale factor to apply to the number of blocks in a threading path
13145 when comparing to the number of (scaled) statements.
13146
13147 @item sched-autopref-queue-depth
13148 Hardware autoprefetcher scheduler model control flag.
13149 Number of lookahead cycles the model looks into; at '
13150 ' only enable instruction sorting heuristic.
13151
13152 @item loop-versioning-max-inner-insns
13153 The maximum number of instructions that an inner loop can have
13154 before the loop versioning pass considers it too big to copy.
13155
13156 @item loop-versioning-max-outer-insns
13157 The maximum number of instructions that an outer loop can have
13158 before the loop versioning pass considers it too big to copy,
13159 discounting any instructions in inner loops that directly benefit
13160 from versioning.
13161
13162 @item ssa-name-def-chain-limit
13163 The maximum number of SSA_NAME assignments to follow in determining
13164 a property of a variable such as its value. This limits the number
13165 of iterations or recursive calls GCC performs when optimizing certain
13166 statements or when determining their validity prior to issuing
13167 diagnostics.
13168
13169 @end table
13170
13171 The following choices of @var{name} are available on AArch64 targets:
13172
13173 @table @gcctabopt
13174 @item aarch64-sve-compare-costs
13175 When vectorizing for SVE, consider using ``unpacked'' vectors for
13176 smaller elements and use the cost model to pick the cheapest approach.
13177 Also use the cost model to choose between SVE and Advanced SIMD vectorization.
13178
13179 Using unpacked vectors includes storing smaller elements in larger
13180 containers and accessing elements with extending loads and truncating
13181 stores.
13182
13183 @item aarch64-float-recp-precision
13184 The number of Newton iterations for calculating the reciprocal for float type.
13185 The precision of division is proportional to this param when division
13186 approximation is enabled. The default value is 1.
13187
13188 @item aarch64-double-recp-precision
13189 The number of Newton iterations for calculating the reciprocal for double type.
13190 The precision of division is propotional to this param when division
13191 approximation is enabled. The default value is 2.
13192
13193 @end table
13194
13195 @end table
13196
13197 @node Instrumentation Options
13198 @section Program Instrumentation Options
13199 @cindex instrumentation options
13200 @cindex program instrumentation options
13201 @cindex run-time error checking options
13202 @cindex profiling options
13203 @cindex options, program instrumentation
13204 @cindex options, run-time error checking
13205 @cindex options, profiling
13206
13207 GCC supports a number of command-line options that control adding
13208 run-time instrumentation to the code it normally generates.
13209 For example, one purpose of instrumentation is collect profiling
13210 statistics for use in finding program hot spots, code coverage
13211 analysis, or profile-guided optimizations.
13212 Another class of program instrumentation is adding run-time checking
13213 to detect programming errors like invalid pointer
13214 dereferences or out-of-bounds array accesses, as well as deliberately
13215 hostile attacks such as stack smashing or C++ vtable hijacking.
13216 There is also a general hook which can be used to implement other
13217 forms of tracing or function-level instrumentation for debug or
13218 program analysis purposes.
13219
13220 @table @gcctabopt
13221 @cindex @command{prof}
13222 @cindex @command{gprof}
13223 @item -p
13224 @itemx -pg
13225 @opindex p
13226 @opindex pg
13227 Generate extra code to write profile information suitable for the
13228 analysis program @command{prof} (for @option{-p}) or @command{gprof}
13229 (for @option{-pg}). You must use this option when compiling
13230 the source files you want data about, and you must also use it when
13231 linking.
13232
13233 You can use the function attribute @code{no_instrument_function} to
13234 suppress profiling of individual functions when compiling with these options.
13235 @xref{Common Function Attributes}.
13236
13237 @item -fprofile-arcs
13238 @opindex fprofile-arcs
13239 Add code so that program flow @dfn{arcs} are instrumented. During
13240 execution the program records how many times each branch and call is
13241 executed and how many times it is taken or returns. On targets that support
13242 constructors with priority support, profiling properly handles constructors,
13243 destructors and C++ constructors (and destructors) of classes which are used
13244 as a type of a global variable.
13245
13246 When the compiled
13247 program exits it saves this data to a file called
13248 @file{@var{auxname}.gcda} for each source file. The data may be used for
13249 profile-directed optimizations (@option{-fbranch-probabilities}), or for
13250 test coverage analysis (@option{-ftest-coverage}). Each object file's
13251 @var{auxname} is generated from the name of the output file, if
13252 explicitly specified and it is not the final executable, otherwise it is
13253 the basename of the source file. In both cases any suffix is removed
13254 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
13255 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
13256 @xref{Cross-profiling}.
13257
13258 @cindex @command{gcov}
13259 @item --coverage
13260 @opindex coverage
13261
13262 This option is used to compile and link code instrumented for coverage
13263 analysis. The option is a synonym for @option{-fprofile-arcs}
13264 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
13265 linking). See the documentation for those options for more details.
13266
13267 @itemize
13268
13269 @item
13270 Compile the source files with @option{-fprofile-arcs} plus optimization
13271 and code generation options. For test coverage analysis, use the
13272 additional @option{-ftest-coverage} option. You do not need to profile
13273 every source file in a program.
13274
13275 @item
13276 Compile the source files additionally with @option{-fprofile-abs-path}
13277 to create absolute path names in the @file{.gcno} files. This allows
13278 @command{gcov} to find the correct sources in projects where compilations
13279 occur with different working directories.
13280
13281 @item
13282 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
13283 (the latter implies the former).
13284
13285 @item
13286 Run the program on a representative workload to generate the arc profile
13287 information. This may be repeated any number of times. You can run
13288 concurrent instances of your program, and provided that the file system
13289 supports locking, the data files will be correctly updated. Unless
13290 a strict ISO C dialect option is in effect, @code{fork} calls are
13291 detected and correctly handled without double counting.
13292
13293 @item
13294 For profile-directed optimizations, compile the source files again with
13295 the same optimization and code generation options plus
13296 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
13297 Control Optimization}).
13298
13299 @item
13300 For test coverage analysis, use @command{gcov} to produce human readable
13301 information from the @file{.gcno} and @file{.gcda} files. Refer to the
13302 @command{gcov} documentation for further information.
13303
13304 @end itemize
13305
13306 With @option{-fprofile-arcs}, for each function of your program GCC
13307 creates a program flow graph, then finds a spanning tree for the graph.
13308 Only arcs that are not on the spanning tree have to be instrumented: the
13309 compiler adds code to count the number of times that these arcs are
13310 executed. When an arc is the only exit or only entrance to a block, the
13311 instrumentation code can be added to the block; otherwise, a new basic
13312 block must be created to hold the instrumentation code.
13313
13314 @need 2000
13315 @item -ftest-coverage
13316 @opindex ftest-coverage
13317 Produce a notes file that the @command{gcov} code-coverage utility
13318 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
13319 show program coverage. Each source file's note file is called
13320 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
13321 above for a description of @var{auxname} and instructions on how to
13322 generate test coverage data. Coverage data matches the source files
13323 more closely if you do not optimize.
13324
13325 @item -fprofile-abs-path
13326 @opindex fprofile-abs-path
13327 Automatically convert relative source file names to absolute path names
13328 in the @file{.gcno} files. This allows @command{gcov} to find the correct
13329 sources in projects where compilations occur with different working
13330 directories.
13331
13332 @item -fprofile-dir=@var{path}
13333 @opindex fprofile-dir
13334
13335 Set the directory to search for the profile data files in to @var{path}.
13336 This option affects only the profile data generated by
13337 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
13338 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
13339 and its related options. Both absolute and relative paths can be used.
13340 By default, GCC uses the current directory as @var{path}, thus the
13341 profile data file appears in the same directory as the object file.
13342 In order to prevent the file name clashing, if the object file name is
13343 not an absolute path, we mangle the absolute path of the
13344 @file{@var{sourcename}.gcda} file and use it as the file name of a
13345 @file{.gcda} file. See similar option @option{-fprofile-note}.
13346
13347 When an executable is run in a massive parallel environment, it is recommended
13348 to save profile to different folders. That can be done with variables
13349 in @var{path} that are exported during run-time:
13350
13351 @table @gcctabopt
13352
13353 @item %p
13354 process ID.
13355
13356 @item %q@{VAR@}
13357 value of environment variable @var{VAR}
13358
13359 @end table
13360
13361 @item -fprofile-generate
13362 @itemx -fprofile-generate=@var{path}
13363 @opindex fprofile-generate
13364
13365 Enable options usually used for instrumenting application to produce
13366 profile useful for later recompilation with profile feedback based
13367 optimization. You must use @option{-fprofile-generate} both when
13368 compiling and when linking your program.
13369
13370 The following options are enabled:
13371 @option{-fprofile-arcs}, @option{-fprofile-values},
13372 @option{-finline-functions}, and @option{-fipa-bit-cp}.
13373
13374 If @var{path} is specified, GCC looks at the @var{path} to find
13375 the profile feedback data files. See @option{-fprofile-dir}.
13376
13377 To optimize the program based on the collected profile information, use
13378 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
13379
13380 @item -fprofile-note=@var{path}
13381 @opindex fprofile-note
13382
13383 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
13384 location. If you combine the option with multiple source files,
13385 the @file{.gcno} file will be overwritten.
13386
13387 @item -fprofile-update=@var{method}
13388 @opindex fprofile-update
13389
13390 Alter the update method for an application instrumented for profile
13391 feedback based optimization. The @var{method} argument should be one of
13392 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
13393 The first one is useful for single-threaded applications,
13394 while the second one prevents profile corruption by emitting thread-safe code.
13395
13396 @strong{Warning:} When an application does not properly join all threads
13397 (or creates an detached thread), a profile file can be still corrupted.
13398
13399 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
13400 when supported by a target, or to @samp{single} otherwise. The GCC driver
13401 automatically selects @samp{prefer-atomic} when @option{-pthread}
13402 is present in the command line.
13403
13404 @item -fprofile-filter-files=@var{regex}
13405 @opindex fprofile-filter-files
13406
13407 Instrument only functions from files where names match
13408 any regular expression (separated by a semi-colon).
13409
13410 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
13411 only @file{main.c} and all C files starting with 'module'.
13412
13413 @item -fprofile-exclude-files=@var{regex}
13414 @opindex fprofile-exclude-files
13415
13416 Instrument only functions from files where names do not match
13417 all the regular expressions (separated by a semi-colon).
13418
13419 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
13420 of all files that are located in @file{/usr/} folder.
13421
13422 @item -fprofile-reproducible
13423 @opindex fprofile-reproducible
13424 Control level of reproducibility of profile gathered by
13425 @code{-fprofile-generate}. This makes it possible to rebuild program
13426 with same outcome which is useful, for example, for distribution
13427 packages.
13428
13429 With @option{-fprofile-reproducibility=serial} the profile gathered by
13430 @option{-fprofile-generate} is reproducible provided the trained program
13431 behaves the same at each invocation of the train run, it is not
13432 multi-threaded and profile data streaming is always done in the same
13433 order. Note that profile streaming happens at the end of program run but
13434 also before @code{fork} function is invoked.
13435
13436 Note that it is quite common that execution counts of some part of
13437 programs depends, for example, on length of temporary file names or
13438 memory space randomization (that may affect hash-table collision rate).
13439 Such non-reproducible part of programs may be annotated by
13440 @code{no_instrument_function} function attribute. @code{gcov-dump} with
13441 @option{-l} can be used to dump gathered data and verify that they are
13442 indeed reproducible.
13443
13444 With @option{-fprofile-reproducibility=parallel-runs} collected profile
13445 stays reproducible regardless the order of streaming of the data into
13446 gcda files. This setting makes it possible to run multiple instances of
13447 instrumented program in parallel (such as with @code{make -j}). This
13448 reduces quality of gathered data, in particular of indirect call
13449 profiling.
13450
13451 @item -fsanitize=address
13452 @opindex fsanitize=address
13453 Enable AddressSanitizer, a fast memory error detector.
13454 Memory access instructions are instrumented to detect
13455 out-of-bounds and use-after-free bugs.
13456 The option enables @option{-fsanitize-address-use-after-scope}.
13457 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
13458 more details. The run-time behavior can be influenced using the
13459 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
13460 the available options are shown at startup of the instrumented program. See
13461 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
13462 for a list of supported options.
13463 The option cannot be combined with @option{-fsanitize=thread}.
13464
13465 @item -fsanitize=kernel-address
13466 @opindex fsanitize=kernel-address
13467 Enable AddressSanitizer for Linux kernel.
13468 See @uref{https://github.com/google/kasan/wiki} for more details.
13469
13470 @item -fsanitize=pointer-compare
13471 @opindex fsanitize=pointer-compare
13472 Instrument comparison operation (<, <=, >, >=) with pointer operands.
13473 The option must be combined with either @option{-fsanitize=kernel-address} or
13474 @option{-fsanitize=address}
13475 The option cannot be combined with @option{-fsanitize=thread}.
13476 Note: By default the check is disabled at run time. To enable it,
13477 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13478 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13479 invalid operation only when both pointers are non-null.
13480
13481 @item -fsanitize=pointer-subtract
13482 @opindex fsanitize=pointer-subtract
13483 Instrument subtraction with pointer operands.
13484 The option must be combined with either @option{-fsanitize=kernel-address} or
13485 @option{-fsanitize=address}
13486 The option cannot be combined with @option{-fsanitize=thread}.
13487 Note: By default the check is disabled at run time. To enable it,
13488 add @code{detect_invalid_pointer_pairs=2} to the environment variable
13489 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
13490 invalid operation only when both pointers are non-null.
13491
13492 @item -fsanitize=thread
13493 @opindex fsanitize=thread
13494 Enable ThreadSanitizer, a fast data race detector.
13495 Memory access instructions are instrumented to detect
13496 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
13497 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
13498 environment variable; see
13499 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
13500 supported options.
13501 The option cannot be combined with @option{-fsanitize=address},
13502 @option{-fsanitize=leak}.
13503
13504 Note that sanitized atomic builtins cannot throw exceptions when
13505 operating on invalid memory addresses with non-call exceptions
13506 (@option{-fnon-call-exceptions}).
13507
13508 @item -fsanitize=leak
13509 @opindex fsanitize=leak
13510 Enable LeakSanitizer, a memory leak detector.
13511 This option only matters for linking of executables and
13512 the executable is linked against a library that overrides @code{malloc}
13513 and other allocator functions. See
13514 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
13515 details. The run-time behavior can be influenced using the
13516 @env{LSAN_OPTIONS} environment variable.
13517 The option cannot be combined with @option{-fsanitize=thread}.
13518
13519 @item -fsanitize=undefined
13520 @opindex fsanitize=undefined
13521 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
13522 Various computations are instrumented to detect undefined behavior
13523 at runtime. Current suboptions are:
13524
13525 @table @gcctabopt
13526
13527 @item -fsanitize=shift
13528 @opindex fsanitize=shift
13529 This option enables checking that the result of a shift operation is
13530 not undefined. Note that what exactly is considered undefined differs
13531 slightly between C and C++, as well as between ISO C90 and C99, etc.
13532 This option has two suboptions, @option{-fsanitize=shift-base} and
13533 @option{-fsanitize=shift-exponent}.
13534
13535 @item -fsanitize=shift-exponent
13536 @opindex fsanitize=shift-exponent
13537 This option enables checking that the second argument of a shift operation
13538 is not negative and is smaller than the precision of the promoted first
13539 argument.
13540
13541 @item -fsanitize=shift-base
13542 @opindex fsanitize=shift-base
13543 If the second argument of a shift operation is within range, check that the
13544 result of a shift operation is not undefined. Note that what exactly is
13545 considered undefined differs slightly between C and C++, as well as between
13546 ISO C90 and C99, etc.
13547
13548 @item -fsanitize=integer-divide-by-zero
13549 @opindex fsanitize=integer-divide-by-zero
13550 Detect integer division by zero as well as @code{INT_MIN / -1} division.
13551
13552 @item -fsanitize=unreachable
13553 @opindex fsanitize=unreachable
13554 With this option, the compiler turns the @code{__builtin_unreachable}
13555 call into a diagnostics message call instead. When reaching the
13556 @code{__builtin_unreachable} call, the behavior is undefined.
13557
13558 @item -fsanitize=vla-bound
13559 @opindex fsanitize=vla-bound
13560 This option instructs the compiler to check that the size of a variable
13561 length array is positive.
13562
13563 @item -fsanitize=null
13564 @opindex fsanitize=null
13565 This option enables pointer checking. Particularly, the application
13566 built with this option turned on will issue an error message when it
13567 tries to dereference a NULL pointer, or if a reference (possibly an
13568 rvalue reference) is bound to a NULL pointer, or if a method is invoked
13569 on an object pointed by a NULL pointer.
13570
13571 @item -fsanitize=return
13572 @opindex fsanitize=return
13573 This option enables return statement checking. Programs
13574 built with this option turned on will issue an error message
13575 when the end of a non-void function is reached without actually
13576 returning a value. This option works in C++ only.
13577
13578 @item -fsanitize=signed-integer-overflow
13579 @opindex fsanitize=signed-integer-overflow
13580 This option enables signed integer overflow checking. We check that
13581 the result of @code{+}, @code{*}, and both unary and binary @code{-}
13582 does not overflow in the signed arithmetics. Note, integer promotion
13583 rules must be taken into account. That is, the following is not an
13584 overflow:
13585 @smallexample
13586 signed char a = SCHAR_MAX;
13587 a++;
13588 @end smallexample
13589
13590 @item -fsanitize=bounds
13591 @opindex fsanitize=bounds
13592 This option enables instrumentation of array bounds. Various out of bounds
13593 accesses are detected. Flexible array members, flexible array member-like
13594 arrays, and initializers of variables with static storage are not instrumented.
13595
13596 @item -fsanitize=bounds-strict
13597 @opindex fsanitize=bounds-strict
13598 This option enables strict instrumentation of array bounds. Most out of bounds
13599 accesses are detected, including flexible array members and flexible array
13600 member-like arrays. Initializers of variables with static storage are not
13601 instrumented.
13602
13603 @item -fsanitize=alignment
13604 @opindex fsanitize=alignment
13605
13606 This option enables checking of alignment of pointers when they are
13607 dereferenced, or when a reference is bound to insufficiently aligned target,
13608 or when a method or constructor is invoked on insufficiently aligned object.
13609
13610 @item -fsanitize=object-size
13611 @opindex fsanitize=object-size
13612 This option enables instrumentation of memory references using the
13613 @code{__builtin_object_size} function. Various out of bounds pointer
13614 accesses are detected.
13615
13616 @item -fsanitize=float-divide-by-zero
13617 @opindex fsanitize=float-divide-by-zero
13618 Detect floating-point division by zero. Unlike other similar options,
13619 @option{-fsanitize=float-divide-by-zero} is not enabled by
13620 @option{-fsanitize=undefined}, since floating-point division by zero can
13621 be a legitimate way of obtaining infinities and NaNs.
13622
13623 @item -fsanitize=float-cast-overflow
13624 @opindex fsanitize=float-cast-overflow
13625 This option enables floating-point type to integer conversion checking.
13626 We check that the result of the conversion does not overflow.
13627 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
13628 not enabled by @option{-fsanitize=undefined}.
13629 This option does not work well with @code{FE_INVALID} exceptions enabled.
13630
13631 @item -fsanitize=nonnull-attribute
13632 @opindex fsanitize=nonnull-attribute
13633
13634 This option enables instrumentation of calls, checking whether null values
13635 are not passed to arguments marked as requiring a non-null value by the
13636 @code{nonnull} function attribute.
13637
13638 @item -fsanitize=returns-nonnull-attribute
13639 @opindex fsanitize=returns-nonnull-attribute
13640
13641 This option enables instrumentation of return statements in functions
13642 marked with @code{returns_nonnull} function attribute, to detect returning
13643 of null values from such functions.
13644
13645 @item -fsanitize=bool
13646 @opindex fsanitize=bool
13647
13648 This option enables instrumentation of loads from bool. If a value other
13649 than 0/1 is loaded, a run-time error is issued.
13650
13651 @item -fsanitize=enum
13652 @opindex fsanitize=enum
13653
13654 This option enables instrumentation of loads from an enum type. If
13655 a value outside the range of values for the enum type is loaded,
13656 a run-time error is issued.
13657
13658 @item -fsanitize=vptr
13659 @opindex fsanitize=vptr
13660
13661 This option enables instrumentation of C++ member function calls, member
13662 accesses and some conversions between pointers to base and derived classes,
13663 to verify the referenced object has the correct dynamic type.
13664
13665 @item -fsanitize=pointer-overflow
13666 @opindex fsanitize=pointer-overflow
13667
13668 This option enables instrumentation of pointer arithmetics. If the pointer
13669 arithmetics overflows, a run-time error is issued.
13670
13671 @item -fsanitize=builtin
13672 @opindex fsanitize=builtin
13673
13674 This option enables instrumentation of arguments to selected builtin
13675 functions. If an invalid value is passed to such arguments, a run-time
13676 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
13677 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
13678 by this option.
13679
13680 @end table
13681
13682 While @option{-ftrapv} causes traps for signed overflows to be emitted,
13683 @option{-fsanitize=undefined} gives a diagnostic message.
13684 This currently works only for the C family of languages.
13685
13686 @item -fno-sanitize=all
13687 @opindex fno-sanitize=all
13688
13689 This option disables all previously enabled sanitizers.
13690 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
13691 together.
13692
13693 @item -fasan-shadow-offset=@var{number}
13694 @opindex fasan-shadow-offset
13695 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
13696 It is useful for experimenting with different shadow memory layouts in
13697 Kernel AddressSanitizer.
13698
13699 @item -fsanitize-sections=@var{s1},@var{s2},...
13700 @opindex fsanitize-sections
13701 Sanitize global variables in selected user-defined sections. @var{si} may
13702 contain wildcards.
13703
13704 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
13705 @opindex fsanitize-recover
13706 @opindex fno-sanitize-recover
13707 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
13708 mentioned in comma-separated list of @var{opts}. Enabling this option
13709 for a sanitizer component causes it to attempt to continue
13710 running the program as if no error happened. This means multiple
13711 runtime errors can be reported in a single program run, and the exit
13712 code of the program may indicate success even when errors
13713 have been reported. The @option{-fno-sanitize-recover=} option
13714 can be used to alter
13715 this behavior: only the first detected error is reported
13716 and program then exits with a non-zero exit code.
13717
13718 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
13719 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
13720 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
13721 @option{-fsanitize=bounds-strict},
13722 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
13723 For these sanitizers error recovery is turned on by default,
13724 except @option{-fsanitize=address}, for which this feature is experimental.
13725 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
13726 accepted, the former enables recovery for all sanitizers that support it,
13727 the latter disables recovery for all sanitizers that support it.
13728
13729 Even if a recovery mode is turned on the compiler side, it needs to be also
13730 enabled on the runtime library side, otherwise the failures are still fatal.
13731 The runtime library defaults to @code{halt_on_error=0} for
13732 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
13733 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
13734 setting the @code{halt_on_error} flag in the corresponding environment variable.
13735
13736 Syntax without an explicit @var{opts} parameter is deprecated. It is
13737 equivalent to specifying an @var{opts} list of:
13738
13739 @smallexample
13740 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
13741 @end smallexample
13742
13743 @item -fsanitize-address-use-after-scope
13744 @opindex fsanitize-address-use-after-scope
13745 Enable sanitization of local variables to detect use-after-scope bugs.
13746 The option sets @option{-fstack-reuse} to @samp{none}.
13747
13748 @item -fsanitize-undefined-trap-on-error
13749 @opindex fsanitize-undefined-trap-on-error
13750 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
13751 report undefined behavior using @code{__builtin_trap} rather than
13752 a @code{libubsan} library routine. The advantage of this is that the
13753 @code{libubsan} library is not needed and is not linked in, so this
13754 is usable even in freestanding environments.
13755
13756 @item -fsanitize-coverage=trace-pc
13757 @opindex fsanitize-coverage=trace-pc
13758 Enable coverage-guided fuzzing code instrumentation.
13759 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
13760
13761 @item -fsanitize-coverage=trace-cmp
13762 @opindex fsanitize-coverage=trace-cmp
13763 Enable dataflow guided fuzzing code instrumentation.
13764 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
13765 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
13766 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
13767 variable or @code{__sanitizer_cov_trace_const_cmp1},
13768 @code{__sanitizer_cov_trace_const_cmp2},
13769 @code{__sanitizer_cov_trace_const_cmp4} or
13770 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
13771 operand constant, @code{__sanitizer_cov_trace_cmpf} or
13772 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
13773 @code{__sanitizer_cov_trace_switch} for switch statements.
13774
13775 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
13776 @opindex fcf-protection
13777 Enable code instrumentation of control-flow transfers to increase
13778 program security by checking that target addresses of control-flow
13779 transfer instructions (such as indirect function call, function return,
13780 indirect jump) are valid. This prevents diverting the flow of control
13781 to an unexpected target. This is intended to protect against such
13782 threats as Return-oriented Programming (ROP), and similarly
13783 call/jmp-oriented programming (COP/JOP).
13784
13785 The value @code{branch} tells the compiler to implement checking of
13786 validity of control-flow transfer at the point of indirect branch
13787 instructions, i.e.@: call/jmp instructions. The value @code{return}
13788 implements checking of validity at the point of returning from a
13789 function. The value @code{full} is an alias for specifying both
13790 @code{branch} and @code{return}. The value @code{none} turns off
13791 instrumentation.
13792
13793 The macro @code{__CET__} is defined when @option{-fcf-protection} is
13794 used. The first bit of @code{__CET__} is set to 1 for the value
13795 @code{branch} and the second bit of @code{__CET__} is set to 1 for
13796 the @code{return}.
13797
13798 You can also use the @code{nocf_check} attribute to identify
13799 which functions and calls should be skipped from instrumentation
13800 (@pxref{Function Attributes}).
13801
13802 Currently the x86 GNU/Linux target provides an implementation based
13803 on Intel Control-flow Enforcement Technology (CET).
13804
13805 @item -fstack-protector
13806 @opindex fstack-protector
13807 Emit extra code to check for buffer overflows, such as stack smashing
13808 attacks. This is done by adding a guard variable to functions with
13809 vulnerable objects. This includes functions that call @code{alloca}, and
13810 functions with buffers larger than or equal to 8 bytes. The guards are
13811 initialized when a function is entered and then checked when the function
13812 exits. If a guard check fails, an error message is printed and the program
13813 exits. Only variables that are actually allocated on the stack are
13814 considered, optimized away variables or variables allocated in registers
13815 don't count.
13816
13817 @item -fstack-protector-all
13818 @opindex fstack-protector-all
13819 Like @option{-fstack-protector} except that all functions are protected.
13820
13821 @item -fstack-protector-strong
13822 @opindex fstack-protector-strong
13823 Like @option{-fstack-protector} but includes additional functions to
13824 be protected --- those that have local array definitions, or have
13825 references to local frame addresses. Only variables that are actually
13826 allocated on the stack are considered, optimized away variables or variables
13827 allocated in registers don't count.
13828
13829 @item -fstack-protector-explicit
13830 @opindex fstack-protector-explicit
13831 Like @option{-fstack-protector} but only protects those functions which
13832 have the @code{stack_protect} attribute.
13833
13834 @item -fstack-check
13835 @opindex fstack-check
13836 Generate code to verify that you do not go beyond the boundary of the
13837 stack. You should specify this flag if you are running in an
13838 environment with multiple threads, but you only rarely need to specify it in
13839 a single-threaded environment since stack overflow is automatically
13840 detected on nearly all systems if there is only one stack.
13841
13842 Note that this switch does not actually cause checking to be done; the
13843 operating system or the language runtime must do that. The switch causes
13844 generation of code to ensure that they see the stack being extended.
13845
13846 You can additionally specify a string parameter: @samp{no} means no
13847 checking, @samp{generic} means force the use of old-style checking,
13848 @samp{specific} means use the best checking method and is equivalent
13849 to bare @option{-fstack-check}.
13850
13851 Old-style checking is a generic mechanism that requires no specific
13852 target support in the compiler but comes with the following drawbacks:
13853
13854 @enumerate
13855 @item
13856 Modified allocation strategy for large objects: they are always
13857 allocated dynamically if their size exceeds a fixed threshold. Note this
13858 may change the semantics of some code.
13859
13860 @item
13861 Fixed limit on the size of the static frame of functions: when it is
13862 topped by a particular function, stack checking is not reliable and
13863 a warning is issued by the compiler.
13864
13865 @item
13866 Inefficiency: because of both the modified allocation strategy and the
13867 generic implementation, code performance is hampered.
13868 @end enumerate
13869
13870 Note that old-style stack checking is also the fallback method for
13871 @samp{specific} if no target support has been added in the compiler.
13872
13873 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
13874 and stack overflows. @samp{specific} is an excellent choice when compiling
13875 Ada code. It is not generally sufficient to protect against stack-clash
13876 attacks. To protect against those you want @samp{-fstack-clash-protection}.
13877
13878 @item -fstack-clash-protection
13879 @opindex fstack-clash-protection
13880 Generate code to prevent stack clash style attacks. When this option is
13881 enabled, the compiler will only allocate one page of stack space at a time
13882 and each page is accessed immediately after allocation. Thus, it prevents
13883 allocations from jumping over any stack guard page provided by the
13884 operating system.
13885
13886 Most targets do not fully support stack clash protection. However, on
13887 those targets @option{-fstack-clash-protection} will protect dynamic stack
13888 allocations. @option{-fstack-clash-protection} may also provide limited
13889 protection for static stack allocations if the target supports
13890 @option{-fstack-check=specific}.
13891
13892 @item -fstack-limit-register=@var{reg}
13893 @itemx -fstack-limit-symbol=@var{sym}
13894 @itemx -fno-stack-limit
13895 @opindex fstack-limit-register
13896 @opindex fstack-limit-symbol
13897 @opindex fno-stack-limit
13898 Generate code to ensure that the stack does not grow beyond a certain value,
13899 either the value of a register or the address of a symbol. If a larger
13900 stack is required, a signal is raised at run time. For most targets,
13901 the signal is raised before the stack overruns the boundary, so
13902 it is possible to catch the signal without taking special precautions.
13903
13904 For instance, if the stack starts at absolute address @samp{0x80000000}
13905 and grows downwards, you can use the flags
13906 @option{-fstack-limit-symbol=__stack_limit} and
13907 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
13908 of 128KB@. Note that this may only work with the GNU linker.
13909
13910 You can locally override stack limit checking by using the
13911 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
13912
13913 @item -fsplit-stack
13914 @opindex fsplit-stack
13915 Generate code to automatically split the stack before it overflows.
13916 The resulting program has a discontiguous stack which can only
13917 overflow if the program is unable to allocate any more memory. This
13918 is most useful when running threaded programs, as it is no longer
13919 necessary to calculate a good stack size to use for each thread. This
13920 is currently only implemented for the x86 targets running
13921 GNU/Linux.
13922
13923 When code compiled with @option{-fsplit-stack} calls code compiled
13924 without @option{-fsplit-stack}, there may not be much stack space
13925 available for the latter code to run. If compiling all code,
13926 including library code, with @option{-fsplit-stack} is not an option,
13927 then the linker can fix up these calls so that the code compiled
13928 without @option{-fsplit-stack} always has a large stack. Support for
13929 this is implemented in the gold linker in GNU binutils release 2.21
13930 and later.
13931
13932 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
13933 @opindex fvtable-verify
13934 This option is only available when compiling C++ code.
13935 It turns on (or off, if using @option{-fvtable-verify=none}) the security
13936 feature that verifies at run time, for every virtual call, that
13937 the vtable pointer through which the call is made is valid for the type of
13938 the object, and has not been corrupted or overwritten. If an invalid vtable
13939 pointer is detected at run time, an error is reported and execution of the
13940 program is immediately halted.
13941
13942 This option causes run-time data structures to be built at program startup,
13943 which are used for verifying the vtable pointers.
13944 The options @samp{std} and @samp{preinit}
13945 control the timing of when these data structures are built. In both cases the
13946 data structures are built before execution reaches @code{main}. Using
13947 @option{-fvtable-verify=std} causes the data structures to be built after
13948 shared libraries have been loaded and initialized.
13949 @option{-fvtable-verify=preinit} causes them to be built before shared
13950 libraries have been loaded and initialized.
13951
13952 If this option appears multiple times in the command line with different
13953 values specified, @samp{none} takes highest priority over both @samp{std} and
13954 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13955
13956 @item -fvtv-debug
13957 @opindex fvtv-debug
13958 When used in conjunction with @option{-fvtable-verify=std} or
13959 @option{-fvtable-verify=preinit}, causes debug versions of the
13960 runtime functions for the vtable verification feature to be called.
13961 This flag also causes the compiler to log information about which
13962 vtable pointers it finds for each class.
13963 This information is written to a file named @file{vtv_set_ptr_data.log}
13964 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13965 if that is defined or the current working directory otherwise.
13966
13967 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13968 file, be sure to delete any existing one.
13969
13970 @item -fvtv-counts
13971 @opindex fvtv-counts
13972 This is a debugging flag. When used in conjunction with
13973 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13974 causes the compiler to keep track of the total number of virtual calls
13975 it encounters and the number of verifications it inserts. It also
13976 counts the number of calls to certain run-time library functions
13977 that it inserts and logs this information for each compilation unit.
13978 The compiler writes this information to a file named
13979 @file{vtv_count_data.log} in the directory named by the environment
13980 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13981 directory otherwise. It also counts the size of the vtable pointer sets
13982 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13983 in the same directory.
13984
13985 Note: This feature @emph{appends} data to the log files. To get fresh log
13986 files, be sure to delete any existing ones.
13987
13988 @item -finstrument-functions
13989 @opindex finstrument-functions
13990 Generate instrumentation calls for entry and exit to functions. Just
13991 after function entry and just before function exit, the following
13992 profiling functions are called with the address of the current
13993 function and its call site. (On some platforms,
13994 @code{__builtin_return_address} does not work beyond the current
13995 function, so the call site information may not be available to the
13996 profiling functions otherwise.)
13997
13998 @smallexample
13999 void __cyg_profile_func_enter (void *this_fn,
14000 void *call_site);
14001 void __cyg_profile_func_exit (void *this_fn,
14002 void *call_site);
14003 @end smallexample
14004
14005 The first argument is the address of the start of the current function,
14006 which may be looked up exactly in the symbol table.
14007
14008 This instrumentation is also done for functions expanded inline in other
14009 functions. The profiling calls indicate where, conceptually, the
14010 inline function is entered and exited. This means that addressable
14011 versions of such functions must be available. If all your uses of a
14012 function are expanded inline, this may mean an additional expansion of
14013 code size. If you use @code{extern inline} in your C code, an
14014 addressable version of such functions must be provided. (This is
14015 normally the case anyway, but if you get lucky and the optimizer always
14016 expands the functions inline, you might have gotten away without
14017 providing static copies.)
14018
14019 A function may be given the attribute @code{no_instrument_function}, in
14020 which case this instrumentation is not done. This can be used, for
14021 example, for the profiling functions listed above, high-priority
14022 interrupt routines, and any functions from which the profiling functions
14023 cannot safely be called (perhaps signal handlers, if the profiling
14024 routines generate output or allocate memory).
14025 @xref{Common Function Attributes}.
14026
14027 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
14028 @opindex finstrument-functions-exclude-file-list
14029
14030 Set the list of functions that are excluded from instrumentation (see
14031 the description of @option{-finstrument-functions}). If the file that
14032 contains a function definition matches with one of @var{file}, then
14033 that function is not instrumented. The match is done on substrings:
14034 if the @var{file} parameter is a substring of the file name, it is
14035 considered to be a match.
14036
14037 For example:
14038
14039 @smallexample
14040 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
14041 @end smallexample
14042
14043 @noindent
14044 excludes any inline function defined in files whose pathnames
14045 contain @file{/bits/stl} or @file{include/sys}.
14046
14047 If, for some reason, you want to include letter @samp{,} in one of
14048 @var{sym}, write @samp{\,}. For example,
14049 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
14050 (note the single quote surrounding the option).
14051
14052 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
14053 @opindex finstrument-functions-exclude-function-list
14054
14055 This is similar to @option{-finstrument-functions-exclude-file-list},
14056 but this option sets the list of function names to be excluded from
14057 instrumentation. The function name to be matched is its user-visible
14058 name, such as @code{vector<int> blah(const vector<int> &)}, not the
14059 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
14060 match is done on substrings: if the @var{sym} parameter is a substring
14061 of the function name, it is considered to be a match. For C99 and C++
14062 extended identifiers, the function name must be given in UTF-8, not
14063 using universal character names.
14064
14065 @item -fpatchable-function-entry=@var{N}[,@var{M}]
14066 @opindex fpatchable-function-entry
14067 Generate @var{N} NOPs right at the beginning
14068 of each function, with the function entry point before the @var{M}th NOP.
14069 If @var{M} is omitted, it defaults to @code{0} so the
14070 function entry points to the address just at the first NOP.
14071 The NOP instructions reserve extra space which can be used to patch in
14072 any desired instrumentation at run time, provided that the code segment
14073 is writable. The amount of space is controllable indirectly via
14074 the number of NOPs; the NOP instruction used corresponds to the instruction
14075 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
14076 is target-specific and may also depend on the architecture variant and/or
14077 other compilation options.
14078
14079 For run-time identification, the starting addresses of these areas,
14080 which correspond to their respective function entries minus @var{M},
14081 are additionally collected in the @code{__patchable_function_entries}
14082 section of the resulting binary.
14083
14084 Note that the value of @code{__attribute__ ((patchable_function_entry
14085 (N,M)))} takes precedence over command-line option
14086 @option{-fpatchable-function-entry=N,M}. This can be used to increase
14087 the area size or to remove it completely on a single function.
14088 If @code{N=0}, no pad location is recorded.
14089
14090 The NOP instructions are inserted at---and maybe before, depending on
14091 @var{M}---the function entry address, even before the prologue.
14092
14093 @end table
14094
14095
14096 @node Preprocessor Options
14097 @section Options Controlling the Preprocessor
14098 @cindex preprocessor options
14099 @cindex options, preprocessor
14100
14101 These options control the C preprocessor, which is run on each C source
14102 file before actual compilation.
14103
14104 If you use the @option{-E} option, nothing is done except preprocessing.
14105 Some of these options make sense only together with @option{-E} because
14106 they cause the preprocessor output to be unsuitable for actual
14107 compilation.
14108
14109 In addition to the options listed here, there are a number of options
14110 to control search paths for include files documented in
14111 @ref{Directory Options}.
14112 Options to control preprocessor diagnostics are listed in
14113 @ref{Warning Options}.
14114
14115 @table @gcctabopt
14116 @include cppopts.texi
14117
14118 @item -Wp,@var{option}
14119 @opindex Wp
14120 You can use @option{-Wp,@var{option}} to bypass the compiler driver
14121 and pass @var{option} directly through to the preprocessor. If
14122 @var{option} contains commas, it is split into multiple options at the
14123 commas. However, many options are modified, translated or interpreted
14124 by the compiler driver before being passed to the preprocessor, and
14125 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
14126 interface is undocumented and subject to change, so whenever possible
14127 you should avoid using @option{-Wp} and let the driver handle the
14128 options instead.
14129
14130 @item -Xpreprocessor @var{option}
14131 @opindex Xpreprocessor
14132 Pass @var{option} as an option to the preprocessor. You can use this to
14133 supply system-specific preprocessor options that GCC does not
14134 recognize.
14135
14136 If you want to pass an option that takes an argument, you must use
14137 @option{-Xpreprocessor} twice, once for the option and once for the argument.
14138
14139 @item -no-integrated-cpp
14140 @opindex no-integrated-cpp
14141 Perform preprocessing as a separate pass before compilation.
14142 By default, GCC performs preprocessing as an integrated part of
14143 input tokenization and parsing.
14144 If this option is provided, the appropriate language front end
14145 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
14146 and Objective-C, respectively) is instead invoked twice,
14147 once for preprocessing only and once for actual compilation
14148 of the preprocessed input.
14149 This option may be useful in conjunction with the @option{-B} or
14150 @option{-wrapper} options to specify an alternate preprocessor or
14151 perform additional processing of the program source between
14152 normal preprocessing and compilation.
14153
14154 @end table
14155
14156 @node Assembler Options
14157 @section Passing Options to the Assembler
14158
14159 @c prevent bad page break with this line
14160 You can pass options to the assembler.
14161
14162 @table @gcctabopt
14163 @item -Wa,@var{option}
14164 @opindex Wa
14165 Pass @var{option} as an option to the assembler. If @var{option}
14166 contains commas, it is split into multiple options at the commas.
14167
14168 @item -Xassembler @var{option}
14169 @opindex Xassembler
14170 Pass @var{option} as an option to the assembler. You can use this to
14171 supply system-specific assembler options that GCC does not
14172 recognize.
14173
14174 If you want to pass an option that takes an argument, you must use
14175 @option{-Xassembler} twice, once for the option and once for the argument.
14176
14177 @end table
14178
14179 @node Link Options
14180 @section Options for Linking
14181 @cindex link options
14182 @cindex options, linking
14183
14184 These options come into play when the compiler links object files into
14185 an executable output file. They are meaningless if the compiler is
14186 not doing a link step.
14187
14188 @table @gcctabopt
14189 @cindex file names
14190 @item @var{object-file-name}
14191 A file name that does not end in a special recognized suffix is
14192 considered to name an object file or library. (Object files are
14193 distinguished from libraries by the linker according to the file
14194 contents.) If linking is done, these object files are used as input
14195 to the linker.
14196
14197 @item -c
14198 @itemx -S
14199 @itemx -E
14200 @opindex c
14201 @opindex S
14202 @opindex E
14203 If any of these options is used, then the linker is not run, and
14204 object file names should not be used as arguments. @xref{Overall
14205 Options}.
14206
14207 @item -flinker-output=@var{type}
14208 @opindex flinker-output
14209 This option controls code generation of the link-time optimizer. By
14210 default the linker output is automatically determined by the linker
14211 plugin. For debugging the compiler and if incremental linking with a
14212 non-LTO object file is desired, it may be useful to control the type
14213 manually.
14214
14215 If @var{type} is @samp{exec}, code generation produces a static
14216 binary. In this case @option{-fpic} and @option{-fpie} are both
14217 disabled.
14218
14219 If @var{type} is @samp{dyn}, code generation produces a shared
14220 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
14221 but not enabled automatically. This allows to build shared libraries
14222 without position-independent code on architectures where this is
14223 possible, i.e.@: on x86.
14224
14225 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
14226 executable. This results in similar optimizations as @samp{exec}
14227 except that @option{-fpie} is not disabled if specified at compilation
14228 time.
14229
14230 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
14231 done. The sections containing intermediate code for link-time optimization are
14232 merged, pre-optimized, and output to the resulting object file. In addition, if
14233 @option{-ffat-lto-objects} is specified, binary code is produced for future
14234 non-LTO linking. The object file produced by incremental linking is smaller
14235 than a static library produced from the same object files. At link time the
14236 result of incremental linking also loads faster than a static
14237 library assuming that the majority of objects in the library are used.
14238
14239 Finally @samp{nolto-rel} configures the compiler for incremental linking where
14240 code generation is forced, a final binary is produced, and the intermediate
14241 code for later link-time optimization is stripped. When multiple object files
14242 are linked together the resulting code is better optimized than with
14243 link-time optimizations disabled (for example, cross-module inlining
14244 happens), but most of benefits of whole program optimizations are lost.
14245
14246 During the incremental link (by @option{-r}) the linker plugin defaults to
14247 @option{rel}. With current interfaces to GNU Binutils it is however not
14248 possible to incrementally link LTO objects and non-LTO objects into a single
14249 mixed object file. If any of object files in incremental link cannot
14250 be used for link-time optimization, the linker plugin issues a warning and
14251 uses @samp{nolto-rel}. To maintain whole program optimization, it is
14252 recommended to link such objects into static library instead. Alternatively it
14253 is possible to use H.J. Lu's binutils with support for mixed objects.
14254
14255 @item -fuse-ld=bfd
14256 @opindex fuse-ld=bfd
14257 Use the @command{bfd} linker instead of the default linker.
14258
14259 @item -fuse-ld=gold
14260 @opindex fuse-ld=gold
14261 Use the @command{gold} linker instead of the default linker.
14262
14263 @item -fuse-ld=lld
14264 @opindex fuse-ld=lld
14265 Use the LLVM @command{lld} linker instead of the default linker.
14266
14267 @cindex Libraries
14268 @item -l@var{library}
14269 @itemx -l @var{library}
14270 @opindex l
14271 Search the library named @var{library} when linking. (The second
14272 alternative with the library as a separate argument is only for
14273 POSIX compliance and is not recommended.)
14274
14275 The @option{-l} option is passed directly to the linker by GCC. Refer
14276 to your linker documentation for exact details. The general
14277 description below applies to the GNU linker.
14278
14279 The linker searches a standard list of directories for the library.
14280 The directories searched include several standard system directories
14281 plus any that you specify with @option{-L}.
14282
14283 Static libraries are archives of object files, and have file names
14284 like @file{lib@var{library}.a}. Some targets also support shared
14285 libraries, which typically have names like @file{lib@var{library}.so}.
14286 If both static and shared libraries are found, the linker gives
14287 preference to linking with the shared library unless the
14288 @option{-static} option is used.
14289
14290 It makes a difference where in the command you write this option; the
14291 linker searches and processes libraries and object files in the order they
14292 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
14293 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
14294 to functions in @samp{z}, those functions may not be loaded.
14295
14296 @item -lobjc
14297 @opindex lobjc
14298 You need this special case of the @option{-l} option in order to
14299 link an Objective-C or Objective-C++ program.
14300
14301 @item -nostartfiles
14302 @opindex nostartfiles
14303 Do not use the standard system startup files when linking.
14304 The standard system libraries are used normally, unless @option{-nostdlib},
14305 @option{-nolibc}, or @option{-nodefaultlibs} is used.
14306
14307 @item -nodefaultlibs
14308 @opindex nodefaultlibs
14309 Do not use the standard system libraries when linking.
14310 Only the libraries you specify are passed to the linker, and options
14311 specifying linkage of the system libraries, such as @option{-static-libgcc}
14312 or @option{-shared-libgcc}, are ignored.
14313 The standard startup files are used normally, unless @option{-nostartfiles}
14314 is used.
14315
14316 The compiler may generate calls to @code{memcmp},
14317 @code{memset}, @code{memcpy} and @code{memmove}.
14318 These entries are usually resolved by entries in
14319 libc. These entry points should be supplied through some other
14320 mechanism when this option is specified.
14321
14322 @item -nolibc
14323 @opindex nolibc
14324 Do not use the C library or system libraries tightly coupled with it when
14325 linking. Still link with the startup files, @file{libgcc} or toolchain
14326 provided language support libraries such as @file{libgnat}, @file{libgfortran}
14327 or @file{libstdc++} unless options preventing their inclusion are used as
14328 well. This typically removes @option{-lc} from the link command line, as well
14329 as system libraries that normally go with it and become meaningless when
14330 absence of a C library is assumed, for example @option{-lpthread} or
14331 @option{-lm} in some configurations. This is intended for bare-board
14332 targets when there is indeed no C library available.
14333
14334 @item -nostdlib
14335 @opindex nostdlib
14336 Do not use the standard system startup files or libraries when linking.
14337 No startup files and only the libraries you specify are passed to
14338 the linker, and options specifying linkage of the system libraries, such as
14339 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
14340
14341 The compiler may generate calls to @code{memcmp}, @code{memset},
14342 @code{memcpy} and @code{memmove}.
14343 These entries are usually resolved by entries in
14344 libc. These entry points should be supplied through some other
14345 mechanism when this option is specified.
14346
14347 @cindex @option{-lgcc}, use with @option{-nostdlib}
14348 @cindex @option{-nostdlib} and unresolved references
14349 @cindex unresolved references and @option{-nostdlib}
14350 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
14351 @cindex @option{-nodefaultlibs} and unresolved references
14352 @cindex unresolved references and @option{-nodefaultlibs}
14353 One of the standard libraries bypassed by @option{-nostdlib} and
14354 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
14355 which GCC uses to overcome shortcomings of particular machines, or special
14356 needs for some languages.
14357 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
14358 Collection (GCC) Internals},
14359 for more discussion of @file{libgcc.a}.)
14360 In most cases, you need @file{libgcc.a} even when you want to avoid
14361 other standard libraries. In other words, when you specify @option{-nostdlib}
14362 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
14363 This ensures that you have no unresolved references to internal GCC
14364 library subroutines.
14365 (An example of such an internal subroutine is @code{__main}, used to ensure C++
14366 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
14367 GNU Compiler Collection (GCC) Internals}.)
14368
14369 @item -e @var{entry}
14370 @itemx --entry=@var{entry}
14371 @opindex e
14372 @opindex entry
14373
14374 Specify that the program entry point is @var{entry}. The argument is
14375 interpreted by the linker; the GNU linker accepts either a symbol name
14376 or an address.
14377
14378 @item -pie
14379 @opindex pie
14380 Produce a dynamically linked position independent executable on targets
14381 that support it. For predictable results, you must also specify the same
14382 set of options used for compilation (@option{-fpie}, @option{-fPIE},
14383 or model suboptions) when you specify this linker option.
14384
14385 @item -no-pie
14386 @opindex no-pie
14387 Don't produce a dynamically linked position independent executable.
14388
14389 @item -static-pie
14390 @opindex static-pie
14391 Produce a static position independent executable on targets that support
14392 it. A static position independent executable is similar to a static
14393 executable, but can be loaded at any address without a dynamic linker.
14394 For predictable results, you must also specify the same set of options
14395 used for compilation (@option{-fpie}, @option{-fPIE}, or model
14396 suboptions) when you specify this linker option.
14397
14398 @item -pthread
14399 @opindex pthread
14400 Link with the POSIX threads library. This option is supported on
14401 GNU/Linux targets, most other Unix derivatives, and also on
14402 x86 Cygwin and MinGW targets. On some targets this option also sets
14403 flags for the preprocessor, so it should be used consistently for both
14404 compilation and linking.
14405
14406 @item -r
14407 @opindex r
14408 Produce a relocatable object as output. This is also known as partial
14409 linking.
14410
14411 @item -rdynamic
14412 @opindex rdynamic
14413 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
14414 that support it. This instructs the linker to add all symbols, not
14415 only used ones, to the dynamic symbol table. This option is needed
14416 for some uses of @code{dlopen} or to allow obtaining backtraces
14417 from within a program.
14418
14419 @item -s
14420 @opindex s
14421 Remove all symbol table and relocation information from the executable.
14422
14423 @item -static
14424 @opindex static
14425 On systems that support dynamic linking, this overrides @option{-pie}
14426 and prevents linking with the shared libraries. On other systems, this
14427 option has no effect.
14428
14429 @item -shared
14430 @opindex shared
14431 Produce a shared object which can then be linked with other objects to
14432 form an executable. Not all systems support this option. For predictable
14433 results, you must also specify the same set of options used for compilation
14434 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
14435 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
14436 needs to build supplementary stub code for constructors to work. On
14437 multi-libbed systems, @samp{gcc -shared} must select the correct support
14438 libraries to link against. Failing to supply the correct flags may lead
14439 to subtle defects. Supplying them in cases where they are not necessary
14440 is innocuous.}
14441
14442 @item -shared-libgcc
14443 @itemx -static-libgcc
14444 @opindex shared-libgcc
14445 @opindex static-libgcc
14446 On systems that provide @file{libgcc} as a shared library, these options
14447 force the use of either the shared or static version, respectively.
14448 If no shared version of @file{libgcc} was built when the compiler was
14449 configured, these options have no effect.
14450
14451 There are several situations in which an application should use the
14452 shared @file{libgcc} instead of the static version. The most common
14453 of these is when the application wishes to throw and catch exceptions
14454 across different shared libraries. In that case, each of the libraries
14455 as well as the application itself should use the shared @file{libgcc}.
14456
14457 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
14458 whenever you build a shared library or a main executable, because C++
14459 programs typically use exceptions, so this is the right thing to do.
14460
14461 If, instead, you use the GCC driver to create shared libraries, you may
14462 find that they are not always linked with the shared @file{libgcc}.
14463 If GCC finds, at its configuration time, that you have a non-GNU linker
14464 or a GNU linker that does not support option @option{--eh-frame-hdr},
14465 it links the shared version of @file{libgcc} into shared libraries
14466 by default. Otherwise, it takes advantage of the linker and optimizes
14467 away the linking with the shared version of @file{libgcc}, linking with
14468 the static version of libgcc by default. This allows exceptions to
14469 propagate through such shared libraries, without incurring relocation
14470 costs at library load time.
14471
14472 However, if a library or main executable is supposed to throw or catch
14473 exceptions, you must link it using the G++ driver, or using the option
14474 @option{-shared-libgcc}, such that it is linked with the shared
14475 @file{libgcc}.
14476
14477 @item -static-libasan
14478 @opindex static-libasan
14479 When the @option{-fsanitize=address} option is used to link a program,
14480 the GCC driver automatically links against @option{libasan}. If
14481 @file{libasan} is available as a shared library, and the @option{-static}
14482 option is not used, then this links against the shared version of
14483 @file{libasan}. The @option{-static-libasan} option directs the GCC
14484 driver to link @file{libasan} statically, without necessarily linking
14485 other libraries statically.
14486
14487 @item -static-libtsan
14488 @opindex static-libtsan
14489 When the @option{-fsanitize=thread} option is used to link a program,
14490 the GCC driver automatically links against @option{libtsan}. If
14491 @file{libtsan} is available as a shared library, and the @option{-static}
14492 option is not used, then this links against the shared version of
14493 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
14494 driver to link @file{libtsan} statically, without necessarily linking
14495 other libraries statically.
14496
14497 @item -static-liblsan
14498 @opindex static-liblsan
14499 When the @option{-fsanitize=leak} option is used to link a program,
14500 the GCC driver automatically links against @option{liblsan}. If
14501 @file{liblsan} is available as a shared library, and the @option{-static}
14502 option is not used, then this links against the shared version of
14503 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
14504 driver to link @file{liblsan} statically, without necessarily linking
14505 other libraries statically.
14506
14507 @item -static-libubsan
14508 @opindex static-libubsan
14509 When the @option{-fsanitize=undefined} option is used to link a program,
14510 the GCC driver automatically links against @option{libubsan}. If
14511 @file{libubsan} is available as a shared library, and the @option{-static}
14512 option is not used, then this links against the shared version of
14513 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
14514 driver to link @file{libubsan} statically, without necessarily linking
14515 other libraries statically.
14516
14517 @item -static-libstdc++
14518 @opindex static-libstdc++
14519 When the @command{g++} program is used to link a C++ program, it
14520 normally automatically links against @option{libstdc++}. If
14521 @file{libstdc++} is available as a shared library, and the
14522 @option{-static} option is not used, then this links against the
14523 shared version of @file{libstdc++}. That is normally fine. However, it
14524 is sometimes useful to freeze the version of @file{libstdc++} used by
14525 the program without going all the way to a fully static link. The
14526 @option{-static-libstdc++} option directs the @command{g++} driver to
14527 link @file{libstdc++} statically, without necessarily linking other
14528 libraries statically.
14529
14530 @item -symbolic
14531 @opindex symbolic
14532 Bind references to global symbols when building a shared object. Warn
14533 about any unresolved references (unless overridden by the link editor
14534 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
14535 this option.
14536
14537 @item -T @var{script}
14538 @opindex T
14539 @cindex linker script
14540 Use @var{script} as the linker script. This option is supported by most
14541 systems using the GNU linker. On some targets, such as bare-board
14542 targets without an operating system, the @option{-T} option may be required
14543 when linking to avoid references to undefined symbols.
14544
14545 @item -Xlinker @var{option}
14546 @opindex Xlinker
14547 Pass @var{option} as an option to the linker. You can use this to
14548 supply system-specific linker options that GCC does not recognize.
14549
14550 If you want to pass an option that takes a separate argument, you must use
14551 @option{-Xlinker} twice, once for the option and once for the argument.
14552 For example, to pass @option{-assert definitions}, you must write
14553 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
14554 @option{-Xlinker "-assert definitions"}, because this passes the entire
14555 string as a single argument, which is not what the linker expects.
14556
14557 When using the GNU linker, it is usually more convenient to pass
14558 arguments to linker options using the @option{@var{option}=@var{value}}
14559 syntax than as separate arguments. For example, you can specify
14560 @option{-Xlinker -Map=output.map} rather than
14561 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
14562 this syntax for command-line options.
14563
14564 @item -Wl,@var{option}
14565 @opindex Wl
14566 Pass @var{option} as an option to the linker. If @var{option} contains
14567 commas, it is split into multiple options at the commas. You can use this
14568 syntax to pass an argument to the option.
14569 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
14570 linker. When using the GNU linker, you can also get the same effect with
14571 @option{-Wl,-Map=output.map}.
14572
14573 @item -u @var{symbol}
14574 @opindex u
14575 Pretend the symbol @var{symbol} is undefined, to force linking of
14576 library modules to define it. You can use @option{-u} multiple times with
14577 different symbols to force loading of additional library modules.
14578
14579 @item -z @var{keyword}
14580 @opindex z
14581 @option{-z} is passed directly on to the linker along with the keyword
14582 @var{keyword}. See the section in the documentation of your linker for
14583 permitted values and their meanings.
14584 @end table
14585
14586 @node Directory Options
14587 @section Options for Directory Search
14588 @cindex directory options
14589 @cindex options, directory search
14590 @cindex search path
14591
14592 These options specify directories to search for header files, for
14593 libraries and for parts of the compiler:
14594
14595 @table @gcctabopt
14596 @include cppdiropts.texi
14597
14598 @item -iplugindir=@var{dir}
14599 @opindex iplugindir=
14600 Set the directory to search for plugins that are passed
14601 by @option{-fplugin=@var{name}} instead of
14602 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
14603 to be used by the user, but only passed by the driver.
14604
14605 @item -L@var{dir}
14606 @opindex L
14607 Add directory @var{dir} to the list of directories to be searched
14608 for @option{-l}.
14609
14610 @item -B@var{prefix}
14611 @opindex B
14612 This option specifies where to find the executables, libraries,
14613 include files, and data files of the compiler itself.
14614
14615 The compiler driver program runs one or more of the subprograms
14616 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
14617 @var{prefix} as a prefix for each program it tries to run, both with and
14618 without @samp{@var{machine}/@var{version}/} for the corresponding target
14619 machine and compiler version.
14620
14621 For each subprogram to be run, the compiler driver first tries the
14622 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
14623 is not specified, the driver tries two standard prefixes,
14624 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
14625 those results in a file name that is found, the unmodified program
14626 name is searched for using the directories specified in your
14627 @env{PATH} environment variable.
14628
14629 The compiler checks to see if the path provided by @option{-B}
14630 refers to a directory, and if necessary it adds a directory
14631 separator character at the end of the path.
14632
14633 @option{-B} prefixes that effectively specify directory names also apply
14634 to libraries in the linker, because the compiler translates these
14635 options into @option{-L} options for the linker. They also apply to
14636 include files in the preprocessor, because the compiler translates these
14637 options into @option{-isystem} options for the preprocessor. In this case,
14638 the compiler appends @samp{include} to the prefix.
14639
14640 The runtime support file @file{libgcc.a} can also be searched for using
14641 the @option{-B} prefix, if needed. If it is not found there, the two
14642 standard prefixes above are tried, and that is all. The file is left
14643 out of the link if it is not found by those means.
14644
14645 Another way to specify a prefix much like the @option{-B} prefix is to use
14646 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
14647 Variables}.
14648
14649 As a special kludge, if the path provided by @option{-B} is
14650 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
14651 9, then it is replaced by @file{[dir/]include}. This is to help
14652 with boot-strapping the compiler.
14653
14654 @item -no-canonical-prefixes
14655 @opindex no-canonical-prefixes
14656 Do not expand any symbolic links, resolve references to @samp{/../}
14657 or @samp{/./}, or make the path absolute when generating a relative
14658 prefix.
14659
14660 @item --sysroot=@var{dir}
14661 @opindex sysroot
14662 Use @var{dir} as the logical root directory for headers and libraries.
14663 For example, if the compiler normally searches for headers in
14664 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
14665 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
14666
14667 If you use both this option and the @option{-isysroot} option, then
14668 the @option{--sysroot} option applies to libraries, but the
14669 @option{-isysroot} option applies to header files.
14670
14671 The GNU linker (beginning with version 2.16) has the necessary support
14672 for this option. If your linker does not support this option, the
14673 header file aspect of @option{--sysroot} still works, but the
14674 library aspect does not.
14675
14676 @item --no-sysroot-suffix
14677 @opindex no-sysroot-suffix
14678 For some targets, a suffix is added to the root directory specified
14679 with @option{--sysroot}, depending on the other options used, so that
14680 headers may for example be found in
14681 @file{@var{dir}/@var{suffix}/usr/include} instead of
14682 @file{@var{dir}/usr/include}. This option disables the addition of
14683 such a suffix.
14684
14685 @end table
14686
14687 @node Code Gen Options
14688 @section Options for Code Generation Conventions
14689 @cindex code generation conventions
14690 @cindex options, code generation
14691 @cindex run-time options
14692
14693 These machine-independent options control the interface conventions
14694 used in code generation.
14695
14696 Most of them have both positive and negative forms; the negative form
14697 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
14698 one of the forms is listed---the one that is not the default. You
14699 can figure out the other form by either removing @samp{no-} or adding
14700 it.
14701
14702 @table @gcctabopt
14703 @item -fstack-reuse=@var{reuse-level}
14704 @opindex fstack_reuse
14705 This option controls stack space reuse for user declared local/auto variables
14706 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
14707 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
14708 local variables and temporaries, @samp{named_vars} enables the reuse only for
14709 user defined local variables with names, and @samp{none} disables stack reuse
14710 completely. The default value is @samp{all}. The option is needed when the
14711 program extends the lifetime of a scoped local variable or a compiler generated
14712 temporary beyond the end point defined by the language. When a lifetime of
14713 a variable ends, and if the variable lives in memory, the optimizing compiler
14714 has the freedom to reuse its stack space with other temporaries or scoped
14715 local variables whose live range does not overlap with it. Legacy code extending
14716 local lifetime is likely to break with the stack reuse optimization.
14717
14718 For example,
14719
14720 @smallexample
14721 int *p;
14722 @{
14723 int local1;
14724
14725 p = &local1;
14726 local1 = 10;
14727 ....
14728 @}
14729 @{
14730 int local2;
14731 local2 = 20;
14732 ...
14733 @}
14734
14735 if (*p == 10) // out of scope use of local1
14736 @{
14737
14738 @}
14739 @end smallexample
14740
14741 Another example:
14742 @smallexample
14743
14744 struct A
14745 @{
14746 A(int k) : i(k), j(k) @{ @}
14747 int i;
14748 int j;
14749 @};
14750
14751 A *ap;
14752
14753 void foo(const A& ar)
14754 @{
14755 ap = &ar;
14756 @}
14757
14758 void bar()
14759 @{
14760 foo(A(10)); // temp object's lifetime ends when foo returns
14761
14762 @{
14763 A a(20);
14764 ....
14765 @}
14766 ap->i+= 10; // ap references out of scope temp whose space
14767 // is reused with a. What is the value of ap->i?
14768 @}
14769
14770 @end smallexample
14771
14772 The lifetime of a compiler generated temporary is well defined by the C++
14773 standard. When a lifetime of a temporary ends, and if the temporary lives
14774 in memory, the optimizing compiler has the freedom to reuse its stack
14775 space with other temporaries or scoped local variables whose live range
14776 does not overlap with it. However some of the legacy code relies on
14777 the behavior of older compilers in which temporaries' stack space is
14778 not reused, the aggressive stack reuse can lead to runtime errors. This
14779 option is used to control the temporary stack reuse optimization.
14780
14781 @item -ftrapv
14782 @opindex ftrapv
14783 This option generates traps for signed overflow on addition, subtraction,
14784 multiplication operations.
14785 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14786 @option{-ftrapv} @option{-fwrapv} on the command-line results in
14787 @option{-fwrapv} being effective. Note that only active options override, so
14788 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14789 results in @option{-ftrapv} being effective.
14790
14791 @item -fwrapv
14792 @opindex fwrapv
14793 This option instructs the compiler to assume that signed arithmetic
14794 overflow of addition, subtraction and multiplication wraps around
14795 using twos-complement representation. This flag enables some optimizations
14796 and disables others.
14797 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
14798 @option{-ftrapv} @option{-fwrapv} on the command-line results in
14799 @option{-fwrapv} being effective. Note that only active options override, so
14800 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
14801 results in @option{-ftrapv} being effective.
14802
14803 @item -fwrapv-pointer
14804 @opindex fwrapv-pointer
14805 This option instructs the compiler to assume that pointer arithmetic
14806 overflow on addition and subtraction wraps around using twos-complement
14807 representation. This flag disables some optimizations which assume
14808 pointer overflow is invalid.
14809
14810 @item -fstrict-overflow
14811 @opindex fstrict-overflow
14812 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
14813 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
14814
14815 @item -fexceptions
14816 @opindex fexceptions
14817 Enable exception handling. Generates extra code needed to propagate
14818 exceptions. For some targets, this implies GCC generates frame
14819 unwind information for all functions, which can produce significant data
14820 size overhead, although it does not affect execution. If you do not
14821 specify this option, GCC enables it by default for languages like
14822 C++ that normally require exception handling, and disables it for
14823 languages like C that do not normally require it. However, you may need
14824 to enable this option when compiling C code that needs to interoperate
14825 properly with exception handlers written in C++. You may also wish to
14826 disable this option if you are compiling older C++ programs that don't
14827 use exception handling.
14828
14829 @item -fnon-call-exceptions
14830 @opindex fnon-call-exceptions
14831 Generate code that allows trapping instructions to throw exceptions.
14832 Note that this requires platform-specific runtime support that does
14833 not exist everywhere. Moreover, it only allows @emph{trapping}
14834 instructions to throw exceptions, i.e.@: memory references or floating-point
14835 instructions. It does not allow exceptions to be thrown from
14836 arbitrary signal handlers such as @code{SIGALRM}.
14837
14838 @item -fdelete-dead-exceptions
14839 @opindex fdelete-dead-exceptions
14840 Consider that instructions that may throw exceptions but don't otherwise
14841 contribute to the execution of the program can be optimized away.
14842 This option is enabled by default for the Ada front end, as permitted by
14843 the Ada language specification.
14844 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
14845
14846 @item -funwind-tables
14847 @opindex funwind-tables
14848 Similar to @option{-fexceptions}, except that it just generates any needed
14849 static data, but does not affect the generated code in any other way.
14850 You normally do not need to enable this option; instead, a language processor
14851 that needs this handling enables it on your behalf.
14852
14853 @item -fasynchronous-unwind-tables
14854 @opindex fasynchronous-unwind-tables
14855 Generate unwind table in DWARF format, if supported by target machine. The
14856 table is exact at each instruction boundary, so it can be used for stack
14857 unwinding from asynchronous events (such as debugger or garbage collector).
14858
14859 @item -fno-gnu-unique
14860 @opindex fno-gnu-unique
14861 @opindex fgnu-unique
14862 On systems with recent GNU assembler and C library, the C++ compiler
14863 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
14864 of template static data members and static local variables in inline
14865 functions are unique even in the presence of @code{RTLD_LOCAL}; this
14866 is necessary to avoid problems with a library used by two different
14867 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
14868 therefore disagreeing with the other one about the binding of the
14869 symbol. But this causes @code{dlclose} to be ignored for affected
14870 DSOs; if your program relies on reinitialization of a DSO via
14871 @code{dlclose} and @code{dlopen}, you can use
14872 @option{-fno-gnu-unique}.
14873
14874 @item -fpcc-struct-return
14875 @opindex fpcc-struct-return
14876 Return ``short'' @code{struct} and @code{union} values in memory like
14877 longer ones, rather than in registers. This convention is less
14878 efficient, but it has the advantage of allowing intercallability between
14879 GCC-compiled files and files compiled with other compilers, particularly
14880 the Portable C Compiler (pcc).
14881
14882 The precise convention for returning structures in memory depends
14883 on the target configuration macros.
14884
14885 Short structures and unions are those whose size and alignment match
14886 that of some integer type.
14887
14888 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14889 switch is not binary compatible with code compiled with the
14890 @option{-freg-struct-return} switch.
14891 Use it to conform to a non-default application binary interface.
14892
14893 @item -freg-struct-return
14894 @opindex freg-struct-return
14895 Return @code{struct} and @code{union} values in registers when possible.
14896 This is more efficient for small structures than
14897 @option{-fpcc-struct-return}.
14898
14899 If you specify neither @option{-fpcc-struct-return} nor
14900 @option{-freg-struct-return}, GCC defaults to whichever convention is
14901 standard for the target. If there is no standard convention, GCC
14902 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14903 the principal compiler. In those cases, we can choose the standard, and
14904 we chose the more efficient register return alternative.
14905
14906 @strong{Warning:} code compiled with the @option{-freg-struct-return}
14907 switch is not binary compatible with code compiled with the
14908 @option{-fpcc-struct-return} switch.
14909 Use it to conform to a non-default application binary interface.
14910
14911 @item -fshort-enums
14912 @opindex fshort-enums
14913 Allocate to an @code{enum} type only as many bytes as it needs for the
14914 declared range of possible values. Specifically, the @code{enum} type
14915 is equivalent to the smallest integer type that has enough room.
14916
14917 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14918 code that is not binary compatible with code generated without that switch.
14919 Use it to conform to a non-default application binary interface.
14920
14921 @item -fshort-wchar
14922 @opindex fshort-wchar
14923 Override the underlying type for @code{wchar_t} to be @code{short
14924 unsigned int} instead of the default for the target. This option is
14925 useful for building programs to run under WINE@.
14926
14927 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14928 code that is not binary compatible with code generated without that switch.
14929 Use it to conform to a non-default application binary interface.
14930
14931 @item -fcommon
14932 @opindex fcommon
14933 @opindex fno-common
14934 @cindex tentative definitions
14935 In C code, this option controls the placement of global variables
14936 defined without an initializer, known as @dfn{tentative definitions}
14937 in the C standard. Tentative definitions are distinct from declarations
14938 of a variable with the @code{extern} keyword, which do not allocate storage.
14939
14940 The default is @option{-fno-common}, which specifies that the compiler places
14941 uninitialized global variables in the BSS section of the object file.
14942 This inhibits the merging of tentative definitions by the linker so you get a
14943 multiple-definition error if the same variable is accidentally defined in more
14944 than one compilation unit.
14945
14946 The @option{-fcommon} places uninitialized global variables in a common block.
14947 This allows the linker to resolve all tentative definitions of the same variable
14948 in different compilation units to the same object, or to a non-tentative
14949 definition. This behavior is inconsistent with C++, and on many targets implies
14950 a speed and code size penalty on global variable references. It is mainly
14951 useful to enable legacy code to link without errors.
14952
14953 @item -fno-ident
14954 @opindex fno-ident
14955 @opindex fident
14956 Ignore the @code{#ident} directive.
14957
14958 @item -finhibit-size-directive
14959 @opindex finhibit-size-directive
14960 Don't output a @code{.size} assembler directive, or anything else that
14961 would cause trouble if the function is split in the middle, and the
14962 two halves are placed at locations far apart in memory. This option is
14963 used when compiling @file{crtstuff.c}; you should not need to use it
14964 for anything else.
14965
14966 @item -fverbose-asm
14967 @opindex fverbose-asm
14968 Put extra commentary information in the generated assembly code to
14969 make it more readable. This option is generally only of use to those
14970 who actually need to read the generated assembly code (perhaps while
14971 debugging the compiler itself).
14972
14973 @option{-fno-verbose-asm}, the default, causes the
14974 extra information to be omitted and is useful when comparing two assembler
14975 files.
14976
14977 The added comments include:
14978
14979 @itemize @bullet
14980
14981 @item
14982 information on the compiler version and command-line options,
14983
14984 @item
14985 the source code lines associated with the assembly instructions,
14986 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14987
14988 @item
14989 hints on which high-level expressions correspond to
14990 the various assembly instruction operands.
14991
14992 @end itemize
14993
14994 For example, given this C source file:
14995
14996 @smallexample
14997 int test (int n)
14998 @{
14999 int i;
15000 int total = 0;
15001
15002 for (i = 0; i < n; i++)
15003 total += i * i;
15004
15005 return total;
15006 @}
15007 @end smallexample
15008
15009 compiling to (x86_64) assembly via @option{-S} and emitting the result
15010 direct to stdout via @option{-o} @option{-}
15011
15012 @smallexample
15013 gcc -S test.c -fverbose-asm -Os -o -
15014 @end smallexample
15015
15016 gives output similar to this:
15017
15018 @smallexample
15019 .file "test.c"
15020 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
15021 [...snip...]
15022 # options passed:
15023 [...snip...]
15024
15025 .text
15026 .globl test
15027 .type test, @@function
15028 test:
15029 .LFB0:
15030 .cfi_startproc
15031 # test.c:4: int total = 0;
15032 xorl %eax, %eax # <retval>
15033 # test.c:6: for (i = 0; i < n; i++)
15034 xorl %edx, %edx # i
15035 .L2:
15036 # test.c:6: for (i = 0; i < n; i++)
15037 cmpl %edi, %edx # n, i
15038 jge .L5 #,
15039 # test.c:7: total += i * i;
15040 movl %edx, %ecx # i, tmp92
15041 imull %edx, %ecx # i, tmp92
15042 # test.c:6: for (i = 0; i < n; i++)
15043 incl %edx # i
15044 # test.c:7: total += i * i;
15045 addl %ecx, %eax # tmp92, <retval>
15046 jmp .L2 #
15047 .L5:
15048 # test.c:10: @}
15049 ret
15050 .cfi_endproc
15051 .LFE0:
15052 .size test, .-test
15053 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
15054 .section .note.GNU-stack,"",@@progbits
15055 @end smallexample
15056
15057 The comments are intended for humans rather than machines and hence the
15058 precise format of the comments is subject to change.
15059
15060 @item -frecord-gcc-switches
15061 @opindex frecord-gcc-switches
15062 This switch causes the command line used to invoke the
15063 compiler to be recorded into the object file that is being created.
15064 This switch is only implemented on some targets and the exact format
15065 of the recording is target and binary file format dependent, but it
15066 usually takes the form of a section containing ASCII text. This
15067 switch is related to the @option{-fverbose-asm} switch, but that
15068 switch only records information in the assembler output file as
15069 comments, so it never reaches the object file.
15070 See also @option{-grecord-gcc-switches} for another
15071 way of storing compiler options into the object file.
15072
15073 @item -fpic
15074 @opindex fpic
15075 @cindex global offset table
15076 @cindex PIC
15077 Generate position-independent code (PIC) suitable for use in a shared
15078 library, if supported for the target machine. Such code accesses all
15079 constant addresses through a global offset table (GOT)@. The dynamic
15080 loader resolves the GOT entries when the program starts (the dynamic
15081 loader is not part of GCC; it is part of the operating system). If
15082 the GOT size for the linked executable exceeds a machine-specific
15083 maximum size, you get an error message from the linker indicating that
15084 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
15085 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
15086 on the m68k and RS/6000. The x86 has no such limit.)
15087
15088 Position-independent code requires special support, and therefore works
15089 only on certain machines. For the x86, GCC supports PIC for System V
15090 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
15091 position-independent.
15092
15093 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15094 are defined to 1.
15095
15096 @item -fPIC
15097 @opindex fPIC
15098 If supported for the target machine, emit position-independent code,
15099 suitable for dynamic linking and avoiding any limit on the size of the
15100 global offset table. This option makes a difference on AArch64, m68k,
15101 PowerPC and SPARC@.
15102
15103 Position-independent code requires special support, and therefore works
15104 only on certain machines.
15105
15106 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
15107 are defined to 2.
15108
15109 @item -fpie
15110 @itemx -fPIE
15111 @opindex fpie
15112 @opindex fPIE
15113 These options are similar to @option{-fpic} and @option{-fPIC}, but the
15114 generated position-independent code can be only linked into executables.
15115 Usually these options are used to compile code that will be linked using
15116 the @option{-pie} GCC option.
15117
15118 @option{-fpie} and @option{-fPIE} both define the macros
15119 @code{__pie__} and @code{__PIE__}. The macros have the value 1
15120 for @option{-fpie} and 2 for @option{-fPIE}.
15121
15122 @item -fno-plt
15123 @opindex fno-plt
15124 @opindex fplt
15125 Do not use the PLT for external function calls in position-independent code.
15126 Instead, load the callee address at call sites from the GOT and branch to it.
15127 This leads to more efficient code by eliminating PLT stubs and exposing
15128 GOT loads to optimizations. On architectures such as 32-bit x86 where
15129 PLT stubs expect the GOT pointer in a specific register, this gives more
15130 register allocation freedom to the compiler.
15131 Lazy binding requires use of the PLT;
15132 with @option{-fno-plt} all external symbols are resolved at load time.
15133
15134 Alternatively, the function attribute @code{noplt} can be used to avoid calls
15135 through the PLT for specific external functions.
15136
15137 In position-dependent code, a few targets also convert calls to
15138 functions that are marked to not use the PLT to use the GOT instead.
15139
15140 @item -fno-jump-tables
15141 @opindex fno-jump-tables
15142 @opindex fjump-tables
15143 Do not use jump tables for switch statements even where it would be
15144 more efficient than other code generation strategies. This option is
15145 of use in conjunction with @option{-fpic} or @option{-fPIC} for
15146 building code that forms part of a dynamic linker and cannot
15147 reference the address of a jump table. On some targets, jump tables
15148 do not require a GOT and this option is not needed.
15149
15150 @item -ffixed-@var{reg}
15151 @opindex ffixed
15152 Treat the register named @var{reg} as a fixed register; generated code
15153 should never refer to it (except perhaps as a stack pointer, frame
15154 pointer or in some other fixed role).
15155
15156 @var{reg} must be the name of a register. The register names accepted
15157 are machine-specific and are defined in the @code{REGISTER_NAMES}
15158 macro in the machine description macro file.
15159
15160 This flag does not have a negative form, because it specifies a
15161 three-way choice.
15162
15163 @item -fcall-used-@var{reg}
15164 @opindex fcall-used
15165 Treat the register named @var{reg} as an allocable register that is
15166 clobbered by function calls. It may be allocated for temporaries or
15167 variables that do not live across a call. Functions compiled this way
15168 do not save and restore the register @var{reg}.
15169
15170 It is an error to use this flag with the frame pointer or stack pointer.
15171 Use of this flag for other registers that have fixed pervasive roles in
15172 the machine's execution model produces disastrous results.
15173
15174 This flag does not have a negative form, because it specifies a
15175 three-way choice.
15176
15177 @item -fcall-saved-@var{reg}
15178 @opindex fcall-saved
15179 Treat the register named @var{reg} as an allocable register saved by
15180 functions. It may be allocated even for temporaries or variables that
15181 live across a call. Functions compiled this way save and restore
15182 the register @var{reg} if they use it.
15183
15184 It is an error to use this flag with the frame pointer or stack pointer.
15185 Use of this flag for other registers that have fixed pervasive roles in
15186 the machine's execution model produces disastrous results.
15187
15188 A different sort of disaster results from the use of this flag for
15189 a register in which function values may be returned.
15190
15191 This flag does not have a negative form, because it specifies a
15192 three-way choice.
15193
15194 @item -fpack-struct[=@var{n}]
15195 @opindex fpack-struct
15196 Without a value specified, pack all structure members together without
15197 holes. When a value is specified (which must be a small power of two), pack
15198 structure members according to this value, representing the maximum
15199 alignment (that is, objects with default alignment requirements larger than
15200 this are output potentially unaligned at the next fitting location.
15201
15202 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
15203 code that is not binary compatible with code generated without that switch.
15204 Additionally, it makes the code suboptimal.
15205 Use it to conform to a non-default application binary interface.
15206
15207 @item -fleading-underscore
15208 @opindex fleading-underscore
15209 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
15210 change the way C symbols are represented in the object file. One use
15211 is to help link with legacy assembly code.
15212
15213 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
15214 generate code that is not binary compatible with code generated without that
15215 switch. Use it to conform to a non-default application binary interface.
15216 Not all targets provide complete support for this switch.
15217
15218 @item -ftls-model=@var{model}
15219 @opindex ftls-model
15220 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
15221 The @var{model} argument should be one of @samp{global-dynamic},
15222 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
15223 Note that the choice is subject to optimization: the compiler may use
15224 a more efficient model for symbols not visible outside of the translation
15225 unit, or if @option{-fpic} is not given on the command line.
15226
15227 The default without @option{-fpic} is @samp{initial-exec}; with
15228 @option{-fpic} the default is @samp{global-dynamic}.
15229
15230 @item -ftrampolines
15231 @opindex ftrampolines
15232 For targets that normally need trampolines for nested functions, always
15233 generate them instead of using descriptors. Otherwise, for targets that
15234 do not need them, like for example HP-PA or IA-64, do nothing.
15235
15236 A trampoline is a small piece of code that is created at run time on the
15237 stack when the address of a nested function is taken, and is used to call
15238 the nested function indirectly. Therefore, it requires the stack to be
15239 made executable in order for the program to work properly.
15240
15241 @option{-fno-trampolines} is enabled by default on a language by language
15242 basis to let the compiler avoid generating them, if it computes that this
15243 is safe, and replace them with descriptors. Descriptors are made up of data
15244 only, but the generated code must be prepared to deal with them. As of this
15245 writing, @option{-fno-trampolines} is enabled by default only for Ada.
15246
15247 Moreover, code compiled with @option{-ftrampolines} and code compiled with
15248 @option{-fno-trampolines} are not binary compatible if nested functions are
15249 present. This option must therefore be used on a program-wide basis and be
15250 manipulated with extreme care.
15251
15252 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
15253 @opindex fvisibility
15254 Set the default ELF image symbol visibility to the specified option---all
15255 symbols are marked with this unless overridden within the code.
15256 Using this feature can very substantially improve linking and
15257 load times of shared object libraries, produce more optimized
15258 code, provide near-perfect API export and prevent symbol clashes.
15259 It is @strong{strongly} recommended that you use this in any shared objects
15260 you distribute.
15261
15262 Despite the nomenclature, @samp{default} always means public; i.e.,
15263 available to be linked against from outside the shared object.
15264 @samp{protected} and @samp{internal} are pretty useless in real-world
15265 usage so the only other commonly used option is @samp{hidden}.
15266 The default if @option{-fvisibility} isn't specified is
15267 @samp{default}, i.e., make every symbol public.
15268
15269 A good explanation of the benefits offered by ensuring ELF
15270 symbols have the correct visibility is given by ``How To Write
15271 Shared Libraries'' by Ulrich Drepper (which can be found at
15272 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
15273 solution made possible by this option to marking things hidden when
15274 the default is public is to make the default hidden and mark things
15275 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
15276 and @code{__attribute__ ((visibility("default")))} instead of
15277 @code{__declspec(dllexport)} you get almost identical semantics with
15278 identical syntax. This is a great boon to those working with
15279 cross-platform projects.
15280
15281 For those adding visibility support to existing code, you may find
15282 @code{#pragma GCC visibility} of use. This works by you enclosing
15283 the declarations you wish to set visibility for with (for example)
15284 @code{#pragma GCC visibility push(hidden)} and
15285 @code{#pragma GCC visibility pop}.
15286 Bear in mind that symbol visibility should be viewed @strong{as
15287 part of the API interface contract} and thus all new code should
15288 always specify visibility when it is not the default; i.e., declarations
15289 only for use within the local DSO should @strong{always} be marked explicitly
15290 as hidden as so to avoid PLT indirection overheads---making this
15291 abundantly clear also aids readability and self-documentation of the code.
15292 Note that due to ISO C++ specification requirements, @code{operator new} and
15293 @code{operator delete} must always be of default visibility.
15294
15295 Be aware that headers from outside your project, in particular system
15296 headers and headers from any other library you use, may not be
15297 expecting to be compiled with visibility other than the default. You
15298 may need to explicitly say @code{#pragma GCC visibility push(default)}
15299 before including any such headers.
15300
15301 @code{extern} declarations are not affected by @option{-fvisibility}, so
15302 a lot of code can be recompiled with @option{-fvisibility=hidden} with
15303 no modifications. However, this means that calls to @code{extern}
15304 functions with no explicit visibility use the PLT, so it is more
15305 effective to use @code{__attribute ((visibility))} and/or
15306 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
15307 declarations should be treated as hidden.
15308
15309 Note that @option{-fvisibility} does affect C++ vague linkage
15310 entities. This means that, for instance, an exception class that is
15311 be thrown between DSOs must be explicitly marked with default
15312 visibility so that the @samp{type_info} nodes are unified between
15313 the DSOs.
15314
15315 An overview of these techniques, their benefits and how to use them
15316 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
15317
15318 @item -fstrict-volatile-bitfields
15319 @opindex fstrict-volatile-bitfields
15320 This option should be used if accesses to volatile bit-fields (or other
15321 structure fields, although the compiler usually honors those types
15322 anyway) should use a single access of the width of the
15323 field's type, aligned to a natural alignment if possible. For
15324 example, targets with memory-mapped peripheral registers might require
15325 all such accesses to be 16 bits wide; with this flag you can
15326 declare all peripheral bit-fields as @code{unsigned short} (assuming short
15327 is 16 bits on these targets) to force GCC to use 16-bit accesses
15328 instead of, perhaps, a more efficient 32-bit access.
15329
15330 If this option is disabled, the compiler uses the most efficient
15331 instruction. In the previous example, that might be a 32-bit load
15332 instruction, even though that accesses bytes that do not contain
15333 any portion of the bit-field, or memory-mapped registers unrelated to
15334 the one being updated.
15335
15336 In some cases, such as when the @code{packed} attribute is applied to a
15337 structure field, it may not be possible to access the field with a single
15338 read or write that is correctly aligned for the target machine. In this
15339 case GCC falls back to generating multiple accesses rather than code that
15340 will fault or truncate the result at run time.
15341
15342 Note: Due to restrictions of the C/C++11 memory model, write accesses are
15343 not allowed to touch non bit-field members. It is therefore recommended
15344 to define all bits of the field's type as bit-field members.
15345
15346 The default value of this option is determined by the application binary
15347 interface for the target processor.
15348
15349 @item -fsync-libcalls
15350 @opindex fsync-libcalls
15351 This option controls whether any out-of-line instance of the @code{__sync}
15352 family of functions may be used to implement the C++11 @code{__atomic}
15353 family of functions.
15354
15355 The default value of this option is enabled, thus the only useful form
15356 of the option is @option{-fno-sync-libcalls}. This option is used in
15357 the implementation of the @file{libatomic} runtime library.
15358
15359 @end table
15360
15361 @node Developer Options
15362 @section GCC Developer Options
15363 @cindex developer options
15364 @cindex debugging GCC
15365 @cindex debug dump options
15366 @cindex dump options
15367 @cindex compilation statistics
15368
15369 This section describes command-line options that are primarily of
15370 interest to GCC developers, including options to support compiler
15371 testing and investigation of compiler bugs and compile-time
15372 performance problems. This includes options that produce debug dumps
15373 at various points in the compilation; that print statistics such as
15374 memory use and execution time; and that print information about GCC's
15375 configuration, such as where it searches for libraries. You should
15376 rarely need to use any of these options for ordinary compilation and
15377 linking tasks.
15378
15379 Many developer options that cause GCC to dump output to a file take an
15380 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
15381 or @samp{-} to dump to standard output, and @samp{stderr} for standard
15382 error.
15383
15384 If @samp{=@var{filename}} is omitted, a default dump file name is
15385 constructed by concatenating the base dump file name, a pass number,
15386 phase letter, and pass name. The base dump file name is the name of
15387 output file produced by the compiler if explicitly specified and not
15388 an executable; otherwise it is the source file name.
15389 The pass number is determined by the order passes are registered with
15390 the compiler's pass manager.
15391 This is generally the same as the order of execution, but passes
15392 registered by plugins, target-specific passes, or passes that are
15393 otherwise registered late are numbered higher than the pass named
15394 @samp{final}, even if they are executed earlier. The phase letter is
15395 one of @samp{i} (inter-procedural analysis), @samp{l}
15396 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
15397 The files are created in the directory of the output file.
15398
15399 @table @gcctabopt
15400
15401 @item -fcallgraph-info
15402 @itemx -fcallgraph-info=@var{MARKERS}
15403 @opindex fcallgraph-info
15404 Makes the compiler output callgraph information for the program, on a
15405 per-object-file basis. The information is generated in the common VCG
15406 format. It can be decorated with additional, per-node and/or per-edge
15407 information, if a list of comma-separated markers is additionally
15408 specified. When the @code{su} marker is specified, the callgraph is
15409 decorated with stack usage information; it is equivalent to
15410 @option{-fstack-usage}. When the @code{da} marker is specified, the
15411 callgraph is decorated with information about dynamically allocated
15412 objects.
15413
15414 When compiling with @option{-flto}, no callgraph information is output
15415 along with the object file. At LTO link time, @option{-fcallgraph-info}
15416 may generate multiple callgraph information files next to intermediate
15417 LTO output files.
15418
15419 @item -d@var{letters}
15420 @itemx -fdump-rtl-@var{pass}
15421 @itemx -fdump-rtl-@var{pass}=@var{filename}
15422 @opindex d
15423 @opindex fdump-rtl-@var{pass}
15424 Says to make debugging dumps during compilation at times specified by
15425 @var{letters}. This is used for debugging the RTL-based passes of the
15426 compiler.
15427
15428 Some @option{-d@var{letters}} switches have different meaning when
15429 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
15430 for information about preprocessor-specific dump options.
15431
15432 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
15433 @option{-d} option @var{letters}. Here are the possible
15434 letters for use in @var{pass} and @var{letters}, and their meanings:
15435
15436 @table @gcctabopt
15437
15438 @item -fdump-rtl-alignments
15439 @opindex fdump-rtl-alignments
15440 Dump after branch alignments have been computed.
15441
15442 @item -fdump-rtl-asmcons
15443 @opindex fdump-rtl-asmcons
15444 Dump after fixing rtl statements that have unsatisfied in/out constraints.
15445
15446 @item -fdump-rtl-auto_inc_dec
15447 @opindex fdump-rtl-auto_inc_dec
15448 Dump after auto-inc-dec discovery. This pass is only run on
15449 architectures that have auto inc or auto dec instructions.
15450
15451 @item -fdump-rtl-barriers
15452 @opindex fdump-rtl-barriers
15453 Dump after cleaning up the barrier instructions.
15454
15455 @item -fdump-rtl-bbpart
15456 @opindex fdump-rtl-bbpart
15457 Dump after partitioning hot and cold basic blocks.
15458
15459 @item -fdump-rtl-bbro
15460 @opindex fdump-rtl-bbro
15461 Dump after block reordering.
15462
15463 @item -fdump-rtl-btl1
15464 @itemx -fdump-rtl-btl2
15465 @opindex fdump-rtl-btl2
15466 @opindex fdump-rtl-btl2
15467 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
15468 after the two branch
15469 target load optimization passes.
15470
15471 @item -fdump-rtl-bypass
15472 @opindex fdump-rtl-bypass
15473 Dump after jump bypassing and control flow optimizations.
15474
15475 @item -fdump-rtl-combine
15476 @opindex fdump-rtl-combine
15477 Dump after the RTL instruction combination pass.
15478
15479 @item -fdump-rtl-compgotos
15480 @opindex fdump-rtl-compgotos
15481 Dump after duplicating the computed gotos.
15482
15483 @item -fdump-rtl-ce1
15484 @itemx -fdump-rtl-ce2
15485 @itemx -fdump-rtl-ce3
15486 @opindex fdump-rtl-ce1
15487 @opindex fdump-rtl-ce2
15488 @opindex fdump-rtl-ce3
15489 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
15490 @option{-fdump-rtl-ce3} enable dumping after the three
15491 if conversion passes.
15492
15493 @item -fdump-rtl-cprop_hardreg
15494 @opindex fdump-rtl-cprop_hardreg
15495 Dump after hard register copy propagation.
15496
15497 @item -fdump-rtl-csa
15498 @opindex fdump-rtl-csa
15499 Dump after combining stack adjustments.
15500
15501 @item -fdump-rtl-cse1
15502 @itemx -fdump-rtl-cse2
15503 @opindex fdump-rtl-cse1
15504 @opindex fdump-rtl-cse2
15505 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
15506 the two common subexpression elimination passes.
15507
15508 @item -fdump-rtl-dce
15509 @opindex fdump-rtl-dce
15510 Dump after the standalone dead code elimination passes.
15511
15512 @item -fdump-rtl-dbr
15513 @opindex fdump-rtl-dbr
15514 Dump after delayed branch scheduling.
15515
15516 @item -fdump-rtl-dce1
15517 @itemx -fdump-rtl-dce2
15518 @opindex fdump-rtl-dce1
15519 @opindex fdump-rtl-dce2
15520 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
15521 the two dead store elimination passes.
15522
15523 @item -fdump-rtl-eh
15524 @opindex fdump-rtl-eh
15525 Dump after finalization of EH handling code.
15526
15527 @item -fdump-rtl-eh_ranges
15528 @opindex fdump-rtl-eh_ranges
15529 Dump after conversion of EH handling range regions.
15530
15531 @item -fdump-rtl-expand
15532 @opindex fdump-rtl-expand
15533 Dump after RTL generation.
15534
15535 @item -fdump-rtl-fwprop1
15536 @itemx -fdump-rtl-fwprop2
15537 @opindex fdump-rtl-fwprop1
15538 @opindex fdump-rtl-fwprop2
15539 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
15540 dumping after the two forward propagation passes.
15541
15542 @item -fdump-rtl-gcse1
15543 @itemx -fdump-rtl-gcse2
15544 @opindex fdump-rtl-gcse1
15545 @opindex fdump-rtl-gcse2
15546 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
15547 after global common subexpression elimination.
15548
15549 @item -fdump-rtl-init-regs
15550 @opindex fdump-rtl-init-regs
15551 Dump after the initialization of the registers.
15552
15553 @item -fdump-rtl-initvals
15554 @opindex fdump-rtl-initvals
15555 Dump after the computation of the initial value sets.
15556
15557 @item -fdump-rtl-into_cfglayout
15558 @opindex fdump-rtl-into_cfglayout
15559 Dump after converting to cfglayout mode.
15560
15561 @item -fdump-rtl-ira
15562 @opindex fdump-rtl-ira
15563 Dump after iterated register allocation.
15564
15565 @item -fdump-rtl-jump
15566 @opindex fdump-rtl-jump
15567 Dump after the second jump optimization.
15568
15569 @item -fdump-rtl-loop2
15570 @opindex fdump-rtl-loop2
15571 @option{-fdump-rtl-loop2} enables dumping after the rtl
15572 loop optimization passes.
15573
15574 @item -fdump-rtl-mach
15575 @opindex fdump-rtl-mach
15576 Dump after performing the machine dependent reorganization pass, if that
15577 pass exists.
15578
15579 @item -fdump-rtl-mode_sw
15580 @opindex fdump-rtl-mode_sw
15581 Dump after removing redundant mode switches.
15582
15583 @item -fdump-rtl-rnreg
15584 @opindex fdump-rtl-rnreg
15585 Dump after register renumbering.
15586
15587 @item -fdump-rtl-outof_cfglayout
15588 @opindex fdump-rtl-outof_cfglayout
15589 Dump after converting from cfglayout mode.
15590
15591 @item -fdump-rtl-peephole2
15592 @opindex fdump-rtl-peephole2
15593 Dump after the peephole pass.
15594
15595 @item -fdump-rtl-postreload
15596 @opindex fdump-rtl-postreload
15597 Dump after post-reload optimizations.
15598
15599 @item -fdump-rtl-pro_and_epilogue
15600 @opindex fdump-rtl-pro_and_epilogue
15601 Dump after generating the function prologues and epilogues.
15602
15603 @item -fdump-rtl-sched1
15604 @itemx -fdump-rtl-sched2
15605 @opindex fdump-rtl-sched1
15606 @opindex fdump-rtl-sched2
15607 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
15608 after the basic block scheduling passes.
15609
15610 @item -fdump-rtl-ree
15611 @opindex fdump-rtl-ree
15612 Dump after sign/zero extension elimination.
15613
15614 @item -fdump-rtl-seqabstr
15615 @opindex fdump-rtl-seqabstr
15616 Dump after common sequence discovery.
15617
15618 @item -fdump-rtl-shorten
15619 @opindex fdump-rtl-shorten
15620 Dump after shortening branches.
15621
15622 @item -fdump-rtl-sibling
15623 @opindex fdump-rtl-sibling
15624 Dump after sibling call optimizations.
15625
15626 @item -fdump-rtl-split1
15627 @itemx -fdump-rtl-split2
15628 @itemx -fdump-rtl-split3
15629 @itemx -fdump-rtl-split4
15630 @itemx -fdump-rtl-split5
15631 @opindex fdump-rtl-split1
15632 @opindex fdump-rtl-split2
15633 @opindex fdump-rtl-split3
15634 @opindex fdump-rtl-split4
15635 @opindex fdump-rtl-split5
15636 These options enable dumping after five rounds of
15637 instruction splitting.
15638
15639 @item -fdump-rtl-sms
15640 @opindex fdump-rtl-sms
15641 Dump after modulo scheduling. This pass is only run on some
15642 architectures.
15643
15644 @item -fdump-rtl-stack
15645 @opindex fdump-rtl-stack
15646 Dump after conversion from GCC's ``flat register file'' registers to the
15647 x87's stack-like registers. This pass is only run on x86 variants.
15648
15649 @item -fdump-rtl-subreg1
15650 @itemx -fdump-rtl-subreg2
15651 @opindex fdump-rtl-subreg1
15652 @opindex fdump-rtl-subreg2
15653 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
15654 the two subreg expansion passes.
15655
15656 @item -fdump-rtl-unshare
15657 @opindex fdump-rtl-unshare
15658 Dump after all rtl has been unshared.
15659
15660 @item -fdump-rtl-vartrack
15661 @opindex fdump-rtl-vartrack
15662 Dump after variable tracking.
15663
15664 @item -fdump-rtl-vregs
15665 @opindex fdump-rtl-vregs
15666 Dump after converting virtual registers to hard registers.
15667
15668 @item -fdump-rtl-web
15669 @opindex fdump-rtl-web
15670 Dump after live range splitting.
15671
15672 @item -fdump-rtl-regclass
15673 @itemx -fdump-rtl-subregs_of_mode_init
15674 @itemx -fdump-rtl-subregs_of_mode_finish
15675 @itemx -fdump-rtl-dfinit
15676 @itemx -fdump-rtl-dfinish
15677 @opindex fdump-rtl-regclass
15678 @opindex fdump-rtl-subregs_of_mode_init
15679 @opindex fdump-rtl-subregs_of_mode_finish
15680 @opindex fdump-rtl-dfinit
15681 @opindex fdump-rtl-dfinish
15682 These dumps are defined but always produce empty files.
15683
15684 @item -da
15685 @itemx -fdump-rtl-all
15686 @opindex da
15687 @opindex fdump-rtl-all
15688 Produce all the dumps listed above.
15689
15690 @item -dA
15691 @opindex dA
15692 Annotate the assembler output with miscellaneous debugging information.
15693
15694 @item -dD
15695 @opindex dD
15696 Dump all macro definitions, at the end of preprocessing, in addition to
15697 normal output.
15698
15699 @item -dH
15700 @opindex dH
15701 Produce a core dump whenever an error occurs.
15702
15703 @item -dp
15704 @opindex dp
15705 Annotate the assembler output with a comment indicating which
15706 pattern and alternative is used. The length and cost of each instruction are
15707 also printed.
15708
15709 @item -dP
15710 @opindex dP
15711 Dump the RTL in the assembler output as a comment before each instruction.
15712 Also turns on @option{-dp} annotation.
15713
15714 @item -dx
15715 @opindex dx
15716 Just generate RTL for a function instead of compiling it. Usually used
15717 with @option{-fdump-rtl-expand}.
15718 @end table
15719
15720 @item -fdump-debug
15721 @opindex fdump-debug
15722 Dump debugging information generated during the debug
15723 generation phase.
15724
15725 @item -fdump-earlydebug
15726 @opindex fdump-earlydebug
15727 Dump debugging information generated during the early debug
15728 generation phase.
15729
15730 @item -fdump-noaddr
15731 @opindex fdump-noaddr
15732 When doing debugging dumps, suppress address output. This makes it more
15733 feasible to use diff on debugging dumps for compiler invocations with
15734 different compiler binaries and/or different
15735 text / bss / data / heap / stack / dso start locations.
15736
15737 @item -freport-bug
15738 @opindex freport-bug
15739 Collect and dump debug information into a temporary file if an
15740 internal compiler error (ICE) occurs.
15741
15742 @item -fdump-unnumbered
15743 @opindex fdump-unnumbered
15744 When doing debugging dumps, suppress instruction numbers and address output.
15745 This makes it more feasible to use diff on debugging dumps for compiler
15746 invocations with different options, in particular with and without
15747 @option{-g}.
15748
15749 @item -fdump-unnumbered-links
15750 @opindex fdump-unnumbered-links
15751 When doing debugging dumps (see @option{-d} option above), suppress
15752 instruction numbers for the links to the previous and next instructions
15753 in a sequence.
15754
15755 @item -fdump-ipa-@var{switch}
15756 @itemx -fdump-ipa-@var{switch}-@var{options}
15757 @opindex fdump-ipa
15758 Control the dumping at various stages of inter-procedural analysis
15759 language tree to a file. The file name is generated by appending a
15760 switch specific suffix to the source file name, and the file is created
15761 in the same directory as the output file. The following dumps are
15762 possible:
15763
15764 @table @samp
15765 @item all
15766 Enables all inter-procedural analysis dumps.
15767
15768 @item cgraph
15769 Dumps information about call-graph optimization, unused function removal,
15770 and inlining decisions.
15771
15772 @item inline
15773 Dump after function inlining.
15774
15775 @end table
15776
15777 Additionally, the options @option{-optimized}, @option{-missed},
15778 @option{-note}, and @option{-all} can be provided, with the same meaning
15779 as for @option{-fopt-info}, defaulting to @option{-optimized}.
15780
15781 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
15782 information on callsites that were inlined, along with callsites
15783 that were not inlined.
15784
15785 By default, the dump will contain messages about successful
15786 optimizations (equivalent to @option{-optimized}) together with
15787 low-level details about the analysis.
15788
15789 @item -fdump-lang-all
15790 @itemx -fdump-lang-@var{switch}
15791 @itemx -fdump-lang-@var{switch}-@var{options}
15792 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
15793 @opindex fdump-lang-all
15794 @opindex fdump-lang
15795 Control the dumping of language-specific information. The @var{options}
15796 and @var{filename} portions behave as described in the
15797 @option{-fdump-tree} option. The following @var{switch} values are
15798 accepted:
15799
15800 @table @samp
15801 @item all
15802
15803 Enable all language-specific dumps.
15804
15805 @item class
15806 Dump class hierarchy information. Virtual table information is emitted
15807 unless '@option{slim}' is specified. This option is applicable to C++ only.
15808
15809 @item raw
15810 Dump the raw internal tree data. This option is applicable to C++ only.
15811
15812 @end table
15813
15814 @item -fdump-passes
15815 @opindex fdump-passes
15816 Print on @file{stderr} the list of optimization passes that are turned
15817 on and off by the current command-line options.
15818
15819 @item -fdump-statistics-@var{option}
15820 @opindex fdump-statistics
15821 Enable and control dumping of pass statistics in a separate file. The
15822 file name is generated by appending a suffix ending in
15823 @samp{.statistics} to the source file name, and the file is created in
15824 the same directory as the output file. If the @samp{-@var{option}}
15825 form is used, @samp{-stats} causes counters to be summed over the
15826 whole compilation unit while @samp{-details} dumps every event as
15827 the passes generate them. The default with no option is to sum
15828 counters for each function compiled.
15829
15830 @item -fdump-tree-all
15831 @itemx -fdump-tree-@var{switch}
15832 @itemx -fdump-tree-@var{switch}-@var{options}
15833 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
15834 @opindex fdump-tree-all
15835 @opindex fdump-tree
15836 Control the dumping at various stages of processing the intermediate
15837 language tree to a file. If the @samp{-@var{options}}
15838 form is used, @var{options} is a list of @samp{-} separated options
15839 which control the details of the dump. Not all options are applicable
15840 to all dumps; those that are not meaningful are ignored. The
15841 following options are available
15842
15843 @table @samp
15844 @item address
15845 Print the address of each node. Usually this is not meaningful as it
15846 changes according to the environment and source file. Its primary use
15847 is for tying up a dump file with a debug environment.
15848 @item asmname
15849 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
15850 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
15851 use working backward from mangled names in the assembly file.
15852 @item slim
15853 When dumping front-end intermediate representations, inhibit dumping
15854 of members of a scope or body of a function merely because that scope
15855 has been reached. Only dump such items when they are directly reachable
15856 by some other path.
15857
15858 When dumping pretty-printed trees, this option inhibits dumping the
15859 bodies of control structures.
15860
15861 When dumping RTL, print the RTL in slim (condensed) form instead of
15862 the default LISP-like representation.
15863 @item raw
15864 Print a raw representation of the tree. By default, trees are
15865 pretty-printed into a C-like representation.
15866 @item details
15867 Enable more detailed dumps (not honored by every dump option). Also
15868 include information from the optimization passes.
15869 @item stats
15870 Enable dumping various statistics about the pass (not honored by every dump
15871 option).
15872 @item blocks
15873 Enable showing basic block boundaries (disabled in raw dumps).
15874 @item graph
15875 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
15876 dump a representation of the control flow graph suitable for viewing with
15877 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
15878 the file is pretty-printed as a subgraph, so that GraphViz can render them
15879 all in a single plot.
15880
15881 This option currently only works for RTL dumps, and the RTL is always
15882 dumped in slim form.
15883 @item vops
15884 Enable showing virtual operands for every statement.
15885 @item lineno
15886 Enable showing line numbers for statements.
15887 @item uid
15888 Enable showing the unique ID (@code{DECL_UID}) for each variable.
15889 @item verbose
15890 Enable showing the tree dump for each statement.
15891 @item eh
15892 Enable showing the EH region number holding each statement.
15893 @item scev
15894 Enable showing scalar evolution analysis details.
15895 @item optimized
15896 Enable showing optimization information (only available in certain
15897 passes).
15898 @item missed
15899 Enable showing missed optimization information (only available in certain
15900 passes).
15901 @item note
15902 Enable other detailed optimization information (only available in
15903 certain passes).
15904 @item all
15905 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
15906 and @option{lineno}.
15907 @item optall
15908 Turn on all optimization options, i.e., @option{optimized},
15909 @option{missed}, and @option{note}.
15910 @end table
15911
15912 To determine what tree dumps are available or find the dump for a pass
15913 of interest follow the steps below.
15914
15915 @enumerate
15916 @item
15917 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
15918 look for a code that corresponds to the pass you are interested in.
15919 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
15920 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
15921 The number at the end distinguishes distinct invocations of the same pass.
15922 @item
15923 To enable the creation of the dump file, append the pass code to
15924 the @option{-fdump-} option prefix and invoke GCC with it. For example,
15925 to enable the dump from the Early Value Range Propagation pass, invoke
15926 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
15927 specify the name of the dump file. If you don't specify one, GCC
15928 creates as described below.
15929 @item
15930 Find the pass dump in a file whose name is composed of three components
15931 separated by a period: the name of the source file GCC was invoked to
15932 compile, a numeric suffix indicating the pass number followed by the
15933 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
15934 and finally the pass code. For example, the Early VRP pass dump might
15935 be in a file named @file{myfile.c.038t.evrp} in the current working
15936 directory. Note that the numeric codes are not stable and may change
15937 from one version of GCC to another.
15938 @end enumerate
15939
15940 @item -fopt-info
15941 @itemx -fopt-info-@var{options}
15942 @itemx -fopt-info-@var{options}=@var{filename}
15943 @opindex fopt-info
15944 Controls optimization dumps from various optimization passes. If the
15945 @samp{-@var{options}} form is used, @var{options} is a list of
15946 @samp{-} separated option keywords to select the dump details and
15947 optimizations.
15948
15949 The @var{options} can be divided into three groups:
15950 @enumerate
15951 @item
15952 options describing what kinds of messages should be emitted,
15953 @item
15954 options describing the verbosity of the dump, and
15955 @item
15956 options describing which optimizations should be included.
15957 @end enumerate
15958 The options from each group can be freely mixed as they are
15959 non-overlapping. However, in case of any conflicts,
15960 the later options override the earlier options on the command
15961 line.
15962
15963 The following options control which kinds of messages should be emitted:
15964
15965 @table @samp
15966 @item optimized
15967 Print information when an optimization is successfully applied. It is
15968 up to a pass to decide which information is relevant. For example, the
15969 vectorizer passes print the source location of loops which are
15970 successfully vectorized.
15971 @item missed
15972 Print information about missed optimizations. Individual passes
15973 control which information to include in the output.
15974 @item note
15975 Print verbose information about optimizations, such as certain
15976 transformations, more detailed messages about decisions etc.
15977 @item all
15978 Print detailed optimization information. This includes
15979 @samp{optimized}, @samp{missed}, and @samp{note}.
15980 @end table
15981
15982 The following option controls the dump verbosity:
15983
15984 @table @samp
15985 @item internals
15986 By default, only ``high-level'' messages are emitted. This option enables
15987 additional, more detailed, messages, which are likely to only be of interest
15988 to GCC developers.
15989 @end table
15990
15991 One or more of the following option keywords can be used to describe a
15992 group of optimizations:
15993
15994 @table @samp
15995 @item ipa
15996 Enable dumps from all interprocedural optimizations.
15997 @item loop
15998 Enable dumps from all loop optimizations.
15999 @item inline
16000 Enable dumps from all inlining optimizations.
16001 @item omp
16002 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
16003 @item vec
16004 Enable dumps from all vectorization optimizations.
16005 @item optall
16006 Enable dumps from all optimizations. This is a superset of
16007 the optimization groups listed above.
16008 @end table
16009
16010 If @var{options} is
16011 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
16012 about successful optimizations from all the passes, omitting messages
16013 that are treated as ``internals''.
16014
16015 If the @var{filename} is provided, then the dumps from all the
16016 applicable optimizations are concatenated into the @var{filename}.
16017 Otherwise the dump is output onto @file{stderr}. Though multiple
16018 @option{-fopt-info} options are accepted, only one of them can include
16019 a @var{filename}. If other filenames are provided then all but the
16020 first such option are ignored.
16021
16022 Note that the output @var{filename} is overwritten
16023 in case of multiple translation units. If a combined output from
16024 multiple translation units is desired, @file{stderr} should be used
16025 instead.
16026
16027 In the following example, the optimization info is output to
16028 @file{stderr}:
16029
16030 @smallexample
16031 gcc -O3 -fopt-info
16032 @end smallexample
16033
16034 This example:
16035 @smallexample
16036 gcc -O3 -fopt-info-missed=missed.all
16037 @end smallexample
16038
16039 @noindent
16040 outputs missed optimization report from all the passes into
16041 @file{missed.all}, and this one:
16042
16043 @smallexample
16044 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
16045 @end smallexample
16046
16047 @noindent
16048 prints information about missed optimization opportunities from
16049 vectorization passes on @file{stderr}.
16050 Note that @option{-fopt-info-vec-missed} is equivalent to
16051 @option{-fopt-info-missed-vec}. The order of the optimization group
16052 names and message types listed after @option{-fopt-info} does not matter.
16053
16054 As another example,
16055 @smallexample
16056 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
16057 @end smallexample
16058
16059 @noindent
16060 outputs information about missed optimizations as well as
16061 optimized locations from all the inlining passes into
16062 @file{inline.txt}.
16063
16064 Finally, consider:
16065
16066 @smallexample
16067 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
16068 @end smallexample
16069
16070 @noindent
16071 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
16072 in conflict since only one output file is allowed. In this case, only
16073 the first option takes effect and the subsequent options are
16074 ignored. Thus only @file{vec.miss} is produced which contains
16075 dumps from the vectorizer about missed opportunities.
16076
16077 @item -fsave-optimization-record
16078 @opindex fsave-optimization-record
16079 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
16080 were performed, for those optimizations that support @option{-fopt-info}.
16081
16082 This option is experimental and the format of the data within the
16083 compressed JSON file is subject to change.
16084
16085 It is roughly equivalent to a machine-readable version of
16086 @option{-fopt-info-all}, as a collection of messages with source file,
16087 line number and column number, with the following additional data for
16088 each message:
16089
16090 @itemize @bullet
16091
16092 @item
16093 the execution count of the code being optimized, along with metadata about
16094 whether this was from actual profile data, or just an estimate, allowing
16095 consumers to prioritize messages by code hotness,
16096
16097 @item
16098 the function name of the code being optimized, where applicable,
16099
16100 @item
16101 the ``inlining chain'' for the code being optimized, so that when
16102 a function is inlined into several different places (which might
16103 themselves be inlined), the reader can distinguish between the copies,
16104
16105 @item
16106 objects identifying those parts of the message that refer to expressions,
16107 statements or symbol-table nodes, which of these categories they are, and,
16108 when available, their source code location,
16109
16110 @item
16111 the GCC pass that emitted the message, and
16112
16113 @item
16114 the location in GCC's own code from which the message was emitted
16115
16116 @end itemize
16117
16118 Additionally, some messages are logically nested within other
16119 messages, reflecting implementation details of the optimization
16120 passes.
16121
16122 @item -fsched-verbose=@var{n}
16123 @opindex fsched-verbose
16124 On targets that use instruction scheduling, this option controls the
16125 amount of debugging output the scheduler prints to the dump files.
16126
16127 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
16128 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
16129 For @var{n} greater than one, it also output basic block probabilities,
16130 detailed ready list information and unit/insn info. For @var{n} greater
16131 than two, it includes RTL at abort point, control-flow and regions info.
16132 And for @var{n} over four, @option{-fsched-verbose} also includes
16133 dependence info.
16134
16135
16136
16137 @item -fenable-@var{kind}-@var{pass}
16138 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
16139 @opindex fdisable-
16140 @opindex fenable-
16141
16142 This is a set of options that are used to explicitly disable/enable
16143 optimization passes. These options are intended for use for debugging GCC.
16144 Compiler users should use regular options for enabling/disabling
16145 passes instead.
16146
16147 @table @gcctabopt
16148
16149 @item -fdisable-ipa-@var{pass}
16150 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
16151 statically invoked in the compiler multiple times, the pass name should be
16152 appended with a sequential number starting from 1.
16153
16154 @item -fdisable-rtl-@var{pass}
16155 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
16156 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
16157 statically invoked in the compiler multiple times, the pass name should be
16158 appended with a sequential number starting from 1. @var{range-list} is a
16159 comma-separated list of function ranges or assembler names. Each range is a number
16160 pair separated by a colon. The range is inclusive in both ends. If the range
16161 is trivial, the number pair can be simplified as a single number. If the
16162 function's call graph node's @var{uid} falls within one of the specified ranges,
16163 the @var{pass} is disabled for that function. The @var{uid} is shown in the
16164 function header of a dump file, and the pass names can be dumped by using
16165 option @option{-fdump-passes}.
16166
16167 @item -fdisable-tree-@var{pass}
16168 @itemx -fdisable-tree-@var{pass}=@var{range-list}
16169 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
16170 option arguments.
16171
16172 @item -fenable-ipa-@var{pass}
16173 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
16174 statically invoked in the compiler multiple times, the pass name should be
16175 appended with a sequential number starting from 1.
16176
16177 @item -fenable-rtl-@var{pass}
16178 @itemx -fenable-rtl-@var{pass}=@var{range-list}
16179 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
16180 description and examples.
16181
16182 @item -fenable-tree-@var{pass}
16183 @itemx -fenable-tree-@var{pass}=@var{range-list}
16184 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
16185 of option arguments.
16186
16187 @end table
16188
16189 Here are some examples showing uses of these options.
16190
16191 @smallexample
16192
16193 # disable ccp1 for all functions
16194 -fdisable-tree-ccp1
16195 # disable complete unroll for function whose cgraph node uid is 1
16196 -fenable-tree-cunroll=1
16197 # disable gcse2 for functions at the following ranges [1,1],
16198 # [300,400], and [400,1000]
16199 # disable gcse2 for functions foo and foo2
16200 -fdisable-rtl-gcse2=foo,foo2
16201 # disable early inlining
16202 -fdisable-tree-einline
16203 # disable ipa inlining
16204 -fdisable-ipa-inline
16205 # enable tree full unroll
16206 -fenable-tree-unroll
16207
16208 @end smallexample
16209
16210 @item -fchecking
16211 @itemx -fchecking=@var{n}
16212 @opindex fchecking
16213 @opindex fno-checking
16214 Enable internal consistency checking. The default depends on
16215 the compiler configuration. @option{-fchecking=2} enables further
16216 internal consistency checking that might affect code generation.
16217
16218 @item -frandom-seed=@var{string}
16219 @opindex frandom-seed
16220 This option provides a seed that GCC uses in place of
16221 random numbers in generating certain symbol names
16222 that have to be different in every compiled file. It is also used to
16223 place unique stamps in coverage data files and the object files that
16224 produce them. You can use the @option{-frandom-seed} option to produce
16225 reproducibly identical object files.
16226
16227 The @var{string} can either be a number (decimal, octal or hex) or an
16228 arbitrary string (in which case it's converted to a number by
16229 computing CRC32).
16230
16231 The @var{string} should be different for every file you compile.
16232
16233 @item -save-temps
16234 @itemx -save-temps=cwd
16235 @opindex save-temps
16236 Store the usual ``temporary'' intermediate files permanently; place them
16237 in the current directory and name them based on the source file. Thus,
16238 compiling @file{foo.c} with @option{-c -save-temps} produces files
16239 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
16240 preprocessed @file{foo.i} output file even though the compiler now
16241 normally uses an integrated preprocessor.
16242
16243 When used in combination with the @option{-x} command-line option,
16244 @option{-save-temps} is sensible enough to avoid over writing an
16245 input source file with the same extension as an intermediate file.
16246 The corresponding intermediate file may be obtained by renaming the
16247 source file before using @option{-save-temps}.
16248
16249 If you invoke GCC in parallel, compiling several different source
16250 files that share a common base name in different subdirectories or the
16251 same source file compiled for multiple output destinations, it is
16252 likely that the different parallel compilers will interfere with each
16253 other, and overwrite the temporary files. For instance:
16254
16255 @smallexample
16256 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
16257 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
16258 @end smallexample
16259
16260 may result in @file{foo.i} and @file{foo.o} being written to
16261 simultaneously by both compilers.
16262
16263 @item -save-temps=obj
16264 @opindex save-temps=obj
16265 Store the usual ``temporary'' intermediate files permanently. If the
16266 @option{-o} option is used, the temporary files are based on the
16267 object file. If the @option{-o} option is not used, the
16268 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
16269
16270 For example:
16271
16272 @smallexample
16273 gcc -save-temps=obj -c foo.c
16274 gcc -save-temps=obj -c bar.c -o dir/xbar.o
16275 gcc -save-temps=obj foobar.c -o dir2/yfoobar
16276 @end smallexample
16277
16278 @noindent
16279 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
16280 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
16281 @file{dir2/yfoobar.o}.
16282
16283 @item -time@r{[}=@var{file}@r{]}
16284 @opindex time
16285 Report the CPU time taken by each subprocess in the compilation
16286 sequence. For C source files, this is the compiler proper and assembler
16287 (plus the linker if linking is done).
16288
16289 Without the specification of an output file, the output looks like this:
16290
16291 @smallexample
16292 # cc1 0.12 0.01
16293 # as 0.00 0.01
16294 @end smallexample
16295
16296 The first number on each line is the ``user time'', that is time spent
16297 executing the program itself. The second number is ``system time'',
16298 time spent executing operating system routines on behalf of the program.
16299 Both numbers are in seconds.
16300
16301 With the specification of an output file, the output is appended to the
16302 named file, and it looks like this:
16303
16304 @smallexample
16305 0.12 0.01 cc1 @var{options}
16306 0.00 0.01 as @var{options}
16307 @end smallexample
16308
16309 The ``user time'' and the ``system time'' are moved before the program
16310 name, and the options passed to the program are displayed, so that one
16311 can later tell what file was being compiled, and with which options.
16312
16313 @item -fdump-final-insns@r{[}=@var{file}@r{]}
16314 @opindex fdump-final-insns
16315 Dump the final internal representation (RTL) to @var{file}. If the
16316 optional argument is omitted (or if @var{file} is @code{.}), the name
16317 of the dump file is determined by appending @code{.gkd} to the
16318 compilation output file name.
16319
16320 @item -fcompare-debug@r{[}=@var{opts}@r{]}
16321 @opindex fcompare-debug
16322 @opindex fno-compare-debug
16323 If no error occurs during compilation, run the compiler a second time,
16324 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
16325 passed to the second compilation. Dump the final internal
16326 representation in both compilations, and print an error if they differ.
16327
16328 If the equal sign is omitted, the default @option{-gtoggle} is used.
16329
16330 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
16331 and nonzero, implicitly enables @option{-fcompare-debug}. If
16332 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
16333 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
16334 is used.
16335
16336 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
16337 is equivalent to @option{-fno-compare-debug}, which disables the dumping
16338 of the final representation and the second compilation, preventing even
16339 @env{GCC_COMPARE_DEBUG} from taking effect.
16340
16341 To verify full coverage during @option{-fcompare-debug} testing, set
16342 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
16343 which GCC rejects as an invalid option in any actual compilation
16344 (rather than preprocessing, assembly or linking). To get just a
16345 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
16346 not overridden} will do.
16347
16348 @item -fcompare-debug-second
16349 @opindex fcompare-debug-second
16350 This option is implicitly passed to the compiler for the second
16351 compilation requested by @option{-fcompare-debug}, along with options to
16352 silence warnings, and omitting other options that would cause the compiler
16353 to produce output to files or to standard output as a side effect. Dump
16354 files and preserved temporary files are renamed so as to contain the
16355 @code{.gk} additional extension during the second compilation, to avoid
16356 overwriting those generated by the first.
16357
16358 When this option is passed to the compiler driver, it causes the
16359 @emph{first} compilation to be skipped, which makes it useful for little
16360 other than debugging the compiler proper.
16361
16362 @item -gtoggle
16363 @opindex gtoggle
16364 Turn off generation of debug info, if leaving out this option
16365 generates it, or turn it on at level 2 otherwise. The position of this
16366 argument in the command line does not matter; it takes effect after all
16367 other options are processed, and it does so only once, no matter how
16368 many times it is given. This is mainly intended to be used with
16369 @option{-fcompare-debug}.
16370
16371 @item -fvar-tracking-assignments-toggle
16372 @opindex fvar-tracking-assignments-toggle
16373 @opindex fno-var-tracking-assignments-toggle
16374 Toggle @option{-fvar-tracking-assignments}, in the same way that
16375 @option{-gtoggle} toggles @option{-g}.
16376
16377 @item -Q
16378 @opindex Q
16379 Makes the compiler print out each function name as it is compiled, and
16380 print some statistics about each pass when it finishes.
16381
16382 @item -ftime-report
16383 @opindex ftime-report
16384 Makes the compiler print some statistics about the time consumed by each
16385 pass when it finishes.
16386
16387 @item -ftime-report-details
16388 @opindex ftime-report-details
16389 Record the time consumed by infrastructure parts separately for each pass.
16390
16391 @item -fira-verbose=@var{n}
16392 @opindex fira-verbose
16393 Control the verbosity of the dump file for the integrated register allocator.
16394 The default value is 5. If the value @var{n} is greater or equal to 10,
16395 the dump output is sent to stderr using the same format as @var{n} minus 10.
16396
16397 @item -flto-report
16398 @opindex flto-report
16399 Prints a report with internal details on the workings of the link-time
16400 optimizer. The contents of this report vary from version to version.
16401 It is meant to be useful to GCC developers when processing object
16402 files in LTO mode (via @option{-flto}).
16403
16404 Disabled by default.
16405
16406 @item -flto-report-wpa
16407 @opindex flto-report-wpa
16408 Like @option{-flto-report}, but only print for the WPA phase of link-time
16409 optimization.
16410
16411 @item -fmem-report
16412 @opindex fmem-report
16413 Makes the compiler print some statistics about permanent memory
16414 allocation when it finishes.
16415
16416 @item -fmem-report-wpa
16417 @opindex fmem-report-wpa
16418 Makes the compiler print some statistics about permanent memory
16419 allocation for the WPA phase only.
16420
16421 @item -fpre-ipa-mem-report
16422 @opindex fpre-ipa-mem-report
16423 @item -fpost-ipa-mem-report
16424 @opindex fpost-ipa-mem-report
16425 Makes the compiler print some statistics about permanent memory
16426 allocation before or after interprocedural optimization.
16427
16428 @item -fprofile-report
16429 @opindex fprofile-report
16430 Makes the compiler print some statistics about consistency of the
16431 (estimated) profile and effect of individual passes.
16432
16433 @item -fstack-usage
16434 @opindex fstack-usage
16435 Makes the compiler output stack usage information for the program, on a
16436 per-function basis. The filename for the dump is made by appending
16437 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
16438 the output file, if explicitly specified and it is not an executable,
16439 otherwise it is the basename of the source file. An entry is made up
16440 of three fields:
16441
16442 @itemize
16443 @item
16444 The name of the function.
16445 @item
16446 A number of bytes.
16447 @item
16448 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
16449 @end itemize
16450
16451 The qualifier @code{static} means that the function manipulates the stack
16452 statically: a fixed number of bytes are allocated for the frame on function
16453 entry and released on function exit; no stack adjustments are otherwise made
16454 in the function. The second field is this fixed number of bytes.
16455
16456 The qualifier @code{dynamic} means that the function manipulates the stack
16457 dynamically: in addition to the static allocation described above, stack
16458 adjustments are made in the body of the function, for example to push/pop
16459 arguments around function calls. If the qualifier @code{bounded} is also
16460 present, the amount of these adjustments is bounded at compile time and
16461 the second field is an upper bound of the total amount of stack used by
16462 the function. If it is not present, the amount of these adjustments is
16463 not bounded at compile time and the second field only represents the
16464 bounded part.
16465
16466 @item -fstats
16467 @opindex fstats
16468 Emit statistics about front-end processing at the end of the compilation.
16469 This option is supported only by the C++ front end, and
16470 the information is generally only useful to the G++ development team.
16471
16472 @item -fdbg-cnt-list
16473 @opindex fdbg-cnt-list
16474 Print the name and the counter upper bound for all debug counters.
16475
16476
16477 @item -fdbg-cnt=@var{counter-value-list}
16478 @opindex fdbg-cnt
16479 Set the internal debug counter lower and upper bound. @var{counter-value-list}
16480 is a comma-separated list of @var{name}:@var{lower_bound1}-@var{upper_bound1}
16481 [:@var{lower_bound2}-@var{upper_bound2}...] tuples which sets
16482 the name of the counter and list of closed intervals.
16483 The @var{lower_bound} is optional and is zero
16484 initialized if not set.
16485 For example, with @option{-fdbg-cnt=dce:2-4:10-11,tail_call:10},
16486 @code{dbg_cnt(dce)} returns true only for second, third, fourth, tenth and
16487 eleventh invocation.
16488 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
16489
16490 @item -print-file-name=@var{library}
16491 @opindex print-file-name
16492 Print the full absolute name of the library file @var{library} that
16493 would be used when linking---and don't do anything else. With this
16494 option, GCC does not compile or link anything; it just prints the
16495 file name.
16496
16497 @item -print-multi-directory
16498 @opindex print-multi-directory
16499 Print the directory name corresponding to the multilib selected by any
16500 other switches present in the command line. This directory is supposed
16501 to exist in @env{GCC_EXEC_PREFIX}.
16502
16503 @item -print-multi-lib
16504 @opindex print-multi-lib
16505 Print the mapping from multilib directory names to compiler switches
16506 that enable them. The directory name is separated from the switches by
16507 @samp{;}, and each switch starts with an @samp{@@} instead of the
16508 @samp{-}, without spaces between multiple switches. This is supposed to
16509 ease shell processing.
16510
16511 @item -print-multi-os-directory
16512 @opindex print-multi-os-directory
16513 Print the path to OS libraries for the selected
16514 multilib, relative to some @file{lib} subdirectory. If OS libraries are
16515 present in the @file{lib} subdirectory and no multilibs are used, this is
16516 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
16517 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
16518 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
16519 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
16520
16521 @item -print-multiarch
16522 @opindex print-multiarch
16523 Print the path to OS libraries for the selected multiarch,
16524 relative to some @file{lib} subdirectory.
16525
16526 @item -print-prog-name=@var{program}
16527 @opindex print-prog-name
16528 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
16529
16530 @item -print-libgcc-file-name
16531 @opindex print-libgcc-file-name
16532 Same as @option{-print-file-name=libgcc.a}.
16533
16534 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
16535 but you do want to link with @file{libgcc.a}. You can do:
16536
16537 @smallexample
16538 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
16539 @end smallexample
16540
16541 @item -print-search-dirs
16542 @opindex print-search-dirs
16543 Print the name of the configured installation directory and a list of
16544 program and library directories @command{gcc} searches---and don't do anything else.
16545
16546 This is useful when @command{gcc} prints the error message
16547 @samp{installation problem, cannot exec cpp0: No such file or directory}.
16548 To resolve this you either need to put @file{cpp0} and the other compiler
16549 components where @command{gcc} expects to find them, or you can set the environment
16550 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
16551 Don't forget the trailing @samp{/}.
16552 @xref{Environment Variables}.
16553
16554 @item -print-sysroot
16555 @opindex print-sysroot
16556 Print the target sysroot directory that is used during
16557 compilation. This is the target sysroot specified either at configure
16558 time or using the @option{--sysroot} option, possibly with an extra
16559 suffix that depends on compilation options. If no target sysroot is
16560 specified, the option prints nothing.
16561
16562 @item -print-sysroot-headers-suffix
16563 @opindex print-sysroot-headers-suffix
16564 Print the suffix added to the target sysroot when searching for
16565 headers, or give an error if the compiler is not configured with such
16566 a suffix---and don't do anything else.
16567
16568 @item -dumpmachine
16569 @opindex dumpmachine
16570 Print the compiler's target machine (for example,
16571 @samp{i686-pc-linux-gnu})---and don't do anything else.
16572
16573 @item -dumpversion
16574 @opindex dumpversion
16575 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
16576 anything else. This is the compiler version used in filesystem paths and
16577 specs. Depending on how the compiler has been configured it can be just
16578 a single number (major version), two numbers separated by a dot (major and
16579 minor version) or three numbers separated by dots (major, minor and patchlevel
16580 version).
16581
16582 @item -dumpfullversion
16583 @opindex dumpfullversion
16584 Print the full compiler version---and don't do anything else. The output is
16585 always three numbers separated by dots, major, minor and patchlevel version.
16586
16587 @item -dumpspecs
16588 @opindex dumpspecs
16589 Print the compiler's built-in specs---and don't do anything else. (This
16590 is used when GCC itself is being built.) @xref{Spec Files}.
16591 @end table
16592
16593 @node Submodel Options
16594 @section Machine-Dependent Options
16595 @cindex submodel options
16596 @cindex specifying hardware config
16597 @cindex hardware models and configurations, specifying
16598 @cindex target-dependent options
16599 @cindex machine-dependent options
16600
16601 Each target machine supported by GCC can have its own options---for
16602 example, to allow you to compile for a particular processor variant or
16603 ABI, or to control optimizations specific to that machine. By
16604 convention, the names of machine-specific options start with
16605 @samp{-m}.
16606
16607 Some configurations of the compiler also support additional target-specific
16608 options, usually for compatibility with other compilers on the same
16609 platform.
16610
16611 @c This list is ordered alphanumerically by subsection name.
16612 @c It should be the same order and spelling as these options are listed
16613 @c in Machine Dependent Options
16614
16615 @menu
16616 * AArch64 Options::
16617 * Adapteva Epiphany Options::
16618 * AMD GCN Options::
16619 * ARC Options::
16620 * ARM Options::
16621 * AVR Options::
16622 * Blackfin Options::
16623 * C6X Options::
16624 * CRIS Options::
16625 * CR16 Options::
16626 * C-SKY Options::
16627 * Darwin Options::
16628 * DEC Alpha Options::
16629 * eBPF Options::
16630 * FR30 Options::
16631 * FT32 Options::
16632 * FRV Options::
16633 * GNU/Linux Options::
16634 * H8/300 Options::
16635 * HPPA Options::
16636 * IA-64 Options::
16637 * LM32 Options::
16638 * M32C Options::
16639 * M32R/D Options::
16640 * M680x0 Options::
16641 * MCore Options::
16642 * MeP Options::
16643 * MicroBlaze Options::
16644 * MIPS Options::
16645 * MMIX Options::
16646 * MN10300 Options::
16647 * Moxie Options::
16648 * MSP430 Options::
16649 * NDS32 Options::
16650 * Nios II Options::
16651 * Nvidia PTX Options::
16652 * OpenRISC Options::
16653 * PDP-11 Options::
16654 * picoChip Options::
16655 * PowerPC Options::
16656 * PRU Options::
16657 * RISC-V Options::
16658 * RL78 Options::
16659 * RS/6000 and PowerPC Options::
16660 * RX Options::
16661 * S/390 and zSeries Options::
16662 * Score Options::
16663 * SH Options::
16664 * Solaris 2 Options::
16665 * SPARC Options::
16666 * System V Options::
16667 * TILE-Gx Options::
16668 * TILEPro Options::
16669 * V850 Options::
16670 * VAX Options::
16671 * Visium Options::
16672 * VMS Options::
16673 * VxWorks Options::
16674 * x86 Options::
16675 * x86 Windows Options::
16676 * Xstormy16 Options::
16677 * Xtensa Options::
16678 * zSeries Options::
16679 @end menu
16680
16681 @node AArch64 Options
16682 @subsection AArch64 Options
16683 @cindex AArch64 Options
16684
16685 These options are defined for AArch64 implementations:
16686
16687 @table @gcctabopt
16688
16689 @item -mabi=@var{name}
16690 @opindex mabi
16691 Generate code for the specified data model. Permissible values
16692 are @samp{ilp32} for SysV-like data model where int, long int and pointers
16693 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
16694 but long int and pointers are 64 bits.
16695
16696 The default depends on the specific target configuration. Note that
16697 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
16698 entire program with the same ABI, and link with a compatible set of libraries.
16699
16700 @item -mbig-endian
16701 @opindex mbig-endian
16702 Generate big-endian code. This is the default when GCC is configured for an
16703 @samp{aarch64_be-*-*} target.
16704
16705 @item -mgeneral-regs-only
16706 @opindex mgeneral-regs-only
16707 Generate code which uses only the general-purpose registers. This will prevent
16708 the compiler from using floating-point and Advanced SIMD registers but will not
16709 impose any restrictions on the assembler.
16710
16711 @item -mlittle-endian
16712 @opindex mlittle-endian
16713 Generate little-endian code. This is the default when GCC is configured for an
16714 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
16715
16716 @item -mcmodel=tiny
16717 @opindex mcmodel=tiny
16718 Generate code for the tiny code model. The program and its statically defined
16719 symbols must be within 1MB of each other. Programs can be statically or
16720 dynamically linked.
16721
16722 @item -mcmodel=small
16723 @opindex mcmodel=small
16724 Generate code for the small code model. The program and its statically defined
16725 symbols must be within 4GB of each other. Programs can be statically or
16726 dynamically linked. This is the default code model.
16727
16728 @item -mcmodel=large
16729 @opindex mcmodel=large
16730 Generate code for the large code model. This makes no assumptions about
16731 addresses and sizes of sections. Programs can be statically linked only.
16732
16733 @item -mstrict-align
16734 @itemx -mno-strict-align
16735 @opindex mstrict-align
16736 @opindex mno-strict-align
16737 Avoid or allow generating memory accesses that may not be aligned on a natural
16738 object boundary as described in the architecture specification.
16739
16740 @item -momit-leaf-frame-pointer
16741 @itemx -mno-omit-leaf-frame-pointer
16742 @opindex momit-leaf-frame-pointer
16743 @opindex mno-omit-leaf-frame-pointer
16744 Omit or keep the frame pointer in leaf functions. The former behavior is the
16745 default.
16746
16747 @item -mstack-protector-guard=@var{guard}
16748 @itemx -mstack-protector-guard-reg=@var{reg}
16749 @itemx -mstack-protector-guard-offset=@var{offset}
16750 @opindex mstack-protector-guard
16751 @opindex mstack-protector-guard-reg
16752 @opindex mstack-protector-guard-offset
16753 Generate stack protection code using canary at @var{guard}. Supported
16754 locations are @samp{global} for a global canary or @samp{sysreg} for a
16755 canary in an appropriate system register.
16756
16757 With the latter choice the options
16758 @option{-mstack-protector-guard-reg=@var{reg}} and
16759 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16760 which system register to use as base register for reading the canary,
16761 and from what offset from that base register. There is no default
16762 register or offset as this is entirely for use within the Linux
16763 kernel.
16764
16765 @item -mstack-protector-guard=@var{guard}
16766 @itemx -mstack-protector-guard-reg=@var{reg}
16767 @itemx -mstack-protector-guard-offset=@var{offset}
16768 @opindex mstack-protector-guard
16769 @opindex mstack-protector-guard-reg
16770 @opindex mstack-protector-guard-offset
16771 Generate stack protection code using canary at @var{guard}. Supported
16772 locations are @samp{global} for a global canary or @samp{sysreg} for a
16773 canary in an appropriate system register.
16774
16775 With the latter choice the options
16776 @option{-mstack-protector-guard-reg=@var{reg}} and
16777 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
16778 which system register to use as base register for reading the canary,
16779 and from what offset from that base register. There is no default
16780 register or offset as this is entirely for use within the Linux
16781 kernel.
16782
16783 @item -mtls-dialect=desc
16784 @opindex mtls-dialect=desc
16785 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
16786 of TLS variables. This is the default.
16787
16788 @item -mtls-dialect=traditional
16789 @opindex mtls-dialect=traditional
16790 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
16791 of TLS variables.
16792
16793 @item -mtls-size=@var{size}
16794 @opindex mtls-size
16795 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
16796 This option requires binutils 2.26 or newer.
16797
16798 @item -mfix-cortex-a53-835769
16799 @itemx -mno-fix-cortex-a53-835769
16800 @opindex mfix-cortex-a53-835769
16801 @opindex mno-fix-cortex-a53-835769
16802 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
16803 This involves inserting a NOP instruction between memory instructions and
16804 64-bit integer multiply-accumulate instructions.
16805
16806 @item -mfix-cortex-a53-843419
16807 @itemx -mno-fix-cortex-a53-843419
16808 @opindex mfix-cortex-a53-843419
16809 @opindex mno-fix-cortex-a53-843419
16810 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
16811 This erratum workaround is made at link time and this will only pass the
16812 corresponding flag to the linker.
16813
16814 @item -mlow-precision-recip-sqrt
16815 @itemx -mno-low-precision-recip-sqrt
16816 @opindex mlow-precision-recip-sqrt
16817 @opindex mno-low-precision-recip-sqrt
16818 Enable or disable the reciprocal square root approximation.
16819 This option only has an effect if @option{-ffast-math} or
16820 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16821 precision of reciprocal square root results to about 16 bits for
16822 single precision and to 32 bits for double precision.
16823
16824 @item -mlow-precision-sqrt
16825 @itemx -mno-low-precision-sqrt
16826 @opindex mlow-precision-sqrt
16827 @opindex mno-low-precision-sqrt
16828 Enable or disable the square root approximation.
16829 This option only has an effect if @option{-ffast-math} or
16830 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16831 precision of square root results to about 16 bits for
16832 single precision and to 32 bits for double precision.
16833 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
16834
16835 @item -mlow-precision-div
16836 @itemx -mno-low-precision-div
16837 @opindex mlow-precision-div
16838 @opindex mno-low-precision-div
16839 Enable or disable the division approximation.
16840 This option only has an effect if @option{-ffast-math} or
16841 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
16842 precision of division results to about 16 bits for
16843 single precision and to 32 bits for double precision.
16844
16845 @item -mtrack-speculation
16846 @itemx -mno-track-speculation
16847 Enable or disable generation of additional code to track speculative
16848 execution through conditional branches. The tracking state can then
16849 be used by the compiler when expanding calls to
16850 @code{__builtin_speculation_safe_copy} to permit a more efficient code
16851 sequence to be generated.
16852
16853 @item -moutline-atomics
16854 @itemx -mno-outline-atomics
16855 Enable or disable calls to out-of-line helpers to implement atomic operations.
16856 These helpers will, at runtime, determine if the LSE instructions from
16857 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
16858 instructions that are present in the base ARMv8.0 ISA.
16859
16860 This option is only applicable when compiling for the base ARMv8.0
16861 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
16862 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
16863 used directly. The same applies when using @option{-mcpu=} when the
16864 selected cpu supports the @samp{lse} feature.
16865
16866 @item -march=@var{name}
16867 @opindex march
16868 Specify the name of the target architecture and, optionally, one or
16869 more feature modifiers. This option has the form
16870 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
16871
16872 The table below summarizes the permissible values for @var{arch}
16873 and the features that they enable by default:
16874
16875 @multitable @columnfractions 0.20 0.20 0.60
16876 @headitem @var{arch} value @tab Architecture @tab Includes by default
16877 @item @samp{armv8-a} @tab Armv8-A @tab @samp{+fp}, @samp{+simd}
16878 @item @samp{armv8.1-a} @tab Armv8.1-A @tab @samp{armv8-a}, @samp{+crc}, @samp{+lse}, @samp{+rdma}
16879 @item @samp{armv8.2-a} @tab Armv8.2-A @tab @samp{armv8.1-a}
16880 @item @samp{armv8.3-a} @tab Armv8.3-A @tab @samp{armv8.2-a}
16881 @item @samp{armv8.4-a} @tab Armv8.4-A @tab @samp{armv8.3-a}, @samp{+fp16fml}, @samp{+dotprod}
16882 @item @samp{armv8.5-a} @tab Armv8.5-A @tab @samp{armv8.4-a}, @samp{+sb}, @samp{+ssbs}, @samp{+predres}
16883 @item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
16884 @end multitable
16885
16886 The value @samp{native} is available on native AArch64 GNU/Linux and
16887 causes the compiler to pick the architecture of the host system. This
16888 option has no effect if the compiler is unable to recognize the
16889 architecture of the host system,
16890
16891 The permissible values for @var{feature} are listed in the sub-section
16892 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16893 Feature Modifiers}. Where conflicting feature modifiers are
16894 specified, the right-most feature is used.
16895
16896 GCC uses @var{name} to determine what kind of instructions it can emit
16897 when generating assembly code. If @option{-march} is specified
16898 without either of @option{-mtune} or @option{-mcpu} also being
16899 specified, the code is tuned to perform well across a range of target
16900 processors implementing the target architecture.
16901
16902 @item -mtune=@var{name}
16903 @opindex mtune
16904 Specify the name of the target processor for which GCC should tune the
16905 performance of the code. Permissible values for this option are:
16906 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
16907 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
16908 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
16909 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
16910 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
16911 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
16912 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
16913 @samp{octeontx81}, @samp{octeontx83},
16914 @samp{octeontx2}, @samp{octeontx2t98}, @samp{octeontx2t96}
16915 @samp{octeontx2t93}, @samp{octeontx2f95}, @samp{octeontx2f95n},
16916 @samp{octeontx2f95mm}
16917 @samp{thunderx}, @samp{thunderxt88},
16918 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
16919 @samp{thunderxt83}, @samp{thunderx2t99},
16920 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16921 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16922 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
16923 @samp{native}.
16924
16925 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
16926 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
16927 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
16928 should tune for a big.LITTLE system.
16929
16930 Additionally on native AArch64 GNU/Linux systems the value
16931 @samp{native} tunes performance to the host system. This option has no effect
16932 if the compiler is unable to recognize the processor of the host system.
16933
16934 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
16935 are specified, the code is tuned to perform well across a range
16936 of target processors.
16937
16938 This option cannot be suffixed by feature modifiers.
16939
16940 @item -mcpu=@var{name}
16941 @opindex mcpu
16942 Specify the name of the target processor, optionally suffixed by one
16943 or more feature modifiers. This option has the form
16944 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
16945 the permissible values for @var{cpu} are the same as those available
16946 for @option{-mtune}. The permissible values for @var{feature} are
16947 documented in the sub-section on
16948 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16949 Feature Modifiers}. Where conflicting feature modifiers are
16950 specified, the right-most feature is used.
16951
16952 GCC uses @var{name} to determine what kind of instructions it can emit when
16953 generating assembly code (as if by @option{-march}) and to determine
16954 the target processor for which to tune for performance (as if
16955 by @option{-mtune}). Where this option is used in conjunction
16956 with @option{-march} or @option{-mtune}, those options take precedence
16957 over the appropriate part of this option.
16958
16959 @item -moverride=@var{string}
16960 @opindex moverride
16961 Override tuning decisions made by the back-end in response to a
16962 @option{-mtune=} switch. The syntax, semantics, and accepted values
16963 for @var{string} in this option are not guaranteed to be consistent
16964 across releases.
16965
16966 This option is only intended to be useful when developing GCC.
16967
16968 @item -mverbose-cost-dump
16969 @opindex mverbose-cost-dump
16970 Enable verbose cost model dumping in the debug dump files. This option is
16971 provided for use in debugging the compiler.
16972
16973 @item -mpc-relative-literal-loads
16974 @itemx -mno-pc-relative-literal-loads
16975 @opindex mpc-relative-literal-loads
16976 @opindex mno-pc-relative-literal-loads
16977 Enable or disable PC-relative literal loads. With this option literal pools are
16978 accessed using a single instruction and emitted after each function. This
16979 limits the maximum size of functions to 1MB. This is enabled by default for
16980 @option{-mcmodel=tiny}.
16981
16982 @item -msign-return-address=@var{scope}
16983 @opindex msign-return-address
16984 Select the function scope on which return address signing will be applied.
16985 Permissible values are @samp{none}, which disables return address signing,
16986 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16987 functions, and @samp{all}, which enables pointer signing for all functions. The
16988 default value is @samp{none}. This option has been deprecated by
16989 -mbranch-protection.
16990
16991 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16992 @opindex mbranch-protection
16993 Select the branch protection features to use.
16994 @samp{none} is the default and turns off all types of branch protection.
16995 @samp{standard} turns on all types of branch protection features. If a feature
16996 has additional tuning options, then @samp{standard} sets it to its standard
16997 level.
16998 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16999 level: signing functions that save the return address to memory (non-leaf
17000 functions will practically always do this) using the a-key. The optional
17001 argument @samp{leaf} can be used to extend the signing to include leaf
17002 functions. The optional argument @samp{b-key} can be used to sign the functions
17003 with the B-key instead of the A-key.
17004 @samp{bti} turns on branch target identification mechanism.
17005
17006 @item -msve-vector-bits=@var{bits}
17007 @opindex msve-vector-bits
17008 Specify the number of bits in an SVE vector register. This option only has
17009 an effect when SVE is enabled.
17010
17011 GCC supports two forms of SVE code generation: ``vector-length
17012 agnostic'' output that works with any size of vector register and
17013 ``vector-length specific'' output that allows GCC to make assumptions
17014 about the vector length when it is useful for optimization reasons.
17015 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
17016 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
17017 Specifying @samp{scalable} selects vector-length agnostic
17018 output. At present @samp{-msve-vector-bits=128} also generates vector-length
17019 agnostic output for big-endian targets. All other values generate
17020 vector-length specific code. The behavior of these values may change
17021 in future releases and no value except @samp{scalable} should be
17022 relied on for producing code that is portable across different
17023 hardware SVE vector lengths.
17024
17025 The default is @samp{-msve-vector-bits=scalable}, which produces
17026 vector-length agnostic code.
17027 @end table
17028
17029 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
17030 @anchor{aarch64-feature-modifiers}
17031 @cindex @option{-march} feature modifiers
17032 @cindex @option{-mcpu} feature modifiers
17033 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
17034 the following and their inverses @option{no@var{feature}}:
17035
17036 @table @samp
17037 @item crc
17038 Enable CRC extension. This is on by default for
17039 @option{-march=armv8.1-a}.
17040 @item crypto
17041 Enable Crypto extension. This also enables Advanced SIMD and floating-point
17042 instructions.
17043 @item fp
17044 Enable floating-point instructions. This is on by default for all possible
17045 values for options @option{-march} and @option{-mcpu}.
17046 @item simd
17047 Enable Advanced SIMD instructions. This also enables floating-point
17048 instructions. This is on by default for all possible values for options
17049 @option{-march} and @option{-mcpu}.
17050 @item sve
17051 Enable Scalable Vector Extension instructions. This also enables Advanced
17052 SIMD and floating-point instructions.
17053 @item lse
17054 Enable Large System Extension instructions. This is on by default for
17055 @option{-march=armv8.1-a}.
17056 @item rdma
17057 Enable Round Double Multiply Accumulate instructions. This is on by default
17058 for @option{-march=armv8.1-a}.
17059 @item fp16
17060 Enable FP16 extension. This also enables floating-point instructions.
17061 @item fp16fml
17062 Enable FP16 fmla extension. This also enables FP16 extensions and
17063 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.
17064
17065 @item rcpc
17066 Enable the RcPc extension. This does not change code generation from GCC,
17067 but is passed on to the assembler, enabling inline asm statements to use
17068 instructions from the RcPc extension.
17069 @item dotprod
17070 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17071 @item aes
17072 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
17073 SIMD instructions.
17074 @item sha2
17075 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
17076 @item sha3
17077 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
17078 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
17079 @item sm4
17080 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
17081 Use of this option with architectures prior to Armv8.2-A is not supported.
17082 @item profile
17083 Enable the Statistical Profiling extension. This option is only to enable the
17084 extension at the assembler level and does not affect code generation.
17085 @item rng
17086 Enable the Armv8.5-a Random Number instructions. This option is only to
17087 enable the extension at the assembler level and does not affect code
17088 generation.
17089 @item memtag
17090 Enable the Armv8.5-a Memory Tagging Extensions.
17091 Use of this option with architectures prior to Armv8.5-A is not supported.
17092 @item sb
17093 Enable the Armv8-a Speculation Barrier instruction. This option is only to
17094 enable the extension at the assembler level and does not affect code
17095 generation. This option is enabled by default for @option{-march=armv8.5-a}.
17096 @item ssbs
17097 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
17098 is only to enable the extension at the assembler level and does not affect code
17099 generation. This option is enabled by default for @option{-march=armv8.5-a}.
17100 @item predres
17101 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
17102 This option is only to enable the extension at the assembler level and does
17103 not affect code generation. This option is enabled by default for
17104 @option{-march=armv8.5-a}.
17105 @item sve2
17106 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
17107 instructions.
17108 @item sve2-bitperm
17109 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
17110 @item sve2-sm4
17111 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
17112 @item sve2-aes
17113 Enable SVE2 aes instructions. This also enables SVE2 instructions.
17114 @item sve2-sha3
17115 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
17116 @item tme
17117 Enable the Transactional Memory Extension.
17118 @item i8mm
17119 Enable 8-bit Integer Matrix Multiply instructions. This also enables
17120 Advanced SIMD and floating-point instructions. This option is enabled by
17121 default for @option{-march=armv8.6-a}. Use of this option with architectures
17122 prior to Armv8.2-A is not supported.
17123 @item f32mm
17124 Enable 32-bit Floating point Matrix Multiply instructions. This also enables
17125 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
17126 not supported.
17127 @item f64mm
17128 Enable 64-bit Floating point Matrix Multiply instructions. This also enables
17129 SVE instructions. Use of this option with architectures prior to Armv8.2-A is
17130 not supported.
17131 @item bf16
17132 Enable brain half-precision floating-point instructions. This also enables
17133 Advanced SIMD and floating-point instructions. This option is enabled by
17134 default for @option{-march=armv8.6-a}. Use of this option with architectures
17135 prior to Armv8.2-A is not supported.
17136
17137 @end table
17138
17139 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
17140 which implies @option{fp}.
17141 Conversely, @option{nofp} implies @option{nosimd}, which implies
17142 @option{nocrypto}, @option{noaes} and @option{nosha2}.
17143
17144 @node Adapteva Epiphany Options
17145 @subsection Adapteva Epiphany Options
17146
17147 These @samp{-m} options are defined for Adapteva Epiphany:
17148
17149 @table @gcctabopt
17150 @item -mhalf-reg-file
17151 @opindex mhalf-reg-file
17152 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
17153 That allows code to run on hardware variants that lack these registers.
17154
17155 @item -mprefer-short-insn-regs
17156 @opindex mprefer-short-insn-regs
17157 Preferentially allocate registers that allow short instruction generation.
17158 This can result in increased instruction count, so this may either reduce or
17159 increase overall code size.
17160
17161 @item -mbranch-cost=@var{num}
17162 @opindex mbranch-cost
17163 Set the cost of branches to roughly @var{num} ``simple'' instructions.
17164 This cost is only a heuristic and is not guaranteed to produce
17165 consistent results across releases.
17166
17167 @item -mcmove
17168 @opindex mcmove
17169 Enable the generation of conditional moves.
17170
17171 @item -mnops=@var{num}
17172 @opindex mnops
17173 Emit @var{num} NOPs before every other generated instruction.
17174
17175 @item -mno-soft-cmpsf
17176 @opindex mno-soft-cmpsf
17177 @opindex msoft-cmpsf
17178 For single-precision floating-point comparisons, emit an @code{fsub} instruction
17179 and test the flags. This is faster than a software comparison, but can
17180 get incorrect results in the presence of NaNs, or when two different small
17181 numbers are compared such that their difference is calculated as zero.
17182 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
17183 software comparisons.
17184
17185 @item -mstack-offset=@var{num}
17186 @opindex mstack-offset
17187 Set the offset between the top of the stack and the stack pointer.
17188 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
17189 can be used by leaf functions without stack allocation.
17190 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
17191 Note also that this option changes the ABI; compiling a program with a
17192 different stack offset than the libraries have been compiled with
17193 generally does not work.
17194 This option can be useful if you want to evaluate if a different stack
17195 offset would give you better code, but to actually use a different stack
17196 offset to build working programs, it is recommended to configure the
17197 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
17198
17199 @item -mno-round-nearest
17200 @opindex mno-round-nearest
17201 @opindex mround-nearest
17202 Make the scheduler assume that the rounding mode has been set to
17203 truncating. The default is @option{-mround-nearest}.
17204
17205 @item -mlong-calls
17206 @opindex mlong-calls
17207 If not otherwise specified by an attribute, assume all calls might be beyond
17208 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
17209 function address into a register before performing a (otherwise direct) call.
17210 This is the default.
17211
17212 @item -mshort-calls
17213 @opindex short-calls
17214 If not otherwise specified by an attribute, assume all direct calls are
17215 in the range of the @code{b} / @code{bl} instructions, so use these instructions
17216 for direct calls. The default is @option{-mlong-calls}.
17217
17218 @item -msmall16
17219 @opindex msmall16
17220 Assume addresses can be loaded as 16-bit unsigned values. This does not
17221 apply to function addresses for which @option{-mlong-calls} semantics
17222 are in effect.
17223
17224 @item -mfp-mode=@var{mode}
17225 @opindex mfp-mode
17226 Set the prevailing mode of the floating-point unit.
17227 This determines the floating-point mode that is provided and expected
17228 at function call and return time. Making this mode match the mode you
17229 predominantly need at function start can make your programs smaller and
17230 faster by avoiding unnecessary mode switches.
17231
17232 @var{mode} can be set to one the following values:
17233
17234 @table @samp
17235 @item caller
17236 Any mode at function entry is valid, and retained or restored when
17237 the function returns, and when it calls other functions.
17238 This mode is useful for compiling libraries or other compilation units
17239 you might want to incorporate into different programs with different
17240 prevailing FPU modes, and the convenience of being able to use a single
17241 object file outweighs the size and speed overhead for any extra
17242 mode switching that might be needed, compared with what would be needed
17243 with a more specific choice of prevailing FPU mode.
17244
17245 @item truncate
17246 This is the mode used for floating-point calculations with
17247 truncating (i.e.@: round towards zero) rounding mode. That includes
17248 conversion from floating point to integer.
17249
17250 @item round-nearest
17251 This is the mode used for floating-point calculations with
17252 round-to-nearest-or-even rounding mode.
17253
17254 @item int
17255 This is the mode used to perform integer calculations in the FPU, e.g.@:
17256 integer multiply, or integer multiply-and-accumulate.
17257 @end table
17258
17259 The default is @option{-mfp-mode=caller}
17260
17261 @item -mno-split-lohi
17262 @itemx -mno-postinc
17263 @itemx -mno-postmodify
17264 @opindex mno-split-lohi
17265 @opindex msplit-lohi
17266 @opindex mno-postinc
17267 @opindex mpostinc
17268 @opindex mno-postmodify
17269 @opindex mpostmodify
17270 Code generation tweaks that disable, respectively, splitting of 32-bit
17271 loads, generation of post-increment addresses, and generation of
17272 post-modify addresses. The defaults are @option{msplit-lohi},
17273 @option{-mpost-inc}, and @option{-mpost-modify}.
17274
17275 @item -mnovect-double
17276 @opindex mno-vect-double
17277 @opindex mvect-double
17278 Change the preferred SIMD mode to SImode. The default is
17279 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
17280
17281 @item -max-vect-align=@var{num}
17282 @opindex max-vect-align
17283 The maximum alignment for SIMD vector mode types.
17284 @var{num} may be 4 or 8. The default is 8.
17285 Note that this is an ABI change, even though many library function
17286 interfaces are unaffected if they don't use SIMD vector modes
17287 in places that affect size and/or alignment of relevant types.
17288
17289 @item -msplit-vecmove-early
17290 @opindex msplit-vecmove-early
17291 Split vector moves into single word moves before reload. In theory this
17292 can give better register allocation, but so far the reverse seems to be
17293 generally the case.
17294
17295 @item -m1reg-@var{reg}
17296 @opindex m1reg-
17297 Specify a register to hold the constant @minus{}1, which makes loading small negative
17298 constants and certain bitmasks faster.
17299 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
17300 which specify use of that register as a fixed register,
17301 and @samp{none}, which means that no register is used for this
17302 purpose. The default is @option{-m1reg-none}.
17303
17304 @end table
17305
17306 @node AMD GCN Options
17307 @subsection AMD GCN Options
17308 @cindex AMD GCN Options
17309
17310 These options are defined specifically for the AMD GCN port.
17311
17312 @table @gcctabopt
17313
17314 @item -march=@var{gpu}
17315 @opindex march
17316 @itemx -mtune=@var{gpu}
17317 @opindex mtune
17318 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
17319 are
17320
17321 @table @samp
17322 @opindex fiji
17323 @item fiji
17324 Compile for GCN3 Fiji devices (gfx803).
17325
17326 @item gfx900
17327 Compile for GCN5 Vega 10 devices (gfx900).
17328
17329 @item gfx906
17330 Compile for GCN5 Vega 20 devices (gfx906).
17331
17332 @end table
17333
17334 @item -mstack-size=@var{bytes}
17335 @opindex mstack-size
17336 Specify how many @var{bytes} of stack space will be requested for each GPU
17337 thread (wave-front). Beware that there may be many threads and limited memory
17338 available. The size of the stack allocation may also have an impact on
17339 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
17340 1MB otherwise.
17341
17342 @end table
17343
17344 @node ARC Options
17345 @subsection ARC Options
17346 @cindex ARC options
17347
17348 The following options control the architecture variant for which code
17349 is being compiled:
17350
17351 @c architecture variants
17352 @table @gcctabopt
17353
17354 @item -mbarrel-shifter
17355 @opindex mbarrel-shifter
17356 Generate instructions supported by barrel shifter. This is the default
17357 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
17358
17359 @item -mjli-always
17360 @opindex mjli-alawys
17361 Force to call a function using jli_s instruction. This option is
17362 valid only for ARCv2 architecture.
17363
17364 @item -mcpu=@var{cpu}
17365 @opindex mcpu
17366 Set architecture type, register usage, and instruction scheduling
17367 parameters for @var{cpu}. There are also shortcut alias options
17368 available for backward compatibility and convenience. Supported
17369 values for @var{cpu} are
17370
17371 @table @samp
17372 @opindex mA6
17373 @opindex mARC600
17374 @item arc600
17375 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
17376
17377 @item arc601
17378 @opindex mARC601
17379 Compile for ARC601. Alias: @option{-mARC601}.
17380
17381 @item arc700
17382 @opindex mA7
17383 @opindex mARC700
17384 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
17385 This is the default when configured with @option{--with-cpu=arc700}@.
17386
17387 @item arcem
17388 Compile for ARC EM.
17389
17390 @item archs
17391 Compile for ARC HS.
17392
17393 @item em
17394 Compile for ARC EM CPU with no hardware extensions.
17395
17396 @item em4
17397 Compile for ARC EM4 CPU.
17398
17399 @item em4_dmips
17400 Compile for ARC EM4 DMIPS CPU.
17401
17402 @item em4_fpus
17403 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
17404 extension.
17405
17406 @item em4_fpuda
17407 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
17408 double assist instructions.
17409
17410 @item hs
17411 Compile for ARC HS CPU with no hardware extensions except the atomic
17412 instructions.
17413
17414 @item hs34
17415 Compile for ARC HS34 CPU.
17416
17417 @item hs38
17418 Compile for ARC HS38 CPU.
17419
17420 @item hs38_linux
17421 Compile for ARC HS38 CPU with all hardware extensions on.
17422
17423 @item arc600_norm
17424 Compile for ARC 600 CPU with @code{norm} instructions enabled.
17425
17426 @item arc600_mul32x16
17427 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
17428 instructions enabled.
17429
17430 @item arc600_mul64
17431 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
17432 instructions enabled.
17433
17434 @item arc601_norm
17435 Compile for ARC 601 CPU with @code{norm} instructions enabled.
17436
17437 @item arc601_mul32x16
17438 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
17439 instructions enabled.
17440
17441 @item arc601_mul64
17442 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
17443 instructions enabled.
17444
17445 @item nps400
17446 Compile for ARC 700 on NPS400 chip.
17447
17448 @item em_mini
17449 Compile for ARC EM minimalist configuration featuring reduced register
17450 set.
17451
17452 @end table
17453
17454 @item -mdpfp
17455 @opindex mdpfp
17456 @itemx -mdpfp-compact
17457 @opindex mdpfp-compact
17458 Generate double-precision FPX instructions, tuned for the compact
17459 implementation.
17460
17461 @item -mdpfp-fast
17462 @opindex mdpfp-fast
17463 Generate double-precision FPX instructions, tuned for the fast
17464 implementation.
17465
17466 @item -mno-dpfp-lrsr
17467 @opindex mno-dpfp-lrsr
17468 Disable @code{lr} and @code{sr} instructions from using FPX extension
17469 aux registers.
17470
17471 @item -mea
17472 @opindex mea
17473 Generate extended arithmetic instructions. Currently only
17474 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
17475 supported. Only valid for @option{-mcpu=ARC700}.
17476
17477 @item -mno-mpy
17478 @opindex mno-mpy
17479 @opindex mmpy
17480 Do not generate @code{mpy}-family instructions for ARC700. This option is
17481 deprecated.
17482
17483 @item -mmul32x16
17484 @opindex mmul32x16
17485 Generate 32x16-bit multiply and multiply-accumulate instructions.
17486
17487 @item -mmul64
17488 @opindex mmul64
17489 Generate @code{mul64} and @code{mulu64} instructions.
17490 Only valid for @option{-mcpu=ARC600}.
17491
17492 @item -mnorm
17493 @opindex mnorm
17494 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
17495 is in effect.
17496
17497 @item -mspfp
17498 @opindex mspfp
17499 @itemx -mspfp-compact
17500 @opindex mspfp-compact
17501 Generate single-precision FPX instructions, tuned for the compact
17502 implementation.
17503
17504 @item -mspfp-fast
17505 @opindex mspfp-fast
17506 Generate single-precision FPX instructions, tuned for the fast
17507 implementation.
17508
17509 @item -msimd
17510 @opindex msimd
17511 Enable generation of ARC SIMD instructions via target-specific
17512 builtins. Only valid for @option{-mcpu=ARC700}.
17513
17514 @item -msoft-float
17515 @opindex msoft-float
17516 This option ignored; it is provided for compatibility purposes only.
17517 Software floating-point code is emitted by default, and this default
17518 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
17519 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
17520 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
17521
17522 @item -mswap
17523 @opindex mswap
17524 Generate @code{swap} instructions.
17525
17526 @item -matomic
17527 @opindex matomic
17528 This enables use of the locked load/store conditional extension to implement
17529 atomic memory built-in functions. Not available for ARC 6xx or ARC
17530 EM cores.
17531
17532 @item -mdiv-rem
17533 @opindex mdiv-rem
17534 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
17535
17536 @item -mcode-density
17537 @opindex mcode-density
17538 Enable code density instructions for ARC EM.
17539 This option is on by default for ARC HS.
17540
17541 @item -mll64
17542 @opindex mll64
17543 Enable double load/store operations for ARC HS cores.
17544
17545 @item -mtp-regno=@var{regno}
17546 @opindex mtp-regno
17547 Specify thread pointer register number.
17548
17549 @item -mmpy-option=@var{multo}
17550 @opindex mmpy-option
17551 Compile ARCv2 code with a multiplier design option. You can specify
17552 the option using either a string or numeric value for @var{multo}.
17553 @samp{wlh1} is the default value. The recognized values are:
17554
17555 @table @samp
17556 @item 0
17557 @itemx none
17558 No multiplier available.
17559
17560 @item 1
17561 @itemx w
17562 16x16 multiplier, fully pipelined.
17563 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
17564
17565 @item 2
17566 @itemx wlh1
17567 32x32 multiplier, fully
17568 pipelined (1 stage). The following instructions are additionally
17569 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17570
17571 @item 3
17572 @itemx wlh2
17573 32x32 multiplier, fully pipelined
17574 (2 stages). The following instructions are additionally enabled: @code{mpy},
17575 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17576
17577 @item 4
17578 @itemx wlh3
17579 Two 16x16 multipliers, blocking,
17580 sequential. The following instructions are additionally enabled: @code{mpy},
17581 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17582
17583 @item 5
17584 @itemx wlh4
17585 One 16x16 multiplier, blocking,
17586 sequential. The following instructions are additionally enabled: @code{mpy},
17587 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17588
17589 @item 6
17590 @itemx wlh5
17591 One 32x4 multiplier, blocking,
17592 sequential. The following instructions are additionally enabled: @code{mpy},
17593 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
17594
17595 @item 7
17596 @itemx plus_dmpy
17597 ARC HS SIMD support.
17598
17599 @item 8
17600 @itemx plus_macd
17601 ARC HS SIMD support.
17602
17603 @item 9
17604 @itemx plus_qmacw
17605 ARC HS SIMD support.
17606
17607 @end table
17608
17609 This option is only available for ARCv2 cores@.
17610
17611 @item -mfpu=@var{fpu}
17612 @opindex mfpu
17613 Enables support for specific floating-point hardware extensions for ARCv2
17614 cores. Supported values for @var{fpu} are:
17615
17616 @table @samp
17617
17618 @item fpus
17619 Enables support for single-precision floating-point hardware
17620 extensions@.
17621
17622 @item fpud
17623 Enables support for double-precision floating-point hardware
17624 extensions. The single-precision floating-point extension is also
17625 enabled. Not available for ARC EM@.
17626
17627 @item fpuda
17628 Enables support for double-precision floating-point hardware
17629 extensions using double-precision assist instructions. The single-precision
17630 floating-point extension is also enabled. This option is
17631 only available for ARC EM@.
17632
17633 @item fpuda_div
17634 Enables support for double-precision floating-point hardware
17635 extensions using double-precision assist instructions.
17636 The single-precision floating-point, square-root, and divide
17637 extensions are also enabled. This option is
17638 only available for ARC EM@.
17639
17640 @item fpuda_fma
17641 Enables support for double-precision floating-point hardware
17642 extensions using double-precision assist instructions.
17643 The single-precision floating-point and fused multiply and add
17644 hardware extensions are also enabled. This option is
17645 only available for ARC EM@.
17646
17647 @item fpuda_all
17648 Enables support for double-precision floating-point hardware
17649 extensions using double-precision assist instructions.
17650 All single-precision floating-point hardware extensions are also
17651 enabled. This option is only available for ARC EM@.
17652
17653 @item fpus_div
17654 Enables support for single-precision floating-point, square-root and divide
17655 hardware extensions@.
17656
17657 @item fpud_div
17658 Enables support for double-precision floating-point, square-root and divide
17659 hardware extensions. This option
17660 includes option @samp{fpus_div}. Not available for ARC EM@.
17661
17662 @item fpus_fma
17663 Enables support for single-precision floating-point and
17664 fused multiply and add hardware extensions@.
17665
17666 @item fpud_fma
17667 Enables support for double-precision floating-point and
17668 fused multiply and add hardware extensions. This option
17669 includes option @samp{fpus_fma}. Not available for ARC EM@.
17670
17671 @item fpus_all
17672 Enables support for all single-precision floating-point hardware
17673 extensions@.
17674
17675 @item fpud_all
17676 Enables support for all single- and double-precision floating-point
17677 hardware extensions. Not available for ARC EM@.
17678
17679 @end table
17680
17681 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
17682 @opindex mirq-ctrl-saved
17683 Specifies general-purposes registers that the processor automatically
17684 saves/restores on interrupt entry and exit. @var{register-range} is
17685 specified as two registers separated by a dash. The register range
17686 always starts with @code{r0}, the upper limit is @code{fp} register.
17687 @var{blink} and @var{lp_count} are optional. This option is only
17688 valid for ARC EM and ARC HS cores.
17689
17690 @item -mrgf-banked-regs=@var{number}
17691 @opindex mrgf-banked-regs
17692 Specifies the number of registers replicated in second register bank
17693 on entry to fast interrupt. Fast interrupts are interrupts with the
17694 highest priority level P0. These interrupts save only PC and STATUS32
17695 registers to avoid memory transactions during interrupt entry and exit
17696 sequences. Use this option when you are using fast interrupts in an
17697 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
17698
17699 @item -mlpc-width=@var{width}
17700 @opindex mlpc-width
17701 Specify the width of the @code{lp_count} register. Valid values for
17702 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
17703 fixed to 32 bits. If the width is less than 32, the compiler does not
17704 attempt to transform loops in your program to use the zero-delay loop
17705 mechanism unless it is known that the @code{lp_count} register can
17706 hold the required loop-counter value. Depending on the width
17707 specified, the compiler and run-time library might continue to use the
17708 loop mechanism for various needs. This option defines macro
17709 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
17710
17711 @item -mrf16
17712 @opindex mrf16
17713 This option instructs the compiler to generate code for a 16-entry
17714 register file. This option defines the @code{__ARC_RF16__}
17715 preprocessor macro.
17716
17717 @item -mbranch-index
17718 @opindex mbranch-index
17719 Enable use of @code{bi} or @code{bih} instructions to implement jump
17720 tables.
17721
17722 @end table
17723
17724 The following options are passed through to the assembler, and also
17725 define preprocessor macro symbols.
17726
17727 @c Flags used by the assembler, but for which we define preprocessor
17728 @c macro symbols as well.
17729 @table @gcctabopt
17730 @item -mdsp-packa
17731 @opindex mdsp-packa
17732 Passed down to the assembler to enable the DSP Pack A extensions.
17733 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
17734 deprecated.
17735
17736 @item -mdvbf
17737 @opindex mdvbf
17738 Passed down to the assembler to enable the dual Viterbi butterfly
17739 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
17740 option is deprecated.
17741
17742 @c ARC700 4.10 extension instruction
17743 @item -mlock
17744 @opindex mlock
17745 Passed down to the assembler to enable the locked load/store
17746 conditional extension. Also sets the preprocessor symbol
17747 @code{__Xlock}.
17748
17749 @item -mmac-d16
17750 @opindex mmac-d16
17751 Passed down to the assembler. Also sets the preprocessor symbol
17752 @code{__Xxmac_d16}. This option is deprecated.
17753
17754 @item -mmac-24
17755 @opindex mmac-24
17756 Passed down to the assembler. Also sets the preprocessor symbol
17757 @code{__Xxmac_24}. This option is deprecated.
17758
17759 @c ARC700 4.10 extension instruction
17760 @item -mrtsc
17761 @opindex mrtsc
17762 Passed down to the assembler to enable the 64-bit time-stamp counter
17763 extension instruction. Also sets the preprocessor symbol
17764 @code{__Xrtsc}. This option is deprecated.
17765
17766 @c ARC700 4.10 extension instruction
17767 @item -mswape
17768 @opindex mswape
17769 Passed down to the assembler to enable the swap byte ordering
17770 extension instruction. Also sets the preprocessor symbol
17771 @code{__Xswape}.
17772
17773 @item -mtelephony
17774 @opindex mtelephony
17775 Passed down to the assembler to enable dual- and single-operand
17776 instructions for telephony. Also sets the preprocessor symbol
17777 @code{__Xtelephony}. This option is deprecated.
17778
17779 @item -mxy
17780 @opindex mxy
17781 Passed down to the assembler to enable the XY memory extension. Also
17782 sets the preprocessor symbol @code{__Xxy}.
17783
17784 @end table
17785
17786 The following options control how the assembly code is annotated:
17787
17788 @c Assembly annotation options
17789 @table @gcctabopt
17790 @item -misize
17791 @opindex misize
17792 Annotate assembler instructions with estimated addresses.
17793
17794 @item -mannotate-align
17795 @opindex mannotate-align
17796 Explain what alignment considerations lead to the decision to make an
17797 instruction short or long.
17798
17799 @end table
17800
17801 The following options are passed through to the linker:
17802
17803 @c options passed through to the linker
17804 @table @gcctabopt
17805 @item -marclinux
17806 @opindex marclinux
17807 Passed through to the linker, to specify use of the @code{arclinux} emulation.
17808 This option is enabled by default in tool chains built for
17809 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
17810 when profiling is not requested.
17811
17812 @item -marclinux_prof
17813 @opindex marclinux_prof
17814 Passed through to the linker, to specify use of the
17815 @code{arclinux_prof} emulation. This option is enabled by default in
17816 tool chains built for @w{@code{arc-linux-uclibc}} and
17817 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
17818
17819 @end table
17820
17821 The following options control the semantics of generated code:
17822
17823 @c semantically relevant code generation options
17824 @table @gcctabopt
17825 @item -mlong-calls
17826 @opindex mlong-calls
17827 Generate calls as register indirect calls, thus providing access
17828 to the full 32-bit address range.
17829
17830 @item -mmedium-calls
17831 @opindex mmedium-calls
17832 Don't use less than 25-bit addressing range for calls, which is the
17833 offset available for an unconditional branch-and-link
17834 instruction. Conditional execution of function calls is suppressed, to
17835 allow use of the 25-bit range, rather than the 21-bit range with
17836 conditional branch-and-link. This is the default for tool chains built
17837 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
17838
17839 @item -G @var{num}
17840 @opindex G
17841 Put definitions of externally-visible data in a small data section if
17842 that data is no bigger than @var{num} bytes. The default value of
17843 @var{num} is 4 for any ARC configuration, or 8 when we have double
17844 load/store operations.
17845
17846 @item -mno-sdata
17847 @opindex mno-sdata
17848 @opindex msdata
17849 Do not generate sdata references. This is the default for tool chains
17850 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
17851 targets.
17852
17853 @item -mvolatile-cache
17854 @opindex mvolatile-cache
17855 Use ordinarily cached memory accesses for volatile references. This is the
17856 default.
17857
17858 @item -mno-volatile-cache
17859 @opindex mno-volatile-cache
17860 @opindex mvolatile-cache
17861 Enable cache bypass for volatile references.
17862
17863 @end table
17864
17865 The following options fine tune code generation:
17866 @c code generation tuning options
17867 @table @gcctabopt
17868 @item -malign-call
17869 @opindex malign-call
17870 Do alignment optimizations for call instructions.
17871
17872 @item -mauto-modify-reg
17873 @opindex mauto-modify-reg
17874 Enable the use of pre/post modify with register displacement.
17875
17876 @item -mbbit-peephole
17877 @opindex mbbit-peephole
17878 Enable bbit peephole2.
17879
17880 @item -mno-brcc
17881 @opindex mno-brcc
17882 This option disables a target-specific pass in @file{arc_reorg} to
17883 generate compare-and-branch (@code{br@var{cc}}) instructions.
17884 It has no effect on
17885 generation of these instructions driven by the combiner pass.
17886
17887 @item -mcase-vector-pcrel
17888 @opindex mcase-vector-pcrel
17889 Use PC-relative switch case tables to enable case table shortening.
17890 This is the default for @option{-Os}.
17891
17892 @item -mcompact-casesi
17893 @opindex mcompact-casesi
17894 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
17895 and only available for ARCv1 cores. This option is deprecated.
17896
17897 @item -mno-cond-exec
17898 @opindex mno-cond-exec
17899 Disable the ARCompact-specific pass to generate conditional
17900 execution instructions.
17901
17902 Due to delay slot scheduling and interactions between operand numbers,
17903 literal sizes, instruction lengths, and the support for conditional execution,
17904 the target-independent pass to generate conditional execution is often lacking,
17905 so the ARC port has kept a special pass around that tries to find more
17906 conditional execution generation opportunities after register allocation,
17907 branch shortening, and delay slot scheduling have been done. This pass
17908 generally, but not always, improves performance and code size, at the cost of
17909 extra compilation time, which is why there is an option to switch it off.
17910 If you have a problem with call instructions exceeding their allowable
17911 offset range because they are conditionalized, you should consider using
17912 @option{-mmedium-calls} instead.
17913
17914 @item -mearly-cbranchsi
17915 @opindex mearly-cbranchsi
17916 Enable pre-reload use of the @code{cbranchsi} pattern.
17917
17918 @item -mexpand-adddi
17919 @opindex mexpand-adddi
17920 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
17921 @code{add.f}, @code{adc} etc. This option is deprecated.
17922
17923 @item -mindexed-loads
17924 @opindex mindexed-loads
17925 Enable the use of indexed loads. This can be problematic because some
17926 optimizers then assume that indexed stores exist, which is not
17927 the case.
17928
17929 @item -mlra
17930 @opindex mlra
17931 Enable Local Register Allocation. This is still experimental for ARC,
17932 so by default the compiler uses standard reload
17933 (i.e.@: @option{-mno-lra}).
17934
17935 @item -mlra-priority-none
17936 @opindex mlra-priority-none
17937 Don't indicate any priority for target registers.
17938
17939 @item -mlra-priority-compact
17940 @opindex mlra-priority-compact
17941 Indicate target register priority for r0..r3 / r12..r15.
17942
17943 @item -mlra-priority-noncompact
17944 @opindex mlra-priority-noncompact
17945 Reduce target register priority for r0..r3 / r12..r15.
17946
17947 @item -mmillicode
17948 @opindex mmillicode
17949 When optimizing for size (using @option{-Os}), prologues and epilogues
17950 that have to save or restore a large number of registers are often
17951 shortened by using call to a special function in libgcc; this is
17952 referred to as a @emph{millicode} call. As these calls can pose
17953 performance issues, and/or cause linking issues when linking in a
17954 nonstandard way, this option is provided to turn on or off millicode
17955 call generation.
17956
17957 @item -mcode-density-frame
17958 @opindex mcode-density-frame
17959 This option enable the compiler to emit @code{enter} and @code{leave}
17960 instructions. These instructions are only valid for CPUs with
17961 code-density feature.
17962
17963 @item -mmixed-code
17964 @opindex mmixed-code
17965 Tweak register allocation to help 16-bit instruction generation.
17966 This generally has the effect of decreasing the average instruction size
17967 while increasing the instruction count.
17968
17969 @item -mq-class
17970 @opindex mq-class
17971 Ths option is deprecated. Enable @samp{q} instruction alternatives.
17972 This is the default for @option{-Os}.
17973
17974 @item -mRcq
17975 @opindex mRcq
17976 Enable @samp{Rcq} constraint handling.
17977 Most short code generation depends on this.
17978 This is the default.
17979
17980 @item -mRcw
17981 @opindex mRcw
17982 Enable @samp{Rcw} constraint handling.
17983 Most ccfsm condexec mostly depends on this.
17984 This is the default.
17985
17986 @item -msize-level=@var{level}
17987 @opindex msize-level
17988 Fine-tune size optimization with regards to instruction lengths and alignment.
17989 The recognized values for @var{level} are:
17990 @table @samp
17991 @item 0
17992 No size optimization. This level is deprecated and treated like @samp{1}.
17993
17994 @item 1
17995 Short instructions are used opportunistically.
17996
17997 @item 2
17998 In addition, alignment of loops and of code after barriers are dropped.
17999
18000 @item 3
18001 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
18002
18003 @end table
18004
18005 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
18006 the behavior when this is not set is equivalent to level @samp{1}.
18007
18008 @item -mtune=@var{cpu}
18009 @opindex mtune
18010 Set instruction scheduling parameters for @var{cpu}, overriding any implied
18011 by @option{-mcpu=}.
18012
18013 Supported values for @var{cpu} are
18014
18015 @table @samp
18016 @item ARC600
18017 Tune for ARC600 CPU.
18018
18019 @item ARC601
18020 Tune for ARC601 CPU.
18021
18022 @item ARC700
18023 Tune for ARC700 CPU with standard multiplier block.
18024
18025 @item ARC700-xmac
18026 Tune for ARC700 CPU with XMAC block.
18027
18028 @item ARC725D
18029 Tune for ARC725D CPU.
18030
18031 @item ARC750D
18032 Tune for ARC750D CPU.
18033
18034 @end table
18035
18036 @item -mmultcost=@var{num}
18037 @opindex mmultcost
18038 Cost to assume for a multiply instruction, with @samp{4} being equal to a
18039 normal instruction.
18040
18041 @item -munalign-prob-threshold=@var{probability}
18042 @opindex munalign-prob-threshold
18043 Set probability threshold for unaligning branches.
18044 When tuning for @samp{ARC700} and optimizing for speed, branches without
18045 filled delay slot are preferably emitted unaligned and long, unless
18046 profiling indicates that the probability for the branch to be taken
18047 is below @var{probability}. @xref{Cross-profiling}.
18048 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
18049
18050 @end table
18051
18052 The following options are maintained for backward compatibility, but
18053 are now deprecated and will be removed in a future release:
18054
18055 @c Deprecated options
18056 @table @gcctabopt
18057
18058 @item -margonaut
18059 @opindex margonaut
18060 Obsolete FPX.
18061
18062 @item -mbig-endian
18063 @opindex mbig-endian
18064 @itemx -EB
18065 @opindex EB
18066 Compile code for big-endian targets. Use of these options is now
18067 deprecated. Big-endian code is supported by configuring GCC to build
18068 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
18069 for which big endian is the default.
18070
18071 @item -mlittle-endian
18072 @opindex mlittle-endian
18073 @itemx -EL
18074 @opindex EL
18075 Compile code for little-endian targets. Use of these options is now
18076 deprecated. Little-endian code is supported by configuring GCC to build
18077 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
18078 for which little endian is the default.
18079
18080 @item -mbarrel_shifter
18081 @opindex mbarrel_shifter
18082 Replaced by @option{-mbarrel-shifter}.
18083
18084 @item -mdpfp_compact
18085 @opindex mdpfp_compact
18086 Replaced by @option{-mdpfp-compact}.
18087
18088 @item -mdpfp_fast
18089 @opindex mdpfp_fast
18090 Replaced by @option{-mdpfp-fast}.
18091
18092 @item -mdsp_packa
18093 @opindex mdsp_packa
18094 Replaced by @option{-mdsp-packa}.
18095
18096 @item -mEA
18097 @opindex mEA
18098 Replaced by @option{-mea}.
18099
18100 @item -mmac_24
18101 @opindex mmac_24
18102 Replaced by @option{-mmac-24}.
18103
18104 @item -mmac_d16
18105 @opindex mmac_d16
18106 Replaced by @option{-mmac-d16}.
18107
18108 @item -mspfp_compact
18109 @opindex mspfp_compact
18110 Replaced by @option{-mspfp-compact}.
18111
18112 @item -mspfp_fast
18113 @opindex mspfp_fast
18114 Replaced by @option{-mspfp-fast}.
18115
18116 @item -mtune=@var{cpu}
18117 @opindex mtune
18118 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
18119 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
18120 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
18121
18122 @item -multcost=@var{num}
18123 @opindex multcost
18124 Replaced by @option{-mmultcost}.
18125
18126 @end table
18127
18128 @node ARM Options
18129 @subsection ARM Options
18130 @cindex ARM options
18131
18132 These @samp{-m} options are defined for the ARM port:
18133
18134 @table @gcctabopt
18135 @item -mabi=@var{name}
18136 @opindex mabi
18137 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
18138 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
18139
18140 @item -mapcs-frame
18141 @opindex mapcs-frame
18142 Generate a stack frame that is compliant with the ARM Procedure Call
18143 Standard for all functions, even if this is not strictly necessary for
18144 correct execution of the code. Specifying @option{-fomit-frame-pointer}
18145 with this option causes the stack frames not to be generated for
18146 leaf functions. The default is @option{-mno-apcs-frame}.
18147 This option is deprecated.
18148
18149 @item -mapcs
18150 @opindex mapcs
18151 This is a synonym for @option{-mapcs-frame} and is deprecated.
18152
18153 @ignore
18154 @c not currently implemented
18155 @item -mapcs-stack-check
18156 @opindex mapcs-stack-check
18157 Generate code to check the amount of stack space available upon entry to
18158 every function (that actually uses some stack space). If there is
18159 insufficient space available then either the function
18160 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
18161 called, depending upon the amount of stack space required. The runtime
18162 system is required to provide these functions. The default is
18163 @option{-mno-apcs-stack-check}, since this produces smaller code.
18164
18165 @c not currently implemented
18166 @item -mapcs-reentrant
18167 @opindex mapcs-reentrant
18168 Generate reentrant, position-independent code. The default is
18169 @option{-mno-apcs-reentrant}.
18170 @end ignore
18171
18172 @item -mthumb-interwork
18173 @opindex mthumb-interwork
18174 Generate code that supports calling between the ARM and Thumb
18175 instruction sets. Without this option, on pre-v5 architectures, the
18176 two instruction sets cannot be reliably used inside one program. The
18177 default is @option{-mno-thumb-interwork}, since slightly larger code
18178 is generated when @option{-mthumb-interwork} is specified. In AAPCS
18179 configurations this option is meaningless.
18180
18181 @item -mno-sched-prolog
18182 @opindex mno-sched-prolog
18183 @opindex msched-prolog
18184 Prevent the reordering of instructions in the function prologue, or the
18185 merging of those instruction with the instructions in the function's
18186 body. This means that all functions start with a recognizable set
18187 of instructions (or in fact one of a choice from a small set of
18188 different function prologues), and this information can be used to
18189 locate the start of functions inside an executable piece of code. The
18190 default is @option{-msched-prolog}.
18191
18192 @item -mfloat-abi=@var{name}
18193 @opindex mfloat-abi
18194 Specifies which floating-point ABI to use. Permissible values
18195 are: @samp{soft}, @samp{softfp} and @samp{hard}.
18196
18197 Specifying @samp{soft} causes GCC to generate output containing
18198 library calls for floating-point operations.
18199 @samp{softfp} allows the generation of code using hardware floating-point
18200 instructions, but still uses the soft-float calling conventions.
18201 @samp{hard} allows generation of floating-point instructions
18202 and uses FPU-specific calling conventions.
18203
18204 The default depends on the specific target configuration. Note that
18205 the hard-float and soft-float ABIs are not link-compatible; you must
18206 compile your entire program with the same ABI, and link with a
18207 compatible set of libraries.
18208
18209 @item -mgeneral-regs-only
18210 @opindex mgeneral-regs-only
18211 Generate code which uses only the general-purpose registers. This will prevent
18212 the compiler from using floating-point and Advanced SIMD registers but will not
18213 impose any restrictions on the assembler.
18214
18215 @item -mlittle-endian
18216 @opindex mlittle-endian
18217 Generate code for a processor running in little-endian mode. This is
18218 the default for all standard configurations.
18219
18220 @item -mbig-endian
18221 @opindex mbig-endian
18222 Generate code for a processor running in big-endian mode; the default is
18223 to compile code for a little-endian processor.
18224
18225 @item -mbe8
18226 @itemx -mbe32
18227 @opindex mbe8
18228 When linking a big-endian image select between BE8 and BE32 formats.
18229 The option has no effect for little-endian images and is ignored. The
18230 default is dependent on the selected target architecture. For ARMv6
18231 and later architectures the default is BE8, for older architectures
18232 the default is BE32. BE32 format has been deprecated by ARM.
18233
18234 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
18235 @opindex march
18236 This specifies the name of the target ARM architecture. GCC uses this
18237 name to determine what kind of instructions it can emit when generating
18238 assembly code. This option can be used in conjunction with or instead
18239 of the @option{-mcpu=} option.
18240
18241 Permissible names are:
18242 @samp{armv4t},
18243 @samp{armv5t}, @samp{armv5te},
18244 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
18245 @samp{armv6z}, @samp{armv6zk},
18246 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
18247 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
18248 @samp{armv8.4-a},
18249 @samp{armv8.5-a},
18250 @samp{armv8.6-a},
18251 @samp{armv7-r},
18252 @samp{armv8-r},
18253 @samp{armv6-m}, @samp{armv6s-m},
18254 @samp{armv7-m}, @samp{armv7e-m},
18255 @samp{armv8-m.base}, @samp{armv8-m.main},
18256 @samp{armv8.1-m.main},
18257 @samp{iwmmxt} and @samp{iwmmxt2}.
18258
18259 Additionally, the following architectures, which lack support for the
18260 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
18261
18262 Many of the architectures support extensions. These can be added by
18263 appending @samp{+@var{extension}} to the architecture name. Extension
18264 options are processed in order and capabilities accumulate. An extension
18265 will also enable any necessary base extensions
18266 upon which it depends. For example, the @samp{+crypto} extension
18267 will always enable the @samp{+simd} extension. The exception to the
18268 additive construction is for extensions that are prefixed with
18269 @samp{+no@dots{}}: these extensions disable the specified option and
18270 any other extensions that may depend on the presence of that
18271 extension.
18272
18273 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
18274 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
18275 entirely disabled by the @samp{+nofp} option that follows it.
18276
18277 Most extension names are generically named, but have an effect that is
18278 dependent upon the architecture to which it is applied. For example,
18279 the @samp{+simd} option can be applied to both @samp{armv7-a} and
18280 @samp{armv8-a} architectures, but will enable the original ARMv7-A
18281 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
18282 variant for @samp{armv8-a}.
18283
18284 The table below lists the supported extensions for each architecture.
18285 Architectures not mentioned do not support any extensions.
18286
18287 @table @samp
18288 @item armv5te
18289 @itemx armv6
18290 @itemx armv6j
18291 @itemx armv6k
18292 @itemx armv6kz
18293 @itemx armv6t2
18294 @itemx armv6z
18295 @itemx armv6zk
18296 @table @samp
18297 @item +fp
18298 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
18299 used as an alias for this extension.
18300
18301 @item +nofp
18302 Disable the floating-point instructions.
18303 @end table
18304
18305 @item armv7
18306 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
18307 @table @samp
18308 @item +fp
18309 The VFPv3 floating-point instructions, with 16 double-precision
18310 registers. The extension @samp{+vfpv3-d16} can be used as an alias
18311 for this extension. Note that floating-point is not supported by the
18312 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
18313 ARMv7-R architectures.
18314
18315 @item +nofp
18316 Disable the floating-point instructions.
18317 @end table
18318
18319 @item armv7-a
18320 @table @samp
18321 @item +mp
18322 The multiprocessing extension.
18323
18324 @item +sec
18325 The security extension.
18326
18327 @item +fp
18328 The VFPv3 floating-point instructions, with 16 double-precision
18329 registers. The extension @samp{+vfpv3-d16} can be used as an alias
18330 for this extension.
18331
18332 @item +simd
18333 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18334 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
18335 for this extension.
18336
18337 @item +vfpv3
18338 The VFPv3 floating-point instructions, with 32 double-precision
18339 registers.
18340
18341 @item +vfpv3-d16-fp16
18342 The VFPv3 floating-point instructions, with 16 double-precision
18343 registers and the half-precision floating-point conversion operations.
18344
18345 @item +vfpv3-fp16
18346 The VFPv3 floating-point instructions, with 32 double-precision
18347 registers and the half-precision floating-point conversion operations.
18348
18349 @item +vfpv4-d16
18350 The VFPv4 floating-point instructions, with 16 double-precision
18351 registers.
18352
18353 @item +vfpv4
18354 The VFPv4 floating-point instructions, with 32 double-precision
18355 registers.
18356
18357 @item +neon-fp16
18358 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18359 the half-precision floating-point conversion operations.
18360
18361 @item +neon-vfpv4
18362 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
18363
18364 @item +nosimd
18365 Disable the Advanced SIMD instructions (does not disable floating point).
18366
18367 @item +nofp
18368 Disable the floating-point and Advanced SIMD instructions.
18369 @end table
18370
18371 @item armv7ve
18372 The extended version of the ARMv7-A architecture with support for
18373 virtualization.
18374 @table @samp
18375 @item +fp
18376 The VFPv4 floating-point instructions, with 16 double-precision registers.
18377 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
18378
18379 @item +simd
18380 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
18381 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
18382
18383 @item +vfpv3-d16
18384 The VFPv3 floating-point instructions, with 16 double-precision
18385 registers.
18386
18387 @item +vfpv3
18388 The VFPv3 floating-point instructions, with 32 double-precision
18389 registers.
18390
18391 @item +vfpv3-d16-fp16
18392 The VFPv3 floating-point instructions, with 16 double-precision
18393 registers and the half-precision floating-point conversion operations.
18394
18395 @item +vfpv3-fp16
18396 The VFPv3 floating-point instructions, with 32 double-precision
18397 registers and the half-precision floating-point conversion operations.
18398
18399 @item +vfpv4-d16
18400 The VFPv4 floating-point instructions, with 16 double-precision
18401 registers.
18402
18403 @item +vfpv4
18404 The VFPv4 floating-point instructions, with 32 double-precision
18405 registers.
18406
18407 @item +neon
18408 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
18409 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
18410
18411 @item +neon-fp16
18412 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
18413 the half-precision floating-point conversion operations.
18414
18415 @item +nosimd
18416 Disable the Advanced SIMD instructions (does not disable floating point).
18417
18418 @item +nofp
18419 Disable the floating-point and Advanced SIMD instructions.
18420 @end table
18421
18422 @item armv8-a
18423 @table @samp
18424 @item +crc
18425 The Cyclic Redundancy Check (CRC) instructions.
18426 @item +simd
18427 The ARMv8-A Advanced SIMD and floating-point instructions.
18428 @item +crypto
18429 The cryptographic instructions.
18430 @item +nocrypto
18431 Disable the cryptographic instructions.
18432 @item +nofp
18433 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18434 @item +sb
18435 Speculation Barrier Instruction.
18436 @item +predres
18437 Execution and Data Prediction Restriction Instructions.
18438 @end table
18439
18440 @item armv8.1-a
18441 @table @samp
18442 @item +simd
18443 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18444
18445 @item +crypto
18446 The cryptographic instructions. This also enables the Advanced SIMD and
18447 floating-point instructions.
18448
18449 @item +nocrypto
18450 Disable the cryptographic instructions.
18451
18452 @item +nofp
18453 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18454
18455 @item +sb
18456 Speculation Barrier Instruction.
18457
18458 @item +predres
18459 Execution and Data Prediction Restriction Instructions.
18460 @end table
18461
18462 @item armv8.2-a
18463 @itemx armv8.3-a
18464 @table @samp
18465 @item +fp16
18466 The half-precision floating-point data processing instructions.
18467 This also enables the Advanced SIMD and floating-point instructions.
18468
18469 @item +fp16fml
18470 The half-precision floating-point fmla extension. This also enables
18471 the half-precision floating-point extension and Advanced SIMD and
18472 floating-point instructions.
18473
18474 @item +simd
18475 The ARMv8.1-A Advanced SIMD and floating-point instructions.
18476
18477 @item +crypto
18478 The cryptographic instructions. This also enables the Advanced SIMD and
18479 floating-point instructions.
18480
18481 @item +dotprod
18482 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
18483
18484 @item +nocrypto
18485 Disable the cryptographic extension.
18486
18487 @item +nofp
18488 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18489
18490 @item +sb
18491 Speculation Barrier Instruction.
18492
18493 @item +predres
18494 Execution and Data Prediction Restriction Instructions.
18495
18496 @item +i8mm
18497 8-bit Integer Matrix Multiply instructions.
18498 This also enables Advanced SIMD and floating-point instructions.
18499
18500 @item +bf16
18501 Brain half-precision floating-point instructions.
18502 This also enables Advanced SIMD and floating-point instructions.
18503 @end table
18504
18505 @item armv8.4-a
18506 @table @samp
18507 @item +fp16
18508 The half-precision floating-point data processing instructions.
18509 This also enables the Advanced SIMD and floating-point instructions as well
18510 as the Dot Product extension and the half-precision floating-point fmla
18511 extension.
18512
18513 @item +simd
18514 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18515 Dot Product extension.
18516
18517 @item +crypto
18518 The cryptographic instructions. This also enables the Advanced SIMD and
18519 floating-point instructions as well as the Dot Product extension.
18520
18521 @item +nocrypto
18522 Disable the cryptographic extension.
18523
18524 @item +nofp
18525 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18526
18527 @item +sb
18528 Speculation Barrier Instruction.
18529
18530 @item +predres
18531 Execution and Data Prediction Restriction Instructions.
18532
18533 @item +i8mm
18534 8-bit Integer Matrix Multiply instructions.
18535 This also enables Advanced SIMD and floating-point instructions.
18536
18537 @item +bf16
18538 Brain half-precision floating-point instructions.
18539 This also enables Advanced SIMD and floating-point instructions.
18540 @end table
18541
18542 @item armv8.5-a
18543 @table @samp
18544 @item +fp16
18545 The half-precision floating-point data processing instructions.
18546 This also enables the Advanced SIMD and floating-point instructions as well
18547 as the Dot Product extension and the half-precision floating-point fmla
18548 extension.
18549
18550 @item +simd
18551 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18552 Dot Product extension.
18553
18554 @item +crypto
18555 The cryptographic instructions. This also enables the Advanced SIMD and
18556 floating-point instructions as well as the Dot Product extension.
18557
18558 @item +nocrypto
18559 Disable the cryptographic extension.
18560
18561 @item +nofp
18562 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18563
18564 @item +i8mm
18565 8-bit Integer Matrix Multiply instructions.
18566 This also enables Advanced SIMD and floating-point instructions.
18567
18568 @item +bf16
18569 Brain half-precision floating-point instructions.
18570 This also enables Advanced SIMD and floating-point instructions.
18571 @end table
18572
18573 @item armv8.6-a
18574 @table @samp
18575 @item +fp16
18576 The half-precision floating-point data processing instructions.
18577 This also enables the Advanced SIMD and floating-point instructions as well
18578 as the Dot Product extension and the half-precision floating-point fmla
18579 extension.
18580
18581 @item +simd
18582 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
18583 Dot Product extension.
18584
18585 @item +crypto
18586 The cryptographic instructions. This also enables the Advanced SIMD and
18587 floating-point instructions as well as the Dot Product extension.
18588
18589 @item +nocrypto
18590 Disable the cryptographic extension.
18591
18592 @item +nofp
18593 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18594
18595 @item +i8mm
18596 8-bit Integer Matrix Multiply instructions.
18597 This also enables Advanced SIMD and floating-point instructions.
18598
18599 @item +bf16
18600 Brain half-precision floating-point instructions.
18601 This also enables Advanced SIMD and floating-point instructions.
18602 @end table
18603
18604 @item armv7-r
18605 @table @samp
18606 @item +fp.sp
18607 The single-precision VFPv3 floating-point instructions. The extension
18608 @samp{+vfpv3xd} can be used as an alias for this extension.
18609
18610 @item +fp
18611 The VFPv3 floating-point instructions with 16 double-precision registers.
18612 The extension +vfpv3-d16 can be used as an alias for this extension.
18613
18614 @item +vfpv3xd-d16-fp16
18615 The single-precision VFPv3 floating-point instructions with 16 double-precision
18616 registers and the half-precision floating-point conversion operations.
18617
18618 @item +vfpv3-d16-fp16
18619 The VFPv3 floating-point instructions with 16 double-precision
18620 registers and the half-precision floating-point conversion operations.
18621
18622 @item +nofp
18623 Disable the floating-point extension.
18624
18625 @item +idiv
18626 The ARM-state integer division instructions.
18627
18628 @item +noidiv
18629 Disable the ARM-state integer division extension.
18630 @end table
18631
18632 @item armv7e-m
18633 @table @samp
18634 @item +fp
18635 The single-precision VFPv4 floating-point instructions.
18636
18637 @item +fpv5
18638 The single-precision FPv5 floating-point instructions.
18639
18640 @item +fp.dp
18641 The single- and double-precision FPv5 floating-point instructions.
18642
18643 @item +nofp
18644 Disable the floating-point extensions.
18645 @end table
18646
18647 @item armv8.1-m.main
18648 @table @samp
18649
18650 @item +dsp
18651 The DSP instructions.
18652
18653 @item +mve
18654 The M-Profile Vector Extension (MVE) integer instructions.
18655
18656 @item +mve.fp
18657 The M-Profile Vector Extension (MVE) integer and single precision
18658 floating-point instructions.
18659
18660 @item +fp
18661 The single-precision floating-point instructions.
18662
18663 @item +fp.dp
18664 The single- and double-precision floating-point instructions.
18665
18666 @item +nofp
18667 Disable the floating-point extension.
18668 @end table
18669
18670 @item armv8-m.main
18671 @table @samp
18672 @item +dsp
18673 The DSP instructions.
18674
18675 @item +nodsp
18676 Disable the DSP extension.
18677
18678 @item +fp
18679 The single-precision floating-point instructions.
18680
18681 @item +fp.dp
18682 The single- and double-precision floating-point instructions.
18683
18684 @item +nofp
18685 Disable the floating-point extension.
18686 @end table
18687
18688 @item armv8-r
18689 @table @samp
18690 @item +crc
18691 The Cyclic Redundancy Check (CRC) instructions.
18692 @item +fp.sp
18693 The single-precision FPv5 floating-point instructions.
18694 @item +simd
18695 The ARMv8-A Advanced SIMD and floating-point instructions.
18696 @item +crypto
18697 The cryptographic instructions.
18698 @item +nocrypto
18699 Disable the cryptographic instructions.
18700 @item +nofp
18701 Disable the floating-point, Advanced SIMD and cryptographic instructions.
18702 @end table
18703
18704 @end table
18705
18706 @option{-march=native} causes the compiler to auto-detect the architecture
18707 of the build computer. At present, this feature is only supported on
18708 GNU/Linux, and not all architectures are recognized. If the auto-detect
18709 is unsuccessful the option has no effect.
18710
18711 @item -mtune=@var{name}
18712 @opindex mtune
18713 This option specifies the name of the target ARM processor for
18714 which GCC should tune the performance of the code.
18715 For some ARM implementations better performance can be obtained by using
18716 this option.
18717 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
18718 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
18719 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
18720 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
18721 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
18722 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
18723 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
18724 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
18725 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
18726 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
18727 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
18728 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
18729 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
18730 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
18731 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
18732 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
18733 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
18734 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
18735 @samp{cortex-m35p},
18736 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
18737 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
18738 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
18739 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
18740 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
18741
18742 Additionally, this option can specify that GCC should tune the performance
18743 of the code for a big.LITTLE system. Permissible names are:
18744 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
18745 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18746 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
18747 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
18748
18749 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
18750 performance for a blend of processors within architecture @var{arch}.
18751 The aim is to generate code that run well on the current most popular
18752 processors, balancing between optimizations that benefit some CPUs in the
18753 range, and avoiding performance pitfalls of other CPUs. The effects of
18754 this option may change in future GCC versions as CPU models come and go.
18755
18756 @option{-mtune} permits the same extension options as @option{-mcpu}, but
18757 the extension options do not affect the tuning of the generated code.
18758
18759 @option{-mtune=native} causes the compiler to auto-detect the CPU
18760 of the build computer. At present, this feature is only supported on
18761 GNU/Linux, and not all architectures are recognized. If the auto-detect is
18762 unsuccessful the option has no effect.
18763
18764 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
18765 @opindex mcpu
18766 This specifies the name of the target ARM processor. GCC uses this name
18767 to derive the name of the target ARM architecture (as if specified
18768 by @option{-march}) and the ARM processor type for which to tune for
18769 performance (as if specified by @option{-mtune}). Where this option
18770 is used in conjunction with @option{-march} or @option{-mtune},
18771 those options take precedence over the appropriate part of this option.
18772
18773 Many of the supported CPUs implement optional architectural
18774 extensions. Where this is so the architectural extensions are
18775 normally enabled by default. If implementations that lack the
18776 extension exist, then the extension syntax can be used to disable
18777 those extensions that have been omitted. For floating-point and
18778 Advanced SIMD (Neon) instructions, the settings of the options
18779 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
18780 floating-point and Advanced SIMD instructions will only be used if
18781 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
18782 @option{-mfpu} other than @samp{auto} will override the available
18783 floating-point and SIMD extension instructions.
18784
18785 For example, @samp{cortex-a9} can be found in three major
18786 configurations: integer only, with just a floating-point unit or with
18787 floating-point and Advanced SIMD. The default is to enable all the
18788 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
18789 be used to disable just the SIMD or both the SIMD and floating-point
18790 instructions respectively.
18791
18792 Permissible names for this option are the same as those for
18793 @option{-mtune}.
18794
18795 The following extension options are common to the listed CPUs:
18796
18797 @table @samp
18798 @item +nodsp
18799 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
18800
18801 @item +nofp
18802 Disables the floating-point instructions on @samp{arm9e},
18803 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
18804 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
18805 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
18806 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
18807 Disables the floating-point and SIMD instructions on
18808 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
18809 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
18810 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
18811 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
18812 @samp{cortex-a53} and @samp{cortex-a55}.
18813
18814 @item +nofp.dp
18815 Disables the double-precision component of the floating-point instructions
18816 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
18817 @samp{cortex-m7}.
18818
18819 @item +nosimd
18820 Disables the SIMD (but not floating-point) instructions on
18821 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
18822 and @samp{cortex-a9}.
18823
18824 @item +crypto
18825 Enables the cryptographic instructions on @samp{cortex-a32},
18826 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
18827 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
18828 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
18829 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
18830 @samp{cortex-a75.cortex-a55}.
18831 @end table
18832
18833 Additionally the @samp{generic-armv7-a} pseudo target defaults to
18834 VFPv3 with 16 double-precision registers. It supports the following
18835 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
18836 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
18837 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
18838 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
18839 the extensions to @option{-march=armv7-a}.
18840
18841 @option{-mcpu=generic-@var{arch}} is also permissible, and is
18842 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
18843 See @option{-mtune} for more information.
18844
18845 @option{-mcpu=native} causes the compiler to auto-detect the CPU
18846 of the build computer. At present, this feature is only supported on
18847 GNU/Linux, and not all architectures are recognized. If the auto-detect
18848 is unsuccessful the option has no effect.
18849
18850 @item -mfpu=@var{name}
18851 @opindex mfpu
18852 This specifies what floating-point hardware (or hardware emulation) is
18853 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
18854 @samp{vfpv3},
18855 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
18856 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
18857 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
18858 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
18859 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
18860 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
18861 is an alias for @samp{vfpv2}.
18862
18863 The setting @samp{auto} is the default and is special. It causes the
18864 compiler to select the floating-point and Advanced SIMD instructions
18865 based on the settings of @option{-mcpu} and @option{-march}.
18866
18867 If the selected floating-point hardware includes the NEON extension
18868 (e.g.@: @option{-mfpu=neon}), note that floating-point
18869 operations are not generated by GCC's auto-vectorization pass unless
18870 @option{-funsafe-math-optimizations} is also specified. This is
18871 because NEON hardware does not fully implement the IEEE 754 standard for
18872 floating-point arithmetic (in particular denormal values are treated as
18873 zero), so the use of NEON instructions may lead to a loss of precision.
18874
18875 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}).
18876
18877 @item -mfp16-format=@var{name}
18878 @opindex mfp16-format
18879 Specify the format of the @code{__fp16} half-precision floating-point type.
18880 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
18881 the default is @samp{none}, in which case the @code{__fp16} type is not
18882 defined. @xref{Half-Precision}, for more information.
18883
18884 @item -mstructure-size-boundary=@var{n}
18885 @opindex mstructure-size-boundary
18886 The sizes of all structures and unions are rounded up to a multiple
18887 of the number of bits set by this option. Permissible values are 8, 32
18888 and 64. The default value varies for different toolchains. For the COFF
18889 targeted toolchain the default value is 8. A value of 64 is only allowed
18890 if the underlying ABI supports it.
18891
18892 Specifying a larger number can produce faster, more efficient code, but
18893 can also increase the size of the program. Different values are potentially
18894 incompatible. Code compiled with one value cannot necessarily expect to
18895 work with code or libraries compiled with another value, if they exchange
18896 information using structures or unions.
18897
18898 This option is deprecated.
18899
18900 @item -mabort-on-noreturn
18901 @opindex mabort-on-noreturn
18902 Generate a call to the function @code{abort} at the end of a
18903 @code{noreturn} function. It is executed if the function tries to
18904 return.
18905
18906 @item -mlong-calls
18907 @itemx -mno-long-calls
18908 @opindex mlong-calls
18909 @opindex mno-long-calls
18910 Tells the compiler to perform function calls by first loading the
18911 address of the function into a register and then performing a subroutine
18912 call on this register. This switch is needed if the target function
18913 lies outside of the 64-megabyte addressing range of the offset-based
18914 version of subroutine call instruction.
18915
18916 Even if this switch is enabled, not all function calls are turned
18917 into long calls. The heuristic is that static functions, functions
18918 that have the @code{short_call} attribute, functions that are inside
18919 the scope of a @code{#pragma no_long_calls} directive, and functions whose
18920 definitions have already been compiled within the current compilation
18921 unit are not turned into long calls. The exceptions to this rule are
18922 that weak function definitions, functions with the @code{long_call}
18923 attribute or the @code{section} attribute, and functions that are within
18924 the scope of a @code{#pragma long_calls} directive are always
18925 turned into long calls.
18926
18927 This feature is not enabled by default. Specifying
18928 @option{-mno-long-calls} restores the default behavior, as does
18929 placing the function calls within the scope of a @code{#pragma
18930 long_calls_off} directive. Note these switches have no effect on how
18931 the compiler generates code to handle function calls via function
18932 pointers.
18933
18934 @item -msingle-pic-base
18935 @opindex msingle-pic-base
18936 Treat the register used for PIC addressing as read-only, rather than
18937 loading it in the prologue for each function. The runtime system is
18938 responsible for initializing this register with an appropriate value
18939 before execution begins.
18940
18941 @item -mpic-register=@var{reg}
18942 @opindex mpic-register
18943 Specify the register to be used for PIC addressing.
18944 For standard PIC base case, the default is any suitable register
18945 determined by compiler. For single PIC base case, the default is
18946 @samp{R9} if target is EABI based or stack-checking is enabled,
18947 otherwise the default is @samp{R10}.
18948
18949 @item -mpic-data-is-text-relative
18950 @opindex mpic-data-is-text-relative
18951 Assume that the displacement between the text and data segments is fixed
18952 at static link time. This permits using PC-relative addressing
18953 operations to access data known to be in the data segment. For
18954 non-VxWorks RTP targets, this option is enabled by default. When
18955 disabled on such targets, it will enable @option{-msingle-pic-base} by
18956 default.
18957
18958 @item -mpoke-function-name
18959 @opindex mpoke-function-name
18960 Write the name of each function into the text section, directly
18961 preceding the function prologue. The generated code is similar to this:
18962
18963 @smallexample
18964 t0
18965 .ascii "arm_poke_function_name", 0
18966 .align
18967 t1
18968 .word 0xff000000 + (t1 - t0)
18969 arm_poke_function_name
18970 mov ip, sp
18971 stmfd sp!, @{fp, ip, lr, pc@}
18972 sub fp, ip, #4
18973 @end smallexample
18974
18975 When performing a stack backtrace, code can inspect the value of
18976 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
18977 location @code{pc - 12} and the top 8 bits are set, then we know that
18978 there is a function name embedded immediately preceding this location
18979 and has length @code{((pc[-3]) & 0xff000000)}.
18980
18981 @item -mthumb
18982 @itemx -marm
18983 @opindex marm
18984 @opindex mthumb
18985
18986 Select between generating code that executes in ARM and Thumb
18987 states. The default for most configurations is to generate code
18988 that executes in ARM state, but the default can be changed by
18989 configuring GCC with the @option{--with-mode=}@var{state}
18990 configure option.
18991
18992 You can also override the ARM and Thumb mode for each function
18993 by using the @code{target("thumb")} and @code{target("arm")} function attributes
18994 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
18995
18996 @item -mflip-thumb
18997 @opindex mflip-thumb
18998 Switch ARM/Thumb modes on alternating functions.
18999 This option is provided for regression testing of mixed Thumb/ARM code
19000 generation, and is not intended for ordinary use in compiling code.
19001
19002 @item -mtpcs-frame
19003 @opindex mtpcs-frame
19004 Generate a stack frame that is compliant with the Thumb Procedure Call
19005 Standard for all non-leaf functions. (A leaf function is one that does
19006 not call any other functions.) The default is @option{-mno-tpcs-frame}.
19007
19008 @item -mtpcs-leaf-frame
19009 @opindex mtpcs-leaf-frame
19010 Generate a stack frame that is compliant with the Thumb Procedure Call
19011 Standard for all leaf functions. (A leaf function is one that does
19012 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
19013
19014 @item -mcallee-super-interworking
19015 @opindex mcallee-super-interworking
19016 Gives all externally visible functions in the file being compiled an ARM
19017 instruction set header which switches to Thumb mode before executing the
19018 rest of the function. This allows these functions to be called from
19019 non-interworking code. This option is not valid in AAPCS configurations
19020 because interworking is enabled by default.
19021
19022 @item -mcaller-super-interworking
19023 @opindex mcaller-super-interworking
19024 Allows calls via function pointers (including virtual functions) to
19025 execute correctly regardless of whether the target code has been
19026 compiled for interworking or not. There is a small overhead in the cost
19027 of executing a function pointer if this option is enabled. This option
19028 is not valid in AAPCS configurations because interworking is enabled
19029 by default.
19030
19031 @item -mtp=@var{name}
19032 @opindex mtp
19033 Specify the access model for the thread local storage pointer. The valid
19034 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
19035 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
19036 (supported in the arm6k architecture), and @samp{auto}, which uses the
19037 best available method for the selected processor. The default setting is
19038 @samp{auto}.
19039
19040 @item -mtls-dialect=@var{dialect}
19041 @opindex mtls-dialect
19042 Specify the dialect to use for accessing thread local storage. Two
19043 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
19044 @samp{gnu} dialect selects the original GNU scheme for supporting
19045 local and global dynamic TLS models. The @samp{gnu2} dialect
19046 selects the GNU descriptor scheme, which provides better performance
19047 for shared libraries. The GNU descriptor scheme is compatible with
19048 the original scheme, but does require new assembler, linker and
19049 library support. Initial and local exec TLS models are unaffected by
19050 this option and always use the original scheme.
19051
19052 @item -mword-relocations
19053 @opindex mword-relocations
19054 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
19055 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
19056 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
19057 is specified. This option conflicts with @option{-mslow-flash-data}.
19058
19059 @item -mfix-cortex-m3-ldrd
19060 @opindex mfix-cortex-m3-ldrd
19061 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
19062 with overlapping destination and base registers are used. This option avoids
19063 generating these instructions. This option is enabled by default when
19064 @option{-mcpu=cortex-m3} is specified.
19065
19066 @item -munaligned-access
19067 @itemx -mno-unaligned-access
19068 @opindex munaligned-access
19069 @opindex mno-unaligned-access
19070 Enables (or disables) reading and writing of 16- and 32- bit values
19071 from addresses that are not 16- or 32- bit aligned. By default
19072 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
19073 ARMv8-M Baseline architectures, and enabled for all other
19074 architectures. If unaligned access is not enabled then words in packed
19075 data structures are accessed a byte at a time.
19076
19077 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
19078 generated object file to either true or false, depending upon the
19079 setting of this option. If unaligned access is enabled then the
19080 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
19081 defined.
19082
19083 @item -mneon-for-64bits
19084 @opindex mneon-for-64bits
19085 This option is deprecated and has no effect.
19086
19087 @item -mslow-flash-data
19088 @opindex mslow-flash-data
19089 Assume loading data from flash is slower than fetching instruction.
19090 Therefore literal load is minimized for better performance.
19091 This option is only supported when compiling for ARMv7 M-profile and
19092 off by default. It conflicts with @option{-mword-relocations}.
19093
19094 @item -masm-syntax-unified
19095 @opindex masm-syntax-unified
19096 Assume inline assembler is using unified asm syntax. The default is
19097 currently off which implies divided syntax. This option has no impact
19098 on Thumb2. However, this may change in future releases of GCC.
19099 Divided syntax should be considered deprecated.
19100
19101 @item -mrestrict-it
19102 @opindex mrestrict-it
19103 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
19104 IT blocks can only contain a single 16-bit instruction from a select
19105 set of instructions. This option is on by default for ARMv8-A Thumb mode.
19106
19107 @item -mprint-tune-info
19108 @opindex mprint-tune-info
19109 Print CPU tuning information as comment in assembler file. This is
19110 an option used only for regression testing of the compiler and not
19111 intended for ordinary use in compiling code. This option is disabled
19112 by default.
19113
19114 @item -mverbose-cost-dump
19115 @opindex mverbose-cost-dump
19116 Enable verbose cost model dumping in the debug dump files. This option is
19117 provided for use in debugging the compiler.
19118
19119 @item -mpure-code
19120 @opindex mpure-code
19121 Do not allow constant data to be placed in code sections.
19122 Additionally, when compiling for ELF object format give all text sections the
19123 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
19124 is only available when generating non-pic code for M-profile targets.
19125
19126 @item -mcmse
19127 @opindex mcmse
19128 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
19129 Development Tools Engineering Specification", which can be found on
19130 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
19131
19132 @item -mfdpic
19133 @itemx -mno-fdpic
19134 @opindex mfdpic
19135 @opindex mno-fdpic
19136 Select the FDPIC ABI, which uses 64-bit function descriptors to
19137 represent pointers to functions. When the compiler is configured for
19138 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
19139 and implies @option{-fPIE} if none of the PIC/PIE-related options is
19140 provided. On other targets, it only enables the FDPIC-specific code
19141 generation features, and the user should explicitly provide the
19142 PIC/PIE-related options as needed.
19143
19144 Note that static linking is not supported because it would still
19145 involve the dynamic linker when the program self-relocates. If such
19146 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
19147
19148 The opposite @option{-mno-fdpic} option is useful (and required) to
19149 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
19150 toolchain as the one used to build the userland programs.
19151
19152 @end table
19153
19154 @node AVR Options
19155 @subsection AVR Options
19156 @cindex AVR Options
19157
19158 These options are defined for AVR implementations:
19159
19160 @table @gcctabopt
19161 @item -mmcu=@var{mcu}
19162 @opindex mmcu
19163 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
19164
19165 The default for this option is@tie{}@samp{avr2}.
19166
19167 GCC supports the following AVR devices and ISAs:
19168
19169 @include avr-mmcu.texi
19170
19171 @item -mabsdata
19172 @opindex mabsdata
19173
19174 Assume that all data in static storage can be accessed by LDS / STS
19175 instructions. This option has only an effect on reduced Tiny devices like
19176 ATtiny40. See also the @code{absdata}
19177 @ref{AVR Variable Attributes,variable attribute}.
19178
19179 @item -maccumulate-args
19180 @opindex maccumulate-args
19181 Accumulate outgoing function arguments and acquire/release the needed
19182 stack space for outgoing function arguments once in function
19183 prologue/epilogue. Without this option, outgoing arguments are pushed
19184 before calling a function and popped afterwards.
19185
19186 Popping the arguments after the function call can be expensive on
19187 AVR so that accumulating the stack space might lead to smaller
19188 executables because arguments need not be removed from the
19189 stack after such a function call.
19190
19191 This option can lead to reduced code size for functions that perform
19192 several calls to functions that get their arguments on the stack like
19193 calls to printf-like functions.
19194
19195 @item -mbranch-cost=@var{cost}
19196 @opindex mbranch-cost
19197 Set the branch costs for conditional branch instructions to
19198 @var{cost}. Reasonable values for @var{cost} are small, non-negative
19199 integers. The default branch cost is 0.
19200
19201 @item -mcall-prologues
19202 @opindex mcall-prologues
19203 Functions prologues/epilogues are expanded as calls to appropriate
19204 subroutines. Code size is smaller.
19205
19206 @item -mdouble=@var{bits}
19207 @itemx -mlong-double=@var{bits}
19208 @opindex mdouble
19209 @opindex mlong-double
19210 Set the size (in bits) of the @code{double} or @code{long double} type,
19211 respectively. Possible values for @var{bits} are 32 and 64.
19212 Whether or not a specific value for @var{bits} is allowed depends on
19213 the @code{--with-double=} and @code{--with-long-double=}
19214 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure options}},
19215 and the same applies for the default values of the options.
19216
19217 @item -mgas-isr-prologues
19218 @opindex mgas-isr-prologues
19219 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
19220 instruction supported by GNU Binutils.
19221 If this option is on, the feature can still be disabled for individual
19222 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
19223 function attribute. This feature is activated per default
19224 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
19225 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
19226
19227 @item -mint8
19228 @opindex mint8
19229 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
19230 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
19231 and @code{long long} is 4 bytes. Please note that this option does not
19232 conform to the C standards, but it results in smaller code
19233 size.
19234
19235 @item -mmain-is-OS_task
19236 @opindex mmain-is-OS_task
19237 Do not save registers in @code{main}. The effect is the same like
19238 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
19239 to @code{main}. It is activated per default if optimization is on.
19240
19241 @item -mn-flash=@var{num}
19242 @opindex mn-flash
19243 Assume that the flash memory has a size of
19244 @var{num} times 64@tie{}KiB.
19245
19246 @item -mno-interrupts
19247 @opindex mno-interrupts
19248 Generated code is not compatible with hardware interrupts.
19249 Code size is smaller.
19250
19251 @item -mrelax
19252 @opindex mrelax
19253 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
19254 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
19255 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
19256 the assembler's command line and the @option{--relax} option to the
19257 linker's command line.
19258
19259 Jump relaxing is performed by the linker because jump offsets are not
19260 known before code is located. Therefore, the assembler code generated by the
19261 compiler is the same, but the instructions in the executable may
19262 differ from instructions in the assembler code.
19263
19264 Relaxing must be turned on if linker stubs are needed, see the
19265 section on @code{EIND} and linker stubs below.
19266
19267 @item -mrmw
19268 @opindex mrmw
19269 Assume that the device supports the Read-Modify-Write
19270 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
19271
19272 @item -mshort-calls
19273 @opindex mshort-calls
19274
19275 Assume that @code{RJMP} and @code{RCALL} can target the whole
19276 program memory.
19277
19278 This option is used internally for multilib selection. It is
19279 not an optimization option, and you don't need to set it by hand.
19280
19281 @item -msp8
19282 @opindex msp8
19283 Treat the stack pointer register as an 8-bit register,
19284 i.e.@: assume the high byte of the stack pointer is zero.
19285 In general, you don't need to set this option by hand.
19286
19287 This option is used internally by the compiler to select and
19288 build multilibs for architectures @code{avr2} and @code{avr25}.
19289 These architectures mix devices with and without @code{SPH}.
19290 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
19291 the compiler driver adds or removes this option from the compiler
19292 proper's command line, because the compiler then knows if the device
19293 or architecture has an 8-bit stack pointer and thus no @code{SPH}
19294 register or not.
19295
19296 @item -mstrict-X
19297 @opindex mstrict-X
19298 Use address register @code{X} in a way proposed by the hardware. This means
19299 that @code{X} is only used in indirect, post-increment or
19300 pre-decrement addressing.
19301
19302 Without this option, the @code{X} register may be used in the same way
19303 as @code{Y} or @code{Z} which then is emulated by additional
19304 instructions.
19305 For example, loading a value with @code{X+const} addressing with a
19306 small non-negative @code{const < 64} to a register @var{Rn} is
19307 performed as
19308
19309 @example
19310 adiw r26, const ; X += const
19311 ld @var{Rn}, X ; @var{Rn} = *X
19312 sbiw r26, const ; X -= const
19313 @end example
19314
19315 @item -mtiny-stack
19316 @opindex mtiny-stack
19317 Only change the lower 8@tie{}bits of the stack pointer.
19318
19319 @item -mfract-convert-truncate
19320 @opindex mfract-convert-truncate
19321 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
19322
19323 @item -nodevicelib
19324 @opindex nodevicelib
19325 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
19326
19327 @item -nodevicespecs
19328 @opindex nodevicespecs
19329 Don't add @option{-specs=device-specs/specs-@var{mcu}} to the compiler driver's
19330 command line. The user takes responsibility for supplying the sub-processes
19331 like compiler proper, assembler and linker with appropriate command line
19332 options. This means that the user has to supply her private device specs
19333 file by means of @option{-specs=@var{path-to-specs-file}}. There is no
19334 more need for option @option{-mmcu=@var{mcu}}.
19335
19336 This option can also serve as a replacement for the older way of
19337 specifying custom device-specs files that needed @option{-B @var{some-path}} to point to a directory
19338 which contains a folder named @code{device-specs} which contains a specs file named
19339 @code{specs-@var{mcu}}, where @var{mcu} was specified by @option{-mmcu=@var{mcu}}.
19340
19341 @item -Waddr-space-convert
19342 @opindex Waddr-space-convert
19343 @opindex Wno-addr-space-convert
19344 Warn about conversions between address spaces in the case where the
19345 resulting address space is not contained in the incoming address space.
19346
19347 @item -Wmisspelled-isr
19348 @opindex Wmisspelled-isr
19349 @opindex Wno-misspelled-isr
19350 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
19351 Enabled by default.
19352 @end table
19353
19354 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
19355 @cindex @code{EIND}
19356 Pointers in the implementation are 16@tie{}bits wide.
19357 The address of a function or label is represented as word address so
19358 that indirect jumps and calls can target any code address in the
19359 range of 64@tie{}Ki words.
19360
19361 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
19362 bytes of program memory space, there is a special function register called
19363 @code{EIND} that serves as most significant part of the target address
19364 when @code{EICALL} or @code{EIJMP} instructions are used.
19365
19366 Indirect jumps and calls on these devices are handled as follows by
19367 the compiler and are subject to some limitations:
19368
19369 @itemize @bullet
19370
19371 @item
19372 The compiler never sets @code{EIND}.
19373
19374 @item
19375 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
19376 instructions or might read @code{EIND} directly in order to emulate an
19377 indirect call/jump by means of a @code{RET} instruction.
19378
19379 @item
19380 The compiler assumes that @code{EIND} never changes during the startup
19381 code or during the application. In particular, @code{EIND} is not
19382 saved/restored in function or interrupt service routine
19383 prologue/epilogue.
19384
19385 @item
19386 For indirect calls to functions and computed goto, the linker
19387 generates @emph{stubs}. Stubs are jump pads sometimes also called
19388 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
19389 The stub contains a direct jump to the desired address.
19390
19391 @item
19392 Linker relaxation must be turned on so that the linker generates
19393 the stubs correctly in all situations. See the compiler option
19394 @option{-mrelax} and the linker option @option{--relax}.
19395 There are corner cases where the linker is supposed to generate stubs
19396 but aborts without relaxation and without a helpful error message.
19397
19398 @item
19399 The default linker script is arranged for code with @code{EIND = 0}.
19400 If code is supposed to work for a setup with @code{EIND != 0}, a custom
19401 linker script has to be used in order to place the sections whose
19402 name start with @code{.trampolines} into the segment where @code{EIND}
19403 points to.
19404
19405 @item
19406 The startup code from libgcc never sets @code{EIND}.
19407 Notice that startup code is a blend of code from libgcc and AVR-LibC.
19408 For the impact of AVR-LibC on @code{EIND}, see the
19409 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
19410
19411 @item
19412 It is legitimate for user-specific startup code to set up @code{EIND}
19413 early, for example by means of initialization code located in
19414 section @code{.init3}. Such code runs prior to general startup code
19415 that initializes RAM and calls constructors, but after the bit
19416 of startup code from AVR-LibC that sets @code{EIND} to the segment
19417 where the vector table is located.
19418 @example
19419 #include <avr/io.h>
19420
19421 static void
19422 __attribute__((section(".init3"),naked,used,no_instrument_function))
19423 init3_set_eind (void)
19424 @{
19425 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
19426 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
19427 @}
19428 @end example
19429
19430 @noindent
19431 The @code{__trampolines_start} symbol is defined in the linker script.
19432
19433 @item
19434 Stubs are generated automatically by the linker if
19435 the following two conditions are met:
19436 @itemize @minus
19437
19438 @item The address of a label is taken by means of the @code{gs} modifier
19439 (short for @emph{generate stubs}) like so:
19440 @example
19441 LDI r24, lo8(gs(@var{func}))
19442 LDI r25, hi8(gs(@var{func}))
19443 @end example
19444 @item The final location of that label is in a code segment
19445 @emph{outside} the segment where the stubs are located.
19446 @end itemize
19447
19448 @item
19449 The compiler emits such @code{gs} modifiers for code labels in the
19450 following situations:
19451 @itemize @minus
19452 @item Taking address of a function or code label.
19453 @item Computed goto.
19454 @item If prologue-save function is used, see @option{-mcall-prologues}
19455 command-line option.
19456 @item Switch/case dispatch tables. If you do not want such dispatch
19457 tables you can specify the @option{-fno-jump-tables} command-line option.
19458 @item C and C++ constructors/destructors called during startup/shutdown.
19459 @item If the tools hit a @code{gs()} modifier explained above.
19460 @end itemize
19461
19462 @item
19463 Jumping to non-symbolic addresses like so is @emph{not} supported:
19464
19465 @example
19466 int main (void)
19467 @{
19468 /* Call function at word address 0x2 */
19469 return ((int(*)(void)) 0x2)();
19470 @}
19471 @end example
19472
19473 Instead, a stub has to be set up, i.e.@: the function has to be called
19474 through a symbol (@code{func_4} in the example):
19475
19476 @example
19477 int main (void)
19478 @{
19479 extern int func_4 (void);
19480
19481 /* Call function at byte address 0x4 */
19482 return func_4();
19483 @}
19484 @end example
19485
19486 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
19487 Alternatively, @code{func_4} can be defined in the linker script.
19488 @end itemize
19489
19490 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
19491 @cindex @code{RAMPD}
19492 @cindex @code{RAMPX}
19493 @cindex @code{RAMPY}
19494 @cindex @code{RAMPZ}
19495 Some AVR devices support memories larger than the 64@tie{}KiB range
19496 that can be accessed with 16-bit pointers. To access memory locations
19497 outside this 64@tie{}KiB range, the content of a @code{RAMP}
19498 register is used as high part of the address:
19499 The @code{X}, @code{Y}, @code{Z} address register is concatenated
19500 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
19501 register, respectively, to get a wide address. Similarly,
19502 @code{RAMPD} is used together with direct addressing.
19503
19504 @itemize
19505 @item
19506 The startup code initializes the @code{RAMP} special function
19507 registers with zero.
19508
19509 @item
19510 If a @ref{AVR Named Address Spaces,named address space} other than
19511 generic or @code{__flash} is used, then @code{RAMPZ} is set
19512 as needed before the operation.
19513
19514 @item
19515 If the device supports RAM larger than 64@tie{}KiB and the compiler
19516 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
19517 is reset to zero after the operation.
19518
19519 @item
19520 If the device comes with a specific @code{RAMP} register, the ISR
19521 prologue/epilogue saves/restores that SFR and initializes it with
19522 zero in case the ISR code might (implicitly) use it.
19523
19524 @item
19525 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
19526 If you use inline assembler to read from locations outside the
19527 16-bit address range and change one of the @code{RAMP} registers,
19528 you must reset it to zero after the access.
19529
19530 @end itemize
19531
19532 @subsubsection AVR Built-in Macros
19533
19534 GCC defines several built-in macros so that the user code can test
19535 for the presence or absence of features. Almost any of the following
19536 built-in macros are deduced from device capabilities and thus
19537 triggered by the @option{-mmcu=} command-line option.
19538
19539 For even more AVR-specific built-in macros see
19540 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
19541
19542 @table @code
19543
19544 @item __AVR_ARCH__
19545 Build-in macro that resolves to a decimal number that identifies the
19546 architecture and depends on the @option{-mmcu=@var{mcu}} option.
19547 Possible values are:
19548
19549 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
19550 @code{4}, @code{5}, @code{51}, @code{6}
19551
19552 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
19553 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
19554
19555 respectively and
19556
19557 @code{100},
19558 @code{102}, @code{103}, @code{104},
19559 @code{105}, @code{106}, @code{107}
19560
19561 for @var{mcu}=@code{avrtiny},
19562 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
19563 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
19564 If @var{mcu} specifies a device, this built-in macro is set
19565 accordingly. For example, with @option{-mmcu=atmega8} the macro is
19566 defined to @code{4}.
19567
19568 @item __AVR_@var{Device}__
19569 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
19570 the device's name. For example, @option{-mmcu=atmega8} defines the
19571 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
19572 @code{__AVR_ATtiny261A__}, etc.
19573
19574 The built-in macros' names follow
19575 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
19576 the device name as from the AVR user manual. The difference between
19577 @var{Device} in the built-in macro and @var{device} in
19578 @option{-mmcu=@var{device}} is that the latter is always lowercase.
19579
19580 If @var{device} is not a device but only a core architecture like
19581 @samp{avr51}, this macro is not defined.
19582
19583 @item __AVR_DEVICE_NAME__
19584 Setting @option{-mmcu=@var{device}} defines this built-in macro to
19585 the device's name. For example, with @option{-mmcu=atmega8} the macro
19586 is defined to @code{atmega8}.
19587
19588 If @var{device} is not a device but only a core architecture like
19589 @samp{avr51}, this macro is not defined.
19590
19591 @item __AVR_XMEGA__
19592 The device / architecture belongs to the XMEGA family of devices.
19593
19594 @item __AVR_HAVE_ELPM__
19595 The device has the @code{ELPM} instruction.
19596
19597 @item __AVR_HAVE_ELPMX__
19598 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
19599 R@var{n},Z+} instructions.
19600
19601 @item __AVR_HAVE_MOVW__
19602 The device has the @code{MOVW} instruction to perform 16-bit
19603 register-register moves.
19604
19605 @item __AVR_HAVE_LPMX__
19606 The device has the @code{LPM R@var{n},Z} and
19607 @code{LPM R@var{n},Z+} instructions.
19608
19609 @item __AVR_HAVE_MUL__
19610 The device has a hardware multiplier.
19611
19612 @item __AVR_HAVE_JMP_CALL__
19613 The device has the @code{JMP} and @code{CALL} instructions.
19614 This is the case for devices with more than 8@tie{}KiB of program
19615 memory.
19616
19617 @item __AVR_HAVE_EIJMP_EICALL__
19618 @itemx __AVR_3_BYTE_PC__
19619 The device has the @code{EIJMP} and @code{EICALL} instructions.
19620 This is the case for devices with more than 128@tie{}KiB of program memory.
19621 This also means that the program counter
19622 (PC) is 3@tie{}bytes wide.
19623
19624 @item __AVR_2_BYTE_PC__
19625 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
19626 with up to 128@tie{}KiB of program memory.
19627
19628 @item __AVR_HAVE_8BIT_SP__
19629 @itemx __AVR_HAVE_16BIT_SP__
19630 The stack pointer (SP) register is treated as 8-bit respectively
19631 16-bit register by the compiler.
19632 The definition of these macros is affected by @option{-mtiny-stack}.
19633
19634 @item __AVR_HAVE_SPH__
19635 @itemx __AVR_SP8__
19636 The device has the SPH (high part of stack pointer) special function
19637 register or has an 8-bit stack pointer, respectively.
19638 The definition of these macros is affected by @option{-mmcu=} and
19639 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
19640 by @option{-msp8}.
19641
19642 @item __AVR_HAVE_RAMPD__
19643 @itemx __AVR_HAVE_RAMPX__
19644 @itemx __AVR_HAVE_RAMPY__
19645 @itemx __AVR_HAVE_RAMPZ__
19646 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
19647 @code{RAMPZ} special function register, respectively.
19648
19649 @item __NO_INTERRUPTS__
19650 This macro reflects the @option{-mno-interrupts} command-line option.
19651
19652 @item __AVR_ERRATA_SKIP__
19653 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
19654 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
19655 instructions because of a hardware erratum. Skip instructions are
19656 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
19657 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
19658 set.
19659
19660 @item __AVR_ISA_RMW__
19661 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
19662
19663 @item __AVR_SFR_OFFSET__=@var{offset}
19664 Instructions that can address I/O special function registers directly
19665 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
19666 address as if addressed by an instruction to access RAM like @code{LD}
19667 or @code{STS}. This offset depends on the device architecture and has
19668 to be subtracted from the RAM address in order to get the
19669 respective I/O@tie{}address.
19670
19671 @item __AVR_SHORT_CALLS__
19672 The @option{-mshort-calls} command line option is set.
19673
19674 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
19675 Some devices support reading from flash memory by means of @code{LD*}
19676 instructions. The flash memory is seen in the data address space
19677 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
19678 is not defined, this feature is not available. If defined,
19679 the address space is linear and there is no need to put
19680 @code{.rodata} into RAM. This is handled by the default linker
19681 description file, and is currently available for
19682 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
19683 there is no need to use address spaces like @code{__flash} or
19684 features like attribute @code{progmem} and @code{pgm_read_*}.
19685
19686 @item __WITH_AVRLIBC__
19687 The compiler is configured to be used together with AVR-Libc.
19688 See the @option{--with-avrlibc} configure option.
19689
19690 @item __HAVE_DOUBLE_MULTILIB__
19691 Defined if @option{-mdouble=} acts as a multilib option.
19692
19693 @item __HAVE_DOUBLE32__
19694 @itemx __HAVE_DOUBLE64__
19695 Defined if the compiler supports 32-bit double resp. 64-bit double.
19696 The actual layout is specified by option @option{-mdouble=}.
19697
19698 @item __DEFAULT_DOUBLE__
19699 The size in bits of @code{double} if @option{-mdouble=} is not set.
19700 To test the layout of @code{double} in a program, use the built-in
19701 macro @code{__SIZEOF_DOUBLE__}.
19702
19703 @item __HAVE_LONG_DOUBLE32__
19704 @itemx __HAVE_LONG_DOUBLE64__
19705 @itemx __HAVE_LONG_DOUBLE_MULTILIB__
19706 @itemx __DEFAULT_LONG_DOUBLE__
19707 Same as above, but for @code{long double} instead of @code{double}.
19708
19709 @item __WITH_DOUBLE_COMPARISON__
19710 Reflects the @code{--with-double-comparison=@{tristate|bool|libf7@}}
19711 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}
19712 and is defined to @code{2} or @code{3}.
19713
19714 @item __WITH_LIBF7_LIBGCC__
19715 @itemx __WITH_LIBF7_MATH__
19716 @itemx __WITH_LIBF7_MATH_SYMBOLS__
19717 Reflects the @code{--with-libf7=@{libgcc|math|math-symbols@}}
19718 @w{@uref{https://gcc.gnu.org/install/configure.html#avr,configure option}}.
19719
19720 @end table
19721
19722 @node Blackfin Options
19723 @subsection Blackfin Options
19724 @cindex Blackfin Options
19725
19726 @table @gcctabopt
19727 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
19728 @opindex mcpu=
19729 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
19730 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
19731 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
19732 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
19733 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
19734 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
19735 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
19736 @samp{bf561}, @samp{bf592}.
19737
19738 The optional @var{sirevision} specifies the silicon revision of the target
19739 Blackfin processor. Any workarounds available for the targeted silicon revision
19740 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
19741 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
19742 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
19743 hexadecimal digits representing the major and minor numbers in the silicon
19744 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
19745 is not defined. If @var{sirevision} is @samp{any}, the
19746 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
19747 If this optional @var{sirevision} is not used, GCC assumes the latest known
19748 silicon revision of the targeted Blackfin processor.
19749
19750 GCC defines a preprocessor macro for the specified @var{cpu}.
19751 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
19752 provided by libgloss to be linked in if @option{-msim} is not given.
19753
19754 Without this option, @samp{bf532} is used as the processor by default.
19755
19756 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
19757 only the preprocessor macro is defined.
19758
19759 @item -msim
19760 @opindex msim
19761 Specifies that the program will be run on the simulator. This causes
19762 the simulator BSP provided by libgloss to be linked in. This option
19763 has effect only for @samp{bfin-elf} toolchain.
19764 Certain other options, such as @option{-mid-shared-library} and
19765 @option{-mfdpic}, imply @option{-msim}.
19766
19767 @item -momit-leaf-frame-pointer
19768 @opindex momit-leaf-frame-pointer
19769 Don't keep the frame pointer in a register for leaf functions. This
19770 avoids the instructions to save, set up and restore frame pointers and
19771 makes an extra register available in leaf functions.
19772
19773 @item -mspecld-anomaly
19774 @opindex mspecld-anomaly
19775 When enabled, the compiler ensures that the generated code does not
19776 contain speculative loads after jump instructions. If this option is used,
19777 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
19778
19779 @item -mno-specld-anomaly
19780 @opindex mno-specld-anomaly
19781 @opindex mspecld-anomaly
19782 Don't generate extra code to prevent speculative loads from occurring.
19783
19784 @item -mcsync-anomaly
19785 @opindex mcsync-anomaly
19786 When enabled, the compiler ensures that the generated code does not
19787 contain CSYNC or SSYNC instructions too soon after conditional branches.
19788 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
19789
19790 @item -mno-csync-anomaly
19791 @opindex mno-csync-anomaly
19792 @opindex mcsync-anomaly
19793 Don't generate extra code to prevent CSYNC or SSYNC instructions from
19794 occurring too soon after a conditional branch.
19795
19796 @item -mlow64k
19797 @opindex mlow64k
19798 When enabled, the compiler is free to take advantage of the knowledge that
19799 the entire program fits into the low 64k of memory.
19800
19801 @item -mno-low64k
19802 @opindex mno-low64k
19803 Assume that the program is arbitrarily large. This is the default.
19804
19805 @item -mstack-check-l1
19806 @opindex mstack-check-l1
19807 Do stack checking using information placed into L1 scratchpad memory by the
19808 uClinux kernel.
19809
19810 @item -mid-shared-library
19811 @opindex mid-shared-library
19812 Generate code that supports shared libraries via the library ID method.
19813 This allows for execute in place and shared libraries in an environment
19814 without virtual memory management. This option implies @option{-fPIC}.
19815 With a @samp{bfin-elf} target, this option implies @option{-msim}.
19816
19817 @item -mno-id-shared-library
19818 @opindex mno-id-shared-library
19819 @opindex mid-shared-library
19820 Generate code that doesn't assume ID-based shared libraries are being used.
19821 This is the default.
19822
19823 @item -mleaf-id-shared-library
19824 @opindex mleaf-id-shared-library
19825 Generate code that supports shared libraries via the library ID method,
19826 but assumes that this library or executable won't link against any other
19827 ID shared libraries. That allows the compiler to use faster code for jumps
19828 and calls.
19829
19830 @item -mno-leaf-id-shared-library
19831 @opindex mno-leaf-id-shared-library
19832 @opindex mleaf-id-shared-library
19833 Do not assume that the code being compiled won't link against any ID shared
19834 libraries. Slower code is generated for jump and call insns.
19835
19836 @item -mshared-library-id=n
19837 @opindex mshared-library-id
19838 Specifies the identification number of the ID-based shared library being
19839 compiled. Specifying a value of 0 generates more compact code; specifying
19840 other values forces the allocation of that number to the current
19841 library but is no more space- or time-efficient than omitting this option.
19842
19843 @item -msep-data
19844 @opindex msep-data
19845 Generate code that allows the data segment to be located in a different
19846 area of memory from the text segment. This allows for execute in place in
19847 an environment without virtual memory management by eliminating relocations
19848 against the text section.
19849
19850 @item -mno-sep-data
19851 @opindex mno-sep-data
19852 @opindex msep-data
19853 Generate code that assumes that the data segment follows the text segment.
19854 This is the default.
19855
19856 @item -mlong-calls
19857 @itemx -mno-long-calls
19858 @opindex mlong-calls
19859 @opindex mno-long-calls
19860 Tells the compiler to perform function calls by first loading the
19861 address of the function into a register and then performing a subroutine
19862 call on this register. This switch is needed if the target function
19863 lies outside of the 24-bit addressing range of the offset-based
19864 version of subroutine call instruction.
19865
19866 This feature is not enabled by default. Specifying
19867 @option{-mno-long-calls} restores the default behavior. Note these
19868 switches have no effect on how the compiler generates code to handle
19869 function calls via function pointers.
19870
19871 @item -mfast-fp
19872 @opindex mfast-fp
19873 Link with the fast floating-point library. This library relaxes some of
19874 the IEEE floating-point standard's rules for checking inputs against
19875 Not-a-Number (NAN), in the interest of performance.
19876
19877 @item -minline-plt
19878 @opindex minline-plt
19879 Enable inlining of PLT entries in function calls to functions that are
19880 not known to bind locally. It has no effect without @option{-mfdpic}.
19881
19882 @item -mmulticore
19883 @opindex mmulticore
19884 Build a standalone application for multicore Blackfin processors.
19885 This option causes proper start files and link scripts supporting
19886 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
19887 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
19888
19889 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
19890 selects the one-application-per-core programming model. Without
19891 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
19892 programming model is used. In this model, the main function of Core B
19893 should be named as @code{coreb_main}.
19894
19895 If this option is not used, the single-core application programming
19896 model is used.
19897
19898 @item -mcorea
19899 @opindex mcorea
19900 Build a standalone application for Core A of BF561 when using
19901 the one-application-per-core programming model. Proper start files
19902 and link scripts are used to support Core A, and the macro
19903 @code{__BFIN_COREA} is defined.
19904 This option can only be used in conjunction with @option{-mmulticore}.
19905
19906 @item -mcoreb
19907 @opindex mcoreb
19908 Build a standalone application for Core B of BF561 when using
19909 the one-application-per-core programming model. Proper start files
19910 and link scripts are used to support Core B, and the macro
19911 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
19912 should be used instead of @code{main}.
19913 This option can only be used in conjunction with @option{-mmulticore}.
19914
19915 @item -msdram
19916 @opindex msdram
19917 Build a standalone application for SDRAM. Proper start files and
19918 link scripts are used to put the application into SDRAM, and the macro
19919 @code{__BFIN_SDRAM} is defined.
19920 The loader should initialize SDRAM before loading the application.
19921
19922 @item -micplb
19923 @opindex micplb
19924 Assume that ICPLBs are enabled at run time. This has an effect on certain
19925 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
19926 are enabled; for standalone applications the default is off.
19927 @end table
19928
19929 @node C6X Options
19930 @subsection C6X Options
19931 @cindex C6X Options
19932
19933 @table @gcctabopt
19934 @item -march=@var{name}
19935 @opindex march
19936 This specifies the name of the target architecture. GCC uses this
19937 name to determine what kind of instructions it can emit when generating
19938 assembly code. Permissible names are: @samp{c62x},
19939 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
19940
19941 @item -mbig-endian
19942 @opindex mbig-endian
19943 Generate code for a big-endian target.
19944
19945 @item -mlittle-endian
19946 @opindex mlittle-endian
19947 Generate code for a little-endian target. This is the default.
19948
19949 @item -msim
19950 @opindex msim
19951 Choose startup files and linker script suitable for the simulator.
19952
19953 @item -msdata=default
19954 @opindex msdata=default
19955 Put small global and static data in the @code{.neardata} section,
19956 which is pointed to by register @code{B14}. Put small uninitialized
19957 global and static data in the @code{.bss} section, which is adjacent
19958 to the @code{.neardata} section. Put small read-only data into the
19959 @code{.rodata} section. The corresponding sections used for large
19960 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
19961
19962 @item -msdata=all
19963 @opindex msdata=all
19964 Put all data, not just small objects, into the sections reserved for
19965 small data, and use addressing relative to the @code{B14} register to
19966 access them.
19967
19968 @item -msdata=none
19969 @opindex msdata=none
19970 Make no use of the sections reserved for small data, and use absolute
19971 addresses to access all data. Put all initialized global and static
19972 data in the @code{.fardata} section, and all uninitialized data in the
19973 @code{.far} section. Put all constant data into the @code{.const}
19974 section.
19975 @end table
19976
19977 @node CRIS Options
19978 @subsection CRIS Options
19979 @cindex CRIS Options
19980
19981 These options are defined specifically for the CRIS ports.
19982
19983 @table @gcctabopt
19984 @item -march=@var{architecture-type}
19985 @itemx -mcpu=@var{architecture-type}
19986 @opindex march
19987 @opindex mcpu
19988 Generate code for the specified architecture. The choices for
19989 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
19990 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
19991 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
19992 @samp{v10}.
19993
19994 @item -mtune=@var{architecture-type}
19995 @opindex mtune
19996 Tune to @var{architecture-type} everything applicable about the generated
19997 code, except for the ABI and the set of available instructions. The
19998 choices for @var{architecture-type} are the same as for
19999 @option{-march=@var{architecture-type}}.
20000
20001 @item -mmax-stack-frame=@var{n}
20002 @opindex mmax-stack-frame
20003 Warn when the stack frame of a function exceeds @var{n} bytes.
20004
20005 @item -metrax4
20006 @itemx -metrax100
20007 @opindex metrax4
20008 @opindex metrax100
20009 The options @option{-metrax4} and @option{-metrax100} are synonyms for
20010 @option{-march=v3} and @option{-march=v8} respectively.
20011
20012 @item -mmul-bug-workaround
20013 @itemx -mno-mul-bug-workaround
20014 @opindex mmul-bug-workaround
20015 @opindex mno-mul-bug-workaround
20016 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
20017 models where it applies. This option is active by default.
20018
20019 @item -mpdebug
20020 @opindex mpdebug
20021 Enable CRIS-specific verbose debug-related information in the assembly
20022 code. This option also has the effect of turning off the @samp{#NO_APP}
20023 formatted-code indicator to the assembler at the beginning of the
20024 assembly file.
20025
20026 @item -mcc-init
20027 @opindex mcc-init
20028 Do not use condition-code results from previous instruction; always emit
20029 compare and test instructions before use of condition codes.
20030
20031 @item -mno-side-effects
20032 @opindex mno-side-effects
20033 @opindex mside-effects
20034 Do not emit instructions with side effects in addressing modes other than
20035 post-increment.
20036
20037 @item -mstack-align
20038 @itemx -mno-stack-align
20039 @itemx -mdata-align
20040 @itemx -mno-data-align
20041 @itemx -mconst-align
20042 @itemx -mno-const-align
20043 @opindex mstack-align
20044 @opindex mno-stack-align
20045 @opindex mdata-align
20046 @opindex mno-data-align
20047 @opindex mconst-align
20048 @opindex mno-const-align
20049 These options (@samp{no-} options) arrange (eliminate arrangements) for the
20050 stack frame, individual data and constants to be aligned for the maximum
20051 single data access size for the chosen CPU model. The default is to
20052 arrange for 32-bit alignment. ABI details such as structure layout are
20053 not affected by these options.
20054
20055 @item -m32-bit
20056 @itemx -m16-bit
20057 @itemx -m8-bit
20058 @opindex m32-bit
20059 @opindex m16-bit
20060 @opindex m8-bit
20061 Similar to the stack- data- and const-align options above, these options
20062 arrange for stack frame, writable data and constants to all be 32-bit,
20063 16-bit or 8-bit aligned. The default is 32-bit alignment.
20064
20065 @item -mno-prologue-epilogue
20066 @itemx -mprologue-epilogue
20067 @opindex mno-prologue-epilogue
20068 @opindex mprologue-epilogue
20069 With @option{-mno-prologue-epilogue}, the normal function prologue and
20070 epilogue which set up the stack frame are omitted and no return
20071 instructions or return sequences are generated in the code. Use this
20072 option only together with visual inspection of the compiled code: no
20073 warnings or errors are generated when call-saved registers must be saved,
20074 or storage for local variables needs to be allocated.
20075
20076 @item -mno-gotplt
20077 @itemx -mgotplt
20078 @opindex mno-gotplt
20079 @opindex mgotplt
20080 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
20081 instruction sequences that load addresses for functions from the PLT part
20082 of the GOT rather than (traditional on other architectures) calls to the
20083 PLT@. The default is @option{-mgotplt}.
20084
20085 @item -melf
20086 @opindex melf
20087 Legacy no-op option only recognized with the cris-axis-elf and
20088 cris-axis-linux-gnu targets.
20089
20090 @item -mlinux
20091 @opindex mlinux
20092 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
20093
20094 @item -sim
20095 @opindex sim
20096 This option, recognized for the cris-axis-elf, arranges
20097 to link with input-output functions from a simulator library. Code,
20098 initialized data and zero-initialized data are allocated consecutively.
20099
20100 @item -sim2
20101 @opindex sim2
20102 Like @option{-sim}, but pass linker options to locate initialized data at
20103 0x40000000 and zero-initialized data at 0x80000000.
20104 @end table
20105
20106 @node CR16 Options
20107 @subsection CR16 Options
20108 @cindex CR16 Options
20109
20110 These options are defined specifically for the CR16 ports.
20111
20112 @table @gcctabopt
20113
20114 @item -mmac
20115 @opindex mmac
20116 Enable the use of multiply-accumulate instructions. Disabled by default.
20117
20118 @item -mcr16cplus
20119 @itemx -mcr16c
20120 @opindex mcr16cplus
20121 @opindex mcr16c
20122 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
20123 is default.
20124
20125 @item -msim
20126 @opindex msim
20127 Links the library libsim.a which is in compatible with simulator. Applicable
20128 to ELF compiler only.
20129
20130 @item -mint32
20131 @opindex mint32
20132 Choose integer type as 32-bit wide.
20133
20134 @item -mbit-ops
20135 @opindex mbit-ops
20136 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
20137
20138 @item -mdata-model=@var{model}
20139 @opindex mdata-model
20140 Choose a data model. The choices for @var{model} are @samp{near},
20141 @samp{far} or @samp{medium}. @samp{medium} is default.
20142 However, @samp{far} is not valid with @option{-mcr16c}, as the
20143 CR16C architecture does not support the far data model.
20144 @end table
20145
20146 @node C-SKY Options
20147 @subsection C-SKY Options
20148 @cindex C-SKY Options
20149
20150 GCC supports these options when compiling for C-SKY V2 processors.
20151
20152 @table @gcctabopt
20153
20154 @item -march=@var{arch}
20155 @opindex march=
20156 Specify the C-SKY target architecture. Valid values for @var{arch} are:
20157 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
20158 The default is @samp{ck810}.
20159
20160 @item -mcpu=@var{cpu}
20161 @opindex mcpu=
20162 Specify the C-SKY target processor. Valid values for @var{cpu} are:
20163 @samp{ck801}, @samp{ck801t},
20164 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
20165 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
20166 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
20167 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
20168 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
20169 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
20170 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
20171 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
20172 @samp{ck803eftr1}, @samp{ck803efhtr1},
20173 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
20174 @samp{ck803sef}, @samp{ck803seft},
20175 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
20176 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
20177 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
20178 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
20179
20180 @item -mbig-endian
20181 @opindex mbig-endian
20182 @itemx -EB
20183 @opindex EB
20184 @itemx -mlittle-endian
20185 @opindex mlittle-endian
20186 @itemx -EL
20187 @opindex EL
20188
20189 Select big- or little-endian code. The default is little-endian.
20190
20191 @item -mhard-float
20192 @opindex mhard-float
20193 @itemx -msoft-float
20194 @opindex msoft-float
20195
20196 Select hardware or software floating-point implementations.
20197 The default is soft float.
20198
20199 @item -mdouble-float
20200 @itemx -mno-double-float
20201 @opindex mdouble-float
20202 When @option{-mhard-float} is in effect, enable generation of
20203 double-precision float instructions. This is the default except
20204 when compiling for CK803.
20205
20206 @item -mfdivdu
20207 @itemx -mno-fdivdu
20208 @opindex mfdivdu
20209 When @option{-mhard-float} is in effect, enable generation of
20210 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
20211 This is the default except when compiling for CK803.
20212
20213 @item -mfpu=@var{fpu}
20214 @opindex mfpu=
20215 Select the floating-point processor. This option can only be used with
20216 @option{-mhard-float}.
20217 Values for @var{fpu} are
20218 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
20219 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
20220 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
20221
20222 @item -melrw
20223 @itemx -mno-elrw
20224 @opindex melrw
20225 Enable the extended @code{lrw} instruction. This option defaults to on
20226 for CK801 and off otherwise.
20227
20228 @item -mistack
20229 @itemx -mno-istack
20230 @opindex mistack
20231 Enable interrupt stack instructions; the default is off.
20232
20233 The @option{-mistack} option is required to handle the
20234 @code{interrupt} and @code{isr} function attributes
20235 (@pxref{C-SKY Function Attributes}).
20236
20237 @item -mmp
20238 @opindex mmp
20239 Enable multiprocessor instructions; the default is off.
20240
20241 @item -mcp
20242 @opindex mcp
20243 Enable coprocessor instructions; the default is off.
20244
20245 @item -mcache
20246 @opindex mcache
20247 Enable coprocessor instructions; the default is off.
20248
20249 @item -msecurity
20250 @opindex msecurity
20251 Enable C-SKY security instructions; the default is off.
20252
20253 @item -mtrust
20254 @opindex mtrust
20255 Enable C-SKY trust instructions; the default is off.
20256
20257 @item -mdsp
20258 @opindex mdsp
20259 @itemx -medsp
20260 @opindex medsp
20261 @itemx -mvdsp
20262 @opindex mvdsp
20263 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
20264 All of these options default to off.
20265
20266 @item -mdiv
20267 @itemx -mno-div
20268 @opindex mdiv
20269 Generate divide instructions. Default is off.
20270
20271 @item -msmart
20272 @itemx -mno-smart
20273 @opindex msmart
20274 Generate code for Smart Mode, using only registers numbered 0-7 to allow
20275 use of 16-bit instructions. This option is ignored for CK801 where this
20276 is the required behavior, and it defaults to on for CK802.
20277 For other targets, the default is off.
20278
20279 @item -mhigh-registers
20280 @itemx -mno-high-registers
20281 @opindex mhigh-registers
20282 Generate code using the high registers numbered 16-31. This option
20283 is not supported on CK801, CK802, or CK803, and is enabled by default
20284 for other processors.
20285
20286 @item -manchor
20287 @itemx -mno-anchor
20288 @opindex manchor
20289 Generate code using global anchor symbol addresses.
20290
20291 @item -mpushpop
20292 @itemx -mno-pushpop
20293 @opindex mpushpop
20294 Generate code using @code{push} and @code{pop} instructions. This option
20295 defaults to on.
20296
20297 @item -mmultiple-stld
20298 @itemx -mstm
20299 @itemx -mno-multiple-stld
20300 @itemx -mno-stm
20301 @opindex mmultiple-stld
20302 Generate code using @code{stm} and @code{ldm} instructions. This option
20303 isn't supported on CK801 but is enabled by default on other processors.
20304
20305 @item -mconstpool
20306 @itemx -mno-constpool
20307 @opindex mconstpool
20308 Create constant pools in the compiler instead of deferring it to the
20309 assembler. This option is the default and required for correct code
20310 generation on CK801 and CK802, and is optional on other processors.
20311
20312 @item -mstack-size
20313 @item -mno-stack-size
20314 @opindex mstack-size
20315 Emit @code{.stack_size} directives for each function in the assembly
20316 output. This option defaults to off.
20317
20318 @item -mccrt
20319 @itemx -mno-ccrt
20320 @opindex mccrt
20321 Generate code for the C-SKY compiler runtime instead of libgcc. This
20322 option defaults to off.
20323
20324 @item -mbranch-cost=@var{n}
20325 @opindex mbranch-cost=
20326 Set the branch costs to roughly @code{n} instructions. The default is 1.
20327
20328 @item -msched-prolog
20329 @itemx -mno-sched-prolog
20330 @opindex msched-prolog
20331 Permit scheduling of function prologue and epilogue sequences. Using
20332 this option can result in code that is not compliant with the C-SKY V2 ABI
20333 prologue requirements and that cannot be debugged or backtraced.
20334 It is disabled by default.
20335
20336 @end table
20337
20338 @node Darwin Options
20339 @subsection Darwin Options
20340 @cindex Darwin options
20341
20342 These options are defined for all architectures running the Darwin operating
20343 system.
20344
20345 FSF GCC on Darwin does not create ``fat'' object files; it creates
20346 an object file for the single architecture that GCC was built to
20347 target. Apple's GCC on Darwin does create ``fat'' files if multiple
20348 @option{-arch} options are used; it does so by running the compiler or
20349 linker multiple times and joining the results together with
20350 @file{lipo}.
20351
20352 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
20353 @samp{i686}) is determined by the flags that specify the ISA
20354 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
20355 @option{-force_cpusubtype_ALL} option can be used to override this.
20356
20357 The Darwin tools vary in their behavior when presented with an ISA
20358 mismatch. The assembler, @file{as}, only permits instructions to
20359 be used that are valid for the subtype of the file it is generating,
20360 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
20361 The linker for shared libraries, @file{/usr/bin/libtool}, fails
20362 and prints an error if asked to create a shared library with a less
20363 restrictive subtype than its input files (for instance, trying to put
20364 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
20365 for executables, @command{ld}, quietly gives the executable the most
20366 restrictive subtype of any of its input files.
20367
20368 @table @gcctabopt
20369 @item -F@var{dir}
20370 @opindex F
20371 Add the framework directory @var{dir} to the head of the list of
20372 directories to be searched for header files. These directories are
20373 interleaved with those specified by @option{-I} options and are
20374 scanned in a left-to-right order.
20375
20376 A framework directory is a directory with frameworks in it. A
20377 framework is a directory with a @file{Headers} and/or
20378 @file{PrivateHeaders} directory contained directly in it that ends
20379 in @file{.framework}. The name of a framework is the name of this
20380 directory excluding the @file{.framework}. Headers associated with
20381 the framework are found in one of those two directories, with
20382 @file{Headers} being searched first. A subframework is a framework
20383 directory that is in a framework's @file{Frameworks} directory.
20384 Includes of subframework headers can only appear in a header of a
20385 framework that contains the subframework, or in a sibling subframework
20386 header. Two subframeworks are siblings if they occur in the same
20387 framework. A subframework should not have the same name as a
20388 framework; a warning is issued if this is violated. Currently a
20389 subframework cannot have subframeworks; in the future, the mechanism
20390 may be extended to support this. The standard frameworks can be found
20391 in @file{/System/Library/Frameworks} and
20392 @file{/Library/Frameworks}. An example include looks like
20393 @code{#include <Framework/header.h>}, where @file{Framework} denotes
20394 the name of the framework and @file{header.h} is found in the
20395 @file{PrivateHeaders} or @file{Headers} directory.
20396
20397 @item -iframework@var{dir}
20398 @opindex iframework
20399 Like @option{-F} except the directory is a treated as a system
20400 directory. The main difference between this @option{-iframework} and
20401 @option{-F} is that with @option{-iframework} the compiler does not
20402 warn about constructs contained within header files found via
20403 @var{dir}. This option is valid only for the C family of languages.
20404
20405 @item -gused
20406 @opindex gused
20407 Emit debugging information for symbols that are used. For stabs
20408 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
20409 This is by default ON@.
20410
20411 @item -gfull
20412 @opindex gfull
20413 Emit debugging information for all symbols and types.
20414
20415 @item -mmacosx-version-min=@var{version}
20416 The earliest version of MacOS X that this executable will run on
20417 is @var{version}. Typical values of @var{version} include @code{10.1},
20418 @code{10.2}, and @code{10.3.9}.
20419
20420 If the compiler was built to use the system's headers by default,
20421 then the default for this option is the system version on which the
20422 compiler is running, otherwise the default is to make choices that
20423 are compatible with as many systems and code bases as possible.
20424
20425 @item -mkernel
20426 @opindex mkernel
20427 Enable kernel development mode. The @option{-mkernel} option sets
20428 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
20429 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
20430 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
20431 applicable. This mode also sets @option{-mno-altivec},
20432 @option{-msoft-float}, @option{-fno-builtin} and
20433 @option{-mlong-branch} for PowerPC targets.
20434
20435 @item -mone-byte-bool
20436 @opindex mone-byte-bool
20437 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
20438 By default @code{sizeof(bool)} is @code{4} when compiling for
20439 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
20440 option has no effect on x86.
20441
20442 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
20443 to generate code that is not binary compatible with code generated
20444 without that switch. Using this switch may require recompiling all
20445 other modules in a program, including system libraries. Use this
20446 switch to conform to a non-default data model.
20447
20448 @item -mfix-and-continue
20449 @itemx -ffix-and-continue
20450 @itemx -findirect-data
20451 @opindex mfix-and-continue
20452 @opindex ffix-and-continue
20453 @opindex findirect-data
20454 Generate code suitable for fast turnaround development, such as to
20455 allow GDB to dynamically load @file{.o} files into already-running
20456 programs. @option{-findirect-data} and @option{-ffix-and-continue}
20457 are provided for backwards compatibility.
20458
20459 @item -all_load
20460 @opindex all_load
20461 Loads all members of static archive libraries.
20462 See man ld(1) for more information.
20463
20464 @item -arch_errors_fatal
20465 @opindex arch_errors_fatal
20466 Cause the errors having to do with files that have the wrong architecture
20467 to be fatal.
20468
20469 @item -bind_at_load
20470 @opindex bind_at_load
20471 Causes the output file to be marked such that the dynamic linker will
20472 bind all undefined references when the file is loaded or launched.
20473
20474 @item -bundle
20475 @opindex bundle
20476 Produce a Mach-o bundle format file.
20477 See man ld(1) for more information.
20478
20479 @item -bundle_loader @var{executable}
20480 @opindex bundle_loader
20481 This option specifies the @var{executable} that will load the build
20482 output file being linked. See man ld(1) for more information.
20483
20484 @item -dynamiclib
20485 @opindex dynamiclib
20486 When passed this option, GCC produces a dynamic library instead of
20487 an executable when linking, using the Darwin @file{libtool} command.
20488
20489 @item -force_cpusubtype_ALL
20490 @opindex force_cpusubtype_ALL
20491 This causes GCC's output file to have the @samp{ALL} subtype, instead of
20492 one controlled by the @option{-mcpu} or @option{-march} option.
20493
20494 @item -allowable_client @var{client_name}
20495 @itemx -client_name
20496 @itemx -compatibility_version
20497 @itemx -current_version
20498 @itemx -dead_strip
20499 @itemx -dependency-file
20500 @itemx -dylib_file
20501 @itemx -dylinker_install_name
20502 @itemx -dynamic
20503 @itemx -exported_symbols_list
20504 @itemx -filelist
20505 @need 800
20506 @itemx -flat_namespace
20507 @itemx -force_flat_namespace
20508 @itemx -headerpad_max_install_names
20509 @itemx -image_base
20510 @itemx -init
20511 @itemx -install_name
20512 @itemx -keep_private_externs
20513 @itemx -multi_module
20514 @itemx -multiply_defined
20515 @itemx -multiply_defined_unused
20516 @need 800
20517 @itemx -noall_load
20518 @itemx -no_dead_strip_inits_and_terms
20519 @itemx -nofixprebinding
20520 @itemx -nomultidefs
20521 @itemx -noprebind
20522 @itemx -noseglinkedit
20523 @itemx -pagezero_size
20524 @itemx -prebind
20525 @itemx -prebind_all_twolevel_modules
20526 @itemx -private_bundle
20527 @need 800
20528 @itemx -read_only_relocs
20529 @itemx -sectalign
20530 @itemx -sectobjectsymbols
20531 @itemx -whyload
20532 @itemx -seg1addr
20533 @itemx -sectcreate
20534 @itemx -sectobjectsymbols
20535 @itemx -sectorder
20536 @itemx -segaddr
20537 @itemx -segs_read_only_addr
20538 @need 800
20539 @itemx -segs_read_write_addr
20540 @itemx -seg_addr_table
20541 @itemx -seg_addr_table_filename
20542 @itemx -seglinkedit
20543 @itemx -segprot
20544 @itemx -segs_read_only_addr
20545 @itemx -segs_read_write_addr
20546 @itemx -single_module
20547 @itemx -static
20548 @itemx -sub_library
20549 @need 800
20550 @itemx -sub_umbrella
20551 @itemx -twolevel_namespace
20552 @itemx -umbrella
20553 @itemx -undefined
20554 @itemx -unexported_symbols_list
20555 @itemx -weak_reference_mismatches
20556 @itemx -whatsloaded
20557 @opindex allowable_client
20558 @opindex client_name
20559 @opindex compatibility_version
20560 @opindex current_version
20561 @opindex dead_strip
20562 @opindex dependency-file
20563 @opindex dylib_file
20564 @opindex dylinker_install_name
20565 @opindex dynamic
20566 @opindex exported_symbols_list
20567 @opindex filelist
20568 @opindex flat_namespace
20569 @opindex force_flat_namespace
20570 @opindex headerpad_max_install_names
20571 @opindex image_base
20572 @opindex init
20573 @opindex install_name
20574 @opindex keep_private_externs
20575 @opindex multi_module
20576 @opindex multiply_defined
20577 @opindex multiply_defined_unused
20578 @opindex noall_load
20579 @opindex no_dead_strip_inits_and_terms
20580 @opindex nofixprebinding
20581 @opindex nomultidefs
20582 @opindex noprebind
20583 @opindex noseglinkedit
20584 @opindex pagezero_size
20585 @opindex prebind
20586 @opindex prebind_all_twolevel_modules
20587 @opindex private_bundle
20588 @opindex read_only_relocs
20589 @opindex sectalign
20590 @opindex sectobjectsymbols
20591 @opindex whyload
20592 @opindex seg1addr
20593 @opindex sectcreate
20594 @opindex sectobjectsymbols
20595 @opindex sectorder
20596 @opindex segaddr
20597 @opindex segs_read_only_addr
20598 @opindex segs_read_write_addr
20599 @opindex seg_addr_table
20600 @opindex seg_addr_table_filename
20601 @opindex seglinkedit
20602 @opindex segprot
20603 @opindex segs_read_only_addr
20604 @opindex segs_read_write_addr
20605 @opindex single_module
20606 @opindex static
20607 @opindex sub_library
20608 @opindex sub_umbrella
20609 @opindex twolevel_namespace
20610 @opindex umbrella
20611 @opindex undefined
20612 @opindex unexported_symbols_list
20613 @opindex weak_reference_mismatches
20614 @opindex whatsloaded
20615 These options are passed to the Darwin linker. The Darwin linker man page
20616 describes them in detail.
20617 @end table
20618
20619 @node DEC Alpha Options
20620 @subsection DEC Alpha Options
20621
20622 These @samp{-m} options are defined for the DEC Alpha implementations:
20623
20624 @table @gcctabopt
20625 @item -mno-soft-float
20626 @itemx -msoft-float
20627 @opindex mno-soft-float
20628 @opindex msoft-float
20629 Use (do not use) the hardware floating-point instructions for
20630 floating-point operations. When @option{-msoft-float} is specified,
20631 functions in @file{libgcc.a} are used to perform floating-point
20632 operations. Unless they are replaced by routines that emulate the
20633 floating-point operations, or compiled in such a way as to call such
20634 emulations routines, these routines issue floating-point
20635 operations. If you are compiling for an Alpha without floating-point
20636 operations, you must ensure that the library is built so as not to call
20637 them.
20638
20639 Note that Alpha implementations without floating-point operations are
20640 required to have floating-point registers.
20641
20642 @item -mfp-reg
20643 @itemx -mno-fp-regs
20644 @opindex mfp-reg
20645 @opindex mno-fp-regs
20646 Generate code that uses (does not use) the floating-point register set.
20647 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
20648 register set is not used, floating-point operands are passed in integer
20649 registers as if they were integers and floating-point results are passed
20650 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
20651 so any function with a floating-point argument or return value called by code
20652 compiled with @option{-mno-fp-regs} must also be compiled with that
20653 option.
20654
20655 A typical use of this option is building a kernel that does not use,
20656 and hence need not save and restore, any floating-point registers.
20657
20658 @item -mieee
20659 @opindex mieee
20660 The Alpha architecture implements floating-point hardware optimized for
20661 maximum performance. It is mostly compliant with the IEEE floating-point
20662 standard. However, for full compliance, software assistance is
20663 required. This option generates code fully IEEE-compliant code
20664 @emph{except} that the @var{inexact-flag} is not maintained (see below).
20665 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
20666 defined during compilation. The resulting code is less efficient but is
20667 able to correctly support denormalized numbers and exceptional IEEE
20668 values such as not-a-number and plus/minus infinity. Other Alpha
20669 compilers call this option @option{-ieee_with_no_inexact}.
20670
20671 @item -mieee-with-inexact
20672 @opindex mieee-with-inexact
20673 This is like @option{-mieee} except the generated code also maintains
20674 the IEEE @var{inexact-flag}. Turning on this option causes the
20675 generated code to implement fully-compliant IEEE math. In addition to
20676 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
20677 macro. On some Alpha implementations the resulting code may execute
20678 significantly slower than the code generated by default. Since there is
20679 very little code that depends on the @var{inexact-flag}, you should
20680 normally not specify this option. Other Alpha compilers call this
20681 option @option{-ieee_with_inexact}.
20682
20683 @item -mfp-trap-mode=@var{trap-mode}
20684 @opindex mfp-trap-mode
20685 This option controls what floating-point related traps are enabled.
20686 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
20687 The trap mode can be set to one of four values:
20688
20689 @table @samp
20690 @item n
20691 This is the default (normal) setting. The only traps that are enabled
20692 are the ones that cannot be disabled in software (e.g., division by zero
20693 trap).
20694
20695 @item u
20696 In addition to the traps enabled by @samp{n}, underflow traps are enabled
20697 as well.
20698
20699 @item su
20700 Like @samp{u}, but the instructions are marked to be safe for software
20701 completion (see Alpha architecture manual for details).
20702
20703 @item sui
20704 Like @samp{su}, but inexact traps are enabled as well.
20705 @end table
20706
20707 @item -mfp-rounding-mode=@var{rounding-mode}
20708 @opindex mfp-rounding-mode
20709 Selects the IEEE rounding mode. Other Alpha compilers call this option
20710 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
20711 of:
20712
20713 @table @samp
20714 @item n
20715 Normal IEEE rounding mode. Floating-point numbers are rounded towards
20716 the nearest machine number or towards the even machine number in case
20717 of a tie.
20718
20719 @item m
20720 Round towards minus infinity.
20721
20722 @item c
20723 Chopped rounding mode. Floating-point numbers are rounded towards zero.
20724
20725 @item d
20726 Dynamic rounding mode. A field in the floating-point control register
20727 (@var{fpcr}, see Alpha architecture reference manual) controls the
20728 rounding mode in effect. The C library initializes this register for
20729 rounding towards plus infinity. Thus, unless your program modifies the
20730 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
20731 @end table
20732
20733 @item -mtrap-precision=@var{trap-precision}
20734 @opindex mtrap-precision
20735 In the Alpha architecture, floating-point traps are imprecise. This
20736 means without software assistance it is impossible to recover from a
20737 floating trap and program execution normally needs to be terminated.
20738 GCC can generate code that can assist operating system trap handlers
20739 in determining the exact location that caused a floating-point trap.
20740 Depending on the requirements of an application, different levels of
20741 precisions can be selected:
20742
20743 @table @samp
20744 @item p
20745 Program precision. This option is the default and means a trap handler
20746 can only identify which program caused a floating-point exception.
20747
20748 @item f
20749 Function precision. The trap handler can determine the function that
20750 caused a floating-point exception.
20751
20752 @item i
20753 Instruction precision. The trap handler can determine the exact
20754 instruction that caused a floating-point exception.
20755 @end table
20756
20757 Other Alpha compilers provide the equivalent options called
20758 @option{-scope_safe} and @option{-resumption_safe}.
20759
20760 @item -mieee-conformant
20761 @opindex mieee-conformant
20762 This option marks the generated code as IEEE conformant. You must not
20763 use this option unless you also specify @option{-mtrap-precision=i} and either
20764 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
20765 is to emit the line @samp{.eflag 48} in the function prologue of the
20766 generated assembly file.
20767
20768 @item -mbuild-constants
20769 @opindex mbuild-constants
20770 Normally GCC examines a 32- or 64-bit integer constant to
20771 see if it can construct it from smaller constants in two or three
20772 instructions. If it cannot, it outputs the constant as a literal and
20773 generates code to load it from the data segment at run time.
20774
20775 Use this option to require GCC to construct @emph{all} integer constants
20776 using code, even if it takes more instructions (the maximum is six).
20777
20778 You typically use this option to build a shared library dynamic
20779 loader. Itself a shared library, it must relocate itself in memory
20780 before it can find the variables and constants in its own data segment.
20781
20782 @item -mbwx
20783 @itemx -mno-bwx
20784 @itemx -mcix
20785 @itemx -mno-cix
20786 @itemx -mfix
20787 @itemx -mno-fix
20788 @itemx -mmax
20789 @itemx -mno-max
20790 @opindex mbwx
20791 @opindex mno-bwx
20792 @opindex mcix
20793 @opindex mno-cix
20794 @opindex mfix
20795 @opindex mno-fix
20796 @opindex mmax
20797 @opindex mno-max
20798 Indicate whether GCC should generate code to use the optional BWX,
20799 CIX, FIX and MAX instruction sets. The default is to use the instruction
20800 sets supported by the CPU type specified via @option{-mcpu=} option or that
20801 of the CPU on which GCC was built if none is specified.
20802
20803 @item -mfloat-vax
20804 @itemx -mfloat-ieee
20805 @opindex mfloat-vax
20806 @opindex mfloat-ieee
20807 Generate code that uses (does not use) VAX F and G floating-point
20808 arithmetic instead of IEEE single and double precision.
20809
20810 @item -mexplicit-relocs
20811 @itemx -mno-explicit-relocs
20812 @opindex mexplicit-relocs
20813 @opindex mno-explicit-relocs
20814 Older Alpha assemblers provided no way to generate symbol relocations
20815 except via assembler macros. Use of these macros does not allow
20816 optimal instruction scheduling. GNU binutils as of version 2.12
20817 supports a new syntax that allows the compiler to explicitly mark
20818 which relocations should apply to which instructions. This option
20819 is mostly useful for debugging, as GCC detects the capabilities of
20820 the assembler when it is built and sets the default accordingly.
20821
20822 @item -msmall-data
20823 @itemx -mlarge-data
20824 @opindex msmall-data
20825 @opindex mlarge-data
20826 When @option{-mexplicit-relocs} is in effect, static data is
20827 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
20828 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
20829 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
20830 16-bit relocations off of the @code{$gp} register. This limits the
20831 size of the small data area to 64KB, but allows the variables to be
20832 directly accessed via a single instruction.
20833
20834 The default is @option{-mlarge-data}. With this option the data area
20835 is limited to just below 2GB@. Programs that require more than 2GB of
20836 data must use @code{malloc} or @code{mmap} to allocate the data in the
20837 heap instead of in the program's data segment.
20838
20839 When generating code for shared libraries, @option{-fpic} implies
20840 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
20841
20842 @item -msmall-text
20843 @itemx -mlarge-text
20844 @opindex msmall-text
20845 @opindex mlarge-text
20846 When @option{-msmall-text} is used, the compiler assumes that the
20847 code of the entire program (or shared library) fits in 4MB, and is
20848 thus reachable with a branch instruction. When @option{-msmall-data}
20849 is used, the compiler can assume that all local symbols share the
20850 same @code{$gp} value, and thus reduce the number of instructions
20851 required for a function call from 4 to 1.
20852
20853 The default is @option{-mlarge-text}.
20854
20855 @item -mcpu=@var{cpu_type}
20856 @opindex mcpu
20857 Set the instruction set and instruction scheduling parameters for
20858 machine type @var{cpu_type}. You can specify either the @samp{EV}
20859 style name or the corresponding chip number. GCC supports scheduling
20860 parameters for the EV4, EV5 and EV6 family of processors and
20861 chooses the default values for the instruction set from the processor
20862 you specify. If you do not specify a processor type, GCC defaults
20863 to the processor on which the compiler was built.
20864
20865 Supported values for @var{cpu_type} are
20866
20867 @table @samp
20868 @item ev4
20869 @itemx ev45
20870 @itemx 21064
20871 Schedules as an EV4 and has no instruction set extensions.
20872
20873 @item ev5
20874 @itemx 21164
20875 Schedules as an EV5 and has no instruction set extensions.
20876
20877 @item ev56
20878 @itemx 21164a
20879 Schedules as an EV5 and supports the BWX extension.
20880
20881 @item pca56
20882 @itemx 21164pc
20883 @itemx 21164PC
20884 Schedules as an EV5 and supports the BWX and MAX extensions.
20885
20886 @item ev6
20887 @itemx 21264
20888 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
20889
20890 @item ev67
20891 @itemx 21264a
20892 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
20893 @end table
20894
20895 Native toolchains also support the value @samp{native},
20896 which selects the best architecture option for the host processor.
20897 @option{-mcpu=native} has no effect if GCC does not recognize
20898 the processor.
20899
20900 @item -mtune=@var{cpu_type}
20901 @opindex mtune
20902 Set only the instruction scheduling parameters for machine type
20903 @var{cpu_type}. The instruction set is not changed.
20904
20905 Native toolchains also support the value @samp{native},
20906 which selects the best architecture option for the host processor.
20907 @option{-mtune=native} has no effect if GCC does not recognize
20908 the processor.
20909
20910 @item -mmemory-latency=@var{time}
20911 @opindex mmemory-latency
20912 Sets the latency the scheduler should assume for typical memory
20913 references as seen by the application. This number is highly
20914 dependent on the memory access patterns used by the application
20915 and the size of the external cache on the machine.
20916
20917 Valid options for @var{time} are
20918
20919 @table @samp
20920 @item @var{number}
20921 A decimal number representing clock cycles.
20922
20923 @item L1
20924 @itemx L2
20925 @itemx L3
20926 @itemx main
20927 The compiler contains estimates of the number of clock cycles for
20928 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
20929 (also called Dcache, Scache, and Bcache), as well as to main memory.
20930 Note that L3 is only valid for EV5.
20931
20932 @end table
20933 @end table
20934
20935 @node eBPF Options
20936 @subsection eBPF Options
20937 @cindex eBPF Options
20938
20939 @table @gcctabopt
20940 @item -mframe-limit=@var{bytes}
20941 This specifies the hard limit for frame sizes, in bytes. Currently,
20942 the value that can be specified should be less than or equal to
20943 @samp{32767}. Defaults to whatever limit is imposed by the version of
20944 the Linux kernel targeted.
20945
20946 @item -mkernel=@var{version}
20947 @opindex mkernel
20948 This specifies the minimum version of the kernel that will run the
20949 compiled program. GCC uses this version to determine which
20950 instructions to use, what kernel helpers to allow, etc. Currently,
20951 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
20952 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
20953 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
20954 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
20955 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
20956 @samp{5.2}, @samp{latest} and @samp{native}.
20957
20958 @item -mbig-endian
20959 @opindex mbig-endian
20960 Generate code for a big-endian target.
20961
20962 @item -mlittle-endian
20963 @opindex mlittle-endian
20964 Generate code for a little-endian target. This is the default.
20965 @end table
20966
20967 @node FR30 Options
20968 @subsection FR30 Options
20969 @cindex FR30 Options
20970
20971 These options are defined specifically for the FR30 port.
20972
20973 @table @gcctabopt
20974
20975 @item -msmall-model
20976 @opindex msmall-model
20977 Use the small address space model. This can produce smaller code, but
20978 it does assume that all symbolic values and addresses fit into a
20979 20-bit range.
20980
20981 @item -mno-lsim
20982 @opindex mno-lsim
20983 Assume that runtime support has been provided and so there is no need
20984 to include the simulator library (@file{libsim.a}) on the linker
20985 command line.
20986
20987 @end table
20988
20989 @node FT32 Options
20990 @subsection FT32 Options
20991 @cindex FT32 Options
20992
20993 These options are defined specifically for the FT32 port.
20994
20995 @table @gcctabopt
20996
20997 @item -msim
20998 @opindex msim
20999 Specifies that the program will be run on the simulator. This causes
21000 an alternate runtime startup and library to be linked.
21001 You must not use this option when generating programs that will run on
21002 real hardware; you must provide your own runtime library for whatever
21003 I/O functions are needed.
21004
21005 @item -mlra
21006 @opindex mlra
21007 Enable Local Register Allocation. This is still experimental for FT32,
21008 so by default the compiler uses standard reload.
21009
21010 @item -mnodiv
21011 @opindex mnodiv
21012 Do not use div and mod instructions.
21013
21014 @item -mft32b
21015 @opindex mft32b
21016 Enable use of the extended instructions of the FT32B processor.
21017
21018 @item -mcompress
21019 @opindex mcompress
21020 Compress all code using the Ft32B code compression scheme.
21021
21022 @item -mnopm
21023 @opindex mnopm
21024 Do not generate code that reads program memory.
21025
21026 @end table
21027
21028 @node FRV Options
21029 @subsection FRV Options
21030 @cindex FRV Options
21031
21032 @table @gcctabopt
21033 @item -mgpr-32
21034 @opindex mgpr-32
21035
21036 Only use the first 32 general-purpose registers.
21037
21038 @item -mgpr-64
21039 @opindex mgpr-64
21040
21041 Use all 64 general-purpose registers.
21042
21043 @item -mfpr-32
21044 @opindex mfpr-32
21045
21046 Use only the first 32 floating-point registers.
21047
21048 @item -mfpr-64
21049 @opindex mfpr-64
21050
21051 Use all 64 floating-point registers.
21052
21053 @item -mhard-float
21054 @opindex mhard-float
21055
21056 Use hardware instructions for floating-point operations.
21057
21058 @item -msoft-float
21059 @opindex msoft-float
21060
21061 Use library routines for floating-point operations.
21062
21063 @item -malloc-cc
21064 @opindex malloc-cc
21065
21066 Dynamically allocate condition code registers.
21067
21068 @item -mfixed-cc
21069 @opindex mfixed-cc
21070
21071 Do not try to dynamically allocate condition code registers, only
21072 use @code{icc0} and @code{fcc0}.
21073
21074 @item -mdword
21075 @opindex mdword
21076
21077 Change ABI to use double word insns.
21078
21079 @item -mno-dword
21080 @opindex mno-dword
21081 @opindex mdword
21082
21083 Do not use double word instructions.
21084
21085 @item -mdouble
21086 @opindex mdouble
21087
21088 Use floating-point double instructions.
21089
21090 @item -mno-double
21091 @opindex mno-double
21092
21093 Do not use floating-point double instructions.
21094
21095 @item -mmedia
21096 @opindex mmedia
21097
21098 Use media instructions.
21099
21100 @item -mno-media
21101 @opindex mno-media
21102
21103 Do not use media instructions.
21104
21105 @item -mmuladd
21106 @opindex mmuladd
21107
21108 Use multiply and add/subtract instructions.
21109
21110 @item -mno-muladd
21111 @opindex mno-muladd
21112
21113 Do not use multiply and add/subtract instructions.
21114
21115 @item -mfdpic
21116 @opindex mfdpic
21117
21118 Select the FDPIC ABI, which uses function descriptors to represent
21119 pointers to functions. Without any PIC/PIE-related options, it
21120 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
21121 assumes GOT entries and small data are within a 12-bit range from the
21122 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
21123 are computed with 32 bits.
21124 With a @samp{bfin-elf} target, this option implies @option{-msim}.
21125
21126 @item -minline-plt
21127 @opindex minline-plt
21128
21129 Enable inlining of PLT entries in function calls to functions that are
21130 not known to bind locally. It has no effect without @option{-mfdpic}.
21131 It's enabled by default if optimizing for speed and compiling for
21132 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
21133 optimization option such as @option{-O3} or above is present in the
21134 command line.
21135
21136 @item -mTLS
21137 @opindex mTLS
21138
21139 Assume a large TLS segment when generating thread-local code.
21140
21141 @item -mtls
21142 @opindex mtls
21143
21144 Do not assume a large TLS segment when generating thread-local code.
21145
21146 @item -mgprel-ro
21147 @opindex mgprel-ro
21148
21149 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
21150 that is known to be in read-only sections. It's enabled by default,
21151 except for @option{-fpic} or @option{-fpie}: even though it may help
21152 make the global offset table smaller, it trades 1 instruction for 4.
21153 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
21154 one of which may be shared by multiple symbols, and it avoids the need
21155 for a GOT entry for the referenced symbol, so it's more likely to be a
21156 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
21157
21158 @item -multilib-library-pic
21159 @opindex multilib-library-pic
21160
21161 Link with the (library, not FD) pic libraries. It's implied by
21162 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
21163 @option{-fpic} without @option{-mfdpic}. You should never have to use
21164 it explicitly.
21165
21166 @item -mlinked-fp
21167 @opindex mlinked-fp
21168
21169 Follow the EABI requirement of always creating a frame pointer whenever
21170 a stack frame is allocated. This option is enabled by default and can
21171 be disabled with @option{-mno-linked-fp}.
21172
21173 @item -mlong-calls
21174 @opindex mlong-calls
21175
21176 Use indirect addressing to call functions outside the current
21177 compilation unit. This allows the functions to be placed anywhere
21178 within the 32-bit address space.
21179
21180 @item -malign-labels
21181 @opindex malign-labels
21182
21183 Try to align labels to an 8-byte boundary by inserting NOPs into the
21184 previous packet. This option only has an effect when VLIW packing
21185 is enabled. It doesn't create new packets; it merely adds NOPs to
21186 existing ones.
21187
21188 @item -mlibrary-pic
21189 @opindex mlibrary-pic
21190
21191 Generate position-independent EABI code.
21192
21193 @item -macc-4
21194 @opindex macc-4
21195
21196 Use only the first four media accumulator registers.
21197
21198 @item -macc-8
21199 @opindex macc-8
21200
21201 Use all eight media accumulator registers.
21202
21203 @item -mpack
21204 @opindex mpack
21205
21206 Pack VLIW instructions.
21207
21208 @item -mno-pack
21209 @opindex mno-pack
21210
21211 Do not pack VLIW instructions.
21212
21213 @item -mno-eflags
21214 @opindex mno-eflags
21215
21216 Do not mark ABI switches in e_flags.
21217
21218 @item -mcond-move
21219 @opindex mcond-move
21220
21221 Enable the use of conditional-move instructions (default).
21222
21223 This switch is mainly for debugging the compiler and will likely be removed
21224 in a future version.
21225
21226 @item -mno-cond-move
21227 @opindex mno-cond-move
21228
21229 Disable the use of conditional-move instructions.
21230
21231 This switch is mainly for debugging the compiler and will likely be removed
21232 in a future version.
21233
21234 @item -mscc
21235 @opindex mscc
21236
21237 Enable the use of conditional set instructions (default).
21238
21239 This switch is mainly for debugging the compiler and will likely be removed
21240 in a future version.
21241
21242 @item -mno-scc
21243 @opindex mno-scc
21244
21245 Disable the use of conditional set instructions.
21246
21247 This switch is mainly for debugging the compiler and will likely be removed
21248 in a future version.
21249
21250 @item -mcond-exec
21251 @opindex mcond-exec
21252
21253 Enable the use of conditional execution (default).
21254
21255 This switch is mainly for debugging the compiler and will likely be removed
21256 in a future version.
21257
21258 @item -mno-cond-exec
21259 @opindex mno-cond-exec
21260
21261 Disable the use of conditional execution.
21262
21263 This switch is mainly for debugging the compiler and will likely be removed
21264 in a future version.
21265
21266 @item -mvliw-branch
21267 @opindex mvliw-branch
21268
21269 Run a pass to pack branches into VLIW instructions (default).
21270
21271 This switch is mainly for debugging the compiler and will likely be removed
21272 in a future version.
21273
21274 @item -mno-vliw-branch
21275 @opindex mno-vliw-branch
21276
21277 Do not run a pass to pack branches into VLIW instructions.
21278
21279 This switch is mainly for debugging the compiler and will likely be removed
21280 in a future version.
21281
21282 @item -mmulti-cond-exec
21283 @opindex mmulti-cond-exec
21284
21285 Enable optimization of @code{&&} and @code{||} in conditional execution
21286 (default).
21287
21288 This switch is mainly for debugging the compiler and will likely be removed
21289 in a future version.
21290
21291 @item -mno-multi-cond-exec
21292 @opindex mno-multi-cond-exec
21293
21294 Disable optimization of @code{&&} and @code{||} in conditional execution.
21295
21296 This switch is mainly for debugging the compiler and will likely be removed
21297 in a future version.
21298
21299 @item -mnested-cond-exec
21300 @opindex mnested-cond-exec
21301
21302 Enable nested conditional execution optimizations (default).
21303
21304 This switch is mainly for debugging the compiler and will likely be removed
21305 in a future version.
21306
21307 @item -mno-nested-cond-exec
21308 @opindex mno-nested-cond-exec
21309
21310 Disable nested conditional execution optimizations.
21311
21312 This switch is mainly for debugging the compiler and will likely be removed
21313 in a future version.
21314
21315 @item -moptimize-membar
21316 @opindex moptimize-membar
21317
21318 This switch removes redundant @code{membar} instructions from the
21319 compiler-generated code. It is enabled by default.
21320
21321 @item -mno-optimize-membar
21322 @opindex mno-optimize-membar
21323 @opindex moptimize-membar
21324
21325 This switch disables the automatic removal of redundant @code{membar}
21326 instructions from the generated code.
21327
21328 @item -mtomcat-stats
21329 @opindex mtomcat-stats
21330
21331 Cause gas to print out tomcat statistics.
21332
21333 @item -mcpu=@var{cpu}
21334 @opindex mcpu
21335
21336 Select the processor type for which to generate code. Possible values are
21337 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
21338 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
21339
21340 @end table
21341
21342 @node GNU/Linux Options
21343 @subsection GNU/Linux Options
21344
21345 These @samp{-m} options are defined for GNU/Linux targets:
21346
21347 @table @gcctabopt
21348 @item -mglibc
21349 @opindex mglibc
21350 Use the GNU C library. This is the default except
21351 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
21352 @samp{*-*-linux-*android*} targets.
21353
21354 @item -muclibc
21355 @opindex muclibc
21356 Use uClibc C library. This is the default on
21357 @samp{*-*-linux-*uclibc*} targets.
21358
21359 @item -mmusl
21360 @opindex mmusl
21361 Use the musl C library. This is the default on
21362 @samp{*-*-linux-*musl*} targets.
21363
21364 @item -mbionic
21365 @opindex mbionic
21366 Use Bionic C library. This is the default on
21367 @samp{*-*-linux-*android*} targets.
21368
21369 @item -mandroid
21370 @opindex mandroid
21371 Compile code compatible with Android platform. This is the default on
21372 @samp{*-*-linux-*android*} targets.
21373
21374 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
21375 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
21376 this option makes the GCC driver pass Android-specific options to the linker.
21377 Finally, this option causes the preprocessor macro @code{__ANDROID__}
21378 to be defined.
21379
21380 @item -tno-android-cc
21381 @opindex tno-android-cc
21382 Disable compilation effects of @option{-mandroid}, i.e., do not enable
21383 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
21384 @option{-fno-rtti} by default.
21385
21386 @item -tno-android-ld
21387 @opindex tno-android-ld
21388 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
21389 linking options to the linker.
21390
21391 @end table
21392
21393 @node H8/300 Options
21394 @subsection H8/300 Options
21395
21396 These @samp{-m} options are defined for the H8/300 implementations:
21397
21398 @table @gcctabopt
21399 @item -mrelax
21400 @opindex mrelax
21401 Shorten some address references at link time, when possible; uses the
21402 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
21403 ld, Using ld}, for a fuller description.
21404
21405 @item -mh
21406 @opindex mh
21407 Generate code for the H8/300H@.
21408
21409 @item -ms
21410 @opindex ms
21411 Generate code for the H8S@.
21412
21413 @item -mn
21414 @opindex mn
21415 Generate code for the H8S and H8/300H in the normal mode. This switch
21416 must be used either with @option{-mh} or @option{-ms}.
21417
21418 @item -ms2600
21419 @opindex ms2600
21420 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
21421
21422 @item -mexr
21423 @opindex mexr
21424 Extended registers are stored on stack before execution of function
21425 with monitor attribute. Default option is @option{-mexr}.
21426 This option is valid only for H8S targets.
21427
21428 @item -mno-exr
21429 @opindex mno-exr
21430 @opindex mexr
21431 Extended registers are not stored on stack before execution of function
21432 with monitor attribute. Default option is @option{-mno-exr}.
21433 This option is valid only for H8S targets.
21434
21435 @item -mint32
21436 @opindex mint32
21437 Make @code{int} data 32 bits by default.
21438
21439 @item -malign-300
21440 @opindex malign-300
21441 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
21442 The default for the H8/300H and H8S is to align longs and floats on
21443 4-byte boundaries.
21444 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
21445 This option has no effect on the H8/300.
21446 @end table
21447
21448 @node HPPA Options
21449 @subsection HPPA Options
21450 @cindex HPPA Options
21451
21452 These @samp{-m} options are defined for the HPPA family of computers:
21453
21454 @table @gcctabopt
21455 @item -march=@var{architecture-type}
21456 @opindex march
21457 Generate code for the specified architecture. The choices for
21458 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
21459 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
21460 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
21461 architecture option for your machine. Code compiled for lower numbered
21462 architectures runs on higher numbered architectures, but not the
21463 other way around.
21464
21465 @item -mpa-risc-1-0
21466 @itemx -mpa-risc-1-1
21467 @itemx -mpa-risc-2-0
21468 @opindex mpa-risc-1-0
21469 @opindex mpa-risc-1-1
21470 @opindex mpa-risc-2-0
21471 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
21472
21473 @item -mcaller-copies
21474 @opindex mcaller-copies
21475 The caller copies function arguments passed by hidden reference. This
21476 option should be used with care as it is not compatible with the default
21477 32-bit runtime. However, only aggregates larger than eight bytes are
21478 passed by hidden reference and the option provides better compatibility
21479 with OpenMP.
21480
21481 @item -mjump-in-delay
21482 @opindex mjump-in-delay
21483 This option is ignored and provided for compatibility purposes only.
21484
21485 @item -mdisable-fpregs
21486 @opindex mdisable-fpregs
21487 Prevent floating-point registers from being used in any manner. This is
21488 necessary for compiling kernels that perform lazy context switching of
21489 floating-point registers. If you use this option and attempt to perform
21490 floating-point operations, the compiler aborts.
21491
21492 @item -mdisable-indexing
21493 @opindex mdisable-indexing
21494 Prevent the compiler from using indexing address modes. This avoids some
21495 rather obscure problems when compiling MIG generated code under MACH@.
21496
21497 @item -mno-space-regs
21498 @opindex mno-space-regs
21499 @opindex mspace-regs
21500 Generate code that assumes the target has no space registers. This allows
21501 GCC to generate faster indirect calls and use unscaled index address modes.
21502
21503 Such code is suitable for level 0 PA systems and kernels.
21504
21505 @item -mfast-indirect-calls
21506 @opindex mfast-indirect-calls
21507 Generate code that assumes calls never cross space boundaries. This
21508 allows GCC to emit code that performs faster indirect calls.
21509
21510 This option does not work in the presence of shared libraries or nested
21511 functions.
21512
21513 @item -mfixed-range=@var{register-range}
21514 @opindex mfixed-range
21515 Generate code treating the given register range as fixed registers.
21516 A fixed register is one that the register allocator cannot use. This is
21517 useful when compiling kernel code. A register range is specified as
21518 two registers separated by a dash. Multiple register ranges can be
21519 specified separated by a comma.
21520
21521 @item -mlong-load-store
21522 @opindex mlong-load-store
21523 Generate 3-instruction load and store sequences as sometimes required by
21524 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
21525 the HP compilers.
21526
21527 @item -mportable-runtime
21528 @opindex mportable-runtime
21529 Use the portable calling conventions proposed by HP for ELF systems.
21530
21531 @item -mgas
21532 @opindex mgas
21533 Enable the use of assembler directives only GAS understands.
21534
21535 @item -mschedule=@var{cpu-type}
21536 @opindex mschedule
21537 Schedule code according to the constraints for the machine type
21538 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
21539 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
21540 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
21541 proper scheduling option for your machine. The default scheduling is
21542 @samp{8000}.
21543
21544 @item -mlinker-opt
21545 @opindex mlinker-opt
21546 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
21547 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
21548 linkers in which they give bogus error messages when linking some programs.
21549
21550 @item -msoft-float
21551 @opindex msoft-float
21552 Generate output containing library calls for floating point.
21553 @strong{Warning:} the requisite libraries are not available for all HPPA
21554 targets. Normally the facilities of the machine's usual C compiler are
21555 used, but this cannot be done directly in cross-compilation. You must make
21556 your own arrangements to provide suitable library functions for
21557 cross-compilation.
21558
21559 @option{-msoft-float} changes the calling convention in the output file;
21560 therefore, it is only useful if you compile @emph{all} of a program with
21561 this option. In particular, you need to compile @file{libgcc.a}, the
21562 library that comes with GCC, with @option{-msoft-float} in order for
21563 this to work.
21564
21565 @item -msio
21566 @opindex msio
21567 Generate the predefine, @code{_SIO}, for server IO@. The default is
21568 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
21569 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
21570 options are available under HP-UX and HI-UX@.
21571
21572 @item -mgnu-ld
21573 @opindex mgnu-ld
21574 Use options specific to GNU @command{ld}.
21575 This passes @option{-shared} to @command{ld} when
21576 building a shared library. It is the default when GCC is configured,
21577 explicitly or implicitly, with the GNU linker. This option does not
21578 affect which @command{ld} is called; it only changes what parameters
21579 are passed to that @command{ld}.
21580 The @command{ld} that is called is determined by the
21581 @option{--with-ld} configure option, GCC's program search path, and
21582 finally by the user's @env{PATH}. The linker used by GCC can be printed
21583 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
21584 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21585
21586 @item -mhp-ld
21587 @opindex mhp-ld
21588 Use options specific to HP @command{ld}.
21589 This passes @option{-b} to @command{ld} when building
21590 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
21591 links. It is the default when GCC is configured, explicitly or
21592 implicitly, with the HP linker. This option does not affect
21593 which @command{ld} is called; it only changes what parameters are passed to that
21594 @command{ld}.
21595 The @command{ld} that is called is determined by the @option{--with-ld}
21596 configure option, GCC's program search path, and finally by the user's
21597 @env{PATH}. The linker used by GCC can be printed using @samp{which
21598 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
21599 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
21600
21601 @item -mlong-calls
21602 @opindex mno-long-calls
21603 @opindex mlong-calls
21604 Generate code that uses long call sequences. This ensures that a call
21605 is always able to reach linker generated stubs. The default is to generate
21606 long calls only when the distance from the call site to the beginning
21607 of the function or translation unit, as the case may be, exceeds a
21608 predefined limit set by the branch type being used. The limits for
21609 normal calls are 7,600,000 and 240,000 bytes, respectively for the
21610 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
21611 240,000 bytes.
21612
21613 Distances are measured from the beginning of functions when using the
21614 @option{-ffunction-sections} option, or when using the @option{-mgas}
21615 and @option{-mno-portable-runtime} options together under HP-UX with
21616 the SOM linker.
21617
21618 It is normally not desirable to use this option as it degrades
21619 performance. However, it may be useful in large applications,
21620 particularly when partial linking is used to build the application.
21621
21622 The types of long calls used depends on the capabilities of the
21623 assembler and linker, and the type of code being generated. The
21624 impact on systems that support long absolute calls, and long pic
21625 symbol-difference or pc-relative calls should be relatively small.
21626 However, an indirect call is used on 32-bit ELF systems in pic code
21627 and it is quite long.
21628
21629 @item -munix=@var{unix-std}
21630 @opindex march
21631 Generate compiler predefines and select a startfile for the specified
21632 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
21633 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
21634 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
21635 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
21636 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
21637 and later.
21638
21639 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
21640 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
21641 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
21642 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
21643 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
21644 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
21645
21646 It is @emph{important} to note that this option changes the interfaces
21647 for various library routines. It also affects the operational behavior
21648 of the C library. Thus, @emph{extreme} care is needed in using this
21649 option.
21650
21651 Library code that is intended to operate with more than one UNIX
21652 standard must test, set and restore the variable @code{__xpg4_extended_mask}
21653 as appropriate. Most GNU software doesn't provide this capability.
21654
21655 @item -nolibdld
21656 @opindex nolibdld
21657 Suppress the generation of link options to search libdld.sl when the
21658 @option{-static} option is specified on HP-UX 10 and later.
21659
21660 @item -static
21661 @opindex static
21662 The HP-UX implementation of setlocale in libc has a dependency on
21663 libdld.sl. There isn't an archive version of libdld.sl. Thus,
21664 when the @option{-static} option is specified, special link options
21665 are needed to resolve this dependency.
21666
21667 On HP-UX 10 and later, the GCC driver adds the necessary options to
21668 link with libdld.sl when the @option{-static} option is specified.
21669 This causes the resulting binary to be dynamic. On the 64-bit port,
21670 the linkers generate dynamic binaries by default in any case. The
21671 @option{-nolibdld} option can be used to prevent the GCC driver from
21672 adding these link options.
21673
21674 @item -threads
21675 @opindex threads
21676 Add support for multithreading with the @dfn{dce thread} library
21677 under HP-UX@. This option sets flags for both the preprocessor and
21678 linker.
21679 @end table
21680
21681 @node IA-64 Options
21682 @subsection IA-64 Options
21683 @cindex IA-64 Options
21684
21685 These are the @samp{-m} options defined for the Intel IA-64 architecture.
21686
21687 @table @gcctabopt
21688 @item -mbig-endian
21689 @opindex mbig-endian
21690 Generate code for a big-endian target. This is the default for HP-UX@.
21691
21692 @item -mlittle-endian
21693 @opindex mlittle-endian
21694 Generate code for a little-endian target. This is the default for AIX5
21695 and GNU/Linux.
21696
21697 @item -mgnu-as
21698 @itemx -mno-gnu-as
21699 @opindex mgnu-as
21700 @opindex mno-gnu-as
21701 Generate (or don't) code for the GNU assembler. This is the default.
21702 @c Also, this is the default if the configure option @option{--with-gnu-as}
21703 @c is used.
21704
21705 @item -mgnu-ld
21706 @itemx -mno-gnu-ld
21707 @opindex mgnu-ld
21708 @opindex mno-gnu-ld
21709 Generate (or don't) code for the GNU linker. This is the default.
21710 @c Also, this is the default if the configure option @option{--with-gnu-ld}
21711 @c is used.
21712
21713 @item -mno-pic
21714 @opindex mno-pic
21715 Generate code that does not use a global pointer register. The result
21716 is not position independent code, and violates the IA-64 ABI@.
21717
21718 @item -mvolatile-asm-stop
21719 @itemx -mno-volatile-asm-stop
21720 @opindex mvolatile-asm-stop
21721 @opindex mno-volatile-asm-stop
21722 Generate (or don't) a stop bit immediately before and after volatile asm
21723 statements.
21724
21725 @item -mregister-names
21726 @itemx -mno-register-names
21727 @opindex mregister-names
21728 @opindex mno-register-names
21729 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
21730 the stacked registers. This may make assembler output more readable.
21731
21732 @item -mno-sdata
21733 @itemx -msdata
21734 @opindex mno-sdata
21735 @opindex msdata
21736 Disable (or enable) optimizations that use the small data section. This may
21737 be useful for working around optimizer bugs.
21738
21739 @item -mconstant-gp
21740 @opindex mconstant-gp
21741 Generate code that uses a single constant global pointer value. This is
21742 useful when compiling kernel code.
21743
21744 @item -mauto-pic
21745 @opindex mauto-pic
21746 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
21747 This is useful when compiling firmware code.
21748
21749 @item -minline-float-divide-min-latency
21750 @opindex minline-float-divide-min-latency
21751 Generate code for inline divides of floating-point values
21752 using the minimum latency algorithm.
21753
21754 @item -minline-float-divide-max-throughput
21755 @opindex minline-float-divide-max-throughput
21756 Generate code for inline divides of floating-point values
21757 using the maximum throughput algorithm.
21758
21759 @item -mno-inline-float-divide
21760 @opindex mno-inline-float-divide
21761 Do not generate inline code for divides of floating-point values.
21762
21763 @item -minline-int-divide-min-latency
21764 @opindex minline-int-divide-min-latency
21765 Generate code for inline divides of integer values
21766 using the minimum latency algorithm.
21767
21768 @item -minline-int-divide-max-throughput
21769 @opindex minline-int-divide-max-throughput
21770 Generate code for inline divides of integer values
21771 using the maximum throughput algorithm.
21772
21773 @item -mno-inline-int-divide
21774 @opindex mno-inline-int-divide
21775 @opindex minline-int-divide
21776 Do not generate inline code for divides of integer values.
21777
21778 @item -minline-sqrt-min-latency
21779 @opindex minline-sqrt-min-latency
21780 Generate code for inline square roots
21781 using the minimum latency algorithm.
21782
21783 @item -minline-sqrt-max-throughput
21784 @opindex minline-sqrt-max-throughput
21785 Generate code for inline square roots
21786 using the maximum throughput algorithm.
21787
21788 @item -mno-inline-sqrt
21789 @opindex mno-inline-sqrt
21790 Do not generate inline code for @code{sqrt}.
21791
21792 @item -mfused-madd
21793 @itemx -mno-fused-madd
21794 @opindex mfused-madd
21795 @opindex mno-fused-madd
21796 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
21797 instructions. The default is to use these instructions.
21798
21799 @item -mno-dwarf2-asm
21800 @itemx -mdwarf2-asm
21801 @opindex mno-dwarf2-asm
21802 @opindex mdwarf2-asm
21803 Don't (or do) generate assembler code for the DWARF line number debugging
21804 info. This may be useful when not using the GNU assembler.
21805
21806 @item -mearly-stop-bits
21807 @itemx -mno-early-stop-bits
21808 @opindex mearly-stop-bits
21809 @opindex mno-early-stop-bits
21810 Allow stop bits to be placed earlier than immediately preceding the
21811 instruction that triggered the stop bit. This can improve instruction
21812 scheduling, but does not always do so.
21813
21814 @item -mfixed-range=@var{register-range}
21815 @opindex mfixed-range
21816 Generate code treating the given register range as fixed registers.
21817 A fixed register is one that the register allocator cannot use. This is
21818 useful when compiling kernel code. A register range is specified as
21819 two registers separated by a dash. Multiple register ranges can be
21820 specified separated by a comma.
21821
21822 @item -mtls-size=@var{tls-size}
21823 @opindex mtls-size
21824 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
21825 64.
21826
21827 @item -mtune=@var{cpu-type}
21828 @opindex mtune
21829 Tune the instruction scheduling for a particular CPU, Valid values are
21830 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
21831 and @samp{mckinley}.
21832
21833 @item -milp32
21834 @itemx -mlp64
21835 @opindex milp32
21836 @opindex mlp64
21837 Generate code for a 32-bit or 64-bit environment.
21838 The 32-bit environment sets int, long and pointer to 32 bits.
21839 The 64-bit environment sets int to 32 bits and long and pointer
21840 to 64 bits. These are HP-UX specific flags.
21841
21842 @item -mno-sched-br-data-spec
21843 @itemx -msched-br-data-spec
21844 @opindex mno-sched-br-data-spec
21845 @opindex msched-br-data-spec
21846 (Dis/En)able data speculative scheduling before reload.
21847 This results in generation of @code{ld.a} instructions and
21848 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
21849 The default setting is disabled.
21850
21851 @item -msched-ar-data-spec
21852 @itemx -mno-sched-ar-data-spec
21853 @opindex msched-ar-data-spec
21854 @opindex mno-sched-ar-data-spec
21855 (En/Dis)able data speculative scheduling after reload.
21856 This results in generation of @code{ld.a} instructions and
21857 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
21858 The default setting is enabled.
21859
21860 @item -mno-sched-control-spec
21861 @itemx -msched-control-spec
21862 @opindex mno-sched-control-spec
21863 @opindex msched-control-spec
21864 (Dis/En)able control speculative scheduling. This feature is
21865 available only during region scheduling (i.e.@: before reload).
21866 This results in generation of the @code{ld.s} instructions and
21867 the corresponding check instructions @code{chk.s}.
21868 The default setting is disabled.
21869
21870 @item -msched-br-in-data-spec
21871 @itemx -mno-sched-br-in-data-spec
21872 @opindex msched-br-in-data-spec
21873 @opindex mno-sched-br-in-data-spec
21874 (En/Dis)able speculative scheduling of the instructions that
21875 are dependent on the data speculative loads before reload.
21876 This is effective only with @option{-msched-br-data-spec} enabled.
21877 The default setting is enabled.
21878
21879 @item -msched-ar-in-data-spec
21880 @itemx -mno-sched-ar-in-data-spec
21881 @opindex msched-ar-in-data-spec
21882 @opindex mno-sched-ar-in-data-spec
21883 (En/Dis)able speculative scheduling of the instructions that
21884 are dependent on the data speculative loads after reload.
21885 This is effective only with @option{-msched-ar-data-spec} enabled.
21886 The default setting is enabled.
21887
21888 @item -msched-in-control-spec
21889 @itemx -mno-sched-in-control-spec
21890 @opindex msched-in-control-spec
21891 @opindex mno-sched-in-control-spec
21892 (En/Dis)able speculative scheduling of the instructions that
21893 are dependent on the control speculative loads.
21894 This is effective only with @option{-msched-control-spec} enabled.
21895 The default setting is enabled.
21896
21897 @item -mno-sched-prefer-non-data-spec-insns
21898 @itemx -msched-prefer-non-data-spec-insns
21899 @opindex mno-sched-prefer-non-data-spec-insns
21900 @opindex msched-prefer-non-data-spec-insns
21901 If enabled, data-speculative instructions are chosen for schedule
21902 only if there are no other choices at the moment. This makes
21903 the use of the data speculation much more conservative.
21904 The default setting is disabled.
21905
21906 @item -mno-sched-prefer-non-control-spec-insns
21907 @itemx -msched-prefer-non-control-spec-insns
21908 @opindex mno-sched-prefer-non-control-spec-insns
21909 @opindex msched-prefer-non-control-spec-insns
21910 If enabled, control-speculative instructions are chosen for schedule
21911 only if there are no other choices at the moment. This makes
21912 the use of the control speculation much more conservative.
21913 The default setting is disabled.
21914
21915 @item -mno-sched-count-spec-in-critical-path
21916 @itemx -msched-count-spec-in-critical-path
21917 @opindex mno-sched-count-spec-in-critical-path
21918 @opindex msched-count-spec-in-critical-path
21919 If enabled, speculative dependencies are considered during
21920 computation of the instructions priorities. This makes the use of the
21921 speculation a bit more conservative.
21922 The default setting is disabled.
21923
21924 @item -msched-spec-ldc
21925 @opindex msched-spec-ldc
21926 Use a simple data speculation check. This option is on by default.
21927
21928 @item -msched-control-spec-ldc
21929 @opindex msched-spec-ldc
21930 Use a simple check for control speculation. This option is on by default.
21931
21932 @item -msched-stop-bits-after-every-cycle
21933 @opindex msched-stop-bits-after-every-cycle
21934 Place a stop bit after every cycle when scheduling. This option is on
21935 by default.
21936
21937 @item -msched-fp-mem-deps-zero-cost
21938 @opindex msched-fp-mem-deps-zero-cost
21939 Assume that floating-point stores and loads are not likely to cause a conflict
21940 when placed into the same instruction group. This option is disabled by
21941 default.
21942
21943 @item -msel-sched-dont-check-control-spec
21944 @opindex msel-sched-dont-check-control-spec
21945 Generate checks for control speculation in selective scheduling.
21946 This flag is disabled by default.
21947
21948 @item -msched-max-memory-insns=@var{max-insns}
21949 @opindex msched-max-memory-insns
21950 Limit on the number of memory insns per instruction group, giving lower
21951 priority to subsequent memory insns attempting to schedule in the same
21952 instruction group. Frequently useful to prevent cache bank conflicts.
21953 The default value is 1.
21954
21955 @item -msched-max-memory-insns-hard-limit
21956 @opindex msched-max-memory-insns-hard-limit
21957 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
21958 disallowing more than that number in an instruction group.
21959 Otherwise, the limit is ``soft'', meaning that non-memory operations
21960 are preferred when the limit is reached, but memory operations may still
21961 be scheduled.
21962
21963 @end table
21964
21965 @node LM32 Options
21966 @subsection LM32 Options
21967 @cindex LM32 options
21968
21969 These @option{-m} options are defined for the LatticeMico32 architecture:
21970
21971 @table @gcctabopt
21972 @item -mbarrel-shift-enabled
21973 @opindex mbarrel-shift-enabled
21974 Enable barrel-shift instructions.
21975
21976 @item -mdivide-enabled
21977 @opindex mdivide-enabled
21978 Enable divide and modulus instructions.
21979
21980 @item -mmultiply-enabled
21981 @opindex multiply-enabled
21982 Enable multiply instructions.
21983
21984 @item -msign-extend-enabled
21985 @opindex msign-extend-enabled
21986 Enable sign extend instructions.
21987
21988 @item -muser-enabled
21989 @opindex muser-enabled
21990 Enable user-defined instructions.
21991
21992 @end table
21993
21994 @node M32C Options
21995 @subsection M32C Options
21996 @cindex M32C options
21997
21998 @table @gcctabopt
21999 @item -mcpu=@var{name}
22000 @opindex mcpu=
22001 Select the CPU for which code is generated. @var{name} may be one of
22002 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
22003 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
22004 the M32C/80 series.
22005
22006 @item -msim
22007 @opindex msim
22008 Specifies that the program will be run on the simulator. This causes
22009 an alternate runtime library to be linked in which supports, for
22010 example, file I/O@. You must not use this option when generating
22011 programs that will run on real hardware; you must provide your own
22012 runtime library for whatever I/O functions are needed.
22013
22014 @item -memregs=@var{number}
22015 @opindex memregs=
22016 Specifies the number of memory-based pseudo-registers GCC uses
22017 during code generation. These pseudo-registers are used like real
22018 registers, so there is a tradeoff between GCC's ability to fit the
22019 code into available registers, and the performance penalty of using
22020 memory instead of registers. Note that all modules in a program must
22021 be compiled with the same value for this option. Because of that, you
22022 must not use this option with GCC's default runtime libraries.
22023
22024 @end table
22025
22026 @node M32R/D Options
22027 @subsection M32R/D Options
22028 @cindex M32R/D options
22029
22030 These @option{-m} options are defined for Renesas M32R/D architectures:
22031
22032 @table @gcctabopt
22033 @item -m32r2
22034 @opindex m32r2
22035 Generate code for the M32R/2@.
22036
22037 @item -m32rx
22038 @opindex m32rx
22039 Generate code for the M32R/X@.
22040
22041 @item -m32r
22042 @opindex m32r
22043 Generate code for the M32R@. This is the default.
22044
22045 @item -mmodel=small
22046 @opindex mmodel=small
22047 Assume all objects live in the lower 16MB of memory (so that their addresses
22048 can be loaded with the @code{ld24} instruction), and assume all subroutines
22049 are reachable with the @code{bl} instruction.
22050 This is the default.
22051
22052 The addressability of a particular object can be set with the
22053 @code{model} attribute.
22054
22055 @item -mmodel=medium
22056 @opindex mmodel=medium
22057 Assume objects may be anywhere in the 32-bit address space (the compiler
22058 generates @code{seth/add3} instructions to load their addresses), and
22059 assume all subroutines are reachable with the @code{bl} instruction.
22060
22061 @item -mmodel=large
22062 @opindex mmodel=large
22063 Assume objects may be anywhere in the 32-bit address space (the compiler
22064 generates @code{seth/add3} instructions to load their addresses), and
22065 assume subroutines may not be reachable with the @code{bl} instruction
22066 (the compiler generates the much slower @code{seth/add3/jl}
22067 instruction sequence).
22068
22069 @item -msdata=none
22070 @opindex msdata=none
22071 Disable use of the small data area. Variables are put into
22072 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
22073 @code{section} attribute has been specified).
22074 This is the default.
22075
22076 The small data area consists of sections @code{.sdata} and @code{.sbss}.
22077 Objects may be explicitly put in the small data area with the
22078 @code{section} attribute using one of these sections.
22079
22080 @item -msdata=sdata
22081 @opindex msdata=sdata
22082 Put small global and static data in the small data area, but do not
22083 generate special code to reference them.
22084
22085 @item -msdata=use
22086 @opindex msdata=use
22087 Put small global and static data in the small data area, and generate
22088 special instructions to reference them.
22089
22090 @item -G @var{num}
22091 @opindex G
22092 @cindex smaller data references
22093 Put global and static objects less than or equal to @var{num} bytes
22094 into the small data or BSS sections instead of the normal data or BSS
22095 sections. The default value of @var{num} is 8.
22096 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
22097 for this option to have any effect.
22098
22099 All modules should be compiled with the same @option{-G @var{num}} value.
22100 Compiling with different values of @var{num} may or may not work; if it
22101 doesn't the linker gives an error message---incorrect code is not
22102 generated.
22103
22104 @item -mdebug
22105 @opindex mdebug
22106 Makes the M32R-specific code in the compiler display some statistics
22107 that might help in debugging programs.
22108
22109 @item -malign-loops
22110 @opindex malign-loops
22111 Align all loops to a 32-byte boundary.
22112
22113 @item -mno-align-loops
22114 @opindex mno-align-loops
22115 Do not enforce a 32-byte alignment for loops. This is the default.
22116
22117 @item -missue-rate=@var{number}
22118 @opindex missue-rate=@var{number}
22119 Issue @var{number} instructions per cycle. @var{number} can only be 1
22120 or 2.
22121
22122 @item -mbranch-cost=@var{number}
22123 @opindex mbranch-cost=@var{number}
22124 @var{number} can only be 1 or 2. If it is 1 then branches are
22125 preferred over conditional code, if it is 2, then the opposite applies.
22126
22127 @item -mflush-trap=@var{number}
22128 @opindex mflush-trap=@var{number}
22129 Specifies the trap number to use to flush the cache. The default is
22130 12. Valid numbers are between 0 and 15 inclusive.
22131
22132 @item -mno-flush-trap
22133 @opindex mno-flush-trap
22134 Specifies that the cache cannot be flushed by using a trap.
22135
22136 @item -mflush-func=@var{name}
22137 @opindex mflush-func=@var{name}
22138 Specifies the name of the operating system function to call to flush
22139 the cache. The default is @samp{_flush_cache}, but a function call
22140 is only used if a trap is not available.
22141
22142 @item -mno-flush-func
22143 @opindex mno-flush-func
22144 Indicates that there is no OS function for flushing the cache.
22145
22146 @end table
22147
22148 @node M680x0 Options
22149 @subsection M680x0 Options
22150 @cindex M680x0 options
22151
22152 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
22153 The default settings depend on which architecture was selected when
22154 the compiler was configured; the defaults for the most common choices
22155 are given below.
22156
22157 @table @gcctabopt
22158 @item -march=@var{arch}
22159 @opindex march
22160 Generate code for a specific M680x0 or ColdFire instruction set
22161 architecture. Permissible values of @var{arch} for M680x0
22162 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
22163 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
22164 architectures are selected according to Freescale's ISA classification
22165 and the permissible values are: @samp{isaa}, @samp{isaaplus},
22166 @samp{isab} and @samp{isac}.
22167
22168 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
22169 code for a ColdFire target. The @var{arch} in this macro is one of the
22170 @option{-march} arguments given above.
22171
22172 When used together, @option{-march} and @option{-mtune} select code
22173 that runs on a family of similar processors but that is optimized
22174 for a particular microarchitecture.
22175
22176 @item -mcpu=@var{cpu}
22177 @opindex mcpu
22178 Generate code for a specific M680x0 or ColdFire processor.
22179 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
22180 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
22181 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
22182 below, which also classifies the CPUs into families:
22183
22184 @multitable @columnfractions 0.20 0.80
22185 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
22186 @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}
22187 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
22188 @item @samp{5206e} @tab @samp{5206e}
22189 @item @samp{5208} @tab @samp{5207} @samp{5208}
22190 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
22191 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
22192 @item @samp{5216} @tab @samp{5214} @samp{5216}
22193 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
22194 @item @samp{5225} @tab @samp{5224} @samp{5225}
22195 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
22196 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
22197 @item @samp{5249} @tab @samp{5249}
22198 @item @samp{5250} @tab @samp{5250}
22199 @item @samp{5271} @tab @samp{5270} @samp{5271}
22200 @item @samp{5272} @tab @samp{5272}
22201 @item @samp{5275} @tab @samp{5274} @samp{5275}
22202 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
22203 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
22204 @item @samp{5307} @tab @samp{5307}
22205 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
22206 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
22207 @item @samp{5407} @tab @samp{5407}
22208 @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}
22209 @end multitable
22210
22211 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
22212 @var{arch} is compatible with @var{cpu}. Other combinations of
22213 @option{-mcpu} and @option{-march} are rejected.
22214
22215 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
22216 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
22217 where the value of @var{family} is given by the table above.
22218
22219 @item -mtune=@var{tune}
22220 @opindex mtune
22221 Tune the code for a particular microarchitecture within the
22222 constraints set by @option{-march} and @option{-mcpu}.
22223 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
22224 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
22225 and @samp{cpu32}. The ColdFire microarchitectures
22226 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
22227
22228 You can also use @option{-mtune=68020-40} for code that needs
22229 to run relatively well on 68020, 68030 and 68040 targets.
22230 @option{-mtune=68020-60} is similar but includes 68060 targets
22231 as well. These two options select the same tuning decisions as
22232 @option{-m68020-40} and @option{-m68020-60} respectively.
22233
22234 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
22235 when tuning for 680x0 architecture @var{arch}. It also defines
22236 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
22237 option is used. If GCC is tuning for a range of architectures,
22238 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
22239 it defines the macros for every architecture in the range.
22240
22241 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
22242 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
22243 of the arguments given above.
22244
22245 @item -m68000
22246 @itemx -mc68000
22247 @opindex m68000
22248 @opindex mc68000
22249 Generate output for a 68000. This is the default
22250 when the compiler is configured for 68000-based systems.
22251 It is equivalent to @option{-march=68000}.
22252
22253 Use this option for microcontrollers with a 68000 or EC000 core,
22254 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
22255
22256 @item -m68010
22257 @opindex m68010
22258 Generate output for a 68010. This is the default
22259 when the compiler is configured for 68010-based systems.
22260 It is equivalent to @option{-march=68010}.
22261
22262 @item -m68020
22263 @itemx -mc68020
22264 @opindex m68020
22265 @opindex mc68020
22266 Generate output for a 68020. This is the default
22267 when the compiler is configured for 68020-based systems.
22268 It is equivalent to @option{-march=68020}.
22269
22270 @item -m68030
22271 @opindex m68030
22272 Generate output for a 68030. This is the default when the compiler is
22273 configured for 68030-based systems. It is equivalent to
22274 @option{-march=68030}.
22275
22276 @item -m68040
22277 @opindex m68040
22278 Generate output for a 68040. This is the default when the compiler is
22279 configured for 68040-based systems. It is equivalent to
22280 @option{-march=68040}.
22281
22282 This option inhibits the use of 68881/68882 instructions that have to be
22283 emulated by software on the 68040. Use this option if your 68040 does not
22284 have code to emulate those instructions.
22285
22286 @item -m68060
22287 @opindex m68060
22288 Generate output for a 68060. This is the default when the compiler is
22289 configured for 68060-based systems. It is equivalent to
22290 @option{-march=68060}.
22291
22292 This option inhibits the use of 68020 and 68881/68882 instructions that
22293 have to be emulated by software on the 68060. Use this option if your 68060
22294 does not have code to emulate those instructions.
22295
22296 @item -mcpu32
22297 @opindex mcpu32
22298 Generate output for a CPU32. This is the default
22299 when the compiler is configured for CPU32-based systems.
22300 It is equivalent to @option{-march=cpu32}.
22301
22302 Use this option for microcontrollers with a
22303 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
22304 68336, 68340, 68341, 68349 and 68360.
22305
22306 @item -m5200
22307 @opindex m5200
22308 Generate output for a 520X ColdFire CPU@. This is the default
22309 when the compiler is configured for 520X-based systems.
22310 It is equivalent to @option{-mcpu=5206}, and is now deprecated
22311 in favor of that option.
22312
22313 Use this option for microcontroller with a 5200 core, including
22314 the MCF5202, MCF5203, MCF5204 and MCF5206.
22315
22316 @item -m5206e
22317 @opindex m5206e
22318 Generate output for a 5206e ColdFire CPU@. The option is now
22319 deprecated in favor of the equivalent @option{-mcpu=5206e}.
22320
22321 @item -m528x
22322 @opindex m528x
22323 Generate output for a member of the ColdFire 528X family.
22324 The option is now deprecated in favor of the equivalent
22325 @option{-mcpu=528x}.
22326
22327 @item -m5307
22328 @opindex m5307
22329 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
22330 in favor of the equivalent @option{-mcpu=5307}.
22331
22332 @item -m5407
22333 @opindex m5407
22334 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
22335 in favor of the equivalent @option{-mcpu=5407}.
22336
22337 @item -mcfv4e
22338 @opindex mcfv4e
22339 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
22340 This includes use of hardware floating-point instructions.
22341 The option is equivalent to @option{-mcpu=547x}, and is now
22342 deprecated in favor of that option.
22343
22344 @item -m68020-40
22345 @opindex m68020-40
22346 Generate output for a 68040, without using any of the new instructions.
22347 This results in code that can run relatively efficiently on either a
22348 68020/68881 or a 68030 or a 68040. The generated code does use the
22349 68881 instructions that are emulated on the 68040.
22350
22351 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
22352
22353 @item -m68020-60
22354 @opindex m68020-60
22355 Generate output for a 68060, without using any of the new instructions.
22356 This results in code that can run relatively efficiently on either a
22357 68020/68881 or a 68030 or a 68040. The generated code does use the
22358 68881 instructions that are emulated on the 68060.
22359
22360 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
22361
22362 @item -mhard-float
22363 @itemx -m68881
22364 @opindex mhard-float
22365 @opindex m68881
22366 Generate floating-point instructions. This is the default for 68020
22367 and above, and for ColdFire devices that have an FPU@. It defines the
22368 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
22369 on ColdFire targets.
22370
22371 @item -msoft-float
22372 @opindex msoft-float
22373 Do not generate floating-point instructions; use library calls instead.
22374 This is the default for 68000, 68010, and 68832 targets. It is also
22375 the default for ColdFire devices that have no FPU.
22376
22377 @item -mdiv
22378 @itemx -mno-div
22379 @opindex mdiv
22380 @opindex mno-div
22381 Generate (do not generate) ColdFire hardware divide and remainder
22382 instructions. If @option{-march} is used without @option{-mcpu},
22383 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
22384 architectures. Otherwise, the default is taken from the target CPU
22385 (either the default CPU, or the one specified by @option{-mcpu}). For
22386 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
22387 @option{-mcpu=5206e}.
22388
22389 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
22390
22391 @item -mshort
22392 @opindex mshort
22393 Consider type @code{int} to be 16 bits wide, like @code{short int}.
22394 Additionally, parameters passed on the stack are also aligned to a
22395 16-bit boundary even on targets whose API mandates promotion to 32-bit.
22396
22397 @item -mno-short
22398 @opindex mno-short
22399 Do not consider type @code{int} to be 16 bits wide. This is the default.
22400
22401 @item -mnobitfield
22402 @itemx -mno-bitfield
22403 @opindex mnobitfield
22404 @opindex mno-bitfield
22405 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
22406 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
22407
22408 @item -mbitfield
22409 @opindex mbitfield
22410 Do use the bit-field instructions. The @option{-m68020} option implies
22411 @option{-mbitfield}. This is the default if you use a configuration
22412 designed for a 68020.
22413
22414 @item -mrtd
22415 @opindex mrtd
22416 Use a different function-calling convention, in which functions
22417 that take a fixed number of arguments return with the @code{rtd}
22418 instruction, which pops their arguments while returning. This
22419 saves one instruction in the caller since there is no need to pop
22420 the arguments there.
22421
22422 This calling convention is incompatible with the one normally
22423 used on Unix, so you cannot use it if you need to call libraries
22424 compiled with the Unix compiler.
22425
22426 Also, you must provide function prototypes for all functions that
22427 take variable numbers of arguments (including @code{printf});
22428 otherwise incorrect code is generated for calls to those
22429 functions.
22430
22431 In addition, seriously incorrect code results if you call a
22432 function with too many arguments. (Normally, extra arguments are
22433 harmlessly ignored.)
22434
22435 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
22436 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
22437
22438 The default is @option{-mno-rtd}.
22439
22440 @item -malign-int
22441 @itemx -mno-align-int
22442 @opindex malign-int
22443 @opindex mno-align-int
22444 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
22445 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
22446 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
22447 Aligning variables on 32-bit boundaries produces code that runs somewhat
22448 faster on processors with 32-bit busses at the expense of more memory.
22449
22450 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
22451 aligns structures containing the above types differently than
22452 most published application binary interface specifications for the m68k.
22453
22454 @opindex mpcrel
22455 Use the pc-relative addressing mode of the 68000 directly, instead of
22456 using a global offset table. At present, this option implies @option{-fpic},
22457 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
22458 not presently supported with @option{-mpcrel}, though this could be supported for
22459 68020 and higher processors.
22460
22461 @item -mno-strict-align
22462 @itemx -mstrict-align
22463 @opindex mno-strict-align
22464 @opindex mstrict-align
22465 Do not (do) assume that unaligned memory references are handled by
22466 the system.
22467
22468 @item -msep-data
22469 Generate code that allows the data segment to be located in a different
22470 area of memory from the text segment. This allows for execute-in-place in
22471 an environment without virtual memory management. This option implies
22472 @option{-fPIC}.
22473
22474 @item -mno-sep-data
22475 Generate code that assumes that the data segment follows the text segment.
22476 This is the default.
22477
22478 @item -mid-shared-library
22479 Generate code that supports shared libraries via the library ID method.
22480 This allows for execute-in-place and shared libraries in an environment
22481 without virtual memory management. This option implies @option{-fPIC}.
22482
22483 @item -mno-id-shared-library
22484 Generate code that doesn't assume ID-based shared libraries are being used.
22485 This is the default.
22486
22487 @item -mshared-library-id=n
22488 Specifies the identification number of the ID-based shared library being
22489 compiled. Specifying a value of 0 generates more compact code; specifying
22490 other values forces the allocation of that number to the current
22491 library, but is no more space- or time-efficient than omitting this option.
22492
22493 @item -mxgot
22494 @itemx -mno-xgot
22495 @opindex mxgot
22496 @opindex mno-xgot
22497 When generating position-independent code for ColdFire, generate code
22498 that works if the GOT has more than 8192 entries. This code is
22499 larger and slower than code generated without this option. On M680x0
22500 processors, this option is not needed; @option{-fPIC} suffices.
22501
22502 GCC normally uses a single instruction to load values from the GOT@.
22503 While this is relatively efficient, it only works if the GOT
22504 is smaller than about 64k. Anything larger causes the linker
22505 to report an error such as:
22506
22507 @cindex relocation truncated to fit (ColdFire)
22508 @smallexample
22509 relocation truncated to fit: R_68K_GOT16O foobar
22510 @end smallexample
22511
22512 If this happens, you should recompile your code with @option{-mxgot}.
22513 It should then work with very large GOTs. However, code generated with
22514 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
22515 the value of a global symbol.
22516
22517 Note that some linkers, including newer versions of the GNU linker,
22518 can create multiple GOTs and sort GOT entries. If you have such a linker,
22519 you should only need to use @option{-mxgot} when compiling a single
22520 object file that accesses more than 8192 GOT entries. Very few do.
22521
22522 These options have no effect unless GCC is generating
22523 position-independent code.
22524
22525 @item -mlong-jump-table-offsets
22526 @opindex mlong-jump-table-offsets
22527 Use 32-bit offsets in @code{switch} tables. The default is to use
22528 16-bit offsets.
22529
22530 @end table
22531
22532 @node MCore Options
22533 @subsection MCore Options
22534 @cindex MCore options
22535
22536 These are the @samp{-m} options defined for the Motorola M*Core
22537 processors.
22538
22539 @table @gcctabopt
22540
22541 @item -mhardlit
22542 @itemx -mno-hardlit
22543 @opindex mhardlit
22544 @opindex mno-hardlit
22545 Inline constants into the code stream if it can be done in two
22546 instructions or less.
22547
22548 @item -mdiv
22549 @itemx -mno-div
22550 @opindex mdiv
22551 @opindex mno-div
22552 Use the divide instruction. (Enabled by default).
22553
22554 @item -mrelax-immediate
22555 @itemx -mno-relax-immediate
22556 @opindex mrelax-immediate
22557 @opindex mno-relax-immediate
22558 Allow arbitrary-sized immediates in bit operations.
22559
22560 @item -mwide-bitfields
22561 @itemx -mno-wide-bitfields
22562 @opindex mwide-bitfields
22563 @opindex mno-wide-bitfields
22564 Always treat bit-fields as @code{int}-sized.
22565
22566 @item -m4byte-functions
22567 @itemx -mno-4byte-functions
22568 @opindex m4byte-functions
22569 @opindex mno-4byte-functions
22570 Force all functions to be aligned to a 4-byte boundary.
22571
22572 @item -mcallgraph-data
22573 @itemx -mno-callgraph-data
22574 @opindex mcallgraph-data
22575 @opindex mno-callgraph-data
22576 Emit callgraph information.
22577
22578 @item -mslow-bytes
22579 @itemx -mno-slow-bytes
22580 @opindex mslow-bytes
22581 @opindex mno-slow-bytes
22582 Prefer word access when reading byte quantities.
22583
22584 @item -mlittle-endian
22585 @itemx -mbig-endian
22586 @opindex mlittle-endian
22587 @opindex mbig-endian
22588 Generate code for a little-endian target.
22589
22590 @item -m210
22591 @itemx -m340
22592 @opindex m210
22593 @opindex m340
22594 Generate code for the 210 processor.
22595
22596 @item -mno-lsim
22597 @opindex mno-lsim
22598 Assume that runtime support has been provided and so omit the
22599 simulator library (@file{libsim.a)} from the linker command line.
22600
22601 @item -mstack-increment=@var{size}
22602 @opindex mstack-increment
22603 Set the maximum amount for a single stack increment operation. Large
22604 values can increase the speed of programs that contain functions
22605 that need a large amount of stack space, but they can also trigger a
22606 segmentation fault if the stack is extended too much. The default
22607 value is 0x1000.
22608
22609 @end table
22610
22611 @node MeP Options
22612 @subsection MeP Options
22613 @cindex MeP options
22614
22615 @table @gcctabopt
22616
22617 @item -mabsdiff
22618 @opindex mabsdiff
22619 Enables the @code{abs} instruction, which is the absolute difference
22620 between two registers.
22621
22622 @item -mall-opts
22623 @opindex mall-opts
22624 Enables all the optional instructions---average, multiply, divide, bit
22625 operations, leading zero, absolute difference, min/max, clip, and
22626 saturation.
22627
22628
22629 @item -maverage
22630 @opindex maverage
22631 Enables the @code{ave} instruction, which computes the average of two
22632 registers.
22633
22634 @item -mbased=@var{n}
22635 @opindex mbased=
22636 Variables of size @var{n} bytes or smaller are placed in the
22637 @code{.based} section by default. Based variables use the @code{$tp}
22638 register as a base register, and there is a 128-byte limit to the
22639 @code{.based} section.
22640
22641 @item -mbitops
22642 @opindex mbitops
22643 Enables the bit operation instructions---bit test (@code{btstm}), set
22644 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
22645 test-and-set (@code{tas}).
22646
22647 @item -mc=@var{name}
22648 @opindex mc=
22649 Selects which section constant data is placed in. @var{name} may
22650 be @samp{tiny}, @samp{near}, or @samp{far}.
22651
22652 @item -mclip
22653 @opindex mclip
22654 Enables the @code{clip} instruction. Note that @option{-mclip} is not
22655 useful unless you also provide @option{-mminmax}.
22656
22657 @item -mconfig=@var{name}
22658 @opindex mconfig=
22659 Selects one of the built-in core configurations. Each MeP chip has
22660 one or more modules in it; each module has a core CPU and a variety of
22661 coprocessors, optional instructions, and peripherals. The
22662 @code{MeP-Integrator} tool, not part of GCC, provides these
22663 configurations through this option; using this option is the same as
22664 using all the corresponding command-line options. The default
22665 configuration is @samp{default}.
22666
22667 @item -mcop
22668 @opindex mcop
22669 Enables the coprocessor instructions. By default, this is a 32-bit
22670 coprocessor. Note that the coprocessor is normally enabled via the
22671 @option{-mconfig=} option.
22672
22673 @item -mcop32
22674 @opindex mcop32
22675 Enables the 32-bit coprocessor's instructions.
22676
22677 @item -mcop64
22678 @opindex mcop64
22679 Enables the 64-bit coprocessor's instructions.
22680
22681 @item -mivc2
22682 @opindex mivc2
22683 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
22684
22685 @item -mdc
22686 @opindex mdc
22687 Causes constant variables to be placed in the @code{.near} section.
22688
22689 @item -mdiv
22690 @opindex mdiv
22691 Enables the @code{div} and @code{divu} instructions.
22692
22693 @item -meb
22694 @opindex meb
22695 Generate big-endian code.
22696
22697 @item -mel
22698 @opindex mel
22699 Generate little-endian code.
22700
22701 @item -mio-volatile
22702 @opindex mio-volatile
22703 Tells the compiler that any variable marked with the @code{io}
22704 attribute is to be considered volatile.
22705
22706 @item -ml
22707 @opindex ml
22708 Causes variables to be assigned to the @code{.far} section by default.
22709
22710 @item -mleadz
22711 @opindex mleadz
22712 Enables the @code{leadz} (leading zero) instruction.
22713
22714 @item -mm
22715 @opindex mm
22716 Causes variables to be assigned to the @code{.near} section by default.
22717
22718 @item -mminmax
22719 @opindex mminmax
22720 Enables the @code{min} and @code{max} instructions.
22721
22722 @item -mmult
22723 @opindex mmult
22724 Enables the multiplication and multiply-accumulate instructions.
22725
22726 @item -mno-opts
22727 @opindex mno-opts
22728 Disables all the optional instructions enabled by @option{-mall-opts}.
22729
22730 @item -mrepeat
22731 @opindex mrepeat
22732 Enables the @code{repeat} and @code{erepeat} instructions, used for
22733 low-overhead looping.
22734
22735 @item -ms
22736 @opindex ms
22737 Causes all variables to default to the @code{.tiny} section. Note
22738 that there is a 65536-byte limit to this section. Accesses to these
22739 variables use the @code{%gp} base register.
22740
22741 @item -msatur
22742 @opindex msatur
22743 Enables the saturation instructions. Note that the compiler does not
22744 currently generate these itself, but this option is included for
22745 compatibility with other tools, like @code{as}.
22746
22747 @item -msdram
22748 @opindex msdram
22749 Link the SDRAM-based runtime instead of the default ROM-based runtime.
22750
22751 @item -msim
22752 @opindex msim
22753 Link the simulator run-time libraries.
22754
22755 @item -msimnovec
22756 @opindex msimnovec
22757 Link the simulator runtime libraries, excluding built-in support
22758 for reset and exception vectors and tables.
22759
22760 @item -mtf
22761 @opindex mtf
22762 Causes all functions to default to the @code{.far} section. Without
22763 this option, functions default to the @code{.near} section.
22764
22765 @item -mtiny=@var{n}
22766 @opindex mtiny=
22767 Variables that are @var{n} bytes or smaller are allocated to the
22768 @code{.tiny} section. These variables use the @code{$gp} base
22769 register. The default for this option is 4, but note that there's a
22770 65536-byte limit to the @code{.tiny} section.
22771
22772 @end table
22773
22774 @node MicroBlaze Options
22775 @subsection MicroBlaze Options
22776 @cindex MicroBlaze Options
22777
22778 @table @gcctabopt
22779
22780 @item -msoft-float
22781 @opindex msoft-float
22782 Use software emulation for floating point (default).
22783
22784 @item -mhard-float
22785 @opindex mhard-float
22786 Use hardware floating-point instructions.
22787
22788 @item -mmemcpy
22789 @opindex mmemcpy
22790 Do not optimize block moves, use @code{memcpy}.
22791
22792 @item -mno-clearbss
22793 @opindex mno-clearbss
22794 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
22795
22796 @item -mcpu=@var{cpu-type}
22797 @opindex mcpu=
22798 Use features of, and schedule code for, the given CPU.
22799 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
22800 where @var{X} is a major version, @var{YY} is the minor version, and
22801 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
22802 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
22803
22804 @item -mxl-soft-mul
22805 @opindex mxl-soft-mul
22806 Use software multiply emulation (default).
22807
22808 @item -mxl-soft-div
22809 @opindex mxl-soft-div
22810 Use software emulation for divides (default).
22811
22812 @item -mxl-barrel-shift
22813 @opindex mxl-barrel-shift
22814 Use the hardware barrel shifter.
22815
22816 @item -mxl-pattern-compare
22817 @opindex mxl-pattern-compare
22818 Use pattern compare instructions.
22819
22820 @item -msmall-divides
22821 @opindex msmall-divides
22822 Use table lookup optimization for small signed integer divisions.
22823
22824 @item -mxl-stack-check
22825 @opindex mxl-stack-check
22826 This option is deprecated. Use @option{-fstack-check} instead.
22827
22828 @item -mxl-gp-opt
22829 @opindex mxl-gp-opt
22830 Use GP-relative @code{.sdata}/@code{.sbss} sections.
22831
22832 @item -mxl-multiply-high
22833 @opindex mxl-multiply-high
22834 Use multiply high instructions for high part of 32x32 multiply.
22835
22836 @item -mxl-float-convert
22837 @opindex mxl-float-convert
22838 Use hardware floating-point conversion instructions.
22839
22840 @item -mxl-float-sqrt
22841 @opindex mxl-float-sqrt
22842 Use hardware floating-point square root instruction.
22843
22844 @item -mbig-endian
22845 @opindex mbig-endian
22846 Generate code for a big-endian target.
22847
22848 @item -mlittle-endian
22849 @opindex mlittle-endian
22850 Generate code for a little-endian target.
22851
22852 @item -mxl-reorder
22853 @opindex mxl-reorder
22854 Use reorder instructions (swap and byte reversed load/store).
22855
22856 @item -mxl-mode-@var{app-model}
22857 Select application model @var{app-model}. Valid models are
22858 @table @samp
22859 @item executable
22860 normal executable (default), uses startup code @file{crt0.o}.
22861
22862 @item -mpic-data-is-text-relative
22863 @opindex mpic-data-is-text-relative
22864 Assume that the displacement between the text and data segments is fixed
22865 at static link time. This allows data to be referenced by offset from start of
22866 text address instead of GOT since PC-relative addressing is not supported.
22867
22868 @item xmdstub
22869 for use with Xilinx Microprocessor Debugger (XMD) based
22870 software intrusive debug agent called xmdstub. This uses startup file
22871 @file{crt1.o} and sets the start address of the program to 0x800.
22872
22873 @item bootstrap
22874 for applications that are loaded using a bootloader.
22875 This model uses startup file @file{crt2.o} which does not contain a processor
22876 reset vector handler. This is suitable for transferring control on a
22877 processor reset to the bootloader rather than the application.
22878
22879 @item novectors
22880 for applications that do not require any of the
22881 MicroBlaze vectors. This option may be useful for applications running
22882 within a monitoring application. This model uses @file{crt3.o} as a startup file.
22883 @end table
22884
22885 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
22886 @option{-mxl-mode-@var{app-model}}.
22887
22888 @end table
22889
22890 @node MIPS Options
22891 @subsection MIPS Options
22892 @cindex MIPS options
22893
22894 @table @gcctabopt
22895
22896 @item -EB
22897 @opindex EB
22898 Generate big-endian code.
22899
22900 @item -EL
22901 @opindex EL
22902 Generate little-endian code. This is the default for @samp{mips*el-*-*}
22903 configurations.
22904
22905 @item -march=@var{arch}
22906 @opindex march
22907 Generate code that runs on @var{arch}, which can be the name of a
22908 generic MIPS ISA, or the name of a particular processor.
22909 The ISA names are:
22910 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
22911 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
22912 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
22913 @samp{mips64r5} and @samp{mips64r6}.
22914 The processor names are:
22915 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
22916 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
22917 @samp{5kc}, @samp{5kf},
22918 @samp{20kc},
22919 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
22920 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
22921 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
22922 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
22923 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
22924 @samp{i6400}, @samp{i6500},
22925 @samp{interaptiv},
22926 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
22927 @samp{gs464e}, @samp{gs264e},
22928 @samp{m4k},
22929 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
22930 @samp{m5100}, @samp{m5101},
22931 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
22932 @samp{orion},
22933 @samp{p5600}, @samp{p6600},
22934 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
22935 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
22936 @samp{r6000}, @samp{r8000},
22937 @samp{rm7000}, @samp{rm9000},
22938 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
22939 @samp{sb1},
22940 @samp{sr71000},
22941 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
22942 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
22943 @samp{xlr} and @samp{xlp}.
22944 The special value @samp{from-abi} selects the
22945 most compatible architecture for the selected ABI (that is,
22946 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
22947
22948 The native Linux/GNU toolchain also supports the value @samp{native},
22949 which selects the best architecture option for the host processor.
22950 @option{-march=native} has no effect if GCC does not recognize
22951 the processor.
22952
22953 In processor names, a final @samp{000} can be abbreviated as @samp{k}
22954 (for example, @option{-march=r2k}). Prefixes are optional, and
22955 @samp{vr} may be written @samp{r}.
22956
22957 Names of the form @samp{@var{n}f2_1} refer to processors with
22958 FPUs clocked at half the rate of the core, names of the form
22959 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
22960 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
22961 processors with FPUs clocked a ratio of 3:2 with respect to the core.
22962 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
22963 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
22964 accepted as synonyms for @samp{@var{n}f1_1}.
22965
22966 GCC defines two macros based on the value of this option. The first
22967 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
22968 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
22969 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
22970 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
22971 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
22972
22973 Note that the @code{_MIPS_ARCH} macro uses the processor names given
22974 above. In other words, it has the full prefix and does not
22975 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
22976 the macro names the resolved architecture (either @code{"mips1"} or
22977 @code{"mips3"}). It names the default architecture when no
22978 @option{-march} option is given.
22979
22980 @item -mtune=@var{arch}
22981 @opindex mtune
22982 Optimize for @var{arch}. Among other things, this option controls
22983 the way instructions are scheduled, and the perceived cost of arithmetic
22984 operations. The list of @var{arch} values is the same as for
22985 @option{-march}.
22986
22987 When this option is not used, GCC optimizes for the processor
22988 specified by @option{-march}. By using @option{-march} and
22989 @option{-mtune} together, it is possible to generate code that
22990 runs on a family of processors, but optimize the code for one
22991 particular member of that family.
22992
22993 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
22994 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
22995 @option{-march} ones described above.
22996
22997 @item -mips1
22998 @opindex mips1
22999 Equivalent to @option{-march=mips1}.
23000
23001 @item -mips2
23002 @opindex mips2
23003 Equivalent to @option{-march=mips2}.
23004
23005 @item -mips3
23006 @opindex mips3
23007 Equivalent to @option{-march=mips3}.
23008
23009 @item -mips4
23010 @opindex mips4
23011 Equivalent to @option{-march=mips4}.
23012
23013 @item -mips32
23014 @opindex mips32
23015 Equivalent to @option{-march=mips32}.
23016
23017 @item -mips32r3
23018 @opindex mips32r3
23019 Equivalent to @option{-march=mips32r3}.
23020
23021 @item -mips32r5
23022 @opindex mips32r5
23023 Equivalent to @option{-march=mips32r5}.
23024
23025 @item -mips32r6
23026 @opindex mips32r6
23027 Equivalent to @option{-march=mips32r6}.
23028
23029 @item -mips64
23030 @opindex mips64
23031 Equivalent to @option{-march=mips64}.
23032
23033 @item -mips64r2
23034 @opindex mips64r2
23035 Equivalent to @option{-march=mips64r2}.
23036
23037 @item -mips64r3
23038 @opindex mips64r3
23039 Equivalent to @option{-march=mips64r3}.
23040
23041 @item -mips64r5
23042 @opindex mips64r5
23043 Equivalent to @option{-march=mips64r5}.
23044
23045 @item -mips64r6
23046 @opindex mips64r6
23047 Equivalent to @option{-march=mips64r6}.
23048
23049 @item -mips16
23050 @itemx -mno-mips16
23051 @opindex mips16
23052 @opindex mno-mips16
23053 Generate (do not generate) MIPS16 code. If GCC is targeting a
23054 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
23055
23056 MIPS16 code generation can also be controlled on a per-function basis
23057 by means of @code{mips16} and @code{nomips16} attributes.
23058 @xref{Function Attributes}, for more information.
23059
23060 @item -mflip-mips16
23061 @opindex mflip-mips16
23062 Generate MIPS16 code on alternating functions. This option is provided
23063 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
23064 not intended for ordinary use in compiling user code.
23065
23066 @item -minterlink-compressed
23067 @itemx -mno-interlink-compressed
23068 @opindex minterlink-compressed
23069 @opindex mno-interlink-compressed
23070 Require (do not require) that code using the standard (uncompressed) MIPS ISA
23071 be link-compatible with MIPS16 and microMIPS code, and vice versa.
23072
23073 For example, code using the standard ISA encoding cannot jump directly
23074 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
23075 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
23076 knows that the target of the jump is not compressed.
23077
23078 @item -minterlink-mips16
23079 @itemx -mno-interlink-mips16
23080 @opindex minterlink-mips16
23081 @opindex mno-interlink-mips16
23082 Aliases of @option{-minterlink-compressed} and
23083 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
23084 and are retained for backwards compatibility.
23085
23086 @item -mabi=32
23087 @itemx -mabi=o64
23088 @itemx -mabi=n32
23089 @itemx -mabi=64
23090 @itemx -mabi=eabi
23091 @opindex mabi=32
23092 @opindex mabi=o64
23093 @opindex mabi=n32
23094 @opindex mabi=64
23095 @opindex mabi=eabi
23096 Generate code for the given ABI@.
23097
23098 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
23099 generates 64-bit code when you select a 64-bit architecture, but you
23100 can use @option{-mgp32} to get 32-bit code instead.
23101
23102 For information about the O64 ABI, see
23103 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
23104
23105 GCC supports a variant of the o32 ABI in which floating-point registers
23106 are 64 rather than 32 bits wide. You can select this combination with
23107 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
23108 and @code{mfhc1} instructions and is therefore only supported for
23109 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
23110
23111 The register assignments for arguments and return values remain the
23112 same, but each scalar value is passed in a single 64-bit register
23113 rather than a pair of 32-bit registers. For example, scalar
23114 floating-point values are returned in @samp{$f0} only, not a
23115 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
23116 remains the same in that the even-numbered double-precision registers
23117 are saved.
23118
23119 Two additional variants of the o32 ABI are supported to enable
23120 a transition from 32-bit to 64-bit registers. These are FPXX
23121 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
23122 The FPXX extension mandates that all code must execute correctly
23123 when run using 32-bit or 64-bit registers. The code can be interlinked
23124 with either FP32 or FP64, but not both.
23125 The FP64A extension is similar to the FP64 extension but forbids the
23126 use of odd-numbered single-precision registers. This can be used
23127 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
23128 processors and allows both FP32 and FP64A code to interlink and
23129 run in the same process without changing FPU modes.
23130
23131 @item -mabicalls
23132 @itemx -mno-abicalls
23133 @opindex mabicalls
23134 @opindex mno-abicalls
23135 Generate (do not generate) code that is suitable for SVR4-style
23136 dynamic objects. @option{-mabicalls} is the default for SVR4-based
23137 systems.
23138
23139 @item -mshared
23140 @itemx -mno-shared
23141 Generate (do not generate) code that is fully position-independent,
23142 and that can therefore be linked into shared libraries. This option
23143 only affects @option{-mabicalls}.
23144
23145 All @option{-mabicalls} code has traditionally been position-independent,
23146 regardless of options like @option{-fPIC} and @option{-fpic}. However,
23147 as an extension, the GNU toolchain allows executables to use absolute
23148 accesses for locally-binding symbols. It can also use shorter GP
23149 initialization sequences and generate direct calls to locally-defined
23150 functions. This mode is selected by @option{-mno-shared}.
23151
23152 @option{-mno-shared} depends on binutils 2.16 or higher and generates
23153 objects that can only be linked by the GNU linker. However, the option
23154 does not affect the ABI of the final executable; it only affects the ABI
23155 of relocatable objects. Using @option{-mno-shared} generally makes
23156 executables both smaller and quicker.
23157
23158 @option{-mshared} is the default.
23159
23160 @item -mplt
23161 @itemx -mno-plt
23162 @opindex mplt
23163 @opindex mno-plt
23164 Assume (do not assume) that the static and dynamic linkers
23165 support PLTs and copy relocations. This option only affects
23166 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
23167 has no effect without @option{-msym32}.
23168
23169 You can make @option{-mplt} the default by configuring
23170 GCC with @option{--with-mips-plt}. The default is
23171 @option{-mno-plt} otherwise.
23172
23173 @item -mxgot
23174 @itemx -mno-xgot
23175 @opindex mxgot
23176 @opindex mno-xgot
23177 Lift (do not lift) the usual restrictions on the size of the global
23178 offset table.
23179
23180 GCC normally uses a single instruction to load values from the GOT@.
23181 While this is relatively efficient, it only works if the GOT
23182 is smaller than about 64k. Anything larger causes the linker
23183 to report an error such as:
23184
23185 @cindex relocation truncated to fit (MIPS)
23186 @smallexample
23187 relocation truncated to fit: R_MIPS_GOT16 foobar
23188 @end smallexample
23189
23190 If this happens, you should recompile your code with @option{-mxgot}.
23191 This works with very large GOTs, although the code is also
23192 less efficient, since it takes three instructions to fetch the
23193 value of a global symbol.
23194
23195 Note that some linkers can create multiple GOTs. If you have such a
23196 linker, you should only need to use @option{-mxgot} when a single object
23197 file accesses more than 64k's worth of GOT entries. Very few do.
23198
23199 These options have no effect unless GCC is generating position
23200 independent code.
23201
23202 @item -mgp32
23203 @opindex mgp32
23204 Assume that general-purpose registers are 32 bits wide.
23205
23206 @item -mgp64
23207 @opindex mgp64
23208 Assume that general-purpose registers are 64 bits wide.
23209
23210 @item -mfp32
23211 @opindex mfp32
23212 Assume that floating-point registers are 32 bits wide.
23213
23214 @item -mfp64
23215 @opindex mfp64
23216 Assume that floating-point registers are 64 bits wide.
23217
23218 @item -mfpxx
23219 @opindex mfpxx
23220 Do not assume the width of floating-point registers.
23221
23222 @item -mhard-float
23223 @opindex mhard-float
23224 Use floating-point coprocessor instructions.
23225
23226 @item -msoft-float
23227 @opindex msoft-float
23228 Do not use floating-point coprocessor instructions. Implement
23229 floating-point calculations using library calls instead.
23230
23231 @item -mno-float
23232 @opindex mno-float
23233 Equivalent to @option{-msoft-float}, but additionally asserts that the
23234 program being compiled does not perform any floating-point operations.
23235 This option is presently supported only by some bare-metal MIPS
23236 configurations, where it may select a special set of libraries
23237 that lack all floating-point support (including, for example, the
23238 floating-point @code{printf} formats).
23239 If code compiled with @option{-mno-float} accidentally contains
23240 floating-point operations, it is likely to suffer a link-time
23241 or run-time failure.
23242
23243 @item -msingle-float
23244 @opindex msingle-float
23245 Assume that the floating-point coprocessor only supports single-precision
23246 operations.
23247
23248 @item -mdouble-float
23249 @opindex mdouble-float
23250 Assume that the floating-point coprocessor supports double-precision
23251 operations. This is the default.
23252
23253 @item -modd-spreg
23254 @itemx -mno-odd-spreg
23255 @opindex modd-spreg
23256 @opindex mno-odd-spreg
23257 Enable the use of odd-numbered single-precision floating-point registers
23258 for the o32 ABI. This is the default for processors that are known to
23259 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
23260 is set by default.
23261
23262 @item -mabs=2008
23263 @itemx -mabs=legacy
23264 @opindex mabs=2008
23265 @opindex mabs=legacy
23266 These options control the treatment of the special not-a-number (NaN)
23267 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
23268 @code{neg.@i{fmt}} machine instructions.
23269
23270 By default or when @option{-mabs=legacy} is used the legacy
23271 treatment is selected. In this case these instructions are considered
23272 arithmetic and avoided where correct operation is required and the
23273 input operand might be a NaN. A longer sequence of instructions that
23274 manipulate the sign bit of floating-point datum manually is used
23275 instead unless the @option{-ffinite-math-only} option has also been
23276 specified.
23277
23278 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
23279 this case these instructions are considered non-arithmetic and therefore
23280 operating correctly in all cases, including in particular where the
23281 input operand is a NaN. These instructions are therefore always used
23282 for the respective operations.
23283
23284 @item -mnan=2008
23285 @itemx -mnan=legacy
23286 @opindex mnan=2008
23287 @opindex mnan=legacy
23288 These options control the encoding of the special not-a-number (NaN)
23289 IEEE 754 floating-point data.
23290
23291 The @option{-mnan=legacy} option selects the legacy encoding. In this
23292 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
23293 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
23294 by the first bit of their trailing significand field being 1.
23295
23296 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
23297 this case qNaNs are denoted by the first bit of their trailing
23298 significand field being 1, whereas sNaNs are denoted by the first bit of
23299 their trailing significand field being 0.
23300
23301 The default is @option{-mnan=legacy} unless GCC has been configured with
23302 @option{--with-nan=2008}.
23303
23304 @item -mllsc
23305 @itemx -mno-llsc
23306 @opindex mllsc
23307 @opindex mno-llsc
23308 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
23309 implement atomic memory built-in functions. When neither option is
23310 specified, GCC uses the instructions if the target architecture
23311 supports them.
23312
23313 @option{-mllsc} is useful if the runtime environment can emulate the
23314 instructions and @option{-mno-llsc} can be useful when compiling for
23315 nonstandard ISAs. You can make either option the default by
23316 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
23317 respectively. @option{--with-llsc} is the default for some
23318 configurations; see the installation documentation for details.
23319
23320 @item -mdsp
23321 @itemx -mno-dsp
23322 @opindex mdsp
23323 @opindex mno-dsp
23324 Use (do not use) revision 1 of the MIPS DSP ASE@.
23325 @xref{MIPS DSP Built-in Functions}. This option defines the
23326 preprocessor macro @code{__mips_dsp}. It also defines
23327 @code{__mips_dsp_rev} to 1.
23328
23329 @item -mdspr2
23330 @itemx -mno-dspr2
23331 @opindex mdspr2
23332 @opindex mno-dspr2
23333 Use (do not use) revision 2 of the MIPS DSP ASE@.
23334 @xref{MIPS DSP Built-in Functions}. This option defines the
23335 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
23336 It also defines @code{__mips_dsp_rev} to 2.
23337
23338 @item -msmartmips
23339 @itemx -mno-smartmips
23340 @opindex msmartmips
23341 @opindex mno-smartmips
23342 Use (do not use) the MIPS SmartMIPS ASE.
23343
23344 @item -mpaired-single
23345 @itemx -mno-paired-single
23346 @opindex mpaired-single
23347 @opindex mno-paired-single
23348 Use (do not use) paired-single floating-point instructions.
23349 @xref{MIPS Paired-Single Support}. This option requires
23350 hardware floating-point support to be enabled.
23351
23352 @item -mdmx
23353 @itemx -mno-mdmx
23354 @opindex mdmx
23355 @opindex mno-mdmx
23356 Use (do not use) MIPS Digital Media Extension instructions.
23357 This option can only be used when generating 64-bit code and requires
23358 hardware floating-point support to be enabled.
23359
23360 @item -mips3d
23361 @itemx -mno-mips3d
23362 @opindex mips3d
23363 @opindex mno-mips3d
23364 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
23365 The option @option{-mips3d} implies @option{-mpaired-single}.
23366
23367 @item -mmicromips
23368 @itemx -mno-micromips
23369 @opindex mmicromips
23370 @opindex mno-mmicromips
23371 Generate (do not generate) microMIPS code.
23372
23373 MicroMIPS code generation can also be controlled on a per-function basis
23374 by means of @code{micromips} and @code{nomicromips} attributes.
23375 @xref{Function Attributes}, for more information.
23376
23377 @item -mmt
23378 @itemx -mno-mt
23379 @opindex mmt
23380 @opindex mno-mt
23381 Use (do not use) MT Multithreading instructions.
23382
23383 @item -mmcu
23384 @itemx -mno-mcu
23385 @opindex mmcu
23386 @opindex mno-mcu
23387 Use (do not use) the MIPS MCU ASE instructions.
23388
23389 @item -meva
23390 @itemx -mno-eva
23391 @opindex meva
23392 @opindex mno-eva
23393 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
23394
23395 @item -mvirt
23396 @itemx -mno-virt
23397 @opindex mvirt
23398 @opindex mno-virt
23399 Use (do not use) the MIPS Virtualization (VZ) instructions.
23400
23401 @item -mxpa
23402 @itemx -mno-xpa
23403 @opindex mxpa
23404 @opindex mno-xpa
23405 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
23406
23407 @item -mcrc
23408 @itemx -mno-crc
23409 @opindex mcrc
23410 @opindex mno-crc
23411 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
23412
23413 @item -mginv
23414 @itemx -mno-ginv
23415 @opindex mginv
23416 @opindex mno-ginv
23417 Use (do not use) the MIPS Global INValidate (GINV) instructions.
23418
23419 @item -mloongson-mmi
23420 @itemx -mno-loongson-mmi
23421 @opindex mloongson-mmi
23422 @opindex mno-loongson-mmi
23423 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
23424
23425 @item -mloongson-ext
23426 @itemx -mno-loongson-ext
23427 @opindex mloongson-ext
23428 @opindex mno-loongson-ext
23429 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
23430
23431 @item -mloongson-ext2
23432 @itemx -mno-loongson-ext2
23433 @opindex mloongson-ext2
23434 @opindex mno-loongson-ext2
23435 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
23436
23437 @item -mlong64
23438 @opindex mlong64
23439 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
23440 an explanation of the default and the way that the pointer size is
23441 determined.
23442
23443 @item -mlong32
23444 @opindex mlong32
23445 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
23446
23447 The default size of @code{int}s, @code{long}s and pointers depends on
23448 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
23449 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
23450 32-bit @code{long}s. Pointers are the same size as @code{long}s,
23451 or the same size as integer registers, whichever is smaller.
23452
23453 @item -msym32
23454 @itemx -mno-sym32
23455 @opindex msym32
23456 @opindex mno-sym32
23457 Assume (do not assume) that all symbols have 32-bit values, regardless
23458 of the selected ABI@. This option is useful in combination with
23459 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
23460 to generate shorter and faster references to symbolic addresses.
23461
23462 @item -G @var{num}
23463 @opindex G
23464 Put definitions of externally-visible data in a small data section
23465 if that data is no bigger than @var{num} bytes. GCC can then generate
23466 more efficient accesses to the data; see @option{-mgpopt} for details.
23467
23468 The default @option{-G} option depends on the configuration.
23469
23470 @item -mlocal-sdata
23471 @itemx -mno-local-sdata
23472 @opindex mlocal-sdata
23473 @opindex mno-local-sdata
23474 Extend (do not extend) the @option{-G} behavior to local data too,
23475 such as to static variables in C@. @option{-mlocal-sdata} is the
23476 default for all configurations.
23477
23478 If the linker complains that an application is using too much small data,
23479 you might want to try rebuilding the less performance-critical parts with
23480 @option{-mno-local-sdata}. You might also want to build large
23481 libraries with @option{-mno-local-sdata}, so that the libraries leave
23482 more room for the main program.
23483
23484 @item -mextern-sdata
23485 @itemx -mno-extern-sdata
23486 @opindex mextern-sdata
23487 @opindex mno-extern-sdata
23488 Assume (do not assume) that externally-defined data is in
23489 a small data section if the size of that data is within the @option{-G} limit.
23490 @option{-mextern-sdata} is the default for all configurations.
23491
23492 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
23493 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
23494 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
23495 is placed in a small data section. If @var{Var} is defined by another
23496 module, you must either compile that module with a high-enough
23497 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
23498 definition. If @var{Var} is common, you must link the application
23499 with a high-enough @option{-G} setting.
23500
23501 The easiest way of satisfying these restrictions is to compile
23502 and link every module with the same @option{-G} option. However,
23503 you may wish to build a library that supports several different
23504 small data limits. You can do this by compiling the library with
23505 the highest supported @option{-G} setting and additionally using
23506 @option{-mno-extern-sdata} to stop the library from making assumptions
23507 about externally-defined data.
23508
23509 @item -mgpopt
23510 @itemx -mno-gpopt
23511 @opindex mgpopt
23512 @opindex mno-gpopt
23513 Use (do not use) GP-relative accesses for symbols that are known to be
23514 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
23515 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
23516 configurations.
23517
23518 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
23519 might not hold the value of @code{_gp}. For example, if the code is
23520 part of a library that might be used in a boot monitor, programs that
23521 call boot monitor routines pass an unknown value in @code{$gp}.
23522 (In such situations, the boot monitor itself is usually compiled
23523 with @option{-G0}.)
23524
23525 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
23526 @option{-mno-extern-sdata}.
23527
23528 @item -membedded-data
23529 @itemx -mno-embedded-data
23530 @opindex membedded-data
23531 @opindex mno-embedded-data
23532 Allocate variables to the read-only data section first if possible, then
23533 next in the small data section if possible, otherwise in data. This gives
23534 slightly slower code than the default, but reduces the amount of RAM required
23535 when executing, and thus may be preferred for some embedded systems.
23536
23537 @item -muninit-const-in-rodata
23538 @itemx -mno-uninit-const-in-rodata
23539 @opindex muninit-const-in-rodata
23540 @opindex mno-uninit-const-in-rodata
23541 Put uninitialized @code{const} variables in the read-only data section.
23542 This option is only meaningful in conjunction with @option{-membedded-data}.
23543
23544 @item -mcode-readable=@var{setting}
23545 @opindex mcode-readable
23546 Specify whether GCC may generate code that reads from executable sections.
23547 There are three possible settings:
23548
23549 @table @gcctabopt
23550 @item -mcode-readable=yes
23551 Instructions may freely access executable sections. This is the
23552 default setting.
23553
23554 @item -mcode-readable=pcrel
23555 MIPS16 PC-relative load instructions can access executable sections,
23556 but other instructions must not do so. This option is useful on 4KSc
23557 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
23558 It is also useful on processors that can be configured to have a dual
23559 instruction/data SRAM interface and that, like the M4K, automatically
23560 redirect PC-relative loads to the instruction RAM.
23561
23562 @item -mcode-readable=no
23563 Instructions must not access executable sections. This option can be
23564 useful on targets that are configured to have a dual instruction/data
23565 SRAM interface but that (unlike the M4K) do not automatically redirect
23566 PC-relative loads to the instruction RAM.
23567 @end table
23568
23569 @item -msplit-addresses
23570 @itemx -mno-split-addresses
23571 @opindex msplit-addresses
23572 @opindex mno-split-addresses
23573 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
23574 relocation operators. This option has been superseded by
23575 @option{-mexplicit-relocs} but is retained for backwards compatibility.
23576
23577 @item -mexplicit-relocs
23578 @itemx -mno-explicit-relocs
23579 @opindex mexplicit-relocs
23580 @opindex mno-explicit-relocs
23581 Use (do not use) assembler relocation operators when dealing with symbolic
23582 addresses. The alternative, selected by @option{-mno-explicit-relocs},
23583 is to use assembler macros instead.
23584
23585 @option{-mexplicit-relocs} is the default if GCC was configured
23586 to use an assembler that supports relocation operators.
23587
23588 @item -mcheck-zero-division
23589 @itemx -mno-check-zero-division
23590 @opindex mcheck-zero-division
23591 @opindex mno-check-zero-division
23592 Trap (do not trap) on integer division by zero.
23593
23594 The default is @option{-mcheck-zero-division}.
23595
23596 @item -mdivide-traps
23597 @itemx -mdivide-breaks
23598 @opindex mdivide-traps
23599 @opindex mdivide-breaks
23600 MIPS systems check for division by zero by generating either a
23601 conditional trap or a break instruction. Using traps results in
23602 smaller code, but is only supported on MIPS II and later. Also, some
23603 versions of the Linux kernel have a bug that prevents trap from
23604 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
23605 allow conditional traps on architectures that support them and
23606 @option{-mdivide-breaks} to force the use of breaks.
23607
23608 The default is usually @option{-mdivide-traps}, but this can be
23609 overridden at configure time using @option{--with-divide=breaks}.
23610 Divide-by-zero checks can be completely disabled using
23611 @option{-mno-check-zero-division}.
23612
23613 @item -mload-store-pairs
23614 @itemx -mno-load-store-pairs
23615 @opindex mload-store-pairs
23616 @opindex mno-load-store-pairs
23617 Enable (disable) an optimization that pairs consecutive load or store
23618 instructions to enable load/store bonding. This option is enabled by
23619 default but only takes effect when the selected architecture is known
23620 to support bonding.
23621
23622 @item -mmemcpy
23623 @itemx -mno-memcpy
23624 @opindex mmemcpy
23625 @opindex mno-memcpy
23626 Force (do not force) the use of @code{memcpy} for non-trivial block
23627 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
23628 most constant-sized copies.
23629
23630 @item -mlong-calls
23631 @itemx -mno-long-calls
23632 @opindex mlong-calls
23633 @opindex mno-long-calls
23634 Disable (do not disable) use of the @code{jal} instruction. Calling
23635 functions using @code{jal} is more efficient but requires the caller
23636 and callee to be in the same 256 megabyte segment.
23637
23638 This option has no effect on abicalls code. The default is
23639 @option{-mno-long-calls}.
23640
23641 @item -mmad
23642 @itemx -mno-mad
23643 @opindex mmad
23644 @opindex mno-mad
23645 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
23646 instructions, as provided by the R4650 ISA@.
23647
23648 @item -mimadd
23649 @itemx -mno-imadd
23650 @opindex mimadd
23651 @opindex mno-imadd
23652 Enable (disable) use of the @code{madd} and @code{msub} integer
23653 instructions. The default is @option{-mimadd} on architectures
23654 that support @code{madd} and @code{msub} except for the 74k
23655 architecture where it was found to generate slower code.
23656
23657 @item -mfused-madd
23658 @itemx -mno-fused-madd
23659 @opindex mfused-madd
23660 @opindex mno-fused-madd
23661 Enable (disable) use of the floating-point multiply-accumulate
23662 instructions, when they are available. The default is
23663 @option{-mfused-madd}.
23664
23665 On the R8000 CPU when multiply-accumulate instructions are used,
23666 the intermediate product is calculated to infinite precision
23667 and is not subject to the FCSR Flush to Zero bit. This may be
23668 undesirable in some circumstances. On other processors the result
23669 is numerically identical to the equivalent computation using
23670 separate multiply, add, subtract and negate instructions.
23671
23672 @item -nocpp
23673 @opindex nocpp
23674 Tell the MIPS assembler to not run its preprocessor over user
23675 assembler files (with a @samp{.s} suffix) when assembling them.
23676
23677 @item -mfix-24k
23678 @itemx -mno-fix-24k
23679 @opindex mfix-24k
23680 @opindex mno-fix-24k
23681 Work around the 24K E48 (lost data on stores during refill) errata.
23682 The workarounds are implemented by the assembler rather than by GCC@.
23683
23684 @item -mfix-r4000
23685 @itemx -mno-fix-r4000
23686 @opindex mfix-r4000
23687 @opindex mno-fix-r4000
23688 Work around certain R4000 CPU errata:
23689 @itemize @minus
23690 @item
23691 A double-word or a variable shift may give an incorrect result if executed
23692 immediately after starting an integer division.
23693 @item
23694 A double-word or a variable shift may give an incorrect result if executed
23695 while an integer multiplication is in progress.
23696 @item
23697 An integer division may give an incorrect result if started in a delay slot
23698 of a taken branch or a jump.
23699 @end itemize
23700
23701 @item -mfix-r4400
23702 @itemx -mno-fix-r4400
23703 @opindex mfix-r4400
23704 @opindex mno-fix-r4400
23705 Work around certain R4400 CPU errata:
23706 @itemize @minus
23707 @item
23708 A double-word or a variable shift may give an incorrect result if executed
23709 immediately after starting an integer division.
23710 @end itemize
23711
23712 @item -mfix-r10000
23713 @itemx -mno-fix-r10000
23714 @opindex mfix-r10000
23715 @opindex mno-fix-r10000
23716 Work around certain R10000 errata:
23717 @itemize @minus
23718 @item
23719 @code{ll}/@code{sc} sequences may not behave atomically on revisions
23720 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
23721 @end itemize
23722
23723 This option can only be used if the target architecture supports
23724 branch-likely instructions. @option{-mfix-r10000} is the default when
23725 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
23726 otherwise.
23727
23728 @item -mfix-r5900
23729 @itemx -mno-fix-r5900
23730 @opindex mfix-r5900
23731 Do not attempt to schedule the preceding instruction into the delay slot
23732 of a branch instruction placed at the end of a short loop of six
23733 instructions or fewer and always schedule a @code{nop} instruction there
23734 instead. The short loop bug under certain conditions causes loops to
23735 execute only once or twice, due to a hardware bug in the R5900 chip. The
23736 workaround is implemented by the assembler rather than by GCC@.
23737
23738 @item -mfix-rm7000
23739 @itemx -mno-fix-rm7000
23740 @opindex mfix-rm7000
23741 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
23742 workarounds are implemented by the assembler rather than by GCC@.
23743
23744 @item -mfix-vr4120
23745 @itemx -mno-fix-vr4120
23746 @opindex mfix-vr4120
23747 Work around certain VR4120 errata:
23748 @itemize @minus
23749 @item
23750 @code{dmultu} does not always produce the correct result.
23751 @item
23752 @code{div} and @code{ddiv} do not always produce the correct result if one
23753 of the operands is negative.
23754 @end itemize
23755 The workarounds for the division errata rely on special functions in
23756 @file{libgcc.a}. At present, these functions are only provided by
23757 the @code{mips64vr*-elf} configurations.
23758
23759 Other VR4120 errata require a NOP to be inserted between certain pairs of
23760 instructions. These errata are handled by the assembler, not by GCC itself.
23761
23762 @item -mfix-vr4130
23763 @opindex mfix-vr4130
23764 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
23765 workarounds are implemented by the assembler rather than by GCC,
23766 although GCC avoids using @code{mflo} and @code{mfhi} if the
23767 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
23768 instructions are available instead.
23769
23770 @item -mfix-sb1
23771 @itemx -mno-fix-sb1
23772 @opindex mfix-sb1
23773 Work around certain SB-1 CPU core errata.
23774 (This flag currently works around the SB-1 revision 2
23775 ``F1'' and ``F2'' floating-point errata.)
23776
23777 @item -mr10k-cache-barrier=@var{setting}
23778 @opindex mr10k-cache-barrier
23779 Specify whether GCC should insert cache barriers to avoid the
23780 side effects of speculation on R10K processors.
23781
23782 In common with many processors, the R10K tries to predict the outcome
23783 of a conditional branch and speculatively executes instructions from
23784 the ``taken'' branch. It later aborts these instructions if the
23785 predicted outcome is wrong. However, on the R10K, even aborted
23786 instructions can have side effects.
23787
23788 This problem only affects kernel stores and, depending on the system,
23789 kernel loads. As an example, a speculatively-executed store may load
23790 the target memory into cache and mark the cache line as dirty, even if
23791 the store itself is later aborted. If a DMA operation writes to the
23792 same area of memory before the ``dirty'' line is flushed, the cached
23793 data overwrites the DMA-ed data. See the R10K processor manual
23794 for a full description, including other potential problems.
23795
23796 One workaround is to insert cache barrier instructions before every memory
23797 access that might be speculatively executed and that might have side
23798 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
23799 controls GCC's implementation of this workaround. It assumes that
23800 aborted accesses to any byte in the following regions does not have
23801 side effects:
23802
23803 @enumerate
23804 @item
23805 the memory occupied by the current function's stack frame;
23806
23807 @item
23808 the memory occupied by an incoming stack argument;
23809
23810 @item
23811 the memory occupied by an object with a link-time-constant address.
23812 @end enumerate
23813
23814 It is the kernel's responsibility to ensure that speculative
23815 accesses to these regions are indeed safe.
23816
23817 If the input program contains a function declaration such as:
23818
23819 @smallexample
23820 void foo (void);
23821 @end smallexample
23822
23823 then the implementation of @code{foo} must allow @code{j foo} and
23824 @code{jal foo} to be executed speculatively. GCC honors this
23825 restriction for functions it compiles itself. It expects non-GCC
23826 functions (such as hand-written assembly code) to do the same.
23827
23828 The option has three forms:
23829
23830 @table @gcctabopt
23831 @item -mr10k-cache-barrier=load-store
23832 Insert a cache barrier before a load or store that might be
23833 speculatively executed and that might have side effects even
23834 if aborted.
23835
23836 @item -mr10k-cache-barrier=store
23837 Insert a cache barrier before a store that might be speculatively
23838 executed and that might have side effects even if aborted.
23839
23840 @item -mr10k-cache-barrier=none
23841 Disable the insertion of cache barriers. This is the default setting.
23842 @end table
23843
23844 @item -mflush-func=@var{func}
23845 @itemx -mno-flush-func
23846 @opindex mflush-func
23847 Specifies the function to call to flush the I and D caches, or to not
23848 call any such function. If called, the function must take the same
23849 arguments as the common @code{_flush_func}, that is, the address of the
23850 memory range for which the cache is being flushed, the size of the
23851 memory range, and the number 3 (to flush both caches). The default
23852 depends on the target GCC was configured for, but commonly is either
23853 @code{_flush_func} or @code{__cpu_flush}.
23854
23855 @item mbranch-cost=@var{num}
23856 @opindex mbranch-cost
23857 Set the cost of branches to roughly @var{num} ``simple'' instructions.
23858 This cost is only a heuristic and is not guaranteed to produce
23859 consistent results across releases. A zero cost redundantly selects
23860 the default, which is based on the @option{-mtune} setting.
23861
23862 @item -mbranch-likely
23863 @itemx -mno-branch-likely
23864 @opindex mbranch-likely
23865 @opindex mno-branch-likely
23866 Enable or disable use of Branch Likely instructions, regardless of the
23867 default for the selected architecture. By default, Branch Likely
23868 instructions may be generated if they are supported by the selected
23869 architecture. An exception is for the MIPS32 and MIPS64 architectures
23870 and processors that implement those architectures; for those, Branch
23871 Likely instructions are not be generated by default because the MIPS32
23872 and MIPS64 architectures specifically deprecate their use.
23873
23874 @item -mcompact-branches=never
23875 @itemx -mcompact-branches=optimal
23876 @itemx -mcompact-branches=always
23877 @opindex mcompact-branches=never
23878 @opindex mcompact-branches=optimal
23879 @opindex mcompact-branches=always
23880 These options control which form of branches will be generated. The
23881 default is @option{-mcompact-branches=optimal}.
23882
23883 The @option{-mcompact-branches=never} option ensures that compact branch
23884 instructions will never be generated.
23885
23886 The @option{-mcompact-branches=always} option ensures that a compact
23887 branch instruction will be generated if available. If a compact branch
23888 instruction is not available, a delay slot form of the branch will be
23889 used instead.
23890
23891 This option is supported from MIPS Release 6 onwards.
23892
23893 The @option{-mcompact-branches=optimal} option will cause a delay slot
23894 branch to be used if one is available in the current ISA and the delay
23895 slot is successfully filled. If the delay slot is not filled, a compact
23896 branch will be chosen if one is available.
23897
23898 @item -mfp-exceptions
23899 @itemx -mno-fp-exceptions
23900 @opindex mfp-exceptions
23901 Specifies whether FP exceptions are enabled. This affects how
23902 FP instructions are scheduled for some processors.
23903 The default is that FP exceptions are
23904 enabled.
23905
23906 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
23907 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
23908 FP pipe.
23909
23910 @item -mvr4130-align
23911 @itemx -mno-vr4130-align
23912 @opindex mvr4130-align
23913 The VR4130 pipeline is two-way superscalar, but can only issue two
23914 instructions together if the first one is 8-byte aligned. When this
23915 option is enabled, GCC aligns pairs of instructions that it
23916 thinks should execute in parallel.
23917
23918 This option only has an effect when optimizing for the VR4130.
23919 It normally makes code faster, but at the expense of making it bigger.
23920 It is enabled by default at optimization level @option{-O3}.
23921
23922 @item -msynci
23923 @itemx -mno-synci
23924 @opindex msynci
23925 Enable (disable) generation of @code{synci} instructions on
23926 architectures that support it. The @code{synci} instructions (if
23927 enabled) are generated when @code{__builtin___clear_cache} is
23928 compiled.
23929
23930 This option defaults to @option{-mno-synci}, but the default can be
23931 overridden by configuring GCC with @option{--with-synci}.
23932
23933 When compiling code for single processor systems, it is generally safe
23934 to use @code{synci}. However, on many multi-core (SMP) systems, it
23935 does not invalidate the instruction caches on all cores and may lead
23936 to undefined behavior.
23937
23938 @item -mrelax-pic-calls
23939 @itemx -mno-relax-pic-calls
23940 @opindex mrelax-pic-calls
23941 Try to turn PIC calls that are normally dispatched via register
23942 @code{$25} into direct calls. This is only possible if the linker can
23943 resolve the destination at link time and if the destination is within
23944 range for a direct call.
23945
23946 @option{-mrelax-pic-calls} is the default if GCC was configured to use
23947 an assembler and a linker that support the @code{.reloc} assembly
23948 directive and @option{-mexplicit-relocs} is in effect. With
23949 @option{-mno-explicit-relocs}, this optimization can be performed by the
23950 assembler and the linker alone without help from the compiler.
23951
23952 @item -mmcount-ra-address
23953 @itemx -mno-mcount-ra-address
23954 @opindex mmcount-ra-address
23955 @opindex mno-mcount-ra-address
23956 Emit (do not emit) code that allows @code{_mcount} to modify the
23957 calling function's return address. When enabled, this option extends
23958 the usual @code{_mcount} interface with a new @var{ra-address}
23959 parameter, which has type @code{intptr_t *} and is passed in register
23960 @code{$12}. @code{_mcount} can then modify the return address by
23961 doing both of the following:
23962 @itemize
23963 @item
23964 Returning the new address in register @code{$31}.
23965 @item
23966 Storing the new address in @code{*@var{ra-address}},
23967 if @var{ra-address} is nonnull.
23968 @end itemize
23969
23970 The default is @option{-mno-mcount-ra-address}.
23971
23972 @item -mframe-header-opt
23973 @itemx -mno-frame-header-opt
23974 @opindex mframe-header-opt
23975 Enable (disable) frame header optimization in the o32 ABI. When using the
23976 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
23977 function to write out register arguments. When enabled, this optimization
23978 will suppress the allocation of the frame header if it can be determined that
23979 it is unused.
23980
23981 This optimization is off by default at all optimization levels.
23982
23983 @item -mlxc1-sxc1
23984 @itemx -mno-lxc1-sxc1
23985 @opindex mlxc1-sxc1
23986 When applicable, enable (disable) the generation of @code{lwxc1},
23987 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
23988
23989 @item -mmadd4
23990 @itemx -mno-madd4
23991 @opindex mmadd4
23992 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
23993 @code{madd.d} and related instructions. Enabled by default.
23994
23995 @end table
23996
23997 @node MMIX Options
23998 @subsection MMIX Options
23999 @cindex MMIX Options
24000
24001 These options are defined for the MMIX:
24002
24003 @table @gcctabopt
24004 @item -mlibfuncs
24005 @itemx -mno-libfuncs
24006 @opindex mlibfuncs
24007 @opindex mno-libfuncs
24008 Specify that intrinsic library functions are being compiled, passing all
24009 values in registers, no matter the size.
24010
24011 @item -mepsilon
24012 @itemx -mno-epsilon
24013 @opindex mepsilon
24014 @opindex mno-epsilon
24015 Generate floating-point comparison instructions that compare with respect
24016 to the @code{rE} epsilon register.
24017
24018 @item -mabi=mmixware
24019 @itemx -mabi=gnu
24020 @opindex mabi=mmixware
24021 @opindex mabi=gnu
24022 Generate code that passes function parameters and return values that (in
24023 the called function) are seen as registers @code{$0} and up, as opposed to
24024 the GNU ABI which uses global registers @code{$231} and up.
24025
24026 @item -mzero-extend
24027 @itemx -mno-zero-extend
24028 @opindex mzero-extend
24029 @opindex mno-zero-extend
24030 When reading data from memory in sizes shorter than 64 bits, use (do not
24031 use) zero-extending load instructions by default, rather than
24032 sign-extending ones.
24033
24034 @item -mknuthdiv
24035 @itemx -mno-knuthdiv
24036 @opindex mknuthdiv
24037 @opindex mno-knuthdiv
24038 Make the result of a division yielding a remainder have the same sign as
24039 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
24040 remainder follows the sign of the dividend. Both methods are
24041 arithmetically valid, the latter being almost exclusively used.
24042
24043 @item -mtoplevel-symbols
24044 @itemx -mno-toplevel-symbols
24045 @opindex mtoplevel-symbols
24046 @opindex mno-toplevel-symbols
24047 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
24048 code can be used with the @code{PREFIX} assembly directive.
24049
24050 @item -melf
24051 @opindex melf
24052 Generate an executable in the ELF format, rather than the default
24053 @samp{mmo} format used by the @command{mmix} simulator.
24054
24055 @item -mbranch-predict
24056 @itemx -mno-branch-predict
24057 @opindex mbranch-predict
24058 @opindex mno-branch-predict
24059 Use (do not use) the probable-branch instructions, when static branch
24060 prediction indicates a probable branch.
24061
24062 @item -mbase-addresses
24063 @itemx -mno-base-addresses
24064 @opindex mbase-addresses
24065 @opindex mno-base-addresses
24066 Generate (do not generate) code that uses @emph{base addresses}. Using a
24067 base address automatically generates a request (handled by the assembler
24068 and the linker) for a constant to be set up in a global register. The
24069 register is used for one or more base address requests within the range 0
24070 to 255 from the value held in the register. The generally leads to short
24071 and fast code, but the number of different data items that can be
24072 addressed is limited. This means that a program that uses lots of static
24073 data may require @option{-mno-base-addresses}.
24074
24075 @item -msingle-exit
24076 @itemx -mno-single-exit
24077 @opindex msingle-exit
24078 @opindex mno-single-exit
24079 Force (do not force) generated code to have a single exit point in each
24080 function.
24081 @end table
24082
24083 @node MN10300 Options
24084 @subsection MN10300 Options
24085 @cindex MN10300 options
24086
24087 These @option{-m} options are defined for Matsushita MN10300 architectures:
24088
24089 @table @gcctabopt
24090 @item -mmult-bug
24091 @opindex mmult-bug
24092 Generate code to avoid bugs in the multiply instructions for the MN10300
24093 processors. This is the default.
24094
24095 @item -mno-mult-bug
24096 @opindex mno-mult-bug
24097 Do not generate code to avoid bugs in the multiply instructions for the
24098 MN10300 processors.
24099
24100 @item -mam33
24101 @opindex mam33
24102 Generate code using features specific to the AM33 processor.
24103
24104 @item -mno-am33
24105 @opindex mno-am33
24106 Do not generate code using features specific to the AM33 processor. This
24107 is the default.
24108
24109 @item -mam33-2
24110 @opindex mam33-2
24111 Generate code using features specific to the AM33/2.0 processor.
24112
24113 @item -mam34
24114 @opindex mam34
24115 Generate code using features specific to the AM34 processor.
24116
24117 @item -mtune=@var{cpu-type}
24118 @opindex mtune
24119 Use the timing characteristics of the indicated CPU type when
24120 scheduling instructions. This does not change the targeted processor
24121 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
24122 @samp{am33-2} or @samp{am34}.
24123
24124 @item -mreturn-pointer-on-d0
24125 @opindex mreturn-pointer-on-d0
24126 When generating a function that returns a pointer, return the pointer
24127 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
24128 only in @code{a0}, and attempts to call such functions without a prototype
24129 result in errors. Note that this option is on by default; use
24130 @option{-mno-return-pointer-on-d0} to disable it.
24131
24132 @item -mno-crt0
24133 @opindex mno-crt0
24134 Do not link in the C run-time initialization object file.
24135
24136 @item -mrelax
24137 @opindex mrelax
24138 Indicate to the linker that it should perform a relaxation optimization pass
24139 to shorten branches, calls and absolute memory addresses. This option only
24140 has an effect when used on the command line for the final link step.
24141
24142 This option makes symbolic debugging impossible.
24143
24144 @item -mliw
24145 @opindex mliw
24146 Allow the compiler to generate @emph{Long Instruction Word}
24147 instructions if the target is the @samp{AM33} or later. This is the
24148 default. This option defines the preprocessor macro @code{__LIW__}.
24149
24150 @item -mno-liw
24151 @opindex mno-liw
24152 Do not allow the compiler to generate @emph{Long Instruction Word}
24153 instructions. This option defines the preprocessor macro
24154 @code{__NO_LIW__}.
24155
24156 @item -msetlb
24157 @opindex msetlb
24158 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
24159 instructions if the target is the @samp{AM33} or later. This is the
24160 default. This option defines the preprocessor macro @code{__SETLB__}.
24161
24162 @item -mno-setlb
24163 @opindex mno-setlb
24164 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
24165 instructions. This option defines the preprocessor macro
24166 @code{__NO_SETLB__}.
24167
24168 @end table
24169
24170 @node Moxie Options
24171 @subsection Moxie Options
24172 @cindex Moxie Options
24173
24174 @table @gcctabopt
24175
24176 @item -meb
24177 @opindex meb
24178 Generate big-endian code. This is the default for @samp{moxie-*-*}
24179 configurations.
24180
24181 @item -mel
24182 @opindex mel
24183 Generate little-endian code.
24184
24185 @item -mmul.x
24186 @opindex mmul.x
24187 Generate mul.x and umul.x instructions. This is the default for
24188 @samp{moxiebox-*-*} configurations.
24189
24190 @item -mno-crt0
24191 @opindex mno-crt0
24192 Do not link in the C run-time initialization object file.
24193
24194 @end table
24195
24196 @node MSP430 Options
24197 @subsection MSP430 Options
24198 @cindex MSP430 Options
24199
24200 These options are defined for the MSP430:
24201
24202 @table @gcctabopt
24203
24204 @item -masm-hex
24205 @opindex masm-hex
24206 Force assembly output to always use hex constants. Normally such
24207 constants are signed decimals, but this option is available for
24208 testsuite and/or aesthetic purposes.
24209
24210 @item -mmcu=
24211 @opindex mmcu=
24212 Select the MCU to target. This is used to create a C preprocessor
24213 symbol based upon the MCU name, converted to upper case and pre- and
24214 post-fixed with @samp{__}. This in turn is used by the
24215 @file{msp430.h} header file to select an MCU-specific supplementary
24216 header file.
24217
24218 The option also sets the ISA to use. If the MCU name is one that is
24219 known to only support the 430 ISA then that is selected, otherwise the
24220 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
24221 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
24222 name selects the 430X ISA.
24223
24224 In addition an MCU-specific linker script is added to the linker
24225 command line. The script's name is the name of the MCU with
24226 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
24227 command line defines the C preprocessor symbol @code{__XXX__} and
24228 cause the linker to search for a script called @file{xxx.ld}.
24229
24230 The ISA and hardware multiply supported for the different MCUs is hard-coded
24231 into GCC. However, an external @samp{devices.csv} file can be used to
24232 extend device support beyond those that have been hard-coded.
24233
24234 GCC searches for the @samp{devices.csv} file using the following methods in the
24235 given precedence order, where the first method takes precendence over the
24236 second which takes precedence over the third.
24237
24238 @table @asis
24239 @item Include path specified with @code{-I} and @code{-L}
24240 @samp{devices.csv} will be searched for in each of the directories specified by
24241 include paths and linker library search paths.
24242 @item Path specified by the environment variable @samp{MSP430_GCC_INCLUDE_DIR}
24243 Define the value of the global environment variable
24244 @samp{MSP430_GCC_INCLUDE_DIR}
24245 to the full path to the directory containing devices.csv, and GCC will search
24246 this directory for devices.csv. If devices.csv is found, this directory will
24247 also be registered as an include path, and linker library path. Header files
24248 and linker scripts in this directory can therefore be used without manually
24249 specifying @code{-I} and @code{-L} on the command line.
24250 @item The @samp{msp430-elf@{,bare@}/include/devices} directory
24251 Finally, GCC will examine @samp{msp430-elf@{,bare@}/include/devices} from the
24252 toolchain root directory. This directory does not exist in a default
24253 installation, but if the user has created it and copied @samp{devices.csv}
24254 there, then the MCU data will be read. As above, this directory will
24255 also be registered as an include path, and linker library path.
24256
24257 @end table
24258 If none of the above search methods find @samp{devices.csv}, then the
24259 hard-coded MCU data is used.
24260
24261
24262 @item -mwarn-mcu
24263 @itemx -mno-warn-mcu
24264 @opindex mwarn-mcu
24265 @opindex mno-warn-mcu
24266 This option enables or disables warnings about conflicts between the
24267 MCU name specified by the @option{-mmcu} option and the ISA set by the
24268 @option{-mcpu} option and/or the hardware multiply support set by the
24269 @option{-mhwmult} option. It also toggles warnings about unrecognized
24270 MCU names. This option is on by default.
24271
24272 @item -mcpu=
24273 @opindex mcpu=
24274 Specifies the ISA to use. Accepted values are @samp{msp430},
24275 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
24276 @option{-mmcu=} option should be used to select the ISA.
24277
24278 @item -msim
24279 @opindex msim
24280 Link to the simulator runtime libraries and linker script. Overrides
24281 any scripts that would be selected by the @option{-mmcu=} option.
24282
24283 @item -mlarge
24284 @opindex mlarge
24285 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
24286
24287 @item -msmall
24288 @opindex msmall
24289 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
24290
24291 @item -mrelax
24292 @opindex mrelax
24293 This option is passed to the assembler and linker, and allows the
24294 linker to perform certain optimizations that cannot be done until
24295 the final link.
24296
24297 @item mhwmult=
24298 @opindex mhwmult=
24299 Describes the type of hardware multiply supported by the target.
24300 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
24301 for the original 16-bit-only multiply supported by early MCUs.
24302 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
24303 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
24304 A value of @samp{auto} can also be given. This tells GCC to deduce
24305 the hardware multiply support based upon the MCU name provided by the
24306 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
24307 the MCU name is not recognized then no hardware multiply support is
24308 assumed. @code{auto} is the default setting.
24309
24310 Hardware multiplies are normally performed by calling a library
24311 routine. This saves space in the generated code. When compiling at
24312 @option{-O3} or higher however the hardware multiplier is invoked
24313 inline. This makes for bigger, but faster code.
24314
24315 The hardware multiply routines disable interrupts whilst running and
24316 restore the previous interrupt state when they finish. This makes
24317 them safe to use inside interrupt handlers as well as in normal code.
24318
24319 @item -minrt
24320 @opindex minrt
24321 Enable the use of a minimum runtime environment - no static
24322 initializers or constructors. This is intended for memory-constrained
24323 devices. The compiler includes special symbols in some objects
24324 that tell the linker and runtime which code fragments are required.
24325
24326 @item -mtiny-printf
24327 @opindex mtiny-printf
24328 Enable reduced code size @code{printf} and @code{puts} library functions.
24329 The @samp{tiny} implementations of these functions are not reentrant, so
24330 must be used with caution in multi-threaded applications.
24331
24332 Support for streams has been removed and the string to be printed will
24333 always be sent to stdout via the @code{write} syscall. The string is not
24334 buffered before it is sent to write.
24335
24336 This option requires Newlib Nano IO, so GCC must be configured with
24337 @samp{--enable-newlib-nano-formatted-io}.
24338
24339 @item -mcode-region=
24340 @itemx -mdata-region=
24341 @opindex mcode-region
24342 @opindex mdata-region
24343 These options tell the compiler where to place functions and data that
24344 do not have one of the @code{lower}, @code{upper}, @code{either} or
24345 @code{section} attributes. Possible values are @code{lower},
24346 @code{upper}, @code{either} or @code{any}. The first three behave
24347 like the corresponding attribute. The fourth possible value -
24348 @code{any} - is the default. It leaves placement entirely up to the
24349 linker script and how it assigns the standard sections
24350 (@code{.text}, @code{.data}, etc) to the memory regions.
24351
24352 @item -msilicon-errata=
24353 @opindex msilicon-errata
24354 This option passes on a request to assembler to enable the fixes for
24355 the named silicon errata.
24356
24357 @item -msilicon-errata-warn=
24358 @opindex msilicon-errata-warn
24359 This option passes on a request to the assembler to enable warning
24360 messages when a silicon errata might need to be applied.
24361
24362 @item -mwarn-devices-csv
24363 @itemx -mno-warn-devices-csv
24364 @opindex mwarn-devices-csv
24365 @opindex mno-warn-devices-csv
24366 Warn if @samp{devices.csv} is not found or there are problem parsing it
24367 (default: on).
24368
24369 @end table
24370
24371 @node NDS32 Options
24372 @subsection NDS32 Options
24373 @cindex NDS32 Options
24374
24375 These options are defined for NDS32 implementations:
24376
24377 @table @gcctabopt
24378
24379 @item -mbig-endian
24380 @opindex mbig-endian
24381 Generate code in big-endian mode.
24382
24383 @item -mlittle-endian
24384 @opindex mlittle-endian
24385 Generate code in little-endian mode.
24386
24387 @item -mreduced-regs
24388 @opindex mreduced-regs
24389 Use reduced-set registers for register allocation.
24390
24391 @item -mfull-regs
24392 @opindex mfull-regs
24393 Use full-set registers for register allocation.
24394
24395 @item -mcmov
24396 @opindex mcmov
24397 Generate conditional move instructions.
24398
24399 @item -mno-cmov
24400 @opindex mno-cmov
24401 Do not generate conditional move instructions.
24402
24403 @item -mext-perf
24404 @opindex mext-perf
24405 Generate performance extension instructions.
24406
24407 @item -mno-ext-perf
24408 @opindex mno-ext-perf
24409 Do not generate performance extension instructions.
24410
24411 @item -mext-perf2
24412 @opindex mext-perf2
24413 Generate performance extension 2 instructions.
24414
24415 @item -mno-ext-perf2
24416 @opindex mno-ext-perf2
24417 Do not generate performance extension 2 instructions.
24418
24419 @item -mext-string
24420 @opindex mext-string
24421 Generate string extension instructions.
24422
24423 @item -mno-ext-string
24424 @opindex mno-ext-string
24425 Do not generate string extension instructions.
24426
24427 @item -mv3push
24428 @opindex mv3push
24429 Generate v3 push25/pop25 instructions.
24430
24431 @item -mno-v3push
24432 @opindex mno-v3push
24433 Do not generate v3 push25/pop25 instructions.
24434
24435 @item -m16-bit
24436 @opindex m16-bit
24437 Generate 16-bit instructions.
24438
24439 @item -mno-16-bit
24440 @opindex mno-16-bit
24441 Do not generate 16-bit instructions.
24442
24443 @item -misr-vector-size=@var{num}
24444 @opindex misr-vector-size
24445 Specify the size of each interrupt vector, which must be 4 or 16.
24446
24447 @item -mcache-block-size=@var{num}
24448 @opindex mcache-block-size
24449 Specify the size of each cache block,
24450 which must be a power of 2 between 4 and 512.
24451
24452 @item -march=@var{arch}
24453 @opindex march
24454 Specify the name of the target architecture.
24455
24456 @item -mcmodel=@var{code-model}
24457 @opindex mcmodel
24458 Set the code model to one of
24459 @table @asis
24460 @item @samp{small}
24461 All the data and read-only data segments must be within 512KB addressing space.
24462 The text segment must be within 16MB addressing space.
24463 @item @samp{medium}
24464 The data segment must be within 512KB while the read-only data segment can be
24465 within 4GB addressing space. The text segment should be still within 16MB
24466 addressing space.
24467 @item @samp{large}
24468 All the text and data segments can be within 4GB addressing space.
24469 @end table
24470
24471 @item -mctor-dtor
24472 @opindex mctor-dtor
24473 Enable constructor/destructor feature.
24474
24475 @item -mrelax
24476 @opindex mrelax
24477 Guide linker to relax instructions.
24478
24479 @end table
24480
24481 @node Nios II Options
24482 @subsection Nios II Options
24483 @cindex Nios II options
24484 @cindex Altera Nios II options
24485
24486 These are the options defined for the Altera Nios II processor.
24487
24488 @table @gcctabopt
24489
24490 @item -G @var{num}
24491 @opindex G
24492 @cindex smaller data references
24493 Put global and static objects less than or equal to @var{num} bytes
24494 into the small data or BSS sections instead of the normal data or BSS
24495 sections. The default value of @var{num} is 8.
24496
24497 @item -mgpopt=@var{option}
24498 @itemx -mgpopt
24499 @itemx -mno-gpopt
24500 @opindex mgpopt
24501 @opindex mno-gpopt
24502 Generate (do not generate) GP-relative accesses. The following
24503 @var{option} names are recognized:
24504
24505 @table @samp
24506
24507 @item none
24508 Do not generate GP-relative accesses.
24509
24510 @item local
24511 Generate GP-relative accesses for small data objects that are not
24512 external, weak, or uninitialized common symbols.
24513 Also use GP-relative addressing for objects that
24514 have been explicitly placed in a small data section via a @code{section}
24515 attribute.
24516
24517 @item global
24518 As for @samp{local}, but also generate GP-relative accesses for
24519 small data objects that are external, weak, or common. If you use this option,
24520 you must ensure that all parts of your program (including libraries) are
24521 compiled with the same @option{-G} setting.
24522
24523 @item data
24524 Generate GP-relative accesses for all data objects in the program. If you
24525 use this option, the entire data and BSS segments
24526 of your program must fit in 64K of memory and you must use an appropriate
24527 linker script to allocate them within the addressable range of the
24528 global pointer.
24529
24530 @item all
24531 Generate GP-relative addresses for function pointers as well as data
24532 pointers. If you use this option, the entire text, data, and BSS segments
24533 of your program must fit in 64K of memory and you must use an appropriate
24534 linker script to allocate them within the addressable range of the
24535 global pointer.
24536
24537 @end table
24538
24539 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
24540 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
24541
24542 The default is @option{-mgpopt} except when @option{-fpic} or
24543 @option{-fPIC} is specified to generate position-independent code.
24544 Note that the Nios II ABI does not permit GP-relative accesses from
24545 shared libraries.
24546
24547 You may need to specify @option{-mno-gpopt} explicitly when building
24548 programs that include large amounts of small data, including large
24549 GOT data sections. In this case, the 16-bit offset for GP-relative
24550 addressing may not be large enough to allow access to the entire
24551 small data section.
24552
24553 @item -mgprel-sec=@var{regexp}
24554 @opindex mgprel-sec
24555 This option specifies additional section names that can be accessed via
24556 GP-relative addressing. It is most useful in conjunction with
24557 @code{section} attributes on variable declarations
24558 (@pxref{Common Variable Attributes}) and a custom linker script.
24559 The @var{regexp} is a POSIX Extended Regular Expression.
24560
24561 This option does not affect the behavior of the @option{-G} option, and
24562 the specified sections are in addition to the standard @code{.sdata}
24563 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
24564
24565 @item -mr0rel-sec=@var{regexp}
24566 @opindex mr0rel-sec
24567 This option specifies names of sections that can be accessed via a
24568 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
24569 of the 32-bit address space. It is most useful in conjunction with
24570 @code{section} attributes on variable declarations
24571 (@pxref{Common Variable Attributes}) and a custom linker script.
24572 The @var{regexp} is a POSIX Extended Regular Expression.
24573
24574 In contrast to the use of GP-relative addressing for small data,
24575 zero-based addressing is never generated by default and there are no
24576 conventional section names used in standard linker scripts for sections
24577 in the low or high areas of memory.
24578
24579 @item -mel
24580 @itemx -meb
24581 @opindex mel
24582 @opindex meb
24583 Generate little-endian (default) or big-endian (experimental) code,
24584 respectively.
24585
24586 @item -march=@var{arch}
24587 @opindex march
24588 This specifies the name of the target Nios II architecture. GCC uses this
24589 name to determine what kind of instructions it can emit when generating
24590 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
24591
24592 The preprocessor macro @code{__nios2_arch__} is available to programs,
24593 with value 1 or 2, indicating the targeted ISA level.
24594
24595 @item -mbypass-cache
24596 @itemx -mno-bypass-cache
24597 @opindex mno-bypass-cache
24598 @opindex mbypass-cache
24599 Force all load and store instructions to always bypass cache by
24600 using I/O variants of the instructions. The default is not to
24601 bypass the cache.
24602
24603 @item -mno-cache-volatile
24604 @itemx -mcache-volatile
24605 @opindex mcache-volatile
24606 @opindex mno-cache-volatile
24607 Volatile memory access bypass the cache using the I/O variants of
24608 the load and store instructions. The default is not to bypass the cache.
24609
24610 @item -mno-fast-sw-div
24611 @itemx -mfast-sw-div
24612 @opindex mno-fast-sw-div
24613 @opindex mfast-sw-div
24614 Do not use table-based fast divide for small numbers. The default
24615 is to use the fast divide at @option{-O3} and above.
24616
24617 @item -mno-hw-mul
24618 @itemx -mhw-mul
24619 @itemx -mno-hw-mulx
24620 @itemx -mhw-mulx
24621 @itemx -mno-hw-div
24622 @itemx -mhw-div
24623 @opindex mno-hw-mul
24624 @opindex mhw-mul
24625 @opindex mno-hw-mulx
24626 @opindex mhw-mulx
24627 @opindex mno-hw-div
24628 @opindex mhw-div
24629 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
24630 instructions by the compiler. The default is to emit @code{mul}
24631 and not emit @code{div} and @code{mulx}.
24632
24633 @item -mbmx
24634 @itemx -mno-bmx
24635 @itemx -mcdx
24636 @itemx -mno-cdx
24637 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
24638 CDX (code density) instructions. Enabling these instructions also
24639 requires @option{-march=r2}. Since these instructions are optional
24640 extensions to the R2 architecture, the default is not to emit them.
24641
24642 @item -mcustom-@var{insn}=@var{N}
24643 @itemx -mno-custom-@var{insn}
24644 @opindex mcustom-@var{insn}
24645 @opindex mno-custom-@var{insn}
24646 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
24647 custom instruction with encoding @var{N} when generating code that uses
24648 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
24649 instruction 253 for single-precision floating-point add operations instead
24650 of the default behavior of using a library call.
24651
24652 The following values of @var{insn} are supported. Except as otherwise
24653 noted, floating-point operations are expected to be implemented with
24654 normal IEEE 754 semantics and correspond directly to the C operators or the
24655 equivalent GCC built-in functions (@pxref{Other Builtins}).
24656
24657 Single-precision floating point:
24658 @table @asis
24659
24660 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
24661 Binary arithmetic operations.
24662
24663 @item @samp{fnegs}
24664 Unary negation.
24665
24666 @item @samp{fabss}
24667 Unary absolute value.
24668
24669 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
24670 Comparison operations.
24671
24672 @item @samp{fmins}, @samp{fmaxs}
24673 Floating-point minimum and maximum. These instructions are only
24674 generated if @option{-ffinite-math-only} is specified.
24675
24676 @item @samp{fsqrts}
24677 Unary square root operation.
24678
24679 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
24680 Floating-point trigonometric and exponential functions. These instructions
24681 are only generated if @option{-funsafe-math-optimizations} is also specified.
24682
24683 @end table
24684
24685 Double-precision floating point:
24686 @table @asis
24687
24688 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
24689 Binary arithmetic operations.
24690
24691 @item @samp{fnegd}
24692 Unary negation.
24693
24694 @item @samp{fabsd}
24695 Unary absolute value.
24696
24697 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
24698 Comparison operations.
24699
24700 @item @samp{fmind}, @samp{fmaxd}
24701 Double-precision minimum and maximum. These instructions are only
24702 generated if @option{-ffinite-math-only} is specified.
24703
24704 @item @samp{fsqrtd}
24705 Unary square root operation.
24706
24707 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
24708 Double-precision trigonometric and exponential functions. These instructions
24709 are only generated if @option{-funsafe-math-optimizations} is also specified.
24710
24711 @end table
24712
24713 Conversions:
24714 @table @asis
24715 @item @samp{fextsd}
24716 Conversion from single precision to double precision.
24717
24718 @item @samp{ftruncds}
24719 Conversion from double precision to single precision.
24720
24721 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
24722 Conversion from floating point to signed or unsigned integer types, with
24723 truncation towards zero.
24724
24725 @item @samp{round}
24726 Conversion from single-precision floating point to signed integer,
24727 rounding to the nearest integer and ties away from zero.
24728 This corresponds to the @code{__builtin_lroundf} function when
24729 @option{-fno-math-errno} is used.
24730
24731 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
24732 Conversion from signed or unsigned integer types to floating-point types.
24733
24734 @end table
24735
24736 In addition, all of the following transfer instructions for internal
24737 registers X and Y must be provided to use any of the double-precision
24738 floating-point instructions. Custom instructions taking two
24739 double-precision source operands expect the first operand in the
24740 64-bit register X. The other operand (or only operand of a unary
24741 operation) is given to the custom arithmetic instruction with the
24742 least significant half in source register @var{src1} and the most
24743 significant half in @var{src2}. A custom instruction that returns a
24744 double-precision result returns the most significant 32 bits in the
24745 destination register and the other half in 32-bit register Y.
24746 GCC automatically generates the necessary code sequences to write
24747 register X and/or read register Y when double-precision floating-point
24748 instructions are used.
24749
24750 @table @asis
24751
24752 @item @samp{fwrx}
24753 Write @var{src1} into the least significant half of X and @var{src2} into
24754 the most significant half of X.
24755
24756 @item @samp{fwry}
24757 Write @var{src1} into Y.
24758
24759 @item @samp{frdxhi}, @samp{frdxlo}
24760 Read the most or least (respectively) significant half of X and store it in
24761 @var{dest}.
24762
24763 @item @samp{frdy}
24764 Read the value of Y and store it into @var{dest}.
24765 @end table
24766
24767 Note that you can gain more local control over generation of Nios II custom
24768 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
24769 and @code{target("no-custom-@var{insn}")} function attributes
24770 (@pxref{Function Attributes})
24771 or pragmas (@pxref{Function Specific Option Pragmas}).
24772
24773 @item -mcustom-fpu-cfg=@var{name}
24774 @opindex mcustom-fpu-cfg
24775
24776 This option enables a predefined, named set of custom instruction encodings
24777 (see @option{-mcustom-@var{insn}} above).
24778 Currently, the following sets are defined:
24779
24780 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
24781 @gccoptlist{-mcustom-fmuls=252 @gol
24782 -mcustom-fadds=253 @gol
24783 -mcustom-fsubs=254 @gol
24784 -fsingle-precision-constant}
24785
24786 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
24787 @gccoptlist{-mcustom-fmuls=252 @gol
24788 -mcustom-fadds=253 @gol
24789 -mcustom-fsubs=254 @gol
24790 -mcustom-fdivs=255 @gol
24791 -fsingle-precision-constant}
24792
24793 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
24794 @gccoptlist{-mcustom-floatus=243 @gol
24795 -mcustom-fixsi=244 @gol
24796 -mcustom-floatis=245 @gol
24797 -mcustom-fcmpgts=246 @gol
24798 -mcustom-fcmples=249 @gol
24799 -mcustom-fcmpeqs=250 @gol
24800 -mcustom-fcmpnes=251 @gol
24801 -mcustom-fmuls=252 @gol
24802 -mcustom-fadds=253 @gol
24803 -mcustom-fsubs=254 @gol
24804 -mcustom-fdivs=255 @gol
24805 -fsingle-precision-constant}
24806
24807 Custom instruction assignments given by individual
24808 @option{-mcustom-@var{insn}=} options override those given by
24809 @option{-mcustom-fpu-cfg=}, regardless of the
24810 order of the options on the command line.
24811
24812 Note that you can gain more local control over selection of a FPU
24813 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
24814 function attribute (@pxref{Function Attributes})
24815 or pragma (@pxref{Function Specific Option Pragmas}).
24816
24817 @end table
24818
24819 These additional @samp{-m} options are available for the Altera Nios II
24820 ELF (bare-metal) target:
24821
24822 @table @gcctabopt
24823
24824 @item -mhal
24825 @opindex mhal
24826 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
24827 startup and termination code, and is typically used in conjunction with
24828 @option{-msys-crt0=} to specify the location of the alternate startup code
24829 provided by the HAL BSP.
24830
24831 @item -msmallc
24832 @opindex msmallc
24833 Link with a limited version of the C library, @option{-lsmallc}, rather than
24834 Newlib.
24835
24836 @item -msys-crt0=@var{startfile}
24837 @opindex msys-crt0
24838 @var{startfile} is the file name of the startfile (crt0) to use
24839 when linking. This option is only useful in conjunction with @option{-mhal}.
24840
24841 @item -msys-lib=@var{systemlib}
24842 @opindex msys-lib
24843 @var{systemlib} is the library name of the library that provides
24844 low-level system calls required by the C library,
24845 e.g.@: @code{read} and @code{write}.
24846 This option is typically used to link with a library provided by a HAL BSP.
24847
24848 @end table
24849
24850 @node Nvidia PTX Options
24851 @subsection Nvidia PTX Options
24852 @cindex Nvidia PTX options
24853 @cindex nvptx options
24854
24855 These options are defined for Nvidia PTX:
24856
24857 @table @gcctabopt
24858
24859 @item -m32
24860 @itemx -m64
24861 @opindex m32
24862 @opindex m64
24863 Generate code for 32-bit or 64-bit ABI.
24864
24865 @item -misa=@var{ISA-string}
24866 @opindex march
24867 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
24868 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
24869 @samp{sm_35}. The default ISA is sm_30.
24870
24871 @item -mmainkernel
24872 @opindex mmainkernel
24873 Link in code for a __main kernel. This is for stand-alone instead of
24874 offloading execution.
24875
24876 @item -moptimize
24877 @opindex moptimize
24878 Apply partitioned execution optimizations. This is the default when any
24879 level of optimization is selected.
24880
24881 @item -msoft-stack
24882 @opindex msoft-stack
24883 Generate code that does not use @code{.local} memory
24884 directly for stack storage. Instead, a per-warp stack pointer is
24885 maintained explicitly. This enables variable-length stack allocation (with
24886 variable-length arrays or @code{alloca}), and when global memory is used for
24887 underlying storage, makes it possible to access automatic variables from other
24888 threads, or with atomic instructions. This code generation variant is used
24889 for OpenMP offloading, but the option is exposed on its own for the purpose
24890 of testing the compiler; to generate code suitable for linking into programs
24891 using OpenMP offloading, use option @option{-mgomp}.
24892
24893 @item -muniform-simt
24894 @opindex muniform-simt
24895 Switch to code generation variant that allows to execute all threads in each
24896 warp, while maintaining memory state and side effects as if only one thread
24897 in each warp was active outside of OpenMP SIMD regions. All atomic operations
24898 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
24899 current lane index equals the master lane index), and the register being
24900 assigned is copied via a shuffle instruction from the master lane. Outside of
24901 SIMD regions lane 0 is the master; inside, each thread sees itself as the
24902 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
24903 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
24904 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
24905 with current lane index to compute the master lane index.
24906
24907 @item -mgomp
24908 @opindex mgomp
24909 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
24910 @option{-muniform-simt} options, and selects corresponding multilib variant.
24911
24912 @end table
24913
24914 @node OpenRISC Options
24915 @subsection OpenRISC Options
24916 @cindex OpenRISC Options
24917
24918 These options are defined for OpenRISC:
24919
24920 @table @gcctabopt
24921
24922 @item -mboard=@var{name}
24923 @opindex mboard
24924 Configure a board specific runtime. This will be passed to the linker for
24925 newlib board library linking. The default is @code{or1ksim}.
24926
24927 @item -mnewlib
24928 @opindex mnewlib
24929 This option is ignored; it is for compatibility purposes only. This used to
24930 select linker and preprocessor options for use with newlib.
24931
24932 @item -msoft-div
24933 @itemx -mhard-div
24934 @opindex msoft-div
24935 @opindex mhard-div
24936 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
24937 This default is hardware divide.
24938
24939 @item -msoft-mul
24940 @itemx -mhard-mul
24941 @opindex msoft-mul
24942 @opindex mhard-mul
24943 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
24944 This default is hardware multiply.
24945
24946 @item -msoft-float
24947 @itemx -mhard-float
24948 @opindex msoft-float
24949 @opindex mhard-float
24950 Select software or hardware for floating point operations.
24951 The default is software.
24952
24953 @item -mdouble-float
24954 @opindex mdouble-float
24955 When @option{-mhard-float} is selected, enables generation of double-precision
24956 floating point instructions. By default functions from @file{libgcc} are used
24957 to perform double-precision floating point operations.
24958
24959 @item -munordered-float
24960 @opindex munordered-float
24961 When @option{-mhard-float} is selected, enables generation of unordered
24962 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
24963 functions from @file{libgcc} are used to perform unordered floating point
24964 compare and set flag operations.
24965
24966 @item -mcmov
24967 @opindex mcmov
24968 Enable generation of conditional move (@code{l.cmov}) instructions. By
24969 default the equivalent will be generated using set and branch.
24970
24971 @item -mror
24972 @opindex mror
24973 Enable generation of rotate right (@code{l.ror}) instructions. By default
24974 functions from @file{libgcc} are used to perform rotate right operations.
24975
24976 @item -mrori
24977 @opindex mrori
24978 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
24979 By default functions from @file{libgcc} are used to perform rotate right with
24980 immediate operations.
24981
24982 @item -msext
24983 @opindex msext
24984 Enable generation of sign extension (@code{l.ext*}) instructions. By default
24985 memory loads are used to perform sign extension.
24986
24987 @item -msfimm
24988 @opindex msfimm
24989 Enable generation of compare and set flag with immediate (@code{l.sf*i})
24990 instructions. By default extra instructions will be generated to store the
24991 immediate to a register first.
24992
24993 @item -mshftimm
24994 @opindex mshftimm
24995 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
24996 @code{l.slli}) instructions. By default extra instructions will be generated
24997 to store the immediate to a register first.
24998
24999
25000 @end table
25001
25002 @node PDP-11 Options
25003 @subsection PDP-11 Options
25004 @cindex PDP-11 Options
25005
25006 These options are defined for the PDP-11:
25007
25008 @table @gcctabopt
25009 @item -mfpu
25010 @opindex mfpu
25011 Use hardware FPP floating point. This is the default. (FIS floating
25012 point on the PDP-11/40 is not supported.) Implies -m45.
25013
25014 @item -msoft-float
25015 @opindex msoft-float
25016 Do not use hardware floating point.
25017
25018 @item -mac0
25019 @opindex mac0
25020 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
25021
25022 @item -mno-ac0
25023 @opindex mno-ac0
25024 Return floating-point results in memory. This is the default.
25025
25026 @item -m40
25027 @opindex m40
25028 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
25029
25030 @item -m45
25031 @opindex m45
25032 Generate code for a PDP-11/45. This is the default.
25033
25034 @item -m10
25035 @opindex m10
25036 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
25037
25038 @item -mint16
25039 @itemx -mno-int32
25040 @opindex mint16
25041 @opindex mno-int32
25042 Use 16-bit @code{int}. This is the default.
25043
25044 @item -mint32
25045 @itemx -mno-int16
25046 @opindex mint32
25047 @opindex mno-int16
25048 Use 32-bit @code{int}.
25049
25050 @item -msplit
25051 @opindex msplit
25052 Target has split instruction and data space. Implies -m45.
25053
25054 @item -munix-asm
25055 @opindex munix-asm
25056 Use Unix assembler syntax.
25057
25058 @item -mdec-asm
25059 @opindex mdec-asm
25060 Use DEC assembler syntax.
25061
25062 @item -mgnu-asm
25063 @opindex mgnu-asm
25064 Use GNU assembler syntax. This is the default.
25065
25066 @item -mlra
25067 @opindex mlra
25068 Use the new LRA register allocator. By default, the old ``reload''
25069 allocator is used.
25070 @end table
25071
25072 @node picoChip Options
25073 @subsection picoChip Options
25074 @cindex picoChip options
25075
25076 These @samp{-m} options are defined for picoChip implementations:
25077
25078 @table @gcctabopt
25079
25080 @item -mae=@var{ae_type}
25081 @opindex mcpu
25082 Set the instruction set, register set, and instruction scheduling
25083 parameters for array element type @var{ae_type}. Supported values
25084 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
25085
25086 @option{-mae=ANY} selects a completely generic AE type. Code
25087 generated with this option runs on any of the other AE types. The
25088 code is not as efficient as it would be if compiled for a specific
25089 AE type, and some types of operation (e.g., multiplication) do not
25090 work properly on all types of AE.
25091
25092 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
25093 for compiled code, and is the default.
25094
25095 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
25096 option may suffer from poor performance of byte (char) manipulation,
25097 since the DSP AE does not provide hardware support for byte load/stores.
25098
25099 @item -msymbol-as-address
25100 Enable the compiler to directly use a symbol name as an address in a
25101 load/store instruction, without first loading it into a
25102 register. Typically, the use of this option generates larger
25103 programs, which run faster than when the option isn't used. However, the
25104 results vary from program to program, so it is left as a user option,
25105 rather than being permanently enabled.
25106
25107 @item -mno-inefficient-warnings
25108 Disables warnings about the generation of inefficient code. These
25109 warnings can be generated, for example, when compiling code that
25110 performs byte-level memory operations on the MAC AE type. The MAC AE has
25111 no hardware support for byte-level memory operations, so all byte
25112 load/stores must be synthesized from word load/store operations. This is
25113 inefficient and a warning is generated to indicate
25114 that you should rewrite the code to avoid byte operations, or to target
25115 an AE type that has the necessary hardware support. This option disables
25116 these warnings.
25117
25118 @end table
25119
25120 @node PowerPC Options
25121 @subsection PowerPC Options
25122 @cindex PowerPC options
25123
25124 These are listed under @xref{RS/6000 and PowerPC Options}.
25125
25126 @node PRU Options
25127 @subsection PRU Options
25128 @cindex PRU Options
25129
25130 These command-line options are defined for PRU target:
25131
25132 @table @gcctabopt
25133 @item -minrt
25134 @opindex minrt
25135 Link with a minimum runtime environment, with no support for static
25136 initializers and constructors. Using this option can significantly reduce
25137 the size of the final ELF binary. Beware that the compiler could still
25138 generate code with static initializers and constructors. It is up to the
25139 programmer to ensure that the source program will not use those features.
25140
25141 @item -mmcu=@var{mcu}
25142 @opindex mmcu
25143 Specify the PRU MCU variant to use. Check Newlib for the exact list of
25144 supported MCUs.
25145
25146 @item -mno-relax
25147 @opindex mno-relax
25148 Make GCC pass the @option{--no-relax} command-line option to the linker
25149 instead of the @option{--relax} option.
25150
25151 @item -mloop
25152 @opindex mloop
25153 Allow (or do not allow) GCC to use the LOOP instruction.
25154
25155 @item -mabi=@var{variant}
25156 @opindex mabi
25157 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
25158 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
25159 more naturally with certain GCC assumptions. These are the differences:
25160
25161 @table @samp
25162 @item Function Pointer Size
25163 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
25164 supports only 32-bit data and code pointers.
25165
25166 @item Optional Return Value Pointer
25167 Function return values larger than 64 bits are passed by using a hidden
25168 pointer as the first argument of the function. TI ABI, though, mandates that
25169 the pointer can be NULL in case the caller is not using the returned value.
25170 GNU always passes and expects a valid return value pointer.
25171
25172 @end table
25173
25174 The current @option{-mabi=ti} implementation simply raises a compile error
25175 when any of the above code constructs is detected. As a consequence
25176 the standard C library cannot be built and it is omitted when linking with
25177 @option{-mabi=ti}.
25178
25179 Relaxation is a GNU feature and for safety reasons is disabled when using
25180 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
25181 instructions, so the GNU linker cannot adjust them when shortening adjacent
25182 LDI32 pseudo instructions.
25183
25184 @end table
25185
25186 @node RISC-V Options
25187 @subsection RISC-V Options
25188 @cindex RISC-V Options
25189
25190 These command-line options are defined for RISC-V targets:
25191
25192 @table @gcctabopt
25193 @item -mbranch-cost=@var{n}
25194 @opindex mbranch-cost
25195 Set the cost of branches to roughly @var{n} instructions.
25196
25197 @item -mplt
25198 @itemx -mno-plt
25199 @opindex plt
25200 When generating PIC code, do or don't allow the use of PLTs. Ignored for
25201 non-PIC. The default is @option{-mplt}.
25202
25203 @item -mabi=@var{ABI-string}
25204 @opindex mabi
25205 Specify integer and floating-point calling convention. @var{ABI-string}
25206 contains two parts: the size of integer types and the registers used for
25207 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
25208 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
25209 32-bit), and that floating-point values up to 64 bits wide are passed in F
25210 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
25211 allows the compiler to generate code that uses the F and D extensions but only
25212 allows floating-point values up to 32 bits long to be passed in registers; or
25213 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
25214 passed in registers.
25215
25216 The default for this argument is system dependent, users who want a specific
25217 calling convention should specify one explicitly. The valid calling
25218 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
25219 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
25220 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
25221 invalid because the ABI requires 64-bit values be passed in F registers, but F
25222 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
25223 only be used with the @samp{rv32e} architecture. This ABI is not well
25224 specified at present, and is subject to change.
25225
25226 @item -mfdiv
25227 @itemx -mno-fdiv
25228 @opindex mfdiv
25229 Do or don't use hardware floating-point divide and square root instructions.
25230 This requires the F or D extensions for floating-point registers. The default
25231 is to use them if the specified architecture has these instructions.
25232
25233 @item -mdiv
25234 @itemx -mno-div
25235 @opindex mdiv
25236 Do or don't use hardware instructions for integer division. This requires the
25237 M extension. The default is to use them if the specified architecture has
25238 these instructions.
25239
25240 @item -march=@var{ISA-string}
25241 @opindex march
25242 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
25243 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
25244 @samp{rv32imaf}.
25245
25246 @item -mtune=@var{processor-string}
25247 @opindex mtune
25248 Optimize the output for the given processor, specified by microarchitecture
25249 name. Permissible values for this option are: @samp{rocket},
25250 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
25251 and @samp{size}.
25252
25253 When @option{-mtune=} is not specified, the default is @samp{rocket}.
25254
25255 The @samp{size} choice is not intended for use by end-users. This is used
25256 when @option{-Os} is specified. It overrides the instruction cost info
25257 provided by @option{-mtune=}, but does not override the pipeline info. This
25258 helps reduce code size while still giving good performance.
25259
25260 @item -mpreferred-stack-boundary=@var{num}
25261 @opindex mpreferred-stack-boundary
25262 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
25263 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
25264 the default is 4 (16 bytes or 128-bits).
25265
25266 @strong{Warning:} If you use this switch, then you must build all modules with
25267 the same value, including any libraries. This includes the system libraries
25268 and startup modules.
25269
25270 @item -msmall-data-limit=@var{n}
25271 @opindex msmall-data-limit
25272 Put global and static data smaller than @var{n} bytes into a special section
25273 (on some targets).
25274
25275 @item -msave-restore
25276 @itemx -mno-save-restore
25277 @opindex msave-restore
25278 Do or don't use smaller but slower prologue and epilogue code that uses
25279 library function calls. The default is to use fast inline prologues and
25280 epilogues.
25281
25282 @item -mstrict-align
25283 @itemx -mno-strict-align
25284 @opindex mstrict-align
25285 Do not or do generate unaligned memory accesses. The default is set depending
25286 on whether the processor we are optimizing for supports fast unaligned access
25287 or not.
25288
25289 @item -mcmodel=medlow
25290 @opindex mcmodel=medlow
25291 Generate code for the medium-low code model. The program and its statically
25292 defined symbols must lie within a single 2 GiB address range and must lie
25293 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
25294 statically or dynamically linked. This is the default code model.
25295
25296 @item -mcmodel=medany
25297 @opindex mcmodel=medany
25298 Generate code for the medium-any code model. The program and its statically
25299 defined symbols must be within any single 2 GiB address range. Programs can be
25300 statically or dynamically linked.
25301
25302 @item -mexplicit-relocs
25303 @itemx -mno-exlicit-relocs
25304 Use or do not use assembler relocation operators when dealing with symbolic
25305 addresses. The alternative is to use assembler macros instead, which may
25306 limit optimization.
25307
25308 @item -mrelax
25309 @itemx -mno-relax
25310 Take advantage of linker relaxations to reduce the number of instructions
25311 required to materialize symbol addresses. The default is to take advantage of
25312 linker relaxations.
25313
25314 @item -memit-attribute
25315 @itemx -mno-emit-attribute
25316 Emit (do not emit) RISC-V attribute to record extra information into ELF
25317 objects. This feature requires at least binutils 2.32.
25318
25319 @item -malign-data=@var{type}
25320 @opindex malign-data
25321 Control how GCC aligns variables and constants of array, structure, or union
25322 types. Supported values for @var{type} are @samp{xlen} which uses x register
25323 width as the alignment value, and @samp{natural} which uses natural alignment.
25324 @samp{xlen} is the default.
25325 @end table
25326
25327 @node RL78 Options
25328 @subsection RL78 Options
25329 @cindex RL78 Options
25330
25331 @table @gcctabopt
25332
25333 @item -msim
25334 @opindex msim
25335 Links in additional target libraries to support operation within a
25336 simulator.
25337
25338 @item -mmul=none
25339 @itemx -mmul=g10
25340 @itemx -mmul=g13
25341 @itemx -mmul=g14
25342 @itemx -mmul=rl78
25343 @opindex mmul
25344 Specifies the type of hardware multiplication and division support to
25345 be used. The simplest is @code{none}, which uses software for both
25346 multiplication and division. This is the default. The @code{g13}
25347 value is for the hardware multiply/divide peripheral found on the
25348 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
25349 the multiplication and division instructions supported by the RL78/G14
25350 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
25351 the value @code{mg10} is an alias for @code{none}.
25352
25353 In addition a C preprocessor macro is defined, based upon the setting
25354 of this option. Possible values are: @code{__RL78_MUL_NONE__},
25355 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
25356
25357 @item -mcpu=g10
25358 @itemx -mcpu=g13
25359 @itemx -mcpu=g14
25360 @itemx -mcpu=rl78
25361 @opindex mcpu
25362 Specifies the RL78 core to target. The default is the G14 core, also
25363 known as an S3 core or just RL78. The G13 or S2 core does not have
25364 multiply or divide instructions, instead it uses a hardware peripheral
25365 for these operations. The G10 or S1 core does not have register
25366 banks, so it uses a different calling convention.
25367
25368 If this option is set it also selects the type of hardware multiply
25369 support to use, unless this is overridden by an explicit
25370 @option{-mmul=none} option on the command line. Thus specifying
25371 @option{-mcpu=g13} enables the use of the G13 hardware multiply
25372 peripheral and specifying @option{-mcpu=g10} disables the use of
25373 hardware multiplications altogether.
25374
25375 Note, although the RL78/G14 core is the default target, specifying
25376 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
25377 change the behavior of the toolchain since it also enables G14
25378 hardware multiply support. If these options are not specified on the
25379 command line then software multiplication routines will be used even
25380 though the code targets the RL78 core. This is for backwards
25381 compatibility with older toolchains which did not have hardware
25382 multiply and divide support.
25383
25384 In addition a C preprocessor macro is defined, based upon the setting
25385 of this option. Possible values are: @code{__RL78_G10__},
25386 @code{__RL78_G13__} or @code{__RL78_G14__}.
25387
25388 @item -mg10
25389 @itemx -mg13
25390 @itemx -mg14
25391 @itemx -mrl78
25392 @opindex mg10
25393 @opindex mg13
25394 @opindex mg14
25395 @opindex mrl78
25396 These are aliases for the corresponding @option{-mcpu=} option. They
25397 are provided for backwards compatibility.
25398
25399 @item -mallregs
25400 @opindex mallregs
25401 Allow the compiler to use all of the available registers. By default
25402 registers @code{r24..r31} are reserved for use in interrupt handlers.
25403 With this option enabled these registers can be used in ordinary
25404 functions as well.
25405
25406 @item -m64bit-doubles
25407 @itemx -m32bit-doubles
25408 @opindex m64bit-doubles
25409 @opindex m32bit-doubles
25410 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25411 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25412 @option{-m32bit-doubles}.
25413
25414 @item -msave-mduc-in-interrupts
25415 @itemx -mno-save-mduc-in-interrupts
25416 @opindex msave-mduc-in-interrupts
25417 @opindex mno-save-mduc-in-interrupts
25418 Specifies that interrupt handler functions should preserve the
25419 MDUC registers. This is only necessary if normal code might use
25420 the MDUC registers, for example because it performs multiplication
25421 and division operations. The default is to ignore the MDUC registers
25422 as this makes the interrupt handlers faster. The target option -mg13
25423 needs to be passed for this to work as this feature is only available
25424 on the G13 target (S2 core). The MDUC registers will only be saved
25425 if the interrupt handler performs a multiplication or division
25426 operation or it calls another function.
25427
25428 @end table
25429
25430 @node RS/6000 and PowerPC Options
25431 @subsection IBM RS/6000 and PowerPC Options
25432 @cindex RS/6000 and PowerPC Options
25433 @cindex IBM RS/6000 and PowerPC Options
25434
25435 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
25436 @table @gcctabopt
25437 @item -mpowerpc-gpopt
25438 @itemx -mno-powerpc-gpopt
25439 @itemx -mpowerpc-gfxopt
25440 @itemx -mno-powerpc-gfxopt
25441 @need 800
25442 @itemx -mpowerpc64
25443 @itemx -mno-powerpc64
25444 @itemx -mmfcrf
25445 @itemx -mno-mfcrf
25446 @itemx -mpopcntb
25447 @itemx -mno-popcntb
25448 @itemx -mpopcntd
25449 @itemx -mno-popcntd
25450 @itemx -mfprnd
25451 @itemx -mno-fprnd
25452 @need 800
25453 @itemx -mcmpb
25454 @itemx -mno-cmpb
25455 @itemx -mhard-dfp
25456 @itemx -mno-hard-dfp
25457 @opindex mpowerpc-gpopt
25458 @opindex mno-powerpc-gpopt
25459 @opindex mpowerpc-gfxopt
25460 @opindex mno-powerpc-gfxopt
25461 @opindex mpowerpc64
25462 @opindex mno-powerpc64
25463 @opindex mmfcrf
25464 @opindex mno-mfcrf
25465 @opindex mpopcntb
25466 @opindex mno-popcntb
25467 @opindex mpopcntd
25468 @opindex mno-popcntd
25469 @opindex mfprnd
25470 @opindex mno-fprnd
25471 @opindex mcmpb
25472 @opindex mno-cmpb
25473 @opindex mhard-dfp
25474 @opindex mno-hard-dfp
25475 You use these options to specify which instructions are available on the
25476 processor you are using. The default value of these options is
25477 determined when configuring GCC@. Specifying the
25478 @option{-mcpu=@var{cpu_type}} overrides the specification of these
25479 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
25480 rather than the options listed above.
25481
25482 Specifying @option{-mpowerpc-gpopt} allows
25483 GCC to use the optional PowerPC architecture instructions in the
25484 General Purpose group, including floating-point square root. Specifying
25485 @option{-mpowerpc-gfxopt} allows GCC to
25486 use the optional PowerPC architecture instructions in the Graphics
25487 group, including floating-point select.
25488
25489 The @option{-mmfcrf} option allows GCC to generate the move from
25490 condition register field instruction implemented on the POWER4
25491 processor and other processors that support the PowerPC V2.01
25492 architecture.
25493 The @option{-mpopcntb} option allows GCC to generate the popcount and
25494 double-precision FP reciprocal estimate instruction implemented on the
25495 POWER5 processor and other processors that support the PowerPC V2.02
25496 architecture.
25497 The @option{-mpopcntd} option allows GCC to generate the popcount
25498 instruction implemented on the POWER7 processor and other processors
25499 that support the PowerPC V2.06 architecture.
25500 The @option{-mfprnd} option allows GCC to generate the FP round to
25501 integer instructions implemented on the POWER5+ processor and other
25502 processors that support the PowerPC V2.03 architecture.
25503 The @option{-mcmpb} option allows GCC to generate the compare bytes
25504 instruction implemented on the POWER6 processor and other processors
25505 that support the PowerPC V2.05 architecture.
25506 The @option{-mhard-dfp} option allows GCC to generate the decimal
25507 floating-point instructions implemented on some POWER processors.
25508
25509 The @option{-mpowerpc64} option allows GCC to generate the additional
25510 64-bit instructions that are found in the full PowerPC64 architecture
25511 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
25512 @option{-mno-powerpc64}.
25513
25514 @item -mcpu=@var{cpu_type}
25515 @opindex mcpu
25516 Set architecture type, register usage, and
25517 instruction scheduling parameters for machine type @var{cpu_type}.
25518 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
25519 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
25520 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
25521 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
25522 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
25523 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
25524 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
25525 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
25526 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
25527 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
25528 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
25529 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
25530
25531 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
25532 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
25533 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
25534 architecture machine types, with an appropriate, generic processor
25535 model assumed for scheduling purposes.
25536
25537 Specifying @samp{native} as cpu type detects and selects the
25538 architecture option that corresponds to the host processor of the
25539 system performing the compilation.
25540 @option{-mcpu=native} has no effect if GCC does not recognize the
25541 processor.
25542
25543 The other options specify a specific processor. Code generated under
25544 those options runs best on that processor, and may not run at all on
25545 others.
25546
25547 The @option{-mcpu} options automatically enable or disable the
25548 following options:
25549
25550 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
25551 -mpopcntb -mpopcntd -mpowerpc64 @gol
25552 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
25553 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
25554 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
25555 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
25556
25557 The particular options set for any particular CPU varies between
25558 compiler versions, depending on what setting seems to produce optimal
25559 code for that CPU; it doesn't necessarily reflect the actual hardware's
25560 capabilities. If you wish to set an individual option to a particular
25561 value, you may specify it after the @option{-mcpu} option, like
25562 @option{-mcpu=970 -mno-altivec}.
25563
25564 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
25565 not enabled or disabled by the @option{-mcpu} option at present because
25566 AIX does not have full support for these options. You may still
25567 enable or disable them individually if you're sure it'll work in your
25568 environment.
25569
25570 @item -mtune=@var{cpu_type}
25571 @opindex mtune
25572 Set the instruction scheduling parameters for machine type
25573 @var{cpu_type}, but do not set the architecture type or register usage,
25574 as @option{-mcpu=@var{cpu_type}} does. The same
25575 values for @var{cpu_type} are used for @option{-mtune} as for
25576 @option{-mcpu}. If both are specified, the code generated uses the
25577 architecture and registers set by @option{-mcpu}, but the
25578 scheduling parameters set by @option{-mtune}.
25579
25580 @item -mcmodel=small
25581 @opindex mcmodel=small
25582 Generate PowerPC64 code for the small model: The TOC is limited to
25583 64k.
25584
25585 @item -mcmodel=medium
25586 @opindex mcmodel=medium
25587 Generate PowerPC64 code for the medium model: The TOC and other static
25588 data may be up to a total of 4G in size. This is the default for 64-bit
25589 Linux.
25590
25591 @item -mcmodel=large
25592 @opindex mcmodel=large
25593 Generate PowerPC64 code for the large model: The TOC may be up to 4G
25594 in size. Other data and code is only limited by the 64-bit address
25595 space.
25596
25597 @item -maltivec
25598 @itemx -mno-altivec
25599 @opindex maltivec
25600 @opindex mno-altivec
25601 Generate code that uses (does not use) AltiVec instructions, and also
25602 enable the use of built-in functions that allow more direct access to
25603 the AltiVec instruction set. You may also need to set
25604 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
25605 enhancements.
25606
25607 When @option{-maltivec} is used, the element order for AltiVec intrinsics
25608 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
25609 match array element order corresponding to the endianness of the
25610 target. That is, element zero identifies the leftmost element in a
25611 vector register when targeting a big-endian platform, and identifies
25612 the rightmost element in a vector register when targeting a
25613 little-endian platform.
25614
25615 @item -mvrsave
25616 @itemx -mno-vrsave
25617 @opindex mvrsave
25618 @opindex mno-vrsave
25619 Generate VRSAVE instructions when generating AltiVec code.
25620
25621 @item -msecure-plt
25622 @opindex msecure-plt
25623 Generate code that allows @command{ld} and @command{ld.so}
25624 to build executables and shared
25625 libraries with non-executable @code{.plt} and @code{.got} sections.
25626 This is a PowerPC
25627 32-bit SYSV ABI option.
25628
25629 @item -mbss-plt
25630 @opindex mbss-plt
25631 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
25632 fills in, and
25633 requires @code{.plt} and @code{.got}
25634 sections that are both writable and executable.
25635 This is a PowerPC 32-bit SYSV ABI option.
25636
25637 @item -misel
25638 @itemx -mno-isel
25639 @opindex misel
25640 @opindex mno-isel
25641 This switch enables or disables the generation of ISEL instructions.
25642
25643 @item -mvsx
25644 @itemx -mno-vsx
25645 @opindex mvsx
25646 @opindex mno-vsx
25647 Generate code that uses (does not use) vector/scalar (VSX)
25648 instructions, and also enable the use of built-in functions that allow
25649 more direct access to the VSX instruction set.
25650
25651 @item -mcrypto
25652 @itemx -mno-crypto
25653 @opindex mcrypto
25654 @opindex mno-crypto
25655 Enable the use (disable) of the built-in functions that allow direct
25656 access to the cryptographic instructions that were added in version
25657 2.07 of the PowerPC ISA.
25658
25659 @item -mhtm
25660 @itemx -mno-htm
25661 @opindex mhtm
25662 @opindex mno-htm
25663 Enable (disable) the use of the built-in functions that allow direct
25664 access to the Hardware Transactional Memory (HTM) instructions that
25665 were added in version 2.07 of the PowerPC ISA.
25666
25667 @item -mpower8-fusion
25668 @itemx -mno-power8-fusion
25669 @opindex mpower8-fusion
25670 @opindex mno-power8-fusion
25671 Generate code that keeps (does not keeps) some integer operations
25672 adjacent so that the instructions can be fused together on power8 and
25673 later processors.
25674
25675 @item -mpower8-vector
25676 @itemx -mno-power8-vector
25677 @opindex mpower8-vector
25678 @opindex mno-power8-vector
25679 Generate code that uses (does not use) the vector and scalar
25680 instructions that were added in version 2.07 of the PowerPC ISA. Also
25681 enable the use of built-in functions that allow more direct access to
25682 the vector instructions.
25683
25684 @item -mquad-memory
25685 @itemx -mno-quad-memory
25686 @opindex mquad-memory
25687 @opindex mno-quad-memory
25688 Generate code that uses (does not use) the non-atomic quad word memory
25689 instructions. The @option{-mquad-memory} option requires use of
25690 64-bit mode.
25691
25692 @item -mquad-memory-atomic
25693 @itemx -mno-quad-memory-atomic
25694 @opindex mquad-memory-atomic
25695 @opindex mno-quad-memory-atomic
25696 Generate code that uses (does not use) the atomic quad word memory
25697 instructions. The @option{-mquad-memory-atomic} option requires use of
25698 64-bit mode.
25699
25700 @item -mfloat128
25701 @itemx -mno-float128
25702 @opindex mfloat128
25703 @opindex mno-float128
25704 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
25705 and use either software emulation for IEEE 128-bit floating point or
25706 hardware instructions.
25707
25708 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
25709 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
25710 use the IEEE 128-bit floating point support. The IEEE 128-bit
25711 floating point support only works on PowerPC Linux systems.
25712
25713 The default for @option{-mfloat128} is enabled on PowerPC Linux
25714 systems using the VSX instruction set, and disabled on other systems.
25715
25716 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
25717 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
25718 point support will also enable the generation of ISA 3.0 IEEE 128-bit
25719 floating point instructions. Otherwise, if you do not specify to
25720 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
25721 system, IEEE 128-bit floating point will be done with software
25722 emulation.
25723
25724 @item -mfloat128-hardware
25725 @itemx -mno-float128-hardware
25726 @opindex mfloat128-hardware
25727 @opindex mno-float128-hardware
25728 Enable/disable using ISA 3.0 hardware instructions to support the
25729 @var{__float128} data type.
25730
25731 The default for @option{-mfloat128-hardware} is enabled on PowerPC
25732 Linux systems using the ISA 3.0 instruction set, and disabled on other
25733 systems.
25734
25735 @item -m32
25736 @itemx -m64
25737 @opindex m32
25738 @opindex m64
25739 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
25740 targets (including GNU/Linux). The 32-bit environment sets int, long
25741 and pointer to 32 bits and generates code that runs on any PowerPC
25742 variant. The 64-bit environment sets int to 32 bits and long and
25743 pointer to 64 bits, and generates code for PowerPC64, as for
25744 @option{-mpowerpc64}.
25745
25746 @item -mfull-toc
25747 @itemx -mno-fp-in-toc
25748 @itemx -mno-sum-in-toc
25749 @itemx -mminimal-toc
25750 @opindex mfull-toc
25751 @opindex mno-fp-in-toc
25752 @opindex mno-sum-in-toc
25753 @opindex mminimal-toc
25754 Modify generation of the TOC (Table Of Contents), which is created for
25755 every executable file. The @option{-mfull-toc} option is selected by
25756 default. In that case, GCC allocates at least one TOC entry for
25757 each unique non-automatic variable reference in your program. GCC
25758 also places floating-point constants in the TOC@. However, only
25759 16,384 entries are available in the TOC@.
25760
25761 If you receive a linker error message that saying you have overflowed
25762 the available TOC space, you can reduce the amount of TOC space used
25763 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
25764 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
25765 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
25766 generate code to calculate the sum of an address and a constant at
25767 run time instead of putting that sum into the TOC@. You may specify one
25768 or both of these options. Each causes GCC to produce very slightly
25769 slower and larger code at the expense of conserving TOC space.
25770
25771 If you still run out of space in the TOC even when you specify both of
25772 these options, specify @option{-mminimal-toc} instead. This option causes
25773 GCC to make only one TOC entry for every file. When you specify this
25774 option, GCC produces code that is slower and larger but which
25775 uses extremely little TOC space. You may wish to use this option
25776 only on files that contain less frequently-executed code.
25777
25778 @item -maix64
25779 @itemx -maix32
25780 @opindex maix64
25781 @opindex maix32
25782 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
25783 @code{long} type, and the infrastructure needed to support them.
25784 Specifying @option{-maix64} implies @option{-mpowerpc64},
25785 while @option{-maix32} disables the 64-bit ABI and
25786 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
25787
25788 @item -mxl-compat
25789 @itemx -mno-xl-compat
25790 @opindex mxl-compat
25791 @opindex mno-xl-compat
25792 Produce code that conforms more closely to IBM XL compiler semantics
25793 when using AIX-compatible ABI@. Pass floating-point arguments to
25794 prototyped functions beyond the register save area (RSA) on the stack
25795 in addition to argument FPRs. Do not assume that most significant
25796 double in 128-bit long double value is properly rounded when comparing
25797 values and converting to double. Use XL symbol names for long double
25798 support routines.
25799
25800 The AIX calling convention was extended but not initially documented to
25801 handle an obscure K&R C case of calling a function that takes the
25802 address of its arguments with fewer arguments than declared. IBM XL
25803 compilers access floating-point arguments that do not fit in the
25804 RSA from the stack when a subroutine is compiled without
25805 optimization. Because always storing floating-point arguments on the
25806 stack is inefficient and rarely needed, this option is not enabled by
25807 default and only is necessary when calling subroutines compiled by IBM
25808 XL compilers without optimization.
25809
25810 @item -mpe
25811 @opindex mpe
25812 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
25813 application written to use message passing with special startup code to
25814 enable the application to run. The system must have PE installed in the
25815 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
25816 must be overridden with the @option{-specs=} option to specify the
25817 appropriate directory location. The Parallel Environment does not
25818 support threads, so the @option{-mpe} option and the @option{-pthread}
25819 option are incompatible.
25820
25821 @item -malign-natural
25822 @itemx -malign-power
25823 @opindex malign-natural
25824 @opindex malign-power
25825 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
25826 @option{-malign-natural} overrides the ABI-defined alignment of larger
25827 types, such as floating-point doubles, on their natural size-based boundary.
25828 The option @option{-malign-power} instructs GCC to follow the ABI-specified
25829 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
25830
25831 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
25832 is not supported.
25833
25834 @item -msoft-float
25835 @itemx -mhard-float
25836 @opindex msoft-float
25837 @opindex mhard-float
25838 Generate code that does not use (uses) the floating-point register set.
25839 Software floating-point emulation is provided if you use the
25840 @option{-msoft-float} option, and pass the option to GCC when linking.
25841
25842 @item -mmultiple
25843 @itemx -mno-multiple
25844 @opindex mmultiple
25845 @opindex mno-multiple
25846 Generate code that uses (does not use) the load multiple word
25847 instructions and the store multiple word instructions. These
25848 instructions are generated by default on POWER systems, and not
25849 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
25850 PowerPC systems, since those instructions do not work when the
25851 processor is in little-endian mode. The exceptions are PPC740 and
25852 PPC750 which permit these instructions in little-endian mode.
25853
25854 @item -mupdate
25855 @itemx -mno-update
25856 @opindex mupdate
25857 @opindex mno-update
25858 Generate code that uses (does not use) the load or store instructions
25859 that update the base register to the address of the calculated memory
25860 location. These instructions are generated by default. If you use
25861 @option{-mno-update}, there is a small window between the time that the
25862 stack pointer is updated and the address of the previous frame is
25863 stored, which means code that walks the stack frame across interrupts or
25864 signals may get corrupted data.
25865
25866 @item -mavoid-indexed-addresses
25867 @itemx -mno-avoid-indexed-addresses
25868 @opindex mavoid-indexed-addresses
25869 @opindex mno-avoid-indexed-addresses
25870 Generate code that tries to avoid (not avoid) the use of indexed load
25871 or store instructions. These instructions can incur a performance
25872 penalty on Power6 processors in certain situations, such as when
25873 stepping through large arrays that cross a 16M boundary. This option
25874 is enabled by default when targeting Power6 and disabled otherwise.
25875
25876 @item -mfused-madd
25877 @itemx -mno-fused-madd
25878 @opindex mfused-madd
25879 @opindex mno-fused-madd
25880 Generate code that uses (does not use) the floating-point multiply and
25881 accumulate instructions. These instructions are generated by default
25882 if hardware floating point is used. The machine-dependent
25883 @option{-mfused-madd} option is now mapped to the machine-independent
25884 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
25885 mapped to @option{-ffp-contract=off}.
25886
25887 @item -mmulhw
25888 @itemx -mno-mulhw
25889 @opindex mmulhw
25890 @opindex mno-mulhw
25891 Generate code that uses (does not use) the half-word multiply and
25892 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
25893 These instructions are generated by default when targeting those
25894 processors.
25895
25896 @item -mdlmzb
25897 @itemx -mno-dlmzb
25898 @opindex mdlmzb
25899 @opindex mno-dlmzb
25900 Generate code that uses (does not use) the string-search @samp{dlmzb}
25901 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
25902 generated by default when targeting those processors.
25903
25904 @item -mno-bit-align
25905 @itemx -mbit-align
25906 @opindex mno-bit-align
25907 @opindex mbit-align
25908 On System V.4 and embedded PowerPC systems do not (do) force structures
25909 and unions that contain bit-fields to be aligned to the base type of the
25910 bit-field.
25911
25912 For example, by default a structure containing nothing but 8
25913 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
25914 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
25915 the structure is aligned to a 1-byte boundary and is 1 byte in
25916 size.
25917
25918 @item -mno-strict-align
25919 @itemx -mstrict-align
25920 @opindex mno-strict-align
25921 @opindex mstrict-align
25922 On System V.4 and embedded PowerPC systems do not (do) assume that
25923 unaligned memory references are handled by the system.
25924
25925 @item -mrelocatable
25926 @itemx -mno-relocatable
25927 @opindex mrelocatable
25928 @opindex mno-relocatable
25929 Generate code that allows (does not allow) a static executable to be
25930 relocated to a different address at run time. A simple embedded
25931 PowerPC system loader should relocate the entire contents of
25932 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
25933 a table of 32-bit addresses generated by this option. For this to
25934 work, all objects linked together must be compiled with
25935 @option{-mrelocatable} or @option{-mrelocatable-lib}.
25936 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
25937
25938 @item -mrelocatable-lib
25939 @itemx -mno-relocatable-lib
25940 @opindex mrelocatable-lib
25941 @opindex mno-relocatable-lib
25942 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
25943 @code{.fixup} section to allow static executables to be relocated at
25944 run time, but @option{-mrelocatable-lib} does not use the smaller stack
25945 alignment of @option{-mrelocatable}. Objects compiled with
25946 @option{-mrelocatable-lib} may be linked with objects compiled with
25947 any combination of the @option{-mrelocatable} options.
25948
25949 @item -mno-toc
25950 @itemx -mtoc
25951 @opindex mno-toc
25952 @opindex mtoc
25953 On System V.4 and embedded PowerPC systems do not (do) assume that
25954 register 2 contains a pointer to a global area pointing to the addresses
25955 used in the program.
25956
25957 @item -mlittle
25958 @itemx -mlittle-endian
25959 @opindex mlittle
25960 @opindex mlittle-endian
25961 On System V.4 and embedded PowerPC systems compile code for the
25962 processor in little-endian mode. The @option{-mlittle-endian} option is
25963 the same as @option{-mlittle}.
25964
25965 @item -mbig
25966 @itemx -mbig-endian
25967 @opindex mbig
25968 @opindex mbig-endian
25969 On System V.4 and embedded PowerPC systems compile code for the
25970 processor in big-endian mode. The @option{-mbig-endian} option is
25971 the same as @option{-mbig}.
25972
25973 @item -mdynamic-no-pic
25974 @opindex mdynamic-no-pic
25975 On Darwin and Mac OS X systems, compile code so that it is not
25976 relocatable, but that its external references are relocatable. The
25977 resulting code is suitable for applications, but not shared
25978 libraries.
25979
25980 @item -msingle-pic-base
25981 @opindex msingle-pic-base
25982 Treat the register used for PIC addressing as read-only, rather than
25983 loading it in the prologue for each function. The runtime system is
25984 responsible for initializing this register with an appropriate value
25985 before execution begins.
25986
25987 @item -mprioritize-restricted-insns=@var{priority}
25988 @opindex mprioritize-restricted-insns
25989 This option controls the priority that is assigned to
25990 dispatch-slot restricted instructions during the second scheduling
25991 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
25992 or @samp{2} to assign no, highest, or second-highest (respectively)
25993 priority to dispatch-slot restricted
25994 instructions.
25995
25996 @item -msched-costly-dep=@var{dependence_type}
25997 @opindex msched-costly-dep
25998 This option controls which dependences are considered costly
25999 by the target during instruction scheduling. The argument
26000 @var{dependence_type} takes one of the following values:
26001
26002 @table @asis
26003 @item @samp{no}
26004 No dependence is costly.
26005
26006 @item @samp{all}
26007 All dependences are costly.
26008
26009 @item @samp{true_store_to_load}
26010 A true dependence from store to load is costly.
26011
26012 @item @samp{store_to_load}
26013 Any dependence from store to load is costly.
26014
26015 @item @var{number}
26016 Any dependence for which the latency is greater than or equal to
26017 @var{number} is costly.
26018 @end table
26019
26020 @item -minsert-sched-nops=@var{scheme}
26021 @opindex minsert-sched-nops
26022 This option controls which NOP insertion scheme is used during
26023 the second scheduling pass. The argument @var{scheme} takes one of the
26024 following values:
26025
26026 @table @asis
26027 @item @samp{no}
26028 Don't insert NOPs.
26029
26030 @item @samp{pad}
26031 Pad with NOPs any dispatch group that has vacant issue slots,
26032 according to the scheduler's grouping.
26033
26034 @item @samp{regroup_exact}
26035 Insert NOPs to force costly dependent insns into
26036 separate groups. Insert exactly as many NOPs as needed to force an insn
26037 to a new group, according to the estimated processor grouping.
26038
26039 @item @var{number}
26040 Insert NOPs to force costly dependent insns into
26041 separate groups. Insert @var{number} NOPs to force an insn to a new group.
26042 @end table
26043
26044 @item -mcall-sysv
26045 @opindex mcall-sysv
26046 On System V.4 and embedded PowerPC systems compile code using calling
26047 conventions that adhere to the March 1995 draft of the System V
26048 Application Binary Interface, PowerPC processor supplement. This is the
26049 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
26050
26051 @item -mcall-sysv-eabi
26052 @itemx -mcall-eabi
26053 @opindex mcall-sysv-eabi
26054 @opindex mcall-eabi
26055 Specify both @option{-mcall-sysv} and @option{-meabi} options.
26056
26057 @item -mcall-sysv-noeabi
26058 @opindex mcall-sysv-noeabi
26059 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
26060
26061 @item -mcall-aixdesc
26062 @opindex m
26063 On System V.4 and embedded PowerPC systems compile code for the AIX
26064 operating system.
26065
26066 @item -mcall-linux
26067 @opindex mcall-linux
26068 On System V.4 and embedded PowerPC systems compile code for the
26069 Linux-based GNU system.
26070
26071 @item -mcall-freebsd
26072 @opindex mcall-freebsd
26073 On System V.4 and embedded PowerPC systems compile code for the
26074 FreeBSD operating system.
26075
26076 @item -mcall-netbsd
26077 @opindex mcall-netbsd
26078 On System V.4 and embedded PowerPC systems compile code for the
26079 NetBSD operating system.
26080
26081 @item -mcall-openbsd
26082 @opindex mcall-netbsd
26083 On System V.4 and embedded PowerPC systems compile code for the
26084 OpenBSD operating system.
26085
26086 @item -mtraceback=@var{traceback_type}
26087 @opindex mtraceback
26088 Select the type of traceback table. Valid values for @var{traceback_type}
26089 are @samp{full}, @samp{part}, and @samp{no}.
26090
26091 @item -maix-struct-return
26092 @opindex maix-struct-return
26093 Return all structures in memory (as specified by the AIX ABI)@.
26094
26095 @item -msvr4-struct-return
26096 @opindex msvr4-struct-return
26097 Return structures smaller than 8 bytes in registers (as specified by the
26098 SVR4 ABI)@.
26099
26100 @item -mabi=@var{abi-type}
26101 @opindex mabi
26102 Extend the current ABI with a particular extension, or remove such extension.
26103 Valid values are @samp{altivec}, @samp{no-altivec},
26104 @samp{ibmlongdouble}, @samp{ieeelongdouble},
26105 @samp{elfv1}, @samp{elfv2}@.
26106
26107 @item -mabi=ibmlongdouble
26108 @opindex mabi=ibmlongdouble
26109 Change the current ABI to use IBM extended-precision long double.
26110 This is not likely to work if your system defaults to using IEEE
26111 extended-precision long double. If you change the long double type
26112 from IEEE extended-precision, the compiler will issue a warning unless
26113 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
26114 to be enabled.
26115
26116 @item -mabi=ieeelongdouble
26117 @opindex mabi=ieeelongdouble
26118 Change the current ABI to use IEEE extended-precision long double.
26119 This is not likely to work if your system defaults to using IBM
26120 extended-precision long double. If you change the long double type
26121 from IBM extended-precision, the compiler will issue a warning unless
26122 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
26123 to be enabled.
26124
26125 @item -mabi=elfv1
26126 @opindex mabi=elfv1
26127 Change the current ABI to use the ELFv1 ABI.
26128 This is the default ABI for big-endian PowerPC 64-bit Linux.
26129 Overriding the default ABI requires special system support and is
26130 likely to fail in spectacular ways.
26131
26132 @item -mabi=elfv2
26133 @opindex mabi=elfv2
26134 Change the current ABI to use the ELFv2 ABI.
26135 This is the default ABI for little-endian PowerPC 64-bit Linux.
26136 Overriding the default ABI requires special system support and is
26137 likely to fail in spectacular ways.
26138
26139 @item -mgnu-attribute
26140 @itemx -mno-gnu-attribute
26141 @opindex mgnu-attribute
26142 @opindex mno-gnu-attribute
26143 Emit .gnu_attribute assembly directives to set tag/value pairs in a
26144 .gnu.attributes section that specify ABI variations in function
26145 parameters or return values.
26146
26147 @item -mprototype
26148 @itemx -mno-prototype
26149 @opindex mprototype
26150 @opindex mno-prototype
26151 On System V.4 and embedded PowerPC systems assume that all calls to
26152 variable argument functions are properly prototyped. Otherwise, the
26153 compiler must insert an instruction before every non-prototyped call to
26154 set or clear bit 6 of the condition code register (@code{CR}) to
26155 indicate whether floating-point values are passed in the floating-point
26156 registers in case the function takes variable arguments. With
26157 @option{-mprototype}, only calls to prototyped variable argument functions
26158 set or clear the bit.
26159
26160 @item -msim
26161 @opindex msim
26162 On embedded PowerPC systems, assume that the startup module is called
26163 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
26164 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
26165 configurations.
26166
26167 @item -mmvme
26168 @opindex mmvme
26169 On embedded PowerPC systems, assume that the startup module is called
26170 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
26171 @file{libc.a}.
26172
26173 @item -mads
26174 @opindex mads
26175 On embedded PowerPC systems, assume that the startup module is called
26176 @file{crt0.o} and the standard C libraries are @file{libads.a} and
26177 @file{libc.a}.
26178
26179 @item -myellowknife
26180 @opindex myellowknife
26181 On embedded PowerPC systems, assume that the startup module is called
26182 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
26183 @file{libc.a}.
26184
26185 @item -mvxworks
26186 @opindex mvxworks
26187 On System V.4 and embedded PowerPC systems, specify that you are
26188 compiling for a VxWorks system.
26189
26190 @item -memb
26191 @opindex memb
26192 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
26193 header to indicate that @samp{eabi} extended relocations are used.
26194
26195 @item -meabi
26196 @itemx -mno-eabi
26197 @opindex meabi
26198 @opindex mno-eabi
26199 On System V.4 and embedded PowerPC systems do (do not) adhere to the
26200 Embedded Applications Binary Interface (EABI), which is a set of
26201 modifications to the System V.4 specifications. Selecting @option{-meabi}
26202 means that the stack is aligned to an 8-byte boundary, a function
26203 @code{__eabi} is called from @code{main} to set up the EABI
26204 environment, and the @option{-msdata} option can use both @code{r2} and
26205 @code{r13} to point to two separate small data areas. Selecting
26206 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
26207 no EABI initialization function is called from @code{main}, and the
26208 @option{-msdata} option only uses @code{r13} to point to a single
26209 small data area. The @option{-meabi} option is on by default if you
26210 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
26211
26212 @item -msdata=eabi
26213 @opindex msdata=eabi
26214 On System V.4 and embedded PowerPC systems, put small initialized
26215 @code{const} global and static data in the @code{.sdata2} section, which
26216 is pointed to by register @code{r2}. Put small initialized
26217 non-@code{const} global and static data in the @code{.sdata} section,
26218 which is pointed to by register @code{r13}. Put small uninitialized
26219 global and static data in the @code{.sbss} section, which is adjacent to
26220 the @code{.sdata} section. The @option{-msdata=eabi} option is
26221 incompatible with the @option{-mrelocatable} option. The
26222 @option{-msdata=eabi} option also sets the @option{-memb} option.
26223
26224 @item -msdata=sysv
26225 @opindex msdata=sysv
26226 On System V.4 and embedded PowerPC systems, put small global and static
26227 data in the @code{.sdata} section, which is pointed to by register
26228 @code{r13}. Put small uninitialized global and static data in the
26229 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
26230 The @option{-msdata=sysv} option is incompatible with the
26231 @option{-mrelocatable} option.
26232
26233 @item -msdata=default
26234 @itemx -msdata
26235 @opindex msdata=default
26236 @opindex msdata
26237 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
26238 compile code the same as @option{-msdata=eabi}, otherwise compile code the
26239 same as @option{-msdata=sysv}.
26240
26241 @item -msdata=data
26242 @opindex msdata=data
26243 On System V.4 and embedded PowerPC systems, put small global
26244 data in the @code{.sdata} section. Put small uninitialized global
26245 data in the @code{.sbss} section. Do not use register @code{r13}
26246 to address small data however. This is the default behavior unless
26247 other @option{-msdata} options are used.
26248
26249 @item -msdata=none
26250 @itemx -mno-sdata
26251 @opindex msdata=none
26252 @opindex mno-sdata
26253 On embedded PowerPC systems, put all initialized global and static data
26254 in the @code{.data} section, and all uninitialized data in the
26255 @code{.bss} section.
26256
26257 @item -mreadonly-in-sdata
26258 @opindex mreadonly-in-sdata
26259 @opindex mno-readonly-in-sdata
26260 Put read-only objects in the @code{.sdata} section as well. This is the
26261 default.
26262
26263 @item -mblock-move-inline-limit=@var{num}
26264 @opindex mblock-move-inline-limit
26265 Inline all block moves (such as calls to @code{memcpy} or structure
26266 copies) less than or equal to @var{num} bytes. The minimum value for
26267 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
26268 targets. The default value is target-specific.
26269
26270 @item -mblock-compare-inline-limit=@var{num}
26271 @opindex mblock-compare-inline-limit
26272 Generate non-looping inline code for all block compares (such as calls
26273 to @code{memcmp} or structure compares) less than or equal to @var{num}
26274 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
26275 block compare is disabled. The default value is target-specific.
26276
26277 @item -mblock-compare-inline-loop-limit=@var{num}
26278 @opindex mblock-compare-inline-loop-limit
26279 Generate an inline expansion using loop code for all block compares that
26280 are less than or equal to @var{num} bytes, but greater than the limit
26281 for non-loop inline block compare expansion. If the block length is not
26282 constant, at most @var{num} bytes will be compared before @code{memcmp}
26283 is called to compare the remainder of the block. The default value is
26284 target-specific.
26285
26286 @item -mstring-compare-inline-limit=@var{num}
26287 @opindex mstring-compare-inline-limit
26288 Compare at most @var{num} string bytes with inline code.
26289 If the difference or end of string is not found at the
26290 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
26291 take care of the rest of the comparison. The default is 64 bytes.
26292
26293 @item -G @var{num}
26294 @opindex G
26295 @cindex smaller data references (PowerPC)
26296 @cindex .sdata/.sdata2 references (PowerPC)
26297 On embedded PowerPC systems, put global and static items less than or
26298 equal to @var{num} bytes into the small data or BSS sections instead of
26299 the normal data or BSS section. By default, @var{num} is 8. The
26300 @option{-G @var{num}} switch is also passed to the linker.
26301 All modules should be compiled with the same @option{-G @var{num}} value.
26302
26303 @item -mregnames
26304 @itemx -mno-regnames
26305 @opindex mregnames
26306 @opindex mno-regnames
26307 On System V.4 and embedded PowerPC systems do (do not) emit register
26308 names in the assembly language output using symbolic forms.
26309
26310 @item -mlongcall
26311 @itemx -mno-longcall
26312 @opindex mlongcall
26313 @opindex mno-longcall
26314 By default assume that all calls are far away so that a longer and more
26315 expensive calling sequence is required. This is required for calls
26316 farther than 32 megabytes (33,554,432 bytes) from the current location.
26317 A short call is generated if the compiler knows
26318 the call cannot be that far away. This setting can be overridden by
26319 the @code{shortcall} function attribute, or by @code{#pragma
26320 longcall(0)}.
26321
26322 Some linkers are capable of detecting out-of-range calls and generating
26323 glue code on the fly. On these systems, long calls are unnecessary and
26324 generate slower code. As of this writing, the AIX linker can do this,
26325 as can the GNU linker for PowerPC/64. It is planned to add this feature
26326 to the GNU linker for 32-bit PowerPC systems as well.
26327
26328 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
26329 GCC can generate long calls using an inline PLT call sequence (see
26330 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
26331 ELFv1 (big-endian) do not support inline PLT calls.
26332
26333 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
26334 callee, L42}, plus a @dfn{branch island} (glue code). The two target
26335 addresses represent the callee and the branch island. The
26336 Darwin/PPC linker prefers the first address and generates a @code{bl
26337 callee} if the PPC @code{bl} instruction reaches the callee directly;
26338 otherwise, the linker generates @code{bl L42} to call the branch
26339 island. The branch island is appended to the body of the
26340 calling function; it computes the full 32-bit address of the callee
26341 and jumps to it.
26342
26343 On Mach-O (Darwin) systems, this option directs the compiler emit to
26344 the glue for every direct call, and the Darwin linker decides whether
26345 to use or discard it.
26346
26347 In the future, GCC may ignore all longcall specifications
26348 when the linker is known to generate glue.
26349
26350 @item -mpltseq
26351 @itemx -mno-pltseq
26352 @opindex mpltseq
26353 @opindex mno-pltseq
26354 Implement (do not implement) -fno-plt and long calls using an inline
26355 PLT call sequence that supports lazy linking and long calls to
26356 functions in dlopen'd shared libraries. Inline PLT calls are only
26357 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
26358 linkers, and are enabled by default if the support is detected when
26359 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
26360 configured with @option{--enable-secureplt}. @option{-mpltseq} code
26361 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
26362 linked together.
26363
26364 @item -mtls-markers
26365 @itemx -mno-tls-markers
26366 @opindex mtls-markers
26367 @opindex mno-tls-markers
26368 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
26369 specifying the function argument. The relocation allows the linker to
26370 reliably associate function call with argument setup instructions for
26371 TLS optimization, which in turn allows GCC to better schedule the
26372 sequence.
26373
26374 @item -mrecip
26375 @itemx -mno-recip
26376 @opindex mrecip
26377 This option enables use of the reciprocal estimate and
26378 reciprocal square root estimate instructions with additional
26379 Newton-Raphson steps to increase precision instead of doing a divide or
26380 square root and divide for floating-point arguments. You should use
26381 the @option{-ffast-math} option when using @option{-mrecip} (or at
26382 least @option{-funsafe-math-optimizations},
26383 @option{-ffinite-math-only}, @option{-freciprocal-math} and
26384 @option{-fno-trapping-math}). Note that while the throughput of the
26385 sequence is generally higher than the throughput of the non-reciprocal
26386 instruction, the precision of the sequence can be decreased by up to 2
26387 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
26388 roots.
26389
26390 @item -mrecip=@var{opt}
26391 @opindex mrecip=opt
26392 This option controls which reciprocal estimate instructions
26393 may be used. @var{opt} is a comma-separated list of options, which may
26394 be preceded by a @code{!} to invert the option:
26395
26396 @table @samp
26397
26398 @item all
26399 Enable all estimate instructions.
26400
26401 @item default
26402 Enable the default instructions, equivalent to @option{-mrecip}.
26403
26404 @item none
26405 Disable all estimate instructions, equivalent to @option{-mno-recip}.
26406
26407 @item div
26408 Enable the reciprocal approximation instructions for both
26409 single and double precision.
26410
26411 @item divf
26412 Enable the single-precision reciprocal approximation instructions.
26413
26414 @item divd
26415 Enable the double-precision reciprocal approximation instructions.
26416
26417 @item rsqrt
26418 Enable the reciprocal square root approximation instructions for both
26419 single and double precision.
26420
26421 @item rsqrtf
26422 Enable the single-precision reciprocal square root approximation instructions.
26423
26424 @item rsqrtd
26425 Enable the double-precision reciprocal square root approximation instructions.
26426
26427 @end table
26428
26429 So, for example, @option{-mrecip=all,!rsqrtd} enables
26430 all of the reciprocal estimate instructions, except for the
26431 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
26432 which handle the double-precision reciprocal square root calculations.
26433
26434 @item -mrecip-precision
26435 @itemx -mno-recip-precision
26436 @opindex mrecip-precision
26437 Assume (do not assume) that the reciprocal estimate instructions
26438 provide higher-precision estimates than is mandated by the PowerPC
26439 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
26440 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
26441 The double-precision square root estimate instructions are not generated by
26442 default on low-precision machines, since they do not provide an
26443 estimate that converges after three steps.
26444
26445 @item -mveclibabi=@var{type}
26446 @opindex mveclibabi
26447 Specifies the ABI type to use for vectorizing intrinsics using an
26448 external library. The only type supported at present is @samp{mass},
26449 which specifies to use IBM's Mathematical Acceleration Subsystem
26450 (MASS) libraries for vectorizing intrinsics using external libraries.
26451 GCC currently emits calls to @code{acosd2}, @code{acosf4},
26452 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
26453 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
26454 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
26455 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
26456 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
26457 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
26458 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
26459 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
26460 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
26461 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
26462 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
26463 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
26464 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
26465 for power7. Both @option{-ftree-vectorize} and
26466 @option{-funsafe-math-optimizations} must also be enabled. The MASS
26467 libraries must be specified at link time.
26468
26469 @item -mfriz
26470 @itemx -mno-friz
26471 @opindex mfriz
26472 Generate (do not generate) the @code{friz} instruction when the
26473 @option{-funsafe-math-optimizations} option is used to optimize
26474 rounding of floating-point values to 64-bit integer and back to floating
26475 point. The @code{friz} instruction does not return the same value if
26476 the floating-point number is too large to fit in an integer.
26477
26478 @item -mpointers-to-nested-functions
26479 @itemx -mno-pointers-to-nested-functions
26480 @opindex mpointers-to-nested-functions
26481 Generate (do not generate) code to load up the static chain register
26482 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
26483 systems where a function pointer points to a 3-word descriptor giving
26484 the function address, TOC value to be loaded in register @code{r2}, and
26485 static chain value to be loaded in register @code{r11}. The
26486 @option{-mpointers-to-nested-functions} is on by default. You cannot
26487 call through pointers to nested functions or pointers
26488 to functions compiled in other languages that use the static chain if
26489 you use @option{-mno-pointers-to-nested-functions}.
26490
26491 @item -msave-toc-indirect
26492 @itemx -mno-save-toc-indirect
26493 @opindex msave-toc-indirect
26494 Generate (do not generate) code to save the TOC value in the reserved
26495 stack location in the function prologue if the function calls through
26496 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
26497 saved in the prologue, it is saved just before the call through the
26498 pointer. The @option{-mno-save-toc-indirect} option is the default.
26499
26500 @item -mcompat-align-parm
26501 @itemx -mno-compat-align-parm
26502 @opindex mcompat-align-parm
26503 Generate (do not generate) code to pass structure parameters with a
26504 maximum alignment of 64 bits, for compatibility with older versions
26505 of GCC.
26506
26507 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
26508 structure parameter on a 128-bit boundary when that structure contained
26509 a member requiring 128-bit alignment. This is corrected in more
26510 recent versions of GCC. This option may be used to generate code
26511 that is compatible with functions compiled with older versions of
26512 GCC.
26513
26514 The @option{-mno-compat-align-parm} option is the default.
26515
26516 @item -mstack-protector-guard=@var{guard}
26517 @itemx -mstack-protector-guard-reg=@var{reg}
26518 @itemx -mstack-protector-guard-offset=@var{offset}
26519 @itemx -mstack-protector-guard-symbol=@var{symbol}
26520 @opindex mstack-protector-guard
26521 @opindex mstack-protector-guard-reg
26522 @opindex mstack-protector-guard-offset
26523 @opindex mstack-protector-guard-symbol
26524 Generate stack protection code using canary at @var{guard}. Supported
26525 locations are @samp{global} for global canary or @samp{tls} for per-thread
26526 canary in the TLS block (the default with GNU libc version 2.4 or later).
26527
26528 With the latter choice the options
26529 @option{-mstack-protector-guard-reg=@var{reg}} and
26530 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
26531 which register to use as base register for reading the canary, and from what
26532 offset from that base register. The default for those is as specified in the
26533 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
26534 the offset with a symbol reference to a canary in the TLS block.
26535
26536 @item -mpcrel
26537 @itemx -mno-pcrel
26538 @opindex mpcrel
26539 @opindex mno-pcrel
26540 Generate (do not generate) pc-relative addressing when the option
26541 @option{-mcpu=future} is used. The @option{-mpcrel} option requires
26542 that the medium code model (@option{-mcmodel=medium}) and prefixed
26543 addressing (@option{-mprefixed}) options are enabled.
26544
26545 @item -mprefixed
26546 @itemx -mno-prefixed
26547 @opindex mprefixed
26548 @opindex mno-prefixed
26549 Generate (do not generate) addressing modes using prefixed load and
26550 store instructions when the option @option{-mcpu=future} is used.
26551 @end table
26552
26553 @node RX Options
26554 @subsection RX Options
26555 @cindex RX Options
26556
26557 These command-line options are defined for RX targets:
26558
26559 @table @gcctabopt
26560 @item -m64bit-doubles
26561 @itemx -m32bit-doubles
26562 @opindex m64bit-doubles
26563 @opindex m32bit-doubles
26564 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
26565 or 32 bits (@option{-m32bit-doubles}) in size. The default is
26566 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
26567 works on 32-bit values, which is why the default is
26568 @option{-m32bit-doubles}.
26569
26570 @item -fpu
26571 @itemx -nofpu
26572 @opindex fpu
26573 @opindex nofpu
26574 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
26575 floating-point hardware. The default is enabled for the RX600
26576 series and disabled for the RX200 series.
26577
26578 Floating-point instructions are only generated for 32-bit floating-point
26579 values, however, so the FPU hardware is not used for doubles if the
26580 @option{-m64bit-doubles} option is used.
26581
26582 @emph{Note} If the @option{-fpu} option is enabled then
26583 @option{-funsafe-math-optimizations} is also enabled automatically.
26584 This is because the RX FPU instructions are themselves unsafe.
26585
26586 @item -mcpu=@var{name}
26587 @opindex mcpu
26588 Selects the type of RX CPU to be targeted. Currently three types are
26589 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
26590 the specific @samp{RX610} CPU. The default is @samp{RX600}.
26591
26592 The only difference between @samp{RX600} and @samp{RX610} is that the
26593 @samp{RX610} does not support the @code{MVTIPL} instruction.
26594
26595 The @samp{RX200} series does not have a hardware floating-point unit
26596 and so @option{-nofpu} is enabled by default when this type is
26597 selected.
26598
26599 @item -mbig-endian-data
26600 @itemx -mlittle-endian-data
26601 @opindex mbig-endian-data
26602 @opindex mlittle-endian-data
26603 Store data (but not code) in the big-endian format. The default is
26604 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
26605 format.
26606
26607 @item -msmall-data-limit=@var{N}
26608 @opindex msmall-data-limit
26609 Specifies the maximum size in bytes of global and static variables
26610 which can be placed into the small data area. Using the small data
26611 area can lead to smaller and faster code, but the size of area is
26612 limited and it is up to the programmer to ensure that the area does
26613 not overflow. Also when the small data area is used one of the RX's
26614 registers (usually @code{r13}) is reserved for use pointing to this
26615 area, so it is no longer available for use by the compiler. This
26616 could result in slower and/or larger code if variables are pushed onto
26617 the stack instead of being held in this register.
26618
26619 Note, common variables (variables that have not been initialized) and
26620 constants are not placed into the small data area as they are assigned
26621 to other sections in the output executable.
26622
26623 The default value is zero, which disables this feature. Note, this
26624 feature is not enabled by default with higher optimization levels
26625 (@option{-O2} etc) because of the potentially detrimental effects of
26626 reserving a register. It is up to the programmer to experiment and
26627 discover whether this feature is of benefit to their program. See the
26628 description of the @option{-mpid} option for a description of how the
26629 actual register to hold the small data area pointer is chosen.
26630
26631 @item -msim
26632 @itemx -mno-sim
26633 @opindex msim
26634 @opindex mno-sim
26635 Use the simulator runtime. The default is to use the libgloss
26636 board-specific runtime.
26637
26638 @item -mas100-syntax
26639 @itemx -mno-as100-syntax
26640 @opindex mas100-syntax
26641 @opindex mno-as100-syntax
26642 When generating assembler output use a syntax that is compatible with
26643 Renesas's AS100 assembler. This syntax can also be handled by the GAS
26644 assembler, but it has some restrictions so it is not generated by default.
26645
26646 @item -mmax-constant-size=@var{N}
26647 @opindex mmax-constant-size
26648 Specifies the maximum size, in bytes, of a constant that can be used as
26649 an operand in a RX instruction. Although the RX instruction set does
26650 allow constants of up to 4 bytes in length to be used in instructions,
26651 a longer value equates to a longer instruction. Thus in some
26652 circumstances it can be beneficial to restrict the size of constants
26653 that are used in instructions. Constants that are too big are instead
26654 placed into a constant pool and referenced via register indirection.
26655
26656 The value @var{N} can be between 0 and 4. A value of 0 (the default)
26657 or 4 means that constants of any size are allowed.
26658
26659 @item -mrelax
26660 @opindex mrelax
26661 Enable linker relaxation. Linker relaxation is a process whereby the
26662 linker attempts to reduce the size of a program by finding shorter
26663 versions of various instructions. Disabled by default.
26664
26665 @item -mint-register=@var{N}
26666 @opindex mint-register
26667 Specify the number of registers to reserve for fast interrupt handler
26668 functions. The value @var{N} can be between 0 and 4. A value of 1
26669 means that register @code{r13} is reserved for the exclusive use
26670 of fast interrupt handlers. A value of 2 reserves @code{r13} and
26671 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
26672 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
26673 A value of 0, the default, does not reserve any registers.
26674
26675 @item -msave-acc-in-interrupts
26676 @opindex msave-acc-in-interrupts
26677 Specifies that interrupt handler functions should preserve the
26678 accumulator register. This is only necessary if normal code might use
26679 the accumulator register, for example because it performs 64-bit
26680 multiplications. The default is to ignore the accumulator as this
26681 makes the interrupt handlers faster.
26682
26683 @item -mpid
26684 @itemx -mno-pid
26685 @opindex mpid
26686 @opindex mno-pid
26687 Enables the generation of position independent data. When enabled any
26688 access to constant data is done via an offset from a base address
26689 held in a register. This allows the location of constant data to be
26690 determined at run time without requiring the executable to be
26691 relocated, which is a benefit to embedded applications with tight
26692 memory constraints. Data that can be modified is not affected by this
26693 option.
26694
26695 Note, using this feature reserves a register, usually @code{r13}, for
26696 the constant data base address. This can result in slower and/or
26697 larger code, especially in complicated functions.
26698
26699 The actual register chosen to hold the constant data base address
26700 depends upon whether the @option{-msmall-data-limit} and/or the
26701 @option{-mint-register} command-line options are enabled. Starting
26702 with register @code{r13} and proceeding downwards, registers are
26703 allocated first to satisfy the requirements of @option{-mint-register},
26704 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
26705 is possible for the small data area register to be @code{r8} if both
26706 @option{-mint-register=4} and @option{-mpid} are specified on the
26707 command line.
26708
26709 By default this feature is not enabled. The default can be restored
26710 via the @option{-mno-pid} command-line option.
26711
26712 @item -mno-warn-multiple-fast-interrupts
26713 @itemx -mwarn-multiple-fast-interrupts
26714 @opindex mno-warn-multiple-fast-interrupts
26715 @opindex mwarn-multiple-fast-interrupts
26716 Prevents GCC from issuing a warning message if it finds more than one
26717 fast interrupt handler when it is compiling a file. The default is to
26718 issue a warning for each extra fast interrupt handler found, as the RX
26719 only supports one such interrupt.
26720
26721 @item -mallow-string-insns
26722 @itemx -mno-allow-string-insns
26723 @opindex mallow-string-insns
26724 @opindex mno-allow-string-insns
26725 Enables or disables the use of the string manipulation instructions
26726 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
26727 @code{SWHILE} and also the @code{RMPA} instruction. These
26728 instructions may prefetch data, which is not safe to do if accessing
26729 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
26730 for more information).
26731
26732 The default is to allow these instructions, but it is not possible for
26733 GCC to reliably detect all circumstances where a string instruction
26734 might be used to access an I/O register, so their use cannot be
26735 disabled automatically. Instead it is reliant upon the programmer to
26736 use the @option{-mno-allow-string-insns} option if their program
26737 accesses I/O space.
26738
26739 When the instructions are enabled GCC defines the C preprocessor
26740 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
26741 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
26742
26743 @item -mjsr
26744 @itemx -mno-jsr
26745 @opindex mjsr
26746 @opindex mno-jsr
26747 Use only (or not only) @code{JSR} instructions to access functions.
26748 This option can be used when code size exceeds the range of @code{BSR}
26749 instructions. Note that @option{-mno-jsr} does not mean to not use
26750 @code{JSR} but instead means that any type of branch may be used.
26751 @end table
26752
26753 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
26754 has special significance to the RX port when used with the
26755 @code{interrupt} function attribute. This attribute indicates a
26756 function intended to process fast interrupts. GCC ensures
26757 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
26758 and/or @code{r13} and only provided that the normal use of the
26759 corresponding registers have been restricted via the
26760 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
26761 options.
26762
26763 @node S/390 and zSeries Options
26764 @subsection S/390 and zSeries Options
26765 @cindex S/390 and zSeries Options
26766
26767 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
26768
26769 @table @gcctabopt
26770 @item -mhard-float
26771 @itemx -msoft-float
26772 @opindex mhard-float
26773 @opindex msoft-float
26774 Use (do not use) the hardware floating-point instructions and registers
26775 for floating-point operations. When @option{-msoft-float} is specified,
26776 functions in @file{libgcc.a} are used to perform floating-point
26777 operations. When @option{-mhard-float} is specified, the compiler
26778 generates IEEE floating-point instructions. This is the default.
26779
26780 @item -mhard-dfp
26781 @itemx -mno-hard-dfp
26782 @opindex mhard-dfp
26783 @opindex mno-hard-dfp
26784 Use (do not use) the hardware decimal-floating-point instructions for
26785 decimal-floating-point operations. When @option{-mno-hard-dfp} is
26786 specified, functions in @file{libgcc.a} are used to perform
26787 decimal-floating-point operations. When @option{-mhard-dfp} is
26788 specified, the compiler generates decimal-floating-point hardware
26789 instructions. This is the default for @option{-march=z9-ec} or higher.
26790
26791 @item -mlong-double-64
26792 @itemx -mlong-double-128
26793 @opindex mlong-double-64
26794 @opindex mlong-double-128
26795 These switches control the size of @code{long double} type. A size
26796 of 64 bits makes the @code{long double} type equivalent to the @code{double}
26797 type. This is the default.
26798
26799 @item -mbackchain
26800 @itemx -mno-backchain
26801 @opindex mbackchain
26802 @opindex mno-backchain
26803 Store (do not store) the address of the caller's frame as backchain pointer
26804 into the callee's stack frame.
26805 A backchain may be needed to allow debugging using tools that do not understand
26806 DWARF call frame information.
26807 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
26808 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
26809 the backchain is placed into the topmost word of the 96/160 byte register
26810 save area.
26811
26812 In general, code compiled with @option{-mbackchain} is call-compatible with
26813 code compiled with @option{-mmo-backchain}; however, use of the backchain
26814 for debugging purposes usually requires that the whole binary is built with
26815 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
26816 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
26817 to build a linux kernel use @option{-msoft-float}.
26818
26819 The default is to not maintain the backchain.
26820
26821 @item -mpacked-stack
26822 @itemx -mno-packed-stack
26823 @opindex mpacked-stack
26824 @opindex mno-packed-stack
26825 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
26826 specified, the compiler uses the all fields of the 96/160 byte register save
26827 area only for their default purpose; unused fields still take up stack space.
26828 When @option{-mpacked-stack} is specified, register save slots are densely
26829 packed at the top of the register save area; unused space is reused for other
26830 purposes, allowing for more efficient use of the available stack space.
26831 However, when @option{-mbackchain} is also in effect, the topmost word of
26832 the save area is always used to store the backchain, and the return address
26833 register is always saved two words below the backchain.
26834
26835 As long as the stack frame backchain is not used, code generated with
26836 @option{-mpacked-stack} is call-compatible with code generated with
26837 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
26838 S/390 or zSeries generated code that uses the stack frame backchain at run
26839 time, not just for debugging purposes. Such code is not call-compatible
26840 with code compiled with @option{-mpacked-stack}. Also, note that the
26841 combination of @option{-mbackchain},
26842 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
26843 to build a linux kernel use @option{-msoft-float}.
26844
26845 The default is to not use the packed stack layout.
26846
26847 @item -msmall-exec
26848 @itemx -mno-small-exec
26849 @opindex msmall-exec
26850 @opindex mno-small-exec
26851 Generate (or do not generate) code using the @code{bras} instruction
26852 to do subroutine calls.
26853 This only works reliably if the total executable size does not
26854 exceed 64k. The default is to use the @code{basr} instruction instead,
26855 which does not have this limitation.
26856
26857 @item -m64
26858 @itemx -m31
26859 @opindex m64
26860 @opindex m31
26861 When @option{-m31} is specified, generate code compliant to the
26862 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
26863 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
26864 particular to generate 64-bit instructions. For the @samp{s390}
26865 targets, the default is @option{-m31}, while the @samp{s390x}
26866 targets default to @option{-m64}.
26867
26868 @item -mzarch
26869 @itemx -mesa
26870 @opindex mzarch
26871 @opindex mesa
26872 When @option{-mzarch} is specified, generate code using the
26873 instructions available on z/Architecture.
26874 When @option{-mesa} is specified, generate code using the
26875 instructions available on ESA/390. Note that @option{-mesa} is
26876 not possible with @option{-m64}.
26877 When generating code compliant to the GNU/Linux for S/390 ABI,
26878 the default is @option{-mesa}. When generating code compliant
26879 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
26880
26881 @item -mhtm
26882 @itemx -mno-htm
26883 @opindex mhtm
26884 @opindex mno-htm
26885 The @option{-mhtm} option enables a set of builtins making use of
26886 instructions available with the transactional execution facility
26887 introduced with the IBM zEnterprise EC12 machine generation
26888 @ref{S/390 System z Built-in Functions}.
26889 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
26890
26891 @item -mvx
26892 @itemx -mno-vx
26893 @opindex mvx
26894 @opindex mno-vx
26895 When @option{-mvx} is specified, generate code using the instructions
26896 available with the vector extension facility introduced with the IBM
26897 z13 machine generation.
26898 This option changes the ABI for some vector type values with regard to
26899 alignment and calling conventions. In case vector type values are
26900 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
26901 command will be added to mark the resulting binary with the ABI used.
26902 @option{-mvx} is enabled by default when using @option{-march=z13}.
26903
26904 @item -mzvector
26905 @itemx -mno-zvector
26906 @opindex mzvector
26907 @opindex mno-zvector
26908 The @option{-mzvector} option enables vector language extensions and
26909 builtins using instructions available with the vector extension
26910 facility introduced with the IBM z13 machine generation.
26911 This option adds support for @samp{vector} to be used as a keyword to
26912 define vector type variables and arguments. @samp{vector} is only
26913 available when GNU extensions are enabled. It will not be expanded
26914 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
26915 In addition to the GCC low-level builtins @option{-mzvector} enables
26916 a set of builtins added for compatibility with AltiVec-style
26917 implementations like Power and Cell. In order to make use of these
26918 builtins the header file @file{vecintrin.h} needs to be included.
26919 @option{-mzvector} is disabled by default.
26920
26921 @item -mmvcle
26922 @itemx -mno-mvcle
26923 @opindex mmvcle
26924 @opindex mno-mvcle
26925 Generate (or do not generate) code using the @code{mvcle} instruction
26926 to perform block moves. When @option{-mno-mvcle} is specified,
26927 use a @code{mvc} loop instead. This is the default unless optimizing for
26928 size.
26929
26930 @item -mdebug
26931 @itemx -mno-debug
26932 @opindex mdebug
26933 @opindex mno-debug
26934 Print (or do not print) additional debug information when compiling.
26935 The default is to not print debug information.
26936
26937 @item -march=@var{cpu-type}
26938 @opindex march
26939 Generate code that runs on @var{cpu-type}, which is the name of a
26940 system representing a certain processor type. Possible values for
26941 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
26942 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
26943 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
26944 @samp{z14}/@samp{arch12}, and @samp{native}.
26945
26946 The default is @option{-march=z900}.
26947
26948 Specifying @samp{native} as cpu type can be used to select the best
26949 architecture option for the host processor.
26950 @option{-march=native} has no effect if GCC does not recognize the
26951 processor.
26952
26953 @item -mtune=@var{cpu-type}
26954 @opindex mtune
26955 Tune to @var{cpu-type} everything applicable about the generated code,
26956 except for the ABI and the set of available instructions.
26957 The list of @var{cpu-type} values is the same as for @option{-march}.
26958 The default is the value used for @option{-march}.
26959
26960 @item -mtpf-trace
26961 @itemx -mno-tpf-trace
26962 @opindex mtpf-trace
26963 @opindex mno-tpf-trace
26964 Generate code that adds (does not add) in TPF OS specific branches to trace
26965 routines in the operating system. This option is off by default, even
26966 when compiling for the TPF OS@.
26967
26968 @item -mtpf-trace-skip
26969 @itemx -mno-tpf-trace-skip
26970 @opindex mtpf-trace-skip
26971 @opindex mno-tpf-trace-skip
26972 Generate code that changes (does not change) the default branch
26973 targets enabled by @option{-mtpf-trace} to point to specialized trace
26974 routines providing the ability of selectively skipping function trace
26975 entries for the TPF OS. This option is off by default, even when
26976 compiling for the TPF OS and specifying @option{-mtpf-trace}.
26977
26978 @item -mfused-madd
26979 @itemx -mno-fused-madd
26980 @opindex mfused-madd
26981 @opindex mno-fused-madd
26982 Generate code that uses (does not use) the floating-point multiply and
26983 accumulate instructions. These instructions are generated by default if
26984 hardware floating point is used.
26985
26986 @item -mwarn-framesize=@var{framesize}
26987 @opindex mwarn-framesize
26988 Emit a warning if the current function exceeds the given frame size. Because
26989 this is a compile-time check it doesn't need to be a real problem when the program
26990 runs. It is intended to identify functions that most probably cause
26991 a stack overflow. It is useful to be used in an environment with limited stack
26992 size e.g.@: the linux kernel.
26993
26994 @item -mwarn-dynamicstack
26995 @opindex mwarn-dynamicstack
26996 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
26997 arrays. This is generally a bad idea with a limited stack size.
26998
26999 @item -mstack-guard=@var{stack-guard}
27000 @itemx -mstack-size=@var{stack-size}
27001 @opindex mstack-guard
27002 @opindex mstack-size
27003 If these options are provided the S/390 back end emits additional instructions in
27004 the function prologue that trigger a trap if the stack size is @var{stack-guard}
27005 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
27006 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
27007 the frame size of the compiled function is chosen.
27008 These options are intended to be used to help debugging stack overflow problems.
27009 The additionally emitted code causes only little overhead and hence can also be
27010 used in production-like systems without greater performance degradation. The given
27011 values have to be exact powers of 2 and @var{stack-size} has to be greater than
27012 @var{stack-guard} without exceeding 64k.
27013 In order to be efficient the extra code makes the assumption that the stack starts
27014 at an address aligned to the value given by @var{stack-size}.
27015 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
27016
27017 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
27018 @opindex mhotpatch
27019 If the hotpatch option is enabled, a ``hot-patching'' function
27020 prologue is generated for all functions in the compilation unit.
27021 The funtion label is prepended with the given number of two-byte
27022 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
27023 the label, 2 * @var{post-halfwords} bytes are appended, using the
27024 largest NOP like instructions the architecture allows (maximum
27025 1000000).
27026
27027 If both arguments are zero, hotpatching is disabled.
27028
27029 This option can be overridden for individual functions with the
27030 @code{hotpatch} attribute.
27031 @end table
27032
27033 @node Score Options
27034 @subsection Score Options
27035 @cindex Score Options
27036
27037 These options are defined for Score implementations:
27038
27039 @table @gcctabopt
27040 @item -meb
27041 @opindex meb
27042 Compile code for big-endian mode. This is the default.
27043
27044 @item -mel
27045 @opindex mel
27046 Compile code for little-endian mode.
27047
27048 @item -mnhwloop
27049 @opindex mnhwloop
27050 Disable generation of @code{bcnz} instructions.
27051
27052 @item -muls
27053 @opindex muls
27054 Enable generation of unaligned load and store instructions.
27055
27056 @item -mmac
27057 @opindex mmac
27058 Enable the use of multiply-accumulate instructions. Disabled by default.
27059
27060 @item -mscore5
27061 @opindex mscore5
27062 Specify the SCORE5 as the target architecture.
27063
27064 @item -mscore5u
27065 @opindex mscore5u
27066 Specify the SCORE5U of the target architecture.
27067
27068 @item -mscore7
27069 @opindex mscore7
27070 Specify the SCORE7 as the target architecture. This is the default.
27071
27072 @item -mscore7d
27073 @opindex mscore7d
27074 Specify the SCORE7D as the target architecture.
27075 @end table
27076
27077 @node SH Options
27078 @subsection SH Options
27079
27080 These @samp{-m} options are defined for the SH implementations:
27081
27082 @table @gcctabopt
27083 @item -m1
27084 @opindex m1
27085 Generate code for the SH1.
27086
27087 @item -m2
27088 @opindex m2
27089 Generate code for the SH2.
27090
27091 @item -m2e
27092 Generate code for the SH2e.
27093
27094 @item -m2a-nofpu
27095 @opindex m2a-nofpu
27096 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
27097 that the floating-point unit is not used.
27098
27099 @item -m2a-single-only
27100 @opindex m2a-single-only
27101 Generate code for the SH2a-FPU, in such a way that no double-precision
27102 floating-point operations are used.
27103
27104 @item -m2a-single
27105 @opindex m2a-single
27106 Generate code for the SH2a-FPU assuming the floating-point unit is in
27107 single-precision mode by default.
27108
27109 @item -m2a
27110 @opindex m2a
27111 Generate code for the SH2a-FPU assuming the floating-point unit is in
27112 double-precision mode by default.
27113
27114 @item -m3
27115 @opindex m3
27116 Generate code for the SH3.
27117
27118 @item -m3e
27119 @opindex m3e
27120 Generate code for the SH3e.
27121
27122 @item -m4-nofpu
27123 @opindex m4-nofpu
27124 Generate code for the SH4 without a floating-point unit.
27125
27126 @item -m4-single-only
27127 @opindex m4-single-only
27128 Generate code for the SH4 with a floating-point unit that only
27129 supports single-precision arithmetic.
27130
27131 @item -m4-single
27132 @opindex m4-single
27133 Generate code for the SH4 assuming the floating-point unit is in
27134 single-precision mode by default.
27135
27136 @item -m4
27137 @opindex m4
27138 Generate code for the SH4.
27139
27140 @item -m4-100
27141 @opindex m4-100
27142 Generate code for SH4-100.
27143
27144 @item -m4-100-nofpu
27145 @opindex m4-100-nofpu
27146 Generate code for SH4-100 in such a way that the
27147 floating-point unit is not used.
27148
27149 @item -m4-100-single
27150 @opindex m4-100-single
27151 Generate code for SH4-100 assuming the floating-point unit is in
27152 single-precision mode by default.
27153
27154 @item -m4-100-single-only
27155 @opindex m4-100-single-only
27156 Generate code for SH4-100 in such a way that no double-precision
27157 floating-point operations are used.
27158
27159 @item -m4-200
27160 @opindex m4-200
27161 Generate code for SH4-200.
27162
27163 @item -m4-200-nofpu
27164 @opindex m4-200-nofpu
27165 Generate code for SH4-200 without in such a way that the
27166 floating-point unit is not used.
27167
27168 @item -m4-200-single
27169 @opindex m4-200-single
27170 Generate code for SH4-200 assuming the floating-point unit is in
27171 single-precision mode by default.
27172
27173 @item -m4-200-single-only
27174 @opindex m4-200-single-only
27175 Generate code for SH4-200 in such a way that no double-precision
27176 floating-point operations are used.
27177
27178 @item -m4-300
27179 @opindex m4-300
27180 Generate code for SH4-300.
27181
27182 @item -m4-300-nofpu
27183 @opindex m4-300-nofpu
27184 Generate code for SH4-300 without in such a way that the
27185 floating-point unit is not used.
27186
27187 @item -m4-300-single
27188 @opindex m4-300-single
27189 Generate code for SH4-300 in such a way that no double-precision
27190 floating-point operations are used.
27191
27192 @item -m4-300-single-only
27193 @opindex m4-300-single-only
27194 Generate code for SH4-300 in such a way that no double-precision
27195 floating-point operations are used.
27196
27197 @item -m4-340
27198 @opindex m4-340
27199 Generate code for SH4-340 (no MMU, no FPU).
27200
27201 @item -m4-500
27202 @opindex m4-500
27203 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
27204 assembler.
27205
27206 @item -m4a-nofpu
27207 @opindex m4a-nofpu
27208 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
27209 floating-point unit is not used.
27210
27211 @item -m4a-single-only
27212 @opindex m4a-single-only
27213 Generate code for the SH4a, in such a way that no double-precision
27214 floating-point operations are used.
27215
27216 @item -m4a-single
27217 @opindex m4a-single
27218 Generate code for the SH4a assuming the floating-point unit is in
27219 single-precision mode by default.
27220
27221 @item -m4a
27222 @opindex m4a
27223 Generate code for the SH4a.
27224
27225 @item -m4al
27226 @opindex m4al
27227 Same as @option{-m4a-nofpu}, except that it implicitly passes
27228 @option{-dsp} to the assembler. GCC doesn't generate any DSP
27229 instructions at the moment.
27230
27231 @item -mb
27232 @opindex mb
27233 Compile code for the processor in big-endian mode.
27234
27235 @item -ml
27236 @opindex ml
27237 Compile code for the processor in little-endian mode.
27238
27239 @item -mdalign
27240 @opindex mdalign
27241 Align doubles at 64-bit boundaries. Note that this changes the calling
27242 conventions, and thus some functions from the standard C library do
27243 not work unless you recompile it first with @option{-mdalign}.
27244
27245 @item -mrelax
27246 @opindex mrelax
27247 Shorten some address references at link time, when possible; uses the
27248 linker option @option{-relax}.
27249
27250 @item -mbigtable
27251 @opindex mbigtable
27252 Use 32-bit offsets in @code{switch} tables. The default is to use
27253 16-bit offsets.
27254
27255 @item -mbitops
27256 @opindex mbitops
27257 Enable the use of bit manipulation instructions on SH2A.
27258
27259 @item -mfmovd
27260 @opindex mfmovd
27261 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
27262 alignment constraints.
27263
27264 @item -mrenesas
27265 @opindex mrenesas
27266 Comply with the calling conventions defined by Renesas.
27267
27268 @item -mno-renesas
27269 @opindex mno-renesas
27270 Comply with the calling conventions defined for GCC before the Renesas
27271 conventions were available. This option is the default for all
27272 targets of the SH toolchain.
27273
27274 @item -mnomacsave
27275 @opindex mnomacsave
27276 Mark the @code{MAC} register as call-clobbered, even if
27277 @option{-mrenesas} is given.
27278
27279 @item -mieee
27280 @itemx -mno-ieee
27281 @opindex mieee
27282 @opindex mno-ieee
27283 Control the IEEE compliance of floating-point comparisons, which affects the
27284 handling of cases where the result of a comparison is unordered. By default
27285 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
27286 enabled @option{-mno-ieee} is implicitly set, which results in faster
27287 floating-point greater-equal and less-equal comparisons. The implicit settings
27288 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
27289
27290 @item -minline-ic_invalidate
27291 @opindex minline-ic_invalidate
27292 Inline code to invalidate instruction cache entries after setting up
27293 nested function trampolines.
27294 This option has no effect if @option{-musermode} is in effect and the selected
27295 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
27296 instruction.
27297 If the selected code generation option does not allow the use of the @code{icbi}
27298 instruction, and @option{-musermode} is not in effect, the inlined code
27299 manipulates the instruction cache address array directly with an associative
27300 write. This not only requires privileged mode at run time, but it also
27301 fails if the cache line had been mapped via the TLB and has become unmapped.
27302
27303 @item -misize
27304 @opindex misize
27305 Dump instruction size and location in the assembly code.
27306
27307 @item -mpadstruct
27308 @opindex mpadstruct
27309 This option is deprecated. It pads structures to multiple of 4 bytes,
27310 which is incompatible with the SH ABI@.
27311
27312 @item -matomic-model=@var{model}
27313 @opindex matomic-model=@var{model}
27314 Sets the model of atomic operations and additional parameters as a comma
27315 separated list. For details on the atomic built-in functions see
27316 @ref{__atomic Builtins}. The following models and parameters are supported:
27317
27318 @table @samp
27319
27320 @item none
27321 Disable compiler generated atomic sequences and emit library calls for atomic
27322 operations. This is the default if the target is not @code{sh*-*-linux*}.
27323
27324 @item soft-gusa
27325 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
27326 built-in functions. The generated atomic sequences require additional support
27327 from the interrupt/exception handling code of the system and are only suitable
27328 for SH3* and SH4* single-core systems. This option is enabled by default when
27329 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
27330 this option also partially utilizes the hardware atomic instructions
27331 @code{movli.l} and @code{movco.l} to create more efficient code, unless
27332 @samp{strict} is specified.
27333
27334 @item soft-tcb
27335 Generate software atomic sequences that use a variable in the thread control
27336 block. This is a variation of the gUSA sequences which can also be used on
27337 SH1* and SH2* targets. The generated atomic sequences require additional
27338 support from the interrupt/exception handling code of the system and are only
27339 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
27340 parameter has to be specified as well.
27341
27342 @item soft-imask
27343 Generate software atomic sequences that temporarily disable interrupts by
27344 setting @code{SR.IMASK = 1111}. This model works only when the program runs
27345 in privileged mode and is only suitable for single-core systems. Additional
27346 support from the interrupt/exception handling code of the system is not
27347 required. This model is enabled by default when the target is
27348 @code{sh*-*-linux*} and SH1* or SH2*.
27349
27350 @item hard-llcs
27351 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
27352 instructions only. This is only available on SH4A and is suitable for
27353 multi-core systems. Since the hardware instructions support only 32 bit atomic
27354 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
27355 Code compiled with this option is also compatible with other software
27356 atomic model interrupt/exception handling systems if executed on an SH4A
27357 system. Additional support from the interrupt/exception handling code of the
27358 system is not required for this model.
27359
27360 @item gbr-offset=
27361 This parameter specifies the offset in bytes of the variable in the thread
27362 control block structure that should be used by the generated atomic sequences
27363 when the @samp{soft-tcb} model has been selected. For other models this
27364 parameter is ignored. The specified value must be an integer multiple of four
27365 and in the range 0-1020.
27366
27367 @item strict
27368 This parameter prevents mixed usage of multiple atomic models, even if they
27369 are compatible, and makes the compiler generate atomic sequences of the
27370 specified model only.
27371
27372 @end table
27373
27374 @item -mtas
27375 @opindex mtas
27376 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
27377 Notice that depending on the particular hardware and software configuration
27378 this can degrade overall performance due to the operand cache line flushes
27379 that are implied by the @code{tas.b} instruction. On multi-core SH4A
27380 processors the @code{tas.b} instruction must be used with caution since it
27381 can result in data corruption for certain cache configurations.
27382
27383 @item -mprefergot
27384 @opindex mprefergot
27385 When generating position-independent code, emit function calls using
27386 the Global Offset Table instead of the Procedure Linkage Table.
27387
27388 @item -musermode
27389 @itemx -mno-usermode
27390 @opindex musermode
27391 @opindex mno-usermode
27392 Don't allow (allow) the compiler generating privileged mode code. Specifying
27393 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
27394 inlined code would not work in user mode. @option{-musermode} is the default
27395 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
27396 @option{-musermode} has no effect, since there is no user mode.
27397
27398 @item -multcost=@var{number}
27399 @opindex multcost=@var{number}
27400 Set the cost to assume for a multiply insn.
27401
27402 @item -mdiv=@var{strategy}
27403 @opindex mdiv=@var{strategy}
27404 Set the division strategy to be used for integer division operations.
27405 @var{strategy} can be one of:
27406
27407 @table @samp
27408
27409 @item call-div1
27410 Calls a library function that uses the single-step division instruction
27411 @code{div1} to perform the operation. Division by zero calculates an
27412 unspecified result and does not trap. This is the default except for SH4,
27413 SH2A and SHcompact.
27414
27415 @item call-fp
27416 Calls a library function that performs the operation in double precision
27417 floating point. Division by zero causes a floating-point exception. This is
27418 the default for SHcompact with FPU. Specifying this for targets that do not
27419 have a double precision FPU defaults to @code{call-div1}.
27420
27421 @item call-table
27422 Calls a library function that uses a lookup table for small divisors and
27423 the @code{div1} instruction with case distinction for larger divisors. Division
27424 by zero calculates an unspecified result and does not trap. This is the default
27425 for SH4. Specifying this for targets that do not have dynamic shift
27426 instructions defaults to @code{call-div1}.
27427
27428 @end table
27429
27430 When a division strategy has not been specified the default strategy is
27431 selected based on the current target. For SH2A the default strategy is to
27432 use the @code{divs} and @code{divu} instructions instead of library function
27433 calls.
27434
27435 @item -maccumulate-outgoing-args
27436 @opindex maccumulate-outgoing-args
27437 Reserve space once for outgoing arguments in the function prologue rather
27438 than around each call. Generally beneficial for performance and size. Also
27439 needed for unwinding to avoid changing the stack frame around conditional code.
27440
27441 @item -mdivsi3_libfunc=@var{name}
27442 @opindex mdivsi3_libfunc=@var{name}
27443 Set the name of the library function used for 32-bit signed division to
27444 @var{name}.
27445 This only affects the name used in the @samp{call} division strategies, and
27446 the compiler still expects the same sets of input/output/clobbered registers as
27447 if this option were not present.
27448
27449 @item -mfixed-range=@var{register-range}
27450 @opindex mfixed-range
27451 Generate code treating the given register range as fixed registers.
27452 A fixed register is one that the register allocator cannot use. This is
27453 useful when compiling kernel code. A register range is specified as
27454 two registers separated by a dash. Multiple register ranges can be
27455 specified separated by a comma.
27456
27457 @item -mbranch-cost=@var{num}
27458 @opindex mbranch-cost=@var{num}
27459 Assume @var{num} to be the cost for a branch instruction. Higher numbers
27460 make the compiler try to generate more branch-free code if possible.
27461 If not specified the value is selected depending on the processor type that
27462 is being compiled for.
27463
27464 @item -mzdcbranch
27465 @itemx -mno-zdcbranch
27466 @opindex mzdcbranch
27467 @opindex mno-zdcbranch
27468 Assume (do not assume) that zero displacement conditional branch instructions
27469 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
27470 compiler prefers zero displacement branch code sequences. This is
27471 enabled by default when generating code for SH4 and SH4A. It can be explicitly
27472 disabled by specifying @option{-mno-zdcbranch}.
27473
27474 @item -mcbranch-force-delay-slot
27475 @opindex mcbranch-force-delay-slot
27476 Force the usage of delay slots for conditional branches, which stuffs the delay
27477 slot with a @code{nop} if a suitable instruction cannot be found. By default
27478 this option is disabled. It can be enabled to work around hardware bugs as
27479 found in the original SH7055.
27480
27481 @item -mfused-madd
27482 @itemx -mno-fused-madd
27483 @opindex mfused-madd
27484 @opindex mno-fused-madd
27485 Generate code that uses (does not use) the floating-point multiply and
27486 accumulate instructions. These instructions are generated by default
27487 if hardware floating point is used. The machine-dependent
27488 @option{-mfused-madd} option is now mapped to the machine-independent
27489 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
27490 mapped to @option{-ffp-contract=off}.
27491
27492 @item -mfsca
27493 @itemx -mno-fsca
27494 @opindex mfsca
27495 @opindex mno-fsca
27496 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
27497 and cosine approximations. The option @option{-mfsca} must be used in
27498 combination with @option{-funsafe-math-optimizations}. It is enabled by default
27499 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
27500 approximations even if @option{-funsafe-math-optimizations} is in effect.
27501
27502 @item -mfsrra
27503 @itemx -mno-fsrra
27504 @opindex mfsrra
27505 @opindex mno-fsrra
27506 Allow or disallow the compiler to emit the @code{fsrra} instruction for
27507 reciprocal square root approximations. The option @option{-mfsrra} must be used
27508 in combination with @option{-funsafe-math-optimizations} and
27509 @option{-ffinite-math-only}. It is enabled by default when generating code for
27510 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
27511 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
27512 in effect.
27513
27514 @item -mpretend-cmove
27515 @opindex mpretend-cmove
27516 Prefer zero-displacement conditional branches for conditional move instruction
27517 patterns. This can result in faster code on the SH4 processor.
27518
27519 @item -mfdpic
27520 @opindex fdpic
27521 Generate code using the FDPIC ABI.
27522
27523 @end table
27524
27525 @node Solaris 2 Options
27526 @subsection Solaris 2 Options
27527 @cindex Solaris 2 options
27528
27529 These @samp{-m} options are supported on Solaris 2:
27530
27531 @table @gcctabopt
27532 @item -mclear-hwcap
27533 @opindex mclear-hwcap
27534 @option{-mclear-hwcap} tells the compiler to remove the hardware
27535 capabilities generated by the Solaris assembler. This is only necessary
27536 when object files use ISA extensions not supported by the current
27537 machine, but check at runtime whether or not to use them.
27538
27539 @item -mimpure-text
27540 @opindex mimpure-text
27541 @option{-mimpure-text}, used in addition to @option{-shared}, tells
27542 the compiler to not pass @option{-z text} to the linker when linking a
27543 shared object. Using this option, you can link position-dependent
27544 code into a shared object.
27545
27546 @option{-mimpure-text} suppresses the ``relocations remain against
27547 allocatable but non-writable sections'' linker error message.
27548 However, the necessary relocations trigger copy-on-write, and the
27549 shared object is not actually shared across processes. Instead of
27550 using @option{-mimpure-text}, you should compile all source code with
27551 @option{-fpic} or @option{-fPIC}.
27552
27553 @end table
27554
27555 These switches are supported in addition to the above on Solaris 2:
27556
27557 @table @gcctabopt
27558 @item -pthreads
27559 @opindex pthreads
27560 This is a synonym for @option{-pthread}.
27561 @end table
27562
27563 @node SPARC Options
27564 @subsection SPARC Options
27565 @cindex SPARC options
27566
27567 These @samp{-m} options are supported on the SPARC:
27568
27569 @table @gcctabopt
27570 @item -mno-app-regs
27571 @itemx -mapp-regs
27572 @opindex mno-app-regs
27573 @opindex mapp-regs
27574 Specify @option{-mapp-regs} to generate output using the global registers
27575 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
27576 global register 1, each global register 2 through 4 is then treated as an
27577 allocable register that is clobbered by function calls. This is the default.
27578
27579 To be fully SVR4 ABI-compliant at the cost of some performance loss,
27580 specify @option{-mno-app-regs}. You should compile libraries and system
27581 software with this option.
27582
27583 @item -mflat
27584 @itemx -mno-flat
27585 @opindex mflat
27586 @opindex mno-flat
27587 With @option{-mflat}, the compiler does not generate save/restore instructions
27588 and uses a ``flat'' or single register window model. This model is compatible
27589 with the regular register window model. The local registers and the input
27590 registers (0--5) are still treated as ``call-saved'' registers and are
27591 saved on the stack as needed.
27592
27593 With @option{-mno-flat} (the default), the compiler generates save/restore
27594 instructions (except for leaf functions). This is the normal operating mode.
27595
27596 @item -mfpu
27597 @itemx -mhard-float
27598 @opindex mfpu
27599 @opindex mhard-float
27600 Generate output containing floating-point instructions. This is the
27601 default.
27602
27603 @item -mno-fpu
27604 @itemx -msoft-float
27605 @opindex mno-fpu
27606 @opindex msoft-float
27607 Generate output containing library calls for floating point.
27608 @strong{Warning:} the requisite libraries are not available for all SPARC
27609 targets. Normally the facilities of the machine's usual C compiler are
27610 used, but this cannot be done directly in cross-compilation. You must make
27611 your own arrangements to provide suitable library functions for
27612 cross-compilation. The embedded targets @samp{sparc-*-aout} and
27613 @samp{sparclite-*-*} do provide software floating-point support.
27614
27615 @option{-msoft-float} changes the calling convention in the output file;
27616 therefore, it is only useful if you compile @emph{all} of a program with
27617 this option. In particular, you need to compile @file{libgcc.a}, the
27618 library that comes with GCC, with @option{-msoft-float} in order for
27619 this to work.
27620
27621 @item -mhard-quad-float
27622 @opindex mhard-quad-float
27623 Generate output containing quad-word (long double) floating-point
27624 instructions.
27625
27626 @item -msoft-quad-float
27627 @opindex msoft-quad-float
27628 Generate output containing library calls for quad-word (long double)
27629 floating-point instructions. The functions called are those specified
27630 in the SPARC ABI@. This is the default.
27631
27632 As of this writing, there are no SPARC implementations that have hardware
27633 support for the quad-word floating-point instructions. They all invoke
27634 a trap handler for one of these instructions, and then the trap handler
27635 emulates the effect of the instruction. Because of the trap handler overhead,
27636 this is much slower than calling the ABI library routines. Thus the
27637 @option{-msoft-quad-float} option is the default.
27638
27639 @item -mno-unaligned-doubles
27640 @itemx -munaligned-doubles
27641 @opindex mno-unaligned-doubles
27642 @opindex munaligned-doubles
27643 Assume that doubles have 8-byte alignment. This is the default.
27644
27645 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
27646 alignment only if they are contained in another type, or if they have an
27647 absolute address. Otherwise, it assumes they have 4-byte alignment.
27648 Specifying this option avoids some rare compatibility problems with code
27649 generated by other compilers. It is not the default because it results
27650 in a performance loss, especially for floating-point code.
27651
27652 @item -muser-mode
27653 @itemx -mno-user-mode
27654 @opindex muser-mode
27655 @opindex mno-user-mode
27656 Do not generate code that can only run in supervisor mode. This is relevant
27657 only for the @code{casa} instruction emitted for the LEON3 processor. This
27658 is the default.
27659
27660 @item -mfaster-structs
27661 @itemx -mno-faster-structs
27662 @opindex mfaster-structs
27663 @opindex mno-faster-structs
27664 With @option{-mfaster-structs}, the compiler assumes that structures
27665 should have 8-byte alignment. This enables the use of pairs of
27666 @code{ldd} and @code{std} instructions for copies in structure
27667 assignment, in place of twice as many @code{ld} and @code{st} pairs.
27668 However, the use of this changed alignment directly violates the SPARC
27669 ABI@. Thus, it's intended only for use on targets where the developer
27670 acknowledges that their resulting code is not directly in line with
27671 the rules of the ABI@.
27672
27673 @item -mstd-struct-return
27674 @itemx -mno-std-struct-return
27675 @opindex mstd-struct-return
27676 @opindex mno-std-struct-return
27677 With @option{-mstd-struct-return}, the compiler generates checking code
27678 in functions returning structures or unions to detect size mismatches
27679 between the two sides of function calls, as per the 32-bit ABI@.
27680
27681 The default is @option{-mno-std-struct-return}. This option has no effect
27682 in 64-bit mode.
27683
27684 @item -mlra
27685 @itemx -mno-lra
27686 @opindex mlra
27687 @opindex mno-lra
27688 Enable Local Register Allocation. This is the default for SPARC since GCC 7
27689 so @option{-mno-lra} needs to be passed to get old Reload.
27690
27691 @item -mcpu=@var{cpu_type}
27692 @opindex mcpu
27693 Set the instruction set, register set, and instruction scheduling parameters
27694 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27695 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
27696 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
27697 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
27698 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
27699 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
27700
27701 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
27702 which selects the best architecture option for the host processor.
27703 @option{-mcpu=native} has no effect if GCC does not recognize
27704 the processor.
27705
27706 Default instruction scheduling parameters are used for values that select
27707 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
27708 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
27709
27710 Here is a list of each supported architecture and their supported
27711 implementations.
27712
27713 @table @asis
27714 @item v7
27715 cypress, leon3v7
27716
27717 @item v8
27718 supersparc, hypersparc, leon, leon3
27719
27720 @item sparclite
27721 f930, f934, sparclite86x
27722
27723 @item sparclet
27724 tsc701
27725
27726 @item v9
27727 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
27728 niagara7, m8
27729 @end table
27730
27731 By default (unless configured otherwise), GCC generates code for the V7
27732 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
27733 additionally optimizes it for the Cypress CY7C602 chip, as used in the
27734 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
27735 SPARCStation 1, 2, IPX etc.
27736
27737 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
27738 architecture. The only difference from V7 code is that the compiler emits
27739 the integer multiply and integer divide instructions which exist in SPARC-V8
27740 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
27741 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
27742 2000 series.
27743
27744 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
27745 the SPARC architecture. This adds the integer multiply, integer divide step
27746 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
27747 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
27748 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
27749 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
27750 MB86934 chip, which is the more recent SPARClite with FPU@.
27751
27752 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
27753 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
27754 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
27755 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
27756 optimizes it for the TEMIC SPARClet chip.
27757
27758 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
27759 architecture. This adds 64-bit integer and floating-point move instructions,
27760 3 additional floating-point condition code registers and conditional move
27761 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
27762 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
27763 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
27764 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
27765 @option{-mcpu=niagara}, the compiler additionally optimizes it for
27766 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
27767 additionally optimizes it for Sun UltraSPARC T2 chips. With
27768 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
27769 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
27770 additionally optimizes it for Sun UltraSPARC T4 chips. With
27771 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
27772 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
27773 additionally optimizes it for Oracle M8 chips.
27774
27775 @item -mtune=@var{cpu_type}
27776 @opindex mtune
27777 Set the instruction scheduling parameters for machine type
27778 @var{cpu_type}, but do not set the instruction set or register set that the
27779 option @option{-mcpu=@var{cpu_type}} does.
27780
27781 The same values for @option{-mcpu=@var{cpu_type}} can be used for
27782 @option{-mtune=@var{cpu_type}}, but the only useful values are those
27783 that select a particular CPU implementation. Those are
27784 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
27785 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
27786 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
27787 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
27788 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
27789 and GNU/Linux toolchains, @samp{native} can also be used.
27790
27791 @item -mv8plus
27792 @itemx -mno-v8plus
27793 @opindex mv8plus
27794 @opindex mno-v8plus
27795 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
27796 difference from the V8 ABI is that the global and out registers are
27797 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
27798 mode for all SPARC-V9 processors.
27799
27800 @item -mvis
27801 @itemx -mno-vis
27802 @opindex mvis
27803 @opindex mno-vis
27804 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
27805 Visual Instruction Set extensions. The default is @option{-mno-vis}.
27806
27807 @item -mvis2
27808 @itemx -mno-vis2
27809 @opindex mvis2
27810 @opindex mno-vis2
27811 With @option{-mvis2}, GCC generates code that takes advantage of
27812 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
27813 default is @option{-mvis2} when targeting a cpu that supports such
27814 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
27815 also sets @option{-mvis}.
27816
27817 @item -mvis3
27818 @itemx -mno-vis3
27819 @opindex mvis3
27820 @opindex mno-vis3
27821 With @option{-mvis3}, GCC generates code that takes advantage of
27822 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
27823 default is @option{-mvis3} when targeting a cpu that supports such
27824 instructions, such as niagara-3 and later. Setting @option{-mvis3}
27825 also sets @option{-mvis2} and @option{-mvis}.
27826
27827 @item -mvis4
27828 @itemx -mno-vis4
27829 @opindex mvis4
27830 @opindex mno-vis4
27831 With @option{-mvis4}, GCC generates code that takes advantage of
27832 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
27833 default is @option{-mvis4} when targeting a cpu that supports such
27834 instructions, such as niagara-7 and later. Setting @option{-mvis4}
27835 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
27836
27837 @item -mvis4b
27838 @itemx -mno-vis4b
27839 @opindex mvis4b
27840 @opindex mno-vis4b
27841 With @option{-mvis4b}, GCC generates code that takes advantage of
27842 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
27843 the additional VIS instructions introduced in the Oracle SPARC
27844 Architecture 2017. The default is @option{-mvis4b} when targeting a
27845 cpu that supports such instructions, such as m8 and later. Setting
27846 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
27847 @option{-mvis2} and @option{-mvis}.
27848
27849 @item -mcbcond
27850 @itemx -mno-cbcond
27851 @opindex mcbcond
27852 @opindex mno-cbcond
27853 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
27854 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
27855 when targeting a CPU that supports such instructions, such as Niagara-4 and
27856 later.
27857
27858 @item -mfmaf
27859 @itemx -mno-fmaf
27860 @opindex mfmaf
27861 @opindex mno-fmaf
27862 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
27863 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
27864 when targeting a CPU that supports such instructions, such as Niagara-3 and
27865 later.
27866
27867 @item -mfsmuld
27868 @itemx -mno-fsmuld
27869 @opindex mfsmuld
27870 @opindex mno-fsmuld
27871 With @option{-mfsmuld}, GCC generates code that takes advantage of the
27872 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
27873 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
27874 or V9 with FPU except @option{-mcpu=leon}.
27875
27876 @item -mpopc
27877 @itemx -mno-popc
27878 @opindex mpopc
27879 @opindex mno-popc
27880 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
27881 Population Count instruction. The default is @option{-mpopc}
27882 when targeting a CPU that supports such an instruction, such as Niagara-2 and
27883 later.
27884
27885 @item -msubxc
27886 @itemx -mno-subxc
27887 @opindex msubxc
27888 @opindex mno-subxc
27889 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
27890 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
27891 when targeting a CPU that supports such an instruction, such as Niagara-7 and
27892 later.
27893
27894 @item -mfix-at697f
27895 @opindex mfix-at697f
27896 Enable the documented workaround for the single erratum of the Atmel AT697F
27897 processor (which corresponds to erratum #13 of the AT697E processor).
27898
27899 @item -mfix-ut699
27900 @opindex mfix-ut699
27901 Enable the documented workarounds for the floating-point errata and the data
27902 cache nullify errata of the UT699 processor.
27903
27904 @item -mfix-ut700
27905 @opindex mfix-ut700
27906 Enable the documented workaround for the back-to-back store errata of
27907 the UT699E/UT700 processor.
27908
27909 @item -mfix-gr712rc
27910 @opindex mfix-gr712rc
27911 Enable the documented workaround for the back-to-back store errata of
27912 the GR712RC processor.
27913 @end table
27914
27915 These @samp{-m} options are supported in addition to the above
27916 on SPARC-V9 processors in 64-bit environments:
27917
27918 @table @gcctabopt
27919 @item -m32
27920 @itemx -m64
27921 @opindex m32
27922 @opindex m64
27923 Generate code for a 32-bit or 64-bit environment.
27924 The 32-bit environment sets int, long and pointer to 32 bits.
27925 The 64-bit environment sets int to 32 bits and long and pointer
27926 to 64 bits.
27927
27928 @item -mcmodel=@var{which}
27929 @opindex mcmodel
27930 Set the code model to one of
27931
27932 @table @samp
27933 @item medlow
27934 The Medium/Low code model: 64-bit addresses, programs
27935 must be linked in the low 32 bits of memory. Programs can be statically
27936 or dynamically linked.
27937
27938 @item medmid
27939 The Medium/Middle code model: 64-bit addresses, programs
27940 must be linked in the low 44 bits of memory, the text and data segments must
27941 be less than 2GB in size and the data segment must be located within 2GB of
27942 the text segment.
27943
27944 @item medany
27945 The Medium/Anywhere code model: 64-bit addresses, programs
27946 may be linked anywhere in memory, the text and data segments must be less
27947 than 2GB in size and the data segment must be located within 2GB of the
27948 text segment.
27949
27950 @item embmedany
27951 The Medium/Anywhere code model for embedded systems:
27952 64-bit addresses, the text and data segments must be less than 2GB in
27953 size, both starting anywhere in memory (determined at link time). The
27954 global register %g4 points to the base of the data segment. Programs
27955 are statically linked and PIC is not supported.
27956 @end table
27957
27958 @item -mmemory-model=@var{mem-model}
27959 @opindex mmemory-model
27960 Set the memory model in force on the processor to one of
27961
27962 @table @samp
27963 @item default
27964 The default memory model for the processor and operating system.
27965
27966 @item rmo
27967 Relaxed Memory Order
27968
27969 @item pso
27970 Partial Store Order
27971
27972 @item tso
27973 Total Store Order
27974
27975 @item sc
27976 Sequential Consistency
27977 @end table
27978
27979 These memory models are formally defined in Appendix D of the SPARC-V9
27980 architecture manual, as set in the processor's @code{PSTATE.MM} field.
27981
27982 @item -mstack-bias
27983 @itemx -mno-stack-bias
27984 @opindex mstack-bias
27985 @opindex mno-stack-bias
27986 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
27987 frame pointer if present, are offset by @minus{}2047 which must be added back
27988 when making stack frame references. This is the default in 64-bit mode.
27989 Otherwise, assume no such offset is present.
27990 @end table
27991
27992 @node System V Options
27993 @subsection Options for System V
27994
27995 These additional options are available on System V Release 4 for
27996 compatibility with other compilers on those systems:
27997
27998 @table @gcctabopt
27999 @item -G
28000 @opindex G
28001 Create a shared object.
28002 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
28003
28004 @item -Qy
28005 @opindex Qy
28006 Identify the versions of each tool used by the compiler, in a
28007 @code{.ident} assembler directive in the output.
28008
28009 @item -Qn
28010 @opindex Qn
28011 Refrain from adding @code{.ident} directives to the output file (this is
28012 the default).
28013
28014 @item -YP,@var{dirs}
28015 @opindex YP
28016 Search the directories @var{dirs}, and no others, for libraries
28017 specified with @option{-l}.
28018
28019 @item -Ym,@var{dir}
28020 @opindex Ym
28021 Look in the directory @var{dir} to find the M4 preprocessor.
28022 The assembler uses this option.
28023 @c This is supposed to go with a -Yd for predefined M4 macro files, but
28024 @c the generic assembler that comes with Solaris takes just -Ym.
28025 @end table
28026
28027 @node TILE-Gx Options
28028 @subsection TILE-Gx Options
28029 @cindex TILE-Gx options
28030
28031 These @samp{-m} options are supported on the TILE-Gx:
28032
28033 @table @gcctabopt
28034 @item -mcmodel=small
28035 @opindex mcmodel=small
28036 Generate code for the small model. The distance for direct calls is
28037 limited to 500M in either direction. PC-relative addresses are 32
28038 bits. Absolute addresses support the full address range.
28039
28040 @item -mcmodel=large
28041 @opindex mcmodel=large
28042 Generate code for the large model. There is no limitation on call
28043 distance, pc-relative addresses, or absolute addresses.
28044
28045 @item -mcpu=@var{name}
28046 @opindex mcpu
28047 Selects the type of CPU to be targeted. Currently the only supported
28048 type is @samp{tilegx}.
28049
28050 @item -m32
28051 @itemx -m64
28052 @opindex m32
28053 @opindex m64
28054 Generate code for a 32-bit or 64-bit environment. The 32-bit
28055 environment sets int, long, and pointer to 32 bits. The 64-bit
28056 environment sets int to 32 bits and long and pointer to 64 bits.
28057
28058 @item -mbig-endian
28059 @itemx -mlittle-endian
28060 @opindex mbig-endian
28061 @opindex mlittle-endian
28062 Generate code in big/little endian mode, respectively.
28063 @end table
28064
28065 @node TILEPro Options
28066 @subsection TILEPro Options
28067 @cindex TILEPro options
28068
28069 These @samp{-m} options are supported on the TILEPro:
28070
28071 @table @gcctabopt
28072 @item -mcpu=@var{name}
28073 @opindex mcpu
28074 Selects the type of CPU to be targeted. Currently the only supported
28075 type is @samp{tilepro}.
28076
28077 @item -m32
28078 @opindex m32
28079 Generate code for a 32-bit environment, which sets int, long, and
28080 pointer to 32 bits. This is the only supported behavior so the flag
28081 is essentially ignored.
28082 @end table
28083
28084 @node V850 Options
28085 @subsection V850 Options
28086 @cindex V850 Options
28087
28088 These @samp{-m} options are defined for V850 implementations:
28089
28090 @table @gcctabopt
28091 @item -mlong-calls
28092 @itemx -mno-long-calls
28093 @opindex mlong-calls
28094 @opindex mno-long-calls
28095 Treat all calls as being far away (near). If calls are assumed to be
28096 far away, the compiler always loads the function's address into a
28097 register, and calls indirect through the pointer.
28098
28099 @item -mno-ep
28100 @itemx -mep
28101 @opindex mno-ep
28102 @opindex mep
28103 Do not optimize (do optimize) basic blocks that use the same index
28104 pointer 4 or more times to copy pointer into the @code{ep} register, and
28105 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
28106 option is on by default if you optimize.
28107
28108 @item -mno-prolog-function
28109 @itemx -mprolog-function
28110 @opindex mno-prolog-function
28111 @opindex mprolog-function
28112 Do not use (do use) external functions to save and restore registers
28113 at the prologue and epilogue of a function. The external functions
28114 are slower, but use less code space if more than one function saves
28115 the same number of registers. The @option{-mprolog-function} option
28116 is on by default if you optimize.
28117
28118 @item -mspace
28119 @opindex mspace
28120 Try to make the code as small as possible. At present, this just turns
28121 on the @option{-mep} and @option{-mprolog-function} options.
28122
28123 @item -mtda=@var{n}
28124 @opindex mtda
28125 Put static or global variables whose size is @var{n} bytes or less into
28126 the tiny data area that register @code{ep} points to. The tiny data
28127 area can hold up to 256 bytes in total (128 bytes for byte references).
28128
28129 @item -msda=@var{n}
28130 @opindex msda
28131 Put static or global variables whose size is @var{n} bytes or less into
28132 the small data area that register @code{gp} points to. The small data
28133 area can hold up to 64 kilobytes.
28134
28135 @item -mzda=@var{n}
28136 @opindex mzda
28137 Put static or global variables whose size is @var{n} bytes or less into
28138 the first 32 kilobytes of memory.
28139
28140 @item -mv850
28141 @opindex mv850
28142 Specify that the target processor is the V850.
28143
28144 @item -mv850e3v5
28145 @opindex mv850e3v5
28146 Specify that the target processor is the V850E3V5. The preprocessor
28147 constant @code{__v850e3v5__} is defined if this option is used.
28148
28149 @item -mv850e2v4
28150 @opindex mv850e2v4
28151 Specify that the target processor is the V850E3V5. This is an alias for
28152 the @option{-mv850e3v5} option.
28153
28154 @item -mv850e2v3
28155 @opindex mv850e2v3
28156 Specify that the target processor is the V850E2V3. The preprocessor
28157 constant @code{__v850e2v3__} is defined if this option is used.
28158
28159 @item -mv850e2
28160 @opindex mv850e2
28161 Specify that the target processor is the V850E2. The preprocessor
28162 constant @code{__v850e2__} is defined if this option is used.
28163
28164 @item -mv850e1
28165 @opindex mv850e1
28166 Specify that the target processor is the V850E1. The preprocessor
28167 constants @code{__v850e1__} and @code{__v850e__} are defined if
28168 this option is used.
28169
28170 @item -mv850es
28171 @opindex mv850es
28172 Specify that the target processor is the V850ES. This is an alias for
28173 the @option{-mv850e1} option.
28174
28175 @item -mv850e
28176 @opindex mv850e
28177 Specify that the target processor is the V850E@. The preprocessor
28178 constant @code{__v850e__} is defined if this option is used.
28179
28180 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
28181 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
28182 are defined then a default target processor is chosen and the
28183 relevant @samp{__v850*__} preprocessor constant is defined.
28184
28185 The preprocessor constants @code{__v850} and @code{__v851__} are always
28186 defined, regardless of which processor variant is the target.
28187
28188 @item -mdisable-callt
28189 @itemx -mno-disable-callt
28190 @opindex mdisable-callt
28191 @opindex mno-disable-callt
28192 This option suppresses generation of the @code{CALLT} instruction for the
28193 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
28194 architecture.
28195
28196 This option is enabled by default when the RH850 ABI is
28197 in use (see @option{-mrh850-abi}), and disabled by default when the
28198 GCC ABI is in use. If @code{CALLT} instructions are being generated
28199 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
28200
28201 @item -mrelax
28202 @itemx -mno-relax
28203 @opindex mrelax
28204 @opindex mno-relax
28205 Pass on (or do not pass on) the @option{-mrelax} command-line option
28206 to the assembler.
28207
28208 @item -mlong-jumps
28209 @itemx -mno-long-jumps
28210 @opindex mlong-jumps
28211 @opindex mno-long-jumps
28212 Disable (or re-enable) the generation of PC-relative jump instructions.
28213
28214 @item -msoft-float
28215 @itemx -mhard-float
28216 @opindex msoft-float
28217 @opindex mhard-float
28218 Disable (or re-enable) the generation of hardware floating point
28219 instructions. This option is only significant when the target
28220 architecture is @samp{V850E2V3} or higher. If hardware floating point
28221 instructions are being generated then the C preprocessor symbol
28222 @code{__FPU_OK__} is defined, otherwise the symbol
28223 @code{__NO_FPU__} is defined.
28224
28225 @item -mloop
28226 @opindex mloop
28227 Enables the use of the e3v5 LOOP instruction. The use of this
28228 instruction is not enabled by default when the e3v5 architecture is
28229 selected because its use is still experimental.
28230
28231 @item -mrh850-abi
28232 @itemx -mghs
28233 @opindex mrh850-abi
28234 @opindex mghs
28235 Enables support for the RH850 version of the V850 ABI. This is the
28236 default. With this version of the ABI the following rules apply:
28237
28238 @itemize
28239 @item
28240 Integer sized structures and unions are returned via a memory pointer
28241 rather than a register.
28242
28243 @item
28244 Large structures and unions (more than 8 bytes in size) are passed by
28245 value.
28246
28247 @item
28248 Functions are aligned to 16-bit boundaries.
28249
28250 @item
28251 The @option{-m8byte-align} command-line option is supported.
28252
28253 @item
28254 The @option{-mdisable-callt} command-line option is enabled by
28255 default. The @option{-mno-disable-callt} command-line option is not
28256 supported.
28257 @end itemize
28258
28259 When this version of the ABI is enabled the C preprocessor symbol
28260 @code{__V850_RH850_ABI__} is defined.
28261
28262 @item -mgcc-abi
28263 @opindex mgcc-abi
28264 Enables support for the old GCC version of the V850 ABI. With this
28265 version of the ABI the following rules apply:
28266
28267 @itemize
28268 @item
28269 Integer sized structures and unions are returned in register @code{r10}.
28270
28271 @item
28272 Large structures and unions (more than 8 bytes in size) are passed by
28273 reference.
28274
28275 @item
28276 Functions are aligned to 32-bit boundaries, unless optimizing for
28277 size.
28278
28279 @item
28280 The @option{-m8byte-align} command-line option is not supported.
28281
28282 @item
28283 The @option{-mdisable-callt} command-line option is supported but not
28284 enabled by default.
28285 @end itemize
28286
28287 When this version of the ABI is enabled the C preprocessor symbol
28288 @code{__V850_GCC_ABI__} is defined.
28289
28290 @item -m8byte-align
28291 @itemx -mno-8byte-align
28292 @opindex m8byte-align
28293 @opindex mno-8byte-align
28294 Enables support for @code{double} and @code{long long} types to be
28295 aligned on 8-byte boundaries. The default is to restrict the
28296 alignment of all objects to at most 4-bytes. When
28297 @option{-m8byte-align} is in effect the C preprocessor symbol
28298 @code{__V850_8BYTE_ALIGN__} is defined.
28299
28300 @item -mbig-switch
28301 @opindex mbig-switch
28302 Generate code suitable for big switch tables. Use this option only if
28303 the assembler/linker complain about out of range branches within a switch
28304 table.
28305
28306 @item -mapp-regs
28307 @opindex mapp-regs
28308 This option causes r2 and r5 to be used in the code generated by
28309 the compiler. This setting is the default.
28310
28311 @item -mno-app-regs
28312 @opindex mno-app-regs
28313 This option causes r2 and r5 to be treated as fixed registers.
28314
28315 @end table
28316
28317 @node VAX Options
28318 @subsection VAX Options
28319 @cindex VAX options
28320
28321 These @samp{-m} options are defined for the VAX:
28322
28323 @table @gcctabopt
28324 @item -munix
28325 @opindex munix
28326 Do not output certain jump instructions (@code{aobleq} and so on)
28327 that the Unix assembler for the VAX cannot handle across long
28328 ranges.
28329
28330 @item -mgnu
28331 @opindex mgnu
28332 Do output those jump instructions, on the assumption that the
28333 GNU assembler is being used.
28334
28335 @item -mg
28336 @opindex mg
28337 Output code for G-format floating-point numbers instead of D-format.
28338 @end table
28339
28340 @node Visium Options
28341 @subsection Visium Options
28342 @cindex Visium options
28343
28344 @table @gcctabopt
28345
28346 @item -mdebug
28347 @opindex mdebug
28348 A program which performs file I/O and is destined to run on an MCM target
28349 should be linked with this option. It causes the libraries libc.a and
28350 libdebug.a to be linked. The program should be run on the target under
28351 the control of the GDB remote debugging stub.
28352
28353 @item -msim
28354 @opindex msim
28355 A program which performs file I/O and is destined to run on the simulator
28356 should be linked with option. This causes libraries libc.a and libsim.a to
28357 be linked.
28358
28359 @item -mfpu
28360 @itemx -mhard-float
28361 @opindex mfpu
28362 @opindex mhard-float
28363 Generate code containing floating-point instructions. This is the
28364 default.
28365
28366 @item -mno-fpu
28367 @itemx -msoft-float
28368 @opindex mno-fpu
28369 @opindex msoft-float
28370 Generate code containing library calls for floating-point.
28371
28372 @option{-msoft-float} changes the calling convention in the output file;
28373 therefore, it is only useful if you compile @emph{all} of a program with
28374 this option. In particular, you need to compile @file{libgcc.a}, the
28375 library that comes with GCC, with @option{-msoft-float} in order for
28376 this to work.
28377
28378 @item -mcpu=@var{cpu_type}
28379 @opindex mcpu
28380 Set the instruction set, register set, and instruction scheduling parameters
28381 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
28382 @samp{mcm}, @samp{gr5} and @samp{gr6}.
28383
28384 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
28385
28386 By default (unless configured otherwise), GCC generates code for the GR5
28387 variant of the Visium architecture.
28388
28389 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
28390 architecture. The only difference from GR5 code is that the compiler will
28391 generate block move instructions.
28392
28393 @item -mtune=@var{cpu_type}
28394 @opindex mtune
28395 Set the instruction scheduling parameters for machine type @var{cpu_type},
28396 but do not set the instruction set or register set that the option
28397 @option{-mcpu=@var{cpu_type}} would.
28398
28399 @item -msv-mode
28400 @opindex msv-mode
28401 Generate code for the supervisor mode, where there are no restrictions on
28402 the access to general registers. This is the default.
28403
28404 @item -muser-mode
28405 @opindex muser-mode
28406 Generate code for the user mode, where the access to some general registers
28407 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
28408 mode; on the GR6, only registers r29 to r31 are affected.
28409 @end table
28410
28411 @node VMS Options
28412 @subsection VMS Options
28413
28414 These @samp{-m} options are defined for the VMS implementations:
28415
28416 @table @gcctabopt
28417 @item -mvms-return-codes
28418 @opindex mvms-return-codes
28419 Return VMS condition codes from @code{main}. The default is to return POSIX-style
28420 condition (e.g.@: error) codes.
28421
28422 @item -mdebug-main=@var{prefix}
28423 @opindex mdebug-main=@var{prefix}
28424 Flag the first routine whose name starts with @var{prefix} as the main
28425 routine for the debugger.
28426
28427 @item -mmalloc64
28428 @opindex mmalloc64
28429 Default to 64-bit memory allocation routines.
28430
28431 @item -mpointer-size=@var{size}
28432 @opindex mpointer-size=@var{size}
28433 Set the default size of pointers. Possible options for @var{size} are
28434 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
28435 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
28436 The later option disables @code{pragma pointer_size}.
28437 @end table
28438
28439 @node VxWorks Options
28440 @subsection VxWorks Options
28441 @cindex VxWorks Options
28442
28443 The options in this section are defined for all VxWorks targets.
28444 Options specific to the target hardware are listed with the other
28445 options for that target.
28446
28447 @table @gcctabopt
28448 @item -mrtp
28449 @opindex mrtp
28450 GCC can generate code for both VxWorks kernels and real time processes
28451 (RTPs). This option switches from the former to the latter. It also
28452 defines the preprocessor macro @code{__RTP__}.
28453
28454 @item -non-static
28455 @opindex non-static
28456 Link an RTP executable against shared libraries rather than static
28457 libraries. The options @option{-static} and @option{-shared} can
28458 also be used for RTPs (@pxref{Link Options}); @option{-static}
28459 is the default.
28460
28461 @item -Bstatic
28462 @itemx -Bdynamic
28463 @opindex Bstatic
28464 @opindex Bdynamic
28465 These options are passed down to the linker. They are defined for
28466 compatibility with Diab.
28467
28468 @item -Xbind-lazy
28469 @opindex Xbind-lazy
28470 Enable lazy binding of function calls. This option is equivalent to
28471 @option{-Wl,-z,now} and is defined for compatibility with Diab.
28472
28473 @item -Xbind-now
28474 @opindex Xbind-now
28475 Disable lazy binding of function calls. This option is the default and
28476 is defined for compatibility with Diab.
28477 @end table
28478
28479 @node x86 Options
28480 @subsection x86 Options
28481 @cindex x86 Options
28482
28483 These @samp{-m} options are defined for the x86 family of computers.
28484
28485 @table @gcctabopt
28486
28487 @item -march=@var{cpu-type}
28488 @opindex march
28489 Generate instructions for the machine type @var{cpu-type}. In contrast to
28490 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
28491 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
28492 to generate code that may not run at all on processors other than the one
28493 indicated. Specifying @option{-march=@var{cpu-type}} implies
28494 @option{-mtune=@var{cpu-type}}.
28495
28496 The choices for @var{cpu-type} are:
28497
28498 @table @samp
28499 @item native
28500 This selects the CPU to generate code for at compilation time by determining
28501 the processor type of the compiling machine. Using @option{-march=native}
28502 enables all instruction subsets supported by the local machine (hence
28503 the result might not run on different machines). Using @option{-mtune=native}
28504 produces code optimized for the local machine under the constraints
28505 of the selected instruction set.
28506
28507 @item x86-64
28508 A generic CPU with 64-bit extensions.
28509
28510 @item i386
28511 Original Intel i386 CPU@.
28512
28513 @item i486
28514 Intel i486 CPU@. (No scheduling is implemented for this chip.)
28515
28516 @item i586
28517 @itemx pentium
28518 Intel Pentium CPU with no MMX support.
28519
28520 @item lakemont
28521 Intel Lakemont MCU, based on Intel Pentium CPU.
28522
28523 @item pentium-mmx
28524 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
28525
28526 @item pentiumpro
28527 Intel Pentium Pro CPU@.
28528
28529 @item i686
28530 When used with @option{-march}, the Pentium Pro
28531 instruction set is used, so the code runs on all i686 family chips.
28532 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
28533
28534 @item pentium2
28535 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
28536 support.
28537
28538 @item pentium3
28539 @itemx pentium3m
28540 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
28541 set support.
28542
28543 @item pentium-m
28544 Intel Pentium M; low-power version of Intel Pentium III CPU
28545 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
28546
28547 @item pentium4
28548 @itemx pentium4m
28549 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
28550
28551 @item prescott
28552 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
28553 set support.
28554
28555 @item nocona
28556 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
28557 SSE2 and SSE3 instruction set support.
28558
28559 @item core2
28560 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
28561 instruction set support.
28562
28563 @item nehalem
28564 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28565 SSE4.1, SSE4.2 and POPCNT instruction set support.
28566
28567 @item westmere
28568 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28569 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
28570
28571 @item sandybridge
28572 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28573 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
28574
28575 @item ivybridge
28576 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
28577 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
28578 instruction set support.
28579
28580 @item haswell
28581 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28582 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28583 BMI, BMI2 and F16C instruction set support.
28584
28585 @item broadwell
28586 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28587 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28588 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
28589
28590 @item skylake
28591 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28592 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28593 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
28594 XSAVES instruction set support.
28595
28596 @item bonnell
28597 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
28598 instruction set support.
28599
28600 @item silvermont
28601 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28602 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
28603
28604 @item goldmont
28605 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28606 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
28607 instruction set support.
28608
28609 @item goldmont-plus
28610 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28611 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
28612 PTWRITE, RDPID, SGX and UMIP instruction set support.
28613
28614 @item tremont
28615 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28616 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
28617 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
28618
28619 @item knl
28620 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28621 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28622 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
28623 AVX512CD instruction set support.
28624
28625 @item knm
28626 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28627 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28628 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
28629 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
28630
28631 @item skylake-avx512
28632 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
28633 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
28634 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28635 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
28636
28637 @item cannonlake
28638 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28639 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28640 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28641 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28642 AVX512IFMA, SHA and UMIP instruction set support.
28643
28644 @item icelake-client
28645 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28646 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28647 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28648 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28649 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28650 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
28651
28652 @item icelake-server
28653 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
28654 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
28655 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
28656 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
28657 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
28658 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
28659 set support.
28660
28661 @item cascadelake
28662 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28663 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28664 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28665 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
28666
28667 @item cooperlake
28668 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28669 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28670 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
28671 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
28672 set support.
28673
28674 @item tigerlake
28675 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
28676 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
28677 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
28678 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
28679 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
28680 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
28681 set support.
28682
28683 @item k6
28684 AMD K6 CPU with MMX instruction set support.
28685
28686 @item k6-2
28687 @itemx k6-3
28688 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
28689
28690 @item athlon
28691 @itemx athlon-tbird
28692 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
28693 support.
28694
28695 @item athlon-4
28696 @itemx athlon-xp
28697 @itemx athlon-mp
28698 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
28699 instruction set support.
28700
28701 @item k8
28702 @itemx opteron
28703 @itemx athlon64
28704 @itemx athlon-fx
28705 Processors based on the AMD K8 core with x86-64 instruction set support,
28706 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
28707 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
28708 instruction set extensions.)
28709
28710 @item k8-sse3
28711 @itemx opteron-sse3
28712 @itemx athlon64-sse3
28713 Improved versions of AMD K8 cores with SSE3 instruction set support.
28714
28715 @item amdfam10
28716 @itemx barcelona
28717 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
28718 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
28719 instruction set extensions.)
28720
28721 @item bdver1
28722 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
28723 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
28724 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
28725
28726 @item bdver2
28727 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
28728 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
28729 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
28730 extensions.)
28731
28732 @item bdver3
28733 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
28734 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
28735 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
28736 64-bit instruction set extensions.)
28737
28738 @item bdver4
28739 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
28740 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
28741 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
28742 SSE4.2, ABM and 64-bit instruction set extensions.)
28743
28744 @item znver1
28745 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
28746 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
28747 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
28748 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
28749 instruction set extensions.)
28750
28751 @item znver2
28752 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
28753 supersets BMI, BMI2, CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
28754 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
28755 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, RDPID,
28756 WBNOINVD, and 64-bit instruction set extensions.)
28757
28758 @item btver1
28759 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
28760 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
28761 instruction set extensions.)
28762
28763 @item btver2
28764 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
28765 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
28766 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
28767
28768 @item winchip-c6
28769 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
28770 set support.
28771
28772 @item winchip2
28773 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
28774 instruction set support.
28775
28776 @item c3
28777 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
28778 (No scheduling is implemented for this chip.)
28779
28780 @item c3-2
28781 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
28782 (No scheduling is implemented for this chip.)
28783
28784 @item c7
28785 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28786 (No scheduling is implemented for this chip.)
28787
28788 @item samuel-2
28789 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
28790 (No scheduling is implemented for this chip.)
28791
28792 @item nehemiah
28793 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
28794 (No scheduling is implemented for this chip.)
28795
28796 @item esther
28797 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
28798 (No scheduling is implemented for this chip.)
28799
28800 @item eden-x2
28801 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
28802 (No scheduling is implemented for this chip.)
28803
28804 @item eden-x4
28805 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
28806 AVX and AVX2 instruction set support.
28807 (No scheduling is implemented for this chip.)
28808
28809 @item nano
28810 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28811 instruction set support.
28812 (No scheduling is implemented for this chip.)
28813
28814 @item nano-1000
28815 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28816 instruction set support.
28817 (No scheduling is implemented for this chip.)
28818
28819 @item nano-2000
28820 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
28821 instruction set support.
28822 (No scheduling is implemented for this chip.)
28823
28824 @item nano-3000
28825 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28826 instruction set support.
28827 (No scheduling is implemented for this chip.)
28828
28829 @item nano-x2
28830 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28831 instruction set support.
28832 (No scheduling is implemented for this chip.)
28833
28834 @item nano-x4
28835 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
28836 instruction set support.
28837 (No scheduling is implemented for this chip.)
28838
28839 @item geode
28840 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
28841 @end table
28842
28843 @item -mtune=@var{cpu-type}
28844 @opindex mtune
28845 Tune to @var{cpu-type} everything applicable about the generated code, except
28846 for the ABI and the set of available instructions.
28847 While picking a specific @var{cpu-type} schedules things appropriately
28848 for that particular chip, the compiler does not generate any code that
28849 cannot run on the default machine type unless you use a
28850 @option{-march=@var{cpu-type}} option.
28851 For example, if GCC is configured for i686-pc-linux-gnu
28852 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
28853 but still runs on i686 machines.
28854
28855 The choices for @var{cpu-type} are the same as for @option{-march}.
28856 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
28857
28858 @table @samp
28859 @item generic
28860 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
28861 If you know the CPU on which your code will run, then you should use
28862 the corresponding @option{-mtune} or @option{-march} option instead of
28863 @option{-mtune=generic}. But, if you do not know exactly what CPU users
28864 of your application will have, then you should use this option.
28865
28866 As new processors are deployed in the marketplace, the behavior of this
28867 option will change. Therefore, if you upgrade to a newer version of
28868 GCC, code generation controlled by this option will change to reflect
28869 the processors
28870 that are most common at the time that version of GCC is released.
28871
28872 There is no @option{-march=generic} option because @option{-march}
28873 indicates the instruction set the compiler can use, and there is no
28874 generic instruction set applicable to all processors. In contrast,
28875 @option{-mtune} indicates the processor (or, in this case, collection of
28876 processors) for which the code is optimized.
28877
28878 @item intel
28879 Produce code optimized for the most current Intel processors, which are
28880 Haswell and Silvermont for this version of GCC. If you know the CPU
28881 on which your code will run, then you should use the corresponding
28882 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
28883 But, if you want your application performs better on both Haswell and
28884 Silvermont, then you should use this option.
28885
28886 As new Intel processors are deployed in the marketplace, the behavior of
28887 this option will change. Therefore, if you upgrade to a newer version of
28888 GCC, code generation controlled by this option will change to reflect
28889 the most current Intel processors at the time that version of GCC is
28890 released.
28891
28892 There is no @option{-march=intel} option because @option{-march} indicates
28893 the instruction set the compiler can use, and there is no common
28894 instruction set applicable to all processors. In contrast,
28895 @option{-mtune} indicates the processor (or, in this case, collection of
28896 processors) for which the code is optimized.
28897 @end table
28898
28899 @item -mcpu=@var{cpu-type}
28900 @opindex mcpu
28901 A deprecated synonym for @option{-mtune}.
28902
28903 @item -mfpmath=@var{unit}
28904 @opindex mfpmath
28905 Generate floating-point arithmetic for selected unit @var{unit}. The choices
28906 for @var{unit} are:
28907
28908 @table @samp
28909 @item 387
28910 Use the standard 387 floating-point coprocessor present on the majority of chips and
28911 emulated otherwise. Code compiled with this option runs almost everywhere.
28912 The temporary results are computed in 80-bit precision instead of the precision
28913 specified by the type, resulting in slightly different results compared to most
28914 of other chips. See @option{-ffloat-store} for more detailed description.
28915
28916 This is the default choice for non-Darwin x86-32 targets.
28917
28918 @item sse
28919 Use scalar floating-point instructions present in the SSE instruction set.
28920 This instruction set is supported by Pentium III and newer chips,
28921 and in the AMD line
28922 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
28923 instruction set supports only single-precision arithmetic, thus the double and
28924 extended-precision arithmetic are still done using 387. A later version, present
28925 only in Pentium 4 and AMD x86-64 chips, supports double-precision
28926 arithmetic too.
28927
28928 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
28929 or @option{-msse2} switches to enable SSE extensions and make this option
28930 effective. For the x86-64 compiler, these extensions are enabled by default.
28931
28932 The resulting code should be considerably faster in the majority of cases and avoid
28933 the numerical instability problems of 387 code, but may break some existing
28934 code that expects temporaries to be 80 bits.
28935
28936 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
28937 and the default choice for x86-32 targets with the SSE2 instruction set
28938 when @option{-ffast-math} is enabled.
28939
28940 @item sse,387
28941 @itemx sse+387
28942 @itemx both
28943 Attempt to utilize both instruction sets at once. This effectively doubles the
28944 amount of available registers, and on chips with separate execution units for
28945 387 and SSE the execution resources too. Use this option with care, as it is
28946 still experimental, because the GCC register allocator does not model separate
28947 functional units well, resulting in unstable performance.
28948 @end table
28949
28950 @item -masm=@var{dialect}
28951 @opindex masm=@var{dialect}
28952 Output assembly instructions using selected @var{dialect}. Also affects
28953 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
28954 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
28955 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
28956 not support @samp{intel}.
28957
28958 @item -mieee-fp
28959 @itemx -mno-ieee-fp
28960 @opindex mieee-fp
28961 @opindex mno-ieee-fp
28962 Control whether or not the compiler uses IEEE floating-point
28963 comparisons. These correctly handle the case where the result of a
28964 comparison is unordered.
28965
28966 @item -m80387
28967 @itemx -mhard-float
28968 @opindex 80387
28969 @opindex mhard-float
28970 Generate output containing 80387 instructions for floating point.
28971
28972 @item -mno-80387
28973 @itemx -msoft-float
28974 @opindex no-80387
28975 @opindex msoft-float
28976 Generate output containing library calls for floating point.
28977
28978 @strong{Warning:} the requisite libraries are not part of GCC@.
28979 Normally the facilities of the machine's usual C compiler are used, but
28980 this cannot be done directly in cross-compilation. You must make your
28981 own arrangements to provide suitable library functions for
28982 cross-compilation.
28983
28984 On machines where a function returns floating-point results in the 80387
28985 register stack, some floating-point opcodes may be emitted even if
28986 @option{-msoft-float} is used.
28987
28988 @item -mno-fp-ret-in-387
28989 @opindex mno-fp-ret-in-387
28990 @opindex mfp-ret-in-387
28991 Do not use the FPU registers for return values of functions.
28992
28993 The usual calling convention has functions return values of types
28994 @code{float} and @code{double} in an FPU register, even if there
28995 is no FPU@. The idea is that the operating system should emulate
28996 an FPU@.
28997
28998 The option @option{-mno-fp-ret-in-387} causes such values to be returned
28999 in ordinary CPU registers instead.
29000
29001 @item -mno-fancy-math-387
29002 @opindex mno-fancy-math-387
29003 @opindex mfancy-math-387
29004 Some 387 emulators do not support the @code{sin}, @code{cos} and
29005 @code{sqrt} instructions for the 387. Specify this option to avoid
29006 generating those instructions.
29007 This option is overridden when @option{-march}
29008 indicates that the target CPU always has an FPU and so the
29009 instruction does not need emulation. These
29010 instructions are not generated unless you also use the
29011 @option{-funsafe-math-optimizations} switch.
29012
29013 @item -malign-double
29014 @itemx -mno-align-double
29015 @opindex malign-double
29016 @opindex mno-align-double
29017 Control whether GCC aligns @code{double}, @code{long double}, and
29018 @code{long long} variables on a two-word boundary or a one-word
29019 boundary. Aligning @code{double} variables on a two-word boundary
29020 produces code that runs somewhat faster on a Pentium at the
29021 expense of more memory.
29022
29023 On x86-64, @option{-malign-double} is enabled by default.
29024
29025 @strong{Warning:} if you use the @option{-malign-double} switch,
29026 structures containing the above types are aligned differently than
29027 the published application binary interface specifications for the x86-32
29028 and are not binary compatible with structures in code compiled
29029 without that switch.
29030
29031 @item -m96bit-long-double
29032 @itemx -m128bit-long-double
29033 @opindex m96bit-long-double
29034 @opindex m128bit-long-double
29035 These switches control the size of @code{long double} type. The x86-32
29036 application binary interface specifies the size to be 96 bits,
29037 so @option{-m96bit-long-double} is the default in 32-bit mode.
29038
29039 Modern architectures (Pentium and newer) prefer @code{long double}
29040 to be aligned to an 8- or 16-byte boundary. In arrays or structures
29041 conforming to the ABI, this is not possible. So specifying
29042 @option{-m128bit-long-double} aligns @code{long double}
29043 to a 16-byte boundary by padding the @code{long double} with an additional
29044 32-bit zero.
29045
29046 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
29047 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
29048
29049 Notice that neither of these options enable any extra precision over the x87
29050 standard of 80 bits for a @code{long double}.
29051
29052 @strong{Warning:} if you override the default value for your target ABI, this
29053 changes the size of
29054 structures and arrays containing @code{long double} variables,
29055 as well as modifying the function calling convention for functions taking
29056 @code{long double}. Hence they are not binary-compatible
29057 with code compiled without that switch.
29058
29059 @item -mlong-double-64
29060 @itemx -mlong-double-80
29061 @itemx -mlong-double-128
29062 @opindex mlong-double-64
29063 @opindex mlong-double-80
29064 @opindex mlong-double-128
29065 These switches control the size of @code{long double} type. A size
29066 of 64 bits makes the @code{long double} type equivalent to the @code{double}
29067 type. This is the default for 32-bit Bionic C library. A size
29068 of 128 bits makes the @code{long double} type equivalent to the
29069 @code{__float128} type. This is the default for 64-bit Bionic C library.
29070
29071 @strong{Warning:} if you override the default value for your target ABI, this
29072 changes the size of
29073 structures and arrays containing @code{long double} variables,
29074 as well as modifying the function calling convention for functions taking
29075 @code{long double}. Hence they are not binary-compatible
29076 with code compiled without that switch.
29077
29078 @item -malign-data=@var{type}
29079 @opindex malign-data
29080 Control how GCC aligns variables. Supported values for @var{type} are
29081 @samp{compat} uses increased alignment value compatible uses GCC 4.8
29082 and earlier, @samp{abi} uses alignment value as specified by the
29083 psABI, and @samp{cacheline} uses increased alignment value to match
29084 the cache line size. @samp{compat} is the default.
29085
29086 @item -mlarge-data-threshold=@var{threshold}
29087 @opindex mlarge-data-threshold
29088 When @option{-mcmodel=medium} is specified, data objects larger than
29089 @var{threshold} are placed in the large data section. This value must be the
29090 same across all objects linked into the binary, and defaults to 65535.
29091
29092 @item -mrtd
29093 @opindex mrtd
29094 Use a different function-calling convention, in which functions that
29095 take a fixed number of arguments return with the @code{ret @var{num}}
29096 instruction, which pops their arguments while returning. This saves one
29097 instruction in the caller since there is no need to pop the arguments
29098 there.
29099
29100 You can specify that an individual function is called with this calling
29101 sequence with the function attribute @code{stdcall}. You can also
29102 override the @option{-mrtd} option by using the function attribute
29103 @code{cdecl}. @xref{Function Attributes}.
29104
29105 @strong{Warning:} this calling convention is incompatible with the one
29106 normally used on Unix, so you cannot use it if you need to call
29107 libraries compiled with the Unix compiler.
29108
29109 Also, you must provide function prototypes for all functions that
29110 take variable numbers of arguments (including @code{printf});
29111 otherwise incorrect code is generated for calls to those
29112 functions.
29113
29114 In addition, seriously incorrect code results if you call a
29115 function with too many arguments. (Normally, extra arguments are
29116 harmlessly ignored.)
29117
29118 @item -mregparm=@var{num}
29119 @opindex mregparm
29120 Control how many registers are used to pass integer arguments. By
29121 default, no registers are used to pass arguments, and at most 3
29122 registers can be used. You can control this behavior for a specific
29123 function by using the function attribute @code{regparm}.
29124 @xref{Function Attributes}.
29125
29126 @strong{Warning:} if you use this switch, and
29127 @var{num} is nonzero, then you must build all modules with the same
29128 value, including any libraries. This includes the system libraries and
29129 startup modules.
29130
29131 @item -msseregparm
29132 @opindex msseregparm
29133 Use SSE register passing conventions for float and double arguments
29134 and return values. You can control this behavior for a specific
29135 function by using the function attribute @code{sseregparm}.
29136 @xref{Function Attributes}.
29137
29138 @strong{Warning:} if you use this switch then you must build all
29139 modules with the same value, including any libraries. This includes
29140 the system libraries and startup modules.
29141
29142 @item -mvect8-ret-in-mem
29143 @opindex mvect8-ret-in-mem
29144 Return 8-byte vectors in memory instead of MMX registers. This is the
29145 default on VxWorks to match the ABI of the Sun Studio compilers until
29146 version 12. @emph{Only} use this option if you need to remain
29147 compatible with existing code produced by those previous compiler
29148 versions or older versions of GCC@.
29149
29150 @item -mpc32
29151 @itemx -mpc64
29152 @itemx -mpc80
29153 @opindex mpc32
29154 @opindex mpc64
29155 @opindex mpc80
29156
29157 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
29158 is specified, the significands of results of floating-point operations are
29159 rounded to 24 bits (single precision); @option{-mpc64} rounds the
29160 significands of results of floating-point operations to 53 bits (double
29161 precision) and @option{-mpc80} rounds the significands of results of
29162 floating-point operations to 64 bits (extended double precision), which is
29163 the default. When this option is used, floating-point operations in higher
29164 precisions are not available to the programmer without setting the FPU
29165 control word explicitly.
29166
29167 Setting the rounding of floating-point operations to less than the default
29168 80 bits can speed some programs by 2% or more. Note that some mathematical
29169 libraries assume that extended-precision (80-bit) floating-point operations
29170 are enabled by default; routines in such libraries could suffer significant
29171 loss of accuracy, typically through so-called ``catastrophic cancellation'',
29172 when this option is used to set the precision to less than extended precision.
29173
29174 @item -mstackrealign
29175 @opindex mstackrealign
29176 Realign the stack at entry. On the x86, the @option{-mstackrealign}
29177 option generates an alternate prologue and epilogue that realigns the
29178 run-time stack if necessary. This supports mixing legacy codes that keep
29179 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
29180 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
29181 applicable to individual functions.
29182
29183 @item -mpreferred-stack-boundary=@var{num}
29184 @opindex mpreferred-stack-boundary
29185 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
29186 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
29187 the default is 4 (16 bytes or 128 bits).
29188
29189 @strong{Warning:} When generating code for the x86-64 architecture with
29190 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
29191 used to keep the stack boundary aligned to 8 byte boundary. Since
29192 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
29193 intended to be used in controlled environment where stack space is
29194 important limitation. This option leads to wrong code when functions
29195 compiled with 16 byte stack alignment (such as functions from a standard
29196 library) are called with misaligned stack. In this case, SSE
29197 instructions may lead to misaligned memory access traps. In addition,
29198 variable arguments are handled incorrectly for 16 byte aligned
29199 objects (including x87 long double and __int128), leading to wrong
29200 results. You must build all modules with
29201 @option{-mpreferred-stack-boundary=3}, including any libraries. This
29202 includes the system libraries and startup modules.
29203
29204 @item -mincoming-stack-boundary=@var{num}
29205 @opindex mincoming-stack-boundary
29206 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
29207 boundary. If @option{-mincoming-stack-boundary} is not specified,
29208 the one specified by @option{-mpreferred-stack-boundary} is used.
29209
29210 On Pentium and Pentium Pro, @code{double} and @code{long double} values
29211 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
29212 suffer significant run time performance penalties. On Pentium III, the
29213 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
29214 properly if it is not 16-byte aligned.
29215
29216 To ensure proper alignment of this values on the stack, the stack boundary
29217 must be as aligned as that required by any value stored on the stack.
29218 Further, every function must be generated such that it keeps the stack
29219 aligned. Thus calling a function compiled with a higher preferred
29220 stack boundary from a function compiled with a lower preferred stack
29221 boundary most likely misaligns the stack. It is recommended that
29222 libraries that use callbacks always use the default setting.
29223
29224 This extra alignment does consume extra stack space, and generally
29225 increases code size. Code that is sensitive to stack space usage, such
29226 as embedded systems and operating system kernels, may want to reduce the
29227 preferred alignment to @option{-mpreferred-stack-boundary=2}.
29228
29229 @need 200
29230 @item -mmmx
29231 @opindex mmmx
29232 @need 200
29233 @itemx -msse
29234 @opindex msse
29235 @need 200
29236 @itemx -msse2
29237 @opindex msse2
29238 @need 200
29239 @itemx -msse3
29240 @opindex msse3
29241 @need 200
29242 @itemx -mssse3
29243 @opindex mssse3
29244 @need 200
29245 @itemx -msse4
29246 @opindex msse4
29247 @need 200
29248 @itemx -msse4a
29249 @opindex msse4a
29250 @need 200
29251 @itemx -msse4.1
29252 @opindex msse4.1
29253 @need 200
29254 @itemx -msse4.2
29255 @opindex msse4.2
29256 @need 200
29257 @itemx -mavx
29258 @opindex mavx
29259 @need 200
29260 @itemx -mavx2
29261 @opindex mavx2
29262 @need 200
29263 @itemx -mavx512f
29264 @opindex mavx512f
29265 @need 200
29266 @itemx -mavx512pf
29267 @opindex mavx512pf
29268 @need 200
29269 @itemx -mavx512er
29270 @opindex mavx512er
29271 @need 200
29272 @itemx -mavx512cd
29273 @opindex mavx512cd
29274 @need 200
29275 @itemx -mavx512vl
29276 @opindex mavx512vl
29277 @need 200
29278 @itemx -mavx512bw
29279 @opindex mavx512bw
29280 @need 200
29281 @itemx -mavx512dq
29282 @opindex mavx512dq
29283 @need 200
29284 @itemx -mavx512ifma
29285 @opindex mavx512ifma
29286 @need 200
29287 @itemx -mavx512vbmi
29288 @opindex mavx512vbmi
29289 @need 200
29290 @itemx -msha
29291 @opindex msha
29292 @need 200
29293 @itemx -maes
29294 @opindex maes
29295 @need 200
29296 @itemx -mpclmul
29297 @opindex mpclmul
29298 @need 200
29299 @itemx -mclflushopt
29300 @opindex mclflushopt
29301 @need 200
29302 @itemx -mclwb
29303 @opindex mclwb
29304 @need 200
29305 @itemx -mfsgsbase
29306 @opindex mfsgsbase
29307 @need 200
29308 @itemx -mptwrite
29309 @opindex mptwrite
29310 @need 200
29311 @itemx -mrdrnd
29312 @opindex mrdrnd
29313 @need 200
29314 @itemx -mf16c
29315 @opindex mf16c
29316 @need 200
29317 @itemx -mfma
29318 @opindex mfma
29319 @need 200
29320 @itemx -mpconfig
29321 @opindex mpconfig
29322 @need 200
29323 @itemx -mwbnoinvd
29324 @opindex mwbnoinvd
29325 @need 200
29326 @itemx -mfma4
29327 @opindex mfma4
29328 @need 200
29329 @itemx -mprfchw
29330 @opindex mprfchw
29331 @need 200
29332 @itemx -mrdpid
29333 @opindex mrdpid
29334 @need 200
29335 @itemx -mprefetchwt1
29336 @opindex mprefetchwt1
29337 @need 200
29338 @itemx -mrdseed
29339 @opindex mrdseed
29340 @need 200
29341 @itemx -msgx
29342 @opindex msgx
29343 @need 200
29344 @itemx -mxop
29345 @opindex mxop
29346 @need 200
29347 @itemx -mlwp
29348 @opindex mlwp
29349 @need 200
29350 @itemx -m3dnow
29351 @opindex m3dnow
29352 @need 200
29353 @itemx -m3dnowa
29354 @opindex m3dnowa
29355 @need 200
29356 @itemx -mpopcnt
29357 @opindex mpopcnt
29358 @need 200
29359 @itemx -mabm
29360 @opindex mabm
29361 @need 200
29362 @itemx -madx
29363 @opindex madx
29364 @need 200
29365 @itemx -mbmi
29366 @opindex mbmi
29367 @need 200
29368 @itemx -mbmi2
29369 @opindex mbmi2
29370 @need 200
29371 @itemx -mlzcnt
29372 @opindex mlzcnt
29373 @need 200
29374 @itemx -mfxsr
29375 @opindex mfxsr
29376 @need 200
29377 @itemx -mxsave
29378 @opindex mxsave
29379 @need 200
29380 @itemx -mxsaveopt
29381 @opindex mxsaveopt
29382 @need 200
29383 @itemx -mxsavec
29384 @opindex mxsavec
29385 @need 200
29386 @itemx -mxsaves
29387 @opindex mxsaves
29388 @need 200
29389 @itemx -mrtm
29390 @opindex mrtm
29391 @need 200
29392 @itemx -mhle
29393 @opindex mhle
29394 @need 200
29395 @itemx -mtbm
29396 @opindex mtbm
29397 @need 200
29398 @itemx -mmwaitx
29399 @opindex mmwaitx
29400 @need 200
29401 @itemx -mclzero
29402 @opindex mclzero
29403 @need 200
29404 @itemx -mpku
29405 @opindex mpku
29406 @need 200
29407 @itemx -mavx512vbmi2
29408 @opindex mavx512vbmi2
29409 @need 200
29410 @itemx -mavx512bf16
29411 @opindex mavx512bf16
29412 @need 200
29413 @itemx -mgfni
29414 @opindex mgfni
29415 @need 200
29416 @itemx -mvaes
29417 @opindex mvaes
29418 @need 200
29419 @itemx -mwaitpkg
29420 @opindex mwaitpkg
29421 @need 200
29422 @itemx -mvpclmulqdq
29423 @opindex mvpclmulqdq
29424 @need 200
29425 @itemx -mavx512bitalg
29426 @opindex mavx512bitalg
29427 @need 200
29428 @itemx -mmovdiri
29429 @opindex mmovdiri
29430 @need 200
29431 @itemx -mmovdir64b
29432 @opindex mmovdir64b
29433 @need 200
29434 @itemx -menqcmd
29435 @opindex menqcmd
29436 @need 200
29437 @itemx -mavx512vpopcntdq
29438 @opindex mavx512vpopcntdq
29439 @need 200
29440 @itemx -mavx512vp2intersect
29441 @opindex mavx512vp2intersect
29442 @need 200
29443 @itemx -mavx5124fmaps
29444 @opindex mavx5124fmaps
29445 @need 200
29446 @itemx -mavx512vnni
29447 @opindex mavx512vnni
29448 @need 200
29449 @itemx -mavx5124vnniw
29450 @opindex mavx5124vnniw
29451 @need 200
29452 @itemx -mcldemote
29453 @opindex mcldemote
29454 These switches enable the use of instructions in the MMX, SSE,
29455 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
29456 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
29457 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
29458 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
29459 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
29460 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
29461 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
29462 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
29463 extended instruction sets. Each has a corresponding @option{-mno-} option to
29464 disable use of these instructions.
29465
29466 These extensions are also available as built-in functions: see
29467 @ref{x86 Built-in Functions}, for details of the functions enabled and
29468 disabled by these switches.
29469
29470 To generate SSE/SSE2 instructions automatically from floating-point
29471 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
29472
29473 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
29474 generates new AVX instructions or AVX equivalence for all SSEx instructions
29475 when needed.
29476
29477 These options enable GCC to use these extended instructions in
29478 generated code, even without @option{-mfpmath=sse}. Applications that
29479 perform run-time CPU detection must compile separate files for each
29480 supported architecture, using the appropriate flags. In particular,
29481 the file containing the CPU detection code should be compiled without
29482 these options.
29483
29484 @item -mdump-tune-features
29485 @opindex mdump-tune-features
29486 This option instructs GCC to dump the names of the x86 performance
29487 tuning features and default settings. The names can be used in
29488 @option{-mtune-ctrl=@var{feature-list}}.
29489
29490 @item -mtune-ctrl=@var{feature-list}
29491 @opindex mtune-ctrl=@var{feature-list}
29492 This option is used to do fine grain control of x86 code generation features.
29493 @var{feature-list} is a comma separated list of @var{feature} names. See also
29494 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
29495 on if it is not preceded with @samp{^}, otherwise, it is turned off.
29496 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
29497 developers. Using it may lead to code paths not covered by testing and can
29498 potentially result in compiler ICEs or runtime errors.
29499
29500 @item -mno-default
29501 @opindex mno-default
29502 This option instructs GCC to turn off all tunable features. See also
29503 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
29504
29505 @item -mcld
29506 @opindex mcld
29507 This option instructs GCC to emit a @code{cld} instruction in the prologue
29508 of functions that use string instructions. String instructions depend on
29509 the DF flag to select between autoincrement or autodecrement mode. While the
29510 ABI specifies the DF flag to be cleared on function entry, some operating
29511 systems violate this specification by not clearing the DF flag in their
29512 exception dispatchers. The exception handler can be invoked with the DF flag
29513 set, which leads to wrong direction mode when string instructions are used.
29514 This option can be enabled by default on 32-bit x86 targets by configuring
29515 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
29516 instructions can be suppressed with the @option{-mno-cld} compiler option
29517 in this case.
29518
29519 @item -mvzeroupper
29520 @opindex mvzeroupper
29521 This option instructs GCC to emit a @code{vzeroupper} instruction
29522 before a transfer of control flow out of the function to minimize
29523 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
29524 intrinsics.
29525
29526 @item -mprefer-avx128
29527 @opindex mprefer-avx128
29528 This option instructs GCC to use 128-bit AVX instructions instead of
29529 256-bit AVX instructions in the auto-vectorizer.
29530
29531 @item -mprefer-vector-width=@var{opt}
29532 @opindex mprefer-vector-width
29533 This option instructs GCC to use @var{opt}-bit vector width in instructions
29534 instead of default on the selected platform.
29535
29536 @table @samp
29537 @item none
29538 No extra limitations applied to GCC other than defined by the selected platform.
29539
29540 @item 128
29541 Prefer 128-bit vector width for instructions.
29542
29543 @item 256
29544 Prefer 256-bit vector width for instructions.
29545
29546 @item 512
29547 Prefer 512-bit vector width for instructions.
29548 @end table
29549
29550 @item -mcx16
29551 @opindex mcx16
29552 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
29553 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
29554 objects. This is useful for atomic updates of data structures exceeding one
29555 machine word in size. The compiler uses this instruction to implement
29556 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
29557 128-bit integers, a library call is always used.
29558
29559 @item -msahf
29560 @opindex msahf
29561 This option enables generation of @code{SAHF} instructions in 64-bit code.
29562 Early Intel Pentium 4 CPUs with Intel 64 support,
29563 prior to the introduction of Pentium 4 G1 step in December 2005,
29564 lacked the @code{LAHF} and @code{SAHF} instructions
29565 which are supported by AMD64.
29566 These are load and store instructions, respectively, for certain status flags.
29567 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
29568 @code{drem}, and @code{remainder} built-in functions;
29569 see @ref{Other Builtins} for details.
29570
29571 @item -mmovbe
29572 @opindex mmovbe
29573 This option enables use of the @code{movbe} instruction to implement
29574 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
29575
29576 @item -mshstk
29577 @opindex mshstk
29578 The @option{-mshstk} option enables shadow stack built-in functions
29579 from x86 Control-flow Enforcement Technology (CET).
29580
29581 @item -mcrc32
29582 @opindex mcrc32
29583 This option enables built-in functions @code{__builtin_ia32_crc32qi},
29584 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
29585 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
29586
29587 @item -mrecip
29588 @opindex mrecip
29589 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
29590 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
29591 with an additional Newton-Raphson step
29592 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
29593 (and their vectorized
29594 variants) for single-precision floating-point arguments. These instructions
29595 are generated only when @option{-funsafe-math-optimizations} is enabled
29596 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
29597 Note that while the throughput of the sequence is higher than the throughput
29598 of the non-reciprocal instruction, the precision of the sequence can be
29599 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
29600
29601 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
29602 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
29603 combination), and doesn't need @option{-mrecip}.
29604
29605 Also note that GCC emits the above sequence with additional Newton-Raphson step
29606 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
29607 already with @option{-ffast-math} (or the above option combination), and
29608 doesn't need @option{-mrecip}.
29609
29610 @item -mrecip=@var{opt}
29611 @opindex mrecip=opt
29612 This option controls which reciprocal estimate instructions
29613 may be used. @var{opt} is a comma-separated list of options, which may
29614 be preceded by a @samp{!} to invert the option:
29615
29616 @table @samp
29617 @item all
29618 Enable all estimate instructions.
29619
29620 @item default
29621 Enable the default instructions, equivalent to @option{-mrecip}.
29622
29623 @item none
29624 Disable all estimate instructions, equivalent to @option{-mno-recip}.
29625
29626 @item div
29627 Enable the approximation for scalar division.
29628
29629 @item vec-div
29630 Enable the approximation for vectorized division.
29631
29632 @item sqrt
29633 Enable the approximation for scalar square root.
29634
29635 @item vec-sqrt
29636 Enable the approximation for vectorized square root.
29637 @end table
29638
29639 So, for example, @option{-mrecip=all,!sqrt} enables
29640 all of the reciprocal approximations, except for square root.
29641
29642 @item -mveclibabi=@var{type}
29643 @opindex mveclibabi
29644 Specifies the ABI type to use for vectorizing intrinsics using an
29645 external library. Supported values for @var{type} are @samp{svml}
29646 for the Intel short
29647 vector math library and @samp{acml} for the AMD math core library.
29648 To use this option, both @option{-ftree-vectorize} and
29649 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
29650 ABI-compatible library must be specified at link time.
29651
29652 GCC currently emits calls to @code{vmldExp2},
29653 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
29654 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
29655 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
29656 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
29657 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
29658 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
29659 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
29660 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
29661 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
29662 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
29663 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
29664 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
29665 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
29666 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
29667 when @option{-mveclibabi=acml} is used.
29668
29669 @item -mabi=@var{name}
29670 @opindex mabi
29671 Generate code for the specified calling convention. Permissible values
29672 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
29673 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
29674 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
29675 You can control this behavior for specific functions by
29676 using the function attributes @code{ms_abi} and @code{sysv_abi}.
29677 @xref{Function Attributes}.
29678
29679 @item -mforce-indirect-call
29680 @opindex mforce-indirect-call
29681 Force all calls to functions to be indirect. This is useful
29682 when using Intel Processor Trace where it generates more precise timing
29683 information for function calls.
29684
29685 @item -mmanual-endbr
29686 @opindex mmanual-endbr
29687 Insert ENDBR instruction at function entry only via the @code{cf_check}
29688 function attribute. This is useful when used with the option
29689 @option{-fcf-protection=branch} to control ENDBR insertion at the
29690 function entry.
29691
29692 @item -mcall-ms2sysv-xlogues
29693 @opindex mcall-ms2sysv-xlogues
29694 @opindex mno-call-ms2sysv-xlogues
29695 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
29696 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
29697 default, the code for saving and restoring these registers is emitted inline,
29698 resulting in fairly lengthy prologues and epilogues. Using
29699 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
29700 use stubs in the static portion of libgcc to perform these saves and restores,
29701 thus reducing function size at the cost of a few extra instructions.
29702
29703 @item -mtls-dialect=@var{type}
29704 @opindex mtls-dialect
29705 Generate code to access thread-local storage using the @samp{gnu} or
29706 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
29707 @samp{gnu2} is more efficient, but it may add compile- and run-time
29708 requirements that cannot be satisfied on all systems.
29709
29710 @item -mpush-args
29711 @itemx -mno-push-args
29712 @opindex mpush-args
29713 @opindex mno-push-args
29714 Use PUSH operations to store outgoing parameters. This method is shorter
29715 and usually equally fast as method using SUB/MOV operations and is enabled
29716 by default. In some cases disabling it may improve performance because of
29717 improved scheduling and reduced dependencies.
29718
29719 @item -maccumulate-outgoing-args
29720 @opindex maccumulate-outgoing-args
29721 If enabled, the maximum amount of space required for outgoing arguments is
29722 computed in the function prologue. This is faster on most modern CPUs
29723 because of reduced dependencies, improved scheduling and reduced stack usage
29724 when the preferred stack boundary is not equal to 2. The drawback is a notable
29725 increase in code size. This switch implies @option{-mno-push-args}.
29726
29727 @item -mthreads
29728 @opindex mthreads
29729 Support thread-safe exception handling on MinGW. Programs that rely
29730 on thread-safe exception handling must compile and link all code with the
29731 @option{-mthreads} option. When compiling, @option{-mthreads} defines
29732 @option{-D_MT}; when linking, it links in a special thread helper library
29733 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
29734
29735 @item -mms-bitfields
29736 @itemx -mno-ms-bitfields
29737 @opindex mms-bitfields
29738 @opindex mno-ms-bitfields
29739
29740 Enable/disable bit-field layout compatible with the native Microsoft
29741 Windows compiler.
29742
29743 If @code{packed} is used on a structure, or if bit-fields are used,
29744 it may be that the Microsoft ABI lays out the structure differently
29745 than the way GCC normally does. Particularly when moving packed
29746 data between functions compiled with GCC and the native Microsoft compiler
29747 (either via function call or as data in a file), it may be necessary to access
29748 either format.
29749
29750 This option is enabled by default for Microsoft Windows
29751 targets. This behavior can also be controlled locally by use of variable
29752 or type attributes. For more information, see @ref{x86 Variable Attributes}
29753 and @ref{x86 Type Attributes}.
29754
29755 The Microsoft structure layout algorithm is fairly simple with the exception
29756 of the bit-field packing.
29757 The padding and alignment of members of structures and whether a bit-field
29758 can straddle a storage-unit boundary are determine by these rules:
29759
29760 @enumerate
29761 @item Structure members are stored sequentially in the order in which they are
29762 declared: the first member has the lowest memory address and the last member
29763 the highest.
29764
29765 @item Every data object has an alignment requirement. The alignment requirement
29766 for all data except structures, unions, and arrays is either the size of the
29767 object or the current packing size (specified with either the
29768 @code{aligned} attribute or the @code{pack} pragma),
29769 whichever is less. For structures, unions, and arrays,
29770 the alignment requirement is the largest alignment requirement of its members.
29771 Every object is allocated an offset so that:
29772
29773 @smallexample
29774 offset % alignment_requirement == 0
29775 @end smallexample
29776
29777 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
29778 unit if the integral types are the same size and if the next bit-field fits
29779 into the current allocation unit without crossing the boundary imposed by the
29780 common alignment requirements of the bit-fields.
29781 @end enumerate
29782
29783 MSVC interprets zero-length bit-fields in the following ways:
29784
29785 @enumerate
29786 @item If a zero-length bit-field is inserted between two bit-fields that
29787 are normally coalesced, the bit-fields are not coalesced.
29788
29789 For example:
29790
29791 @smallexample
29792 struct
29793 @{
29794 unsigned long bf_1 : 12;
29795 unsigned long : 0;
29796 unsigned long bf_2 : 12;
29797 @} t1;
29798 @end smallexample
29799
29800 @noindent
29801 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
29802 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
29803
29804 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
29805 alignment of the zero-length bit-field is greater than the member that follows it,
29806 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
29807
29808 For example:
29809
29810 @smallexample
29811 struct
29812 @{
29813 char foo : 4;
29814 short : 0;
29815 char bar;
29816 @} t2;
29817
29818 struct
29819 @{
29820 char foo : 4;
29821 short : 0;
29822 double bar;
29823 @} t3;
29824 @end smallexample
29825
29826 @noindent
29827 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
29828 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
29829 bit-field does not affect the alignment of @code{bar} or, as a result, the size
29830 of the structure.
29831
29832 Taking this into account, it is important to note the following:
29833
29834 @enumerate
29835 @item If a zero-length bit-field follows a normal bit-field, the type of the
29836 zero-length bit-field may affect the alignment of the structure as whole. For
29837 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
29838 normal bit-field, and is of type short.
29839
29840 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
29841 still affect the alignment of the structure:
29842
29843 @smallexample
29844 struct
29845 @{
29846 char foo : 6;
29847 long : 0;
29848 @} t4;
29849 @end smallexample
29850
29851 @noindent
29852 Here, @code{t4} takes up 4 bytes.
29853 @end enumerate
29854
29855 @item Zero-length bit-fields following non-bit-field members are ignored:
29856
29857 @smallexample
29858 struct
29859 @{
29860 char foo;
29861 long : 0;
29862 char bar;
29863 @} t5;
29864 @end smallexample
29865
29866 @noindent
29867 Here, @code{t5} takes up 2 bytes.
29868 @end enumerate
29869
29870
29871 @item -mno-align-stringops
29872 @opindex mno-align-stringops
29873 @opindex malign-stringops
29874 Do not align the destination of inlined string operations. This switch reduces
29875 code size and improves performance in case the destination is already aligned,
29876 but GCC doesn't know about it.
29877
29878 @item -minline-all-stringops
29879 @opindex minline-all-stringops
29880 By default GCC inlines string operations only when the destination is
29881 known to be aligned to least a 4-byte boundary.
29882 This enables more inlining and increases code
29883 size, but may improve performance of code that depends on fast
29884 @code{memcpy} and @code{memset} for short lengths.
29885 The option enables inline expansion of @code{strlen} for all
29886 pointer alignments.
29887
29888 @item -minline-stringops-dynamically
29889 @opindex minline-stringops-dynamically
29890 For string operations of unknown size, use run-time checks with
29891 inline code for small blocks and a library call for large blocks.
29892
29893 @item -mstringop-strategy=@var{alg}
29894 @opindex mstringop-strategy=@var{alg}
29895 Override the internal decision heuristic for the particular algorithm to use
29896 for inlining string operations. The allowed values for @var{alg} are:
29897
29898 @table @samp
29899 @item rep_byte
29900 @itemx rep_4byte
29901 @itemx rep_8byte
29902 Expand using i386 @code{rep} prefix of the specified size.
29903
29904 @item byte_loop
29905 @itemx loop
29906 @itemx unrolled_loop
29907 Expand into an inline loop.
29908
29909 @item libcall
29910 Always use a library call.
29911 @end table
29912
29913 @item -mmemcpy-strategy=@var{strategy}
29914 @opindex mmemcpy-strategy=@var{strategy}
29915 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
29916 should be inlined and what inline algorithm to use when the expected size
29917 of the copy operation is known. @var{strategy}
29918 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
29919 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
29920 the max byte size with which inline algorithm @var{alg} is allowed. For the last
29921 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
29922 in the list must be specified in increasing order. The minimal byte size for
29923 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
29924 preceding range.
29925
29926 @item -mmemset-strategy=@var{strategy}
29927 @opindex mmemset-strategy=@var{strategy}
29928 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
29929 @code{__builtin_memset} expansion.
29930
29931 @item -momit-leaf-frame-pointer
29932 @opindex momit-leaf-frame-pointer
29933 Don't keep the frame pointer in a register for leaf functions. This
29934 avoids the instructions to save, set up, and restore frame pointers and
29935 makes an extra register available in leaf functions. The option
29936 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
29937 which might make debugging harder.
29938
29939 @item -mtls-direct-seg-refs
29940 @itemx -mno-tls-direct-seg-refs
29941 @opindex mtls-direct-seg-refs
29942 Controls whether TLS variables may be accessed with offsets from the
29943 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
29944 or whether the thread base pointer must be added. Whether or not this
29945 is valid depends on the operating system, and whether it maps the
29946 segment to cover the entire TLS area.
29947
29948 For systems that use the GNU C Library, the default is on.
29949
29950 @item -msse2avx
29951 @itemx -mno-sse2avx
29952 @opindex msse2avx
29953 Specify that the assembler should encode SSE instructions with VEX
29954 prefix. The option @option{-mavx} turns this on by default.
29955
29956 @item -mfentry
29957 @itemx -mno-fentry
29958 @opindex mfentry
29959 If profiling is active (@option{-pg}), put the profiling
29960 counter call before the prologue.
29961 Note: On x86 architectures the attribute @code{ms_hook_prologue}
29962 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
29963
29964 @item -mrecord-mcount
29965 @itemx -mno-record-mcount
29966 @opindex mrecord-mcount
29967 If profiling is active (@option{-pg}), generate a __mcount_loc section
29968 that contains pointers to each profiling call. This is useful for
29969 automatically patching and out calls.
29970
29971 @item -mnop-mcount
29972 @itemx -mno-nop-mcount
29973 @opindex mnop-mcount
29974 If profiling is active (@option{-pg}), generate the calls to
29975 the profiling functions as NOPs. This is useful when they
29976 should be patched in later dynamically. This is likely only
29977 useful together with @option{-mrecord-mcount}.
29978
29979 @item -minstrument-return=@var{type}
29980 @opindex minstrument-return
29981 Instrument function exit in -pg -mfentry instrumented functions with
29982 call to specified function. This only instruments true returns ending
29983 with ret, but not sibling calls ending with jump. Valid types
29984 are @var{none} to not instrument, @var{call} to generate a call to __return__,
29985 or @var{nop5} to generate a 5 byte nop.
29986
29987 @item -mrecord-return
29988 @itemx -mno-record-return
29989 @opindex mrecord-return
29990 Generate a __return_loc section pointing to all return instrumentation code.
29991
29992 @item -mfentry-name=@var{name}
29993 @opindex mfentry-name
29994 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
29995
29996 @item -mfentry-section=@var{name}
29997 @opindex mfentry-section
29998 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
29999
30000 @item -mskip-rax-setup
30001 @itemx -mno-skip-rax-setup
30002 @opindex mskip-rax-setup
30003 When generating code for the x86-64 architecture with SSE extensions
30004 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
30005 register when there are no variable arguments passed in vector registers.
30006
30007 @strong{Warning:} Since RAX register is used to avoid unnecessarily
30008 saving vector registers on stack when passing variable arguments, the
30009 impacts of this option are callees may waste some stack space,
30010 misbehave or jump to a random location. GCC 4.4 or newer don't have
30011 those issues, regardless the RAX register value.
30012
30013 @item -m8bit-idiv
30014 @itemx -mno-8bit-idiv
30015 @opindex m8bit-idiv
30016 On some processors, like Intel Atom, 8-bit unsigned integer divide is
30017 much faster than 32-bit/64-bit integer divide. This option generates a
30018 run-time check. If both dividend and divisor are within range of 0
30019 to 255, 8-bit unsigned integer divide is used instead of
30020 32-bit/64-bit integer divide.
30021
30022 @item -mavx256-split-unaligned-load
30023 @itemx -mavx256-split-unaligned-store
30024 @opindex mavx256-split-unaligned-load
30025 @opindex mavx256-split-unaligned-store
30026 Split 32-byte AVX unaligned load and store.
30027
30028 @item -mstack-protector-guard=@var{guard}
30029 @itemx -mstack-protector-guard-reg=@var{reg}
30030 @itemx -mstack-protector-guard-offset=@var{offset}
30031 @opindex mstack-protector-guard
30032 @opindex mstack-protector-guard-reg
30033 @opindex mstack-protector-guard-offset
30034 Generate stack protection code using canary at @var{guard}. Supported
30035 locations are @samp{global} for global canary or @samp{tls} for per-thread
30036 canary in the TLS block (the default). This option has effect only when
30037 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
30038
30039 With the latter choice the options
30040 @option{-mstack-protector-guard-reg=@var{reg}} and
30041 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
30042 which segment register (@code{%fs} or @code{%gs}) to use as base register
30043 for reading the canary, and from what offset from that base register.
30044 The default for those is as specified in the relevant ABI.
30045
30046 @item -mgeneral-regs-only
30047 @opindex mgeneral-regs-only
30048 Generate code that uses only the general-purpose registers. This
30049 prevents the compiler from using floating-point, vector, mask and bound
30050 registers.
30051
30052 @item -mindirect-branch=@var{choice}
30053 @opindex mindirect-branch
30054 Convert indirect call and jump with @var{choice}. The default is
30055 @samp{keep}, which keeps indirect call and jump unmodified.
30056 @samp{thunk} converts indirect call and jump to call and return thunk.
30057 @samp{thunk-inline} converts indirect call and jump to inlined call
30058 and return thunk. @samp{thunk-extern} converts indirect call and jump
30059 to external call and return thunk provided in a separate object file.
30060 You can control this behavior for a specific function by using the
30061 function attribute @code{indirect_branch}. @xref{Function Attributes}.
30062
30063 Note that @option{-mcmodel=large} is incompatible with
30064 @option{-mindirect-branch=thunk} and
30065 @option{-mindirect-branch=thunk-extern} since the thunk function may
30066 not be reachable in the large code model.
30067
30068 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
30069 @option{-fcf-protection=branch} since the external thunk cannot be modified
30070 to disable control-flow check.
30071
30072 @item -mfunction-return=@var{choice}
30073 @opindex mfunction-return
30074 Convert function return with @var{choice}. The default is @samp{keep},
30075 which keeps function return unmodified. @samp{thunk} converts function
30076 return to call and return thunk. @samp{thunk-inline} converts function
30077 return to inlined call and return thunk. @samp{thunk-extern} converts
30078 function return to external call and return thunk provided in a separate
30079 object file. You can control this behavior for a specific function by
30080 using the function attribute @code{function_return}.
30081 @xref{Function Attributes}.
30082
30083 Note that @option{-mcmodel=large} is incompatible with
30084 @option{-mfunction-return=thunk} and
30085 @option{-mfunction-return=thunk-extern} since the thunk function may
30086 not be reachable in the large code model.
30087
30088
30089 @item -mindirect-branch-register
30090 @opindex mindirect-branch-register
30091 Force indirect call and jump via register.
30092
30093 @end table
30094
30095 These @samp{-m} switches are supported in addition to the above
30096 on x86-64 processors in 64-bit environments.
30097
30098 @table @gcctabopt
30099 @item -m32
30100 @itemx -m64
30101 @itemx -mx32
30102 @itemx -m16
30103 @itemx -miamcu
30104 @opindex m32
30105 @opindex m64
30106 @opindex mx32
30107 @opindex m16
30108 @opindex miamcu
30109 Generate code for a 16-bit, 32-bit or 64-bit environment.
30110 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
30111 to 32 bits, and
30112 generates code that runs on any i386 system.
30113
30114 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
30115 types to 64 bits, and generates code for the x86-64 architecture.
30116 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
30117 and @option{-mdynamic-no-pic} options.
30118
30119 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
30120 to 32 bits, and
30121 generates code for the x86-64 architecture.
30122
30123 The @option{-m16} option is the same as @option{-m32}, except for that
30124 it outputs the @code{.code16gcc} assembly directive at the beginning of
30125 the assembly output so that the binary can run in 16-bit mode.
30126
30127 The @option{-miamcu} option generates code which conforms to Intel MCU
30128 psABI. It requires the @option{-m32} option to be turned on.
30129
30130 @item -mno-red-zone
30131 @opindex mno-red-zone
30132 @opindex mred-zone
30133 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
30134 by the x86-64 ABI; it is a 128-byte area beyond the location of the
30135 stack pointer that is not modified by signal or interrupt handlers
30136 and therefore can be used for temporary data without adjusting the stack
30137 pointer. The flag @option{-mno-red-zone} disables this red zone.
30138
30139 @item -mcmodel=small
30140 @opindex mcmodel=small
30141 Generate code for the small code model: the program and its symbols must
30142 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
30143 Programs can be statically or dynamically linked. This is the default
30144 code model.
30145
30146 @item -mcmodel=kernel
30147 @opindex mcmodel=kernel
30148 Generate code for the kernel code model. The kernel runs in the
30149 negative 2 GB of the address space.
30150 This model has to be used for Linux kernel code.
30151
30152 @item -mcmodel=medium
30153 @opindex mcmodel=medium
30154 Generate code for the medium model: the program is linked in the lower 2
30155 GB of the address space. Small symbols are also placed there. Symbols
30156 with sizes larger than @option{-mlarge-data-threshold} are put into
30157 large data or BSS sections and can be located above 2GB. Programs can
30158 be statically or dynamically linked.
30159
30160 @item -mcmodel=large
30161 @opindex mcmodel=large
30162 Generate code for the large model. This model makes no assumptions
30163 about addresses and sizes of sections.
30164
30165 @item -maddress-mode=long
30166 @opindex maddress-mode=long
30167 Generate code for long address mode. This is only supported for 64-bit
30168 and x32 environments. It is the default address mode for 64-bit
30169 environments.
30170
30171 @item -maddress-mode=short
30172 @opindex maddress-mode=short
30173 Generate code for short address mode. This is only supported for 32-bit
30174 and x32 environments. It is the default address mode for 32-bit and
30175 x32 environments.
30176 @end table
30177
30178 @node x86 Windows Options
30179 @subsection x86 Windows Options
30180 @cindex x86 Windows Options
30181 @cindex Windows Options for x86
30182
30183 These additional options are available for Microsoft Windows targets:
30184
30185 @table @gcctabopt
30186 @item -mconsole
30187 @opindex mconsole
30188 This option
30189 specifies that a console application is to be generated, by
30190 instructing the linker to set the PE header subsystem type
30191 required for console applications.
30192 This option is available for Cygwin and MinGW targets and is
30193 enabled by default on those targets.
30194
30195 @item -mdll
30196 @opindex mdll
30197 This option is available for Cygwin and MinGW targets. It
30198 specifies that a DLL---a dynamic link library---is to be
30199 generated, enabling the selection of the required runtime
30200 startup object and entry point.
30201
30202 @item -mnop-fun-dllimport
30203 @opindex mnop-fun-dllimport
30204 This option is available for Cygwin and MinGW targets. It
30205 specifies that the @code{dllimport} attribute should be ignored.
30206
30207 @item -mthread
30208 @opindex mthread
30209 This option is available for MinGW targets. It specifies
30210 that MinGW-specific thread support is to be used.
30211
30212 @item -municode
30213 @opindex municode
30214 This option is available for MinGW-w64 targets. It causes
30215 the @code{UNICODE} preprocessor macro to be predefined, and
30216 chooses Unicode-capable runtime startup code.
30217
30218 @item -mwin32
30219 @opindex mwin32
30220 This option is available for Cygwin and MinGW targets. It
30221 specifies that the typical Microsoft Windows predefined macros are to
30222 be set in the pre-processor, but does not influence the choice
30223 of runtime library/startup code.
30224
30225 @item -mwindows
30226 @opindex mwindows
30227 This option is available for Cygwin and MinGW targets. It
30228 specifies that a GUI application is to be generated by
30229 instructing the linker to set the PE header subsystem type
30230 appropriately.
30231
30232 @item -fno-set-stack-executable
30233 @opindex fno-set-stack-executable
30234 @opindex fset-stack-executable
30235 This option is available for MinGW targets. It specifies that
30236 the executable flag for the stack used by nested functions isn't
30237 set. This is necessary for binaries running in kernel mode of
30238 Microsoft Windows, as there the User32 API, which is used to set executable
30239 privileges, isn't available.
30240
30241 @item -fwritable-relocated-rdata
30242 @opindex fno-writable-relocated-rdata
30243 @opindex fwritable-relocated-rdata
30244 This option is available for MinGW and Cygwin targets. It specifies
30245 that relocated-data in read-only section is put into the @code{.data}
30246 section. This is a necessary for older runtimes not supporting
30247 modification of @code{.rdata} sections for pseudo-relocation.
30248
30249 @item -mpe-aligned-commons
30250 @opindex mpe-aligned-commons
30251 This option is available for Cygwin and MinGW targets. It
30252 specifies that the GNU extension to the PE file format that
30253 permits the correct alignment of COMMON variables should be
30254 used when generating code. It is enabled by default if
30255 GCC detects that the target assembler found during configuration
30256 supports the feature.
30257 @end table
30258
30259 See also under @ref{x86 Options} for standard options.
30260
30261 @node Xstormy16 Options
30262 @subsection Xstormy16 Options
30263 @cindex Xstormy16 Options
30264
30265 These options are defined for Xstormy16:
30266
30267 @table @gcctabopt
30268 @item -msim
30269 @opindex msim
30270 Choose startup files and linker script suitable for the simulator.
30271 @end table
30272
30273 @node Xtensa Options
30274 @subsection Xtensa Options
30275 @cindex Xtensa Options
30276
30277 These options are supported for Xtensa targets:
30278
30279 @table @gcctabopt
30280 @item -mconst16
30281 @itemx -mno-const16
30282 @opindex mconst16
30283 @opindex mno-const16
30284 Enable or disable use of @code{CONST16} instructions for loading
30285 constant values. The @code{CONST16} instruction is currently not a
30286 standard option from Tensilica. When enabled, @code{CONST16}
30287 instructions are always used in place of the standard @code{L32R}
30288 instructions. The use of @code{CONST16} is enabled by default only if
30289 the @code{L32R} instruction is not available.
30290
30291 @item -mfused-madd
30292 @itemx -mno-fused-madd
30293 @opindex mfused-madd
30294 @opindex mno-fused-madd
30295 Enable or disable use of fused multiply/add and multiply/subtract
30296 instructions in the floating-point option. This has no effect if the
30297 floating-point option is not also enabled. Disabling fused multiply/add
30298 and multiply/subtract instructions forces the compiler to use separate
30299 instructions for the multiply and add/subtract operations. This may be
30300 desirable in some cases where strict IEEE 754-compliant results are
30301 required: the fused multiply add/subtract instructions do not round the
30302 intermediate result, thereby producing results with @emph{more} bits of
30303 precision than specified by the IEEE standard. Disabling fused multiply
30304 add/subtract instructions also ensures that the program output is not
30305 sensitive to the compiler's ability to combine multiply and add/subtract
30306 operations.
30307
30308 @item -mserialize-volatile
30309 @itemx -mno-serialize-volatile
30310 @opindex mserialize-volatile
30311 @opindex mno-serialize-volatile
30312 When this option is enabled, GCC inserts @code{MEMW} instructions before
30313 @code{volatile} memory references to guarantee sequential consistency.
30314 The default is @option{-mserialize-volatile}. Use
30315 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
30316
30317 @item -mforce-no-pic
30318 @opindex mforce-no-pic
30319 For targets, like GNU/Linux, where all user-mode Xtensa code must be
30320 position-independent code (PIC), this option disables PIC for compiling
30321 kernel code.
30322
30323 @item -mtext-section-literals
30324 @itemx -mno-text-section-literals
30325 @opindex mtext-section-literals
30326 @opindex mno-text-section-literals
30327 These options control the treatment of literal pools. The default is
30328 @option{-mno-text-section-literals}, which places literals in a separate
30329 section in the output file. This allows the literal pool to be placed
30330 in a data RAM/ROM, and it also allows the linker to combine literal
30331 pools from separate object files to remove redundant literals and
30332 improve code size. With @option{-mtext-section-literals}, the literals
30333 are interspersed in the text section in order to keep them as close as
30334 possible to their references. This may be necessary for large assembly
30335 files. Literals for each function are placed right before that function.
30336
30337 @item -mauto-litpools
30338 @itemx -mno-auto-litpools
30339 @opindex mauto-litpools
30340 @opindex mno-auto-litpools
30341 These options control the treatment of literal pools. The default is
30342 @option{-mno-auto-litpools}, which places literals in a separate
30343 section in the output file unless @option{-mtext-section-literals} is
30344 used. With @option{-mauto-litpools} the literals are interspersed in
30345 the text section by the assembler. Compiler does not produce explicit
30346 @code{.literal} directives and loads literals into registers with
30347 @code{MOVI} instructions instead of @code{L32R} to let the assembler
30348 do relaxation and place literals as necessary. This option allows
30349 assembler to create several literal pools per function and assemble
30350 very big functions, which may not be possible with
30351 @option{-mtext-section-literals}.
30352
30353 @item -mtarget-align
30354 @itemx -mno-target-align
30355 @opindex mtarget-align
30356 @opindex mno-target-align
30357 When this option is enabled, GCC instructs the assembler to
30358 automatically align instructions to reduce branch penalties at the
30359 expense of some code density. The assembler attempts to widen density
30360 instructions to align branch targets and the instructions following call
30361 instructions. If there are not enough preceding safe density
30362 instructions to align a target, no widening is performed. The
30363 default is @option{-mtarget-align}. These options do not affect the
30364 treatment of auto-aligned instructions like @code{LOOP}, which the
30365 assembler always aligns, either by widening density instructions or
30366 by inserting NOP instructions.
30367
30368 @item -mlongcalls
30369 @itemx -mno-longcalls
30370 @opindex mlongcalls
30371 @opindex mno-longcalls
30372 When this option is enabled, GCC instructs the assembler to translate
30373 direct calls to indirect calls unless it can determine that the target
30374 of a direct call is in the range allowed by the call instruction. This
30375 translation typically occurs for calls to functions in other source
30376 files. Specifically, the assembler translates a direct @code{CALL}
30377 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
30378 The default is @option{-mno-longcalls}. This option should be used in
30379 programs where the call target can potentially be out of range. This
30380 option is implemented in the assembler, not the compiler, so the
30381 assembly code generated by GCC still shows direct call
30382 instructions---look at the disassembled object code to see the actual
30383 instructions. Note that the assembler uses an indirect call for
30384 every cross-file call, not just those that really are out of range.
30385 @end table
30386
30387 @node zSeries Options
30388 @subsection zSeries Options
30389 @cindex zSeries options
30390
30391 These are listed under @xref{S/390 and zSeries Options}.
30392
30393
30394 @c man end
30395
30396 @node Spec Files
30397 @section Specifying Subprocesses and the Switches to Pass to Them
30398 @cindex Spec Files
30399
30400 @command{gcc} is a driver program. It performs its job by invoking a
30401 sequence of other programs to do the work of compiling, assembling and
30402 linking. GCC interprets its command-line parameters and uses these to
30403 deduce which programs it should invoke, and which command-line options
30404 it ought to place on their command lines. This behavior is controlled
30405 by @dfn{spec strings}. In most cases there is one spec string for each
30406 program that GCC can invoke, but a few programs have multiple spec
30407 strings to control their behavior. The spec strings built into GCC can
30408 be overridden by using the @option{-specs=} command-line switch to specify
30409 a spec file.
30410
30411 @dfn{Spec files} are plain-text files that are used to construct spec
30412 strings. They consist of a sequence of directives separated by blank
30413 lines. The type of directive is determined by the first non-whitespace
30414 character on the line, which can be one of the following:
30415
30416 @table @code
30417 @item %@var{command}
30418 Issues a @var{command} to the spec file processor. The commands that can
30419 appear here are:
30420
30421 @table @code
30422 @item %include <@var{file}>
30423 @cindex @code{%include}
30424 Search for @var{file} and insert its text at the current point in the
30425 specs file.
30426
30427 @item %include_noerr <@var{file}>
30428 @cindex @code{%include_noerr}
30429 Just like @samp{%include}, but do not generate an error message if the include
30430 file cannot be found.
30431
30432 @item %rename @var{old_name} @var{new_name}
30433 @cindex @code{%rename}
30434 Rename the spec string @var{old_name} to @var{new_name}.
30435
30436 @end table
30437
30438 @item *[@var{spec_name}]:
30439 This tells the compiler to create, override or delete the named spec
30440 string. All lines after this directive up to the next directive or
30441 blank line are considered to be the text for the spec string. If this
30442 results in an empty string then the spec is deleted. (Or, if the
30443 spec did not exist, then nothing happens.) Otherwise, if the spec
30444 does not currently exist a new spec is created. If the spec does
30445 exist then its contents are overridden by the text of this
30446 directive, unless the first character of that text is the @samp{+}
30447 character, in which case the text is appended to the spec.
30448
30449 @item [@var{suffix}]:
30450 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
30451 and up to the next directive or blank line are considered to make up the
30452 spec string for the indicated suffix. When the compiler encounters an
30453 input file with the named suffix, it processes the spec string in
30454 order to work out how to compile that file. For example:
30455
30456 @smallexample
30457 .ZZ:
30458 z-compile -input %i
30459 @end smallexample
30460
30461 This says that any input file whose name ends in @samp{.ZZ} should be
30462 passed to the program @samp{z-compile}, which should be invoked with the
30463 command-line switch @option{-input} and with the result of performing the
30464 @samp{%i} substitution. (See below.)
30465
30466 As an alternative to providing a spec string, the text following a
30467 suffix directive can be one of the following:
30468
30469 @table @code
30470 @item @@@var{language}
30471 This says that the suffix is an alias for a known @var{language}. This is
30472 similar to using the @option{-x} command-line switch to GCC to specify a
30473 language explicitly. For example:
30474
30475 @smallexample
30476 .ZZ:
30477 @@c++
30478 @end smallexample
30479
30480 Says that .ZZ files are, in fact, C++ source files.
30481
30482 @item #@var{name}
30483 This causes an error messages saying:
30484
30485 @smallexample
30486 @var{name} compiler not installed on this system.
30487 @end smallexample
30488 @end table
30489
30490 GCC already has an extensive list of suffixes built into it.
30491 This directive adds an entry to the end of the list of suffixes, but
30492 since the list is searched from the end backwards, it is effectively
30493 possible to override earlier entries using this technique.
30494
30495 @end table
30496
30497 GCC has the following spec strings built into it. Spec files can
30498 override these strings or create their own. Note that individual
30499 targets can also add their own spec strings to this list.
30500
30501 @smallexample
30502 asm Options to pass to the assembler
30503 asm_final Options to pass to the assembler post-processor
30504 cpp Options to pass to the C preprocessor
30505 cc1 Options to pass to the C compiler
30506 cc1plus Options to pass to the C++ compiler
30507 endfile Object files to include at the end of the link
30508 link Options to pass to the linker
30509 lib Libraries to include on the command line to the linker
30510 libgcc Decides which GCC support library to pass to the linker
30511 linker Sets the name of the linker
30512 predefines Defines to be passed to the C preprocessor
30513 signed_char Defines to pass to CPP to say whether @code{char} is signed
30514 by default
30515 startfile Object files to include at the start of the link
30516 @end smallexample
30517
30518 Here is a small example of a spec file:
30519
30520 @smallexample
30521 %rename lib old_lib
30522
30523 *lib:
30524 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
30525 @end smallexample
30526
30527 This example renames the spec called @samp{lib} to @samp{old_lib} and
30528 then overrides the previous definition of @samp{lib} with a new one.
30529 The new definition adds in some extra command-line options before
30530 including the text of the old definition.
30531
30532 @dfn{Spec strings} are a list of command-line options to be passed to their
30533 corresponding program. In addition, the spec strings can contain
30534 @samp{%}-prefixed sequences to substitute variable text or to
30535 conditionally insert text into the command line. Using these constructs
30536 it is possible to generate quite complex command lines.
30537
30538 Here is a table of all defined @samp{%}-sequences for spec
30539 strings. Note that spaces are not generated automatically around the
30540 results of expanding these sequences. Therefore you can concatenate them
30541 together or combine them with constant text in a single argument.
30542
30543 @table @code
30544 @item %%
30545 Substitute one @samp{%} into the program name or argument.
30546
30547 @item %i
30548 Substitute the name of the input file being processed.
30549
30550 @item %b
30551 Substitute the basename of the input file being processed.
30552 This is the substring up to (and not including) the last period
30553 and not including the directory.
30554
30555 @item %B
30556 This is the same as @samp{%b}, but include the file suffix (text after
30557 the last period).
30558
30559 @item %d
30560 Marks the argument containing or following the @samp{%d} as a
30561 temporary file name, so that that file is deleted if GCC exits
30562 successfully. Unlike @samp{%g}, this contributes no text to the
30563 argument.
30564
30565 @item %g@var{suffix}
30566 Substitute a file name that has suffix @var{suffix} and is chosen
30567 once per compilation, and mark the argument in the same way as
30568 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
30569 name is now chosen in a way that is hard to predict even when previously
30570 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
30571 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
30572 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
30573 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
30574 was simply substituted with a file name chosen once per compilation,
30575 without regard to any appended suffix (which was therefore treated
30576 just like ordinary text), making such attacks more likely to succeed.
30577
30578 @item %u@var{suffix}
30579 Like @samp{%g}, but generates a new temporary file name
30580 each time it appears instead of once per compilation.
30581
30582 @item %U@var{suffix}
30583 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
30584 new one if there is no such last file name. In the absence of any
30585 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
30586 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
30587 involves the generation of two distinct file names, one
30588 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
30589 simply substituted with a file name chosen for the previous @samp{%u},
30590 without regard to any appended suffix.
30591
30592 @item %j@var{suffix}
30593 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
30594 writable, and if @option{-save-temps} is not used;
30595 otherwise, substitute the name
30596 of a temporary file, just like @samp{%u}. This temporary file is not
30597 meant for communication between processes, but rather as a junk
30598 disposal mechanism.
30599
30600 @item %|@var{suffix}
30601 @itemx %m@var{suffix}
30602 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
30603 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
30604 all. These are the two most common ways to instruct a program that it
30605 should read from standard input or write to standard output. If you
30606 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
30607 construct: see for example @file{gcc/fortran/lang-specs.h}.
30608
30609 @item %.@var{SUFFIX}
30610 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
30611 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
30612 terminated by the next space or %.
30613
30614 @item %w
30615 Marks the argument containing or following the @samp{%w} as the
30616 designated output file of this compilation. This puts the argument
30617 into the sequence of arguments that @samp{%o} substitutes.
30618
30619 @item %o
30620 Substitutes the names of all the output files, with spaces
30621 automatically placed around them. You should write spaces
30622 around the @samp{%o} as well or the results are undefined.
30623 @samp{%o} is for use in the specs for running the linker.
30624 Input files whose names have no recognized suffix are not compiled
30625 at all, but they are included among the output files, so they are
30626 linked.
30627
30628 @item %O
30629 Substitutes the suffix for object files. Note that this is
30630 handled specially when it immediately follows @samp{%g, %u, or %U},
30631 because of the need for those to form complete file names. The
30632 handling is such that @samp{%O} is treated exactly as if it had already
30633 been substituted, except that @samp{%g, %u, and %U} do not currently
30634 support additional @var{suffix} characters following @samp{%O} as they do
30635 following, for example, @samp{.o}.
30636
30637 @item %p
30638 Substitutes the standard macro predefinitions for the
30639 current target machine. Use this when running @command{cpp}.
30640
30641 @item %P
30642 Like @samp{%p}, but puts @samp{__} before and after the name of each
30643 predefined macro, except for macros that start with @samp{__} or with
30644 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
30645 C@.
30646
30647 @item %I
30648 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
30649 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
30650 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
30651 and @option{-imultilib} as necessary.
30652
30653 @item %s
30654 Current argument is the name of a library or startup file of some sort.
30655 Search for that file in a standard list of directories and substitute
30656 the full name found. The current working directory is included in the
30657 list of directories scanned.
30658
30659 @item %T
30660 Current argument is the name of a linker script. Search for that file
30661 in the current list of directories to scan for libraries. If the file
30662 is located insert a @option{--script} option into the command line
30663 followed by the full path name found. If the file is not found then
30664 generate an error message. Note: the current working directory is not
30665 searched.
30666
30667 @item %e@var{str}
30668 Print @var{str} as an error message. @var{str} is terminated by a newline.
30669 Use this when inconsistent options are detected.
30670
30671 @item %(@var{name})
30672 Substitute the contents of spec string @var{name} at this point.
30673
30674 @item %x@{@var{option}@}
30675 Accumulate an option for @samp{%X}.
30676
30677 @item %X
30678 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
30679 spec string.
30680
30681 @item %Y
30682 Output the accumulated assembler options specified by @option{-Wa}.
30683
30684 @item %Z
30685 Output the accumulated preprocessor options specified by @option{-Wp}.
30686
30687 @item %a
30688 Process the @code{asm} spec. This is used to compute the
30689 switches to be passed to the assembler.
30690
30691 @item %A
30692 Process the @code{asm_final} spec. This is a spec string for
30693 passing switches to an assembler post-processor, if such a program is
30694 needed.
30695
30696 @item %l
30697 Process the @code{link} spec. This is the spec for computing the
30698 command line passed to the linker. Typically it makes use of the
30699 @samp{%L %G %S %D and %E} sequences.
30700
30701 @item %D
30702 Dump out a @option{-L} option for each directory that GCC believes might
30703 contain startup files. If the target supports multilibs then the
30704 current multilib directory is prepended to each of these paths.
30705
30706 @item %L
30707 Process the @code{lib} spec. This is a spec string for deciding which
30708 libraries are included on the command line to the linker.
30709
30710 @item %G
30711 Process the @code{libgcc} spec. This is a spec string for deciding
30712 which GCC support library is included on the command line to the linker.
30713
30714 @item %S
30715 Process the @code{startfile} spec. This is a spec for deciding which
30716 object files are the first ones passed to the linker. Typically
30717 this might be a file named @file{crt0.o}.
30718
30719 @item %E
30720 Process the @code{endfile} spec. This is a spec string that specifies
30721 the last object files that are passed to the linker.
30722
30723 @item %C
30724 Process the @code{cpp} spec. This is used to construct the arguments
30725 to be passed to the C preprocessor.
30726
30727 @item %1
30728 Process the @code{cc1} spec. This is used to construct the options to be
30729 passed to the actual C compiler (@command{cc1}).
30730
30731 @item %2
30732 Process the @code{cc1plus} spec. This is used to construct the options to be
30733 passed to the actual C++ compiler (@command{cc1plus}).
30734
30735 @item %*
30736 Substitute the variable part of a matched option. See below.
30737 Note that each comma in the substituted string is replaced by
30738 a single space.
30739
30740 @item %<S
30741 Remove all occurrences of @code{-S} from the command line. Note---this
30742 command is position dependent. @samp{%} commands in the spec string
30743 before this one see @code{-S}, @samp{%} commands in the spec string
30744 after this one do not.
30745
30746 @item %:@var{function}(@var{args})
30747 Call the named function @var{function}, passing it @var{args}.
30748 @var{args} is first processed as a nested spec string, then split
30749 into an argument vector in the usual fashion. The function returns
30750 a string which is processed as if it had appeared literally as part
30751 of the current spec.
30752
30753 The following built-in spec functions are provided:
30754
30755 @table @code
30756 @item @code{getenv}
30757 The @code{getenv} spec function takes two arguments: an environment
30758 variable name and a string. If the environment variable is not
30759 defined, a fatal error is issued. Otherwise, the return value is the
30760 value of the environment variable concatenated with the string. For
30761 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
30762
30763 @smallexample
30764 %:getenv(TOPDIR /include)
30765 @end smallexample
30766
30767 expands to @file{/path/to/top/include}.
30768
30769 @item @code{if-exists}
30770 The @code{if-exists} spec function takes one argument, an absolute
30771 pathname to a file. If the file exists, @code{if-exists} returns the
30772 pathname. Here is a small example of its usage:
30773
30774 @smallexample
30775 *startfile:
30776 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
30777 @end smallexample
30778
30779 @item @code{if-exists-else}
30780 The @code{if-exists-else} spec function is similar to the @code{if-exists}
30781 spec function, except that it takes two arguments. The first argument is
30782 an absolute pathname to a file. If the file exists, @code{if-exists-else}
30783 returns the pathname. If it does not exist, it returns the second argument.
30784 This way, @code{if-exists-else} can be used to select one file or another,
30785 based on the existence of the first. Here is a small example of its usage:
30786
30787 @smallexample
30788 *startfile:
30789 crt0%O%s %:if-exists(crti%O%s) \
30790 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
30791 @end smallexample
30792
30793 @item @code{replace-outfile}
30794 The @code{replace-outfile} spec function takes two arguments. It looks for the
30795 first argument in the outfiles array and replaces it with the second argument. Here
30796 is a small example of its usage:
30797
30798 @smallexample
30799 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
30800 @end smallexample
30801
30802 @item @code{remove-outfile}
30803 The @code{remove-outfile} spec function takes one argument. It looks for the
30804 first argument in the outfiles array and removes it. Here is a small example
30805 its usage:
30806
30807 @smallexample
30808 %:remove-outfile(-lm)
30809 @end smallexample
30810
30811 @item @code{pass-through-libs}
30812 The @code{pass-through-libs} spec function takes any number of arguments. It
30813 finds any @option{-l} options and any non-options ending in @file{.a} (which it
30814 assumes are the names of linker input library archive files) and returns a
30815 result containing all the found arguments each prepended by
30816 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
30817 intended to be passed to the LTO linker plugin.
30818
30819 @smallexample
30820 %:pass-through-libs(%G %L %G)
30821 @end smallexample
30822
30823 @item @code{print-asm-header}
30824 The @code{print-asm-header} function takes no arguments and simply
30825 prints a banner like:
30826
30827 @smallexample
30828 Assembler options
30829 =================
30830
30831 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
30832 @end smallexample
30833
30834 It is used to separate compiler options from assembler options
30835 in the @option{--target-help} output.
30836 @end table
30837
30838 @item %@{S@}
30839 Substitutes the @code{-S} switch, if that switch is given to GCC@.
30840 If that switch is not specified, this substitutes nothing. Note that
30841 the leading dash is omitted when specifying this option, and it is
30842 automatically inserted if the substitution is performed. Thus the spec
30843 string @samp{%@{foo@}} matches the command-line option @option{-foo}
30844 and outputs the command-line option @option{-foo}.
30845
30846 @item %W@{S@}
30847 Like %@{@code{S}@} but mark last argument supplied within as a file to be
30848 deleted on failure.
30849
30850 @item %@{S*@}
30851 Substitutes all the switches specified to GCC whose names start
30852 with @code{-S}, but which also take an argument. This is used for
30853 switches like @option{-o}, @option{-D}, @option{-I}, etc.
30854 GCC considers @option{-o foo} as being
30855 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
30856 text, including the space. Thus two arguments are generated.
30857
30858 @item %@{S*&T*@}
30859 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
30860 (the order of @code{S} and @code{T} in the spec is not significant).
30861 There can be any number of ampersand-separated variables; for each the
30862 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
30863
30864 @item %@{S:X@}
30865 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
30866
30867 @item %@{!S:X@}
30868 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
30869
30870 @item %@{S*:X@}
30871 Substitutes @code{X} if one or more switches whose names start with
30872 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
30873 once, no matter how many such switches appeared. However, if @code{%*}
30874 appears somewhere in @code{X}, then @code{X} is substituted once
30875 for each matching switch, with the @code{%*} replaced by the part of
30876 that switch matching the @code{*}.
30877
30878 If @code{%*} appears as the last part of a spec sequence then a space
30879 is added after the end of the last substitution. If there is more
30880 text in the sequence, however, then a space is not generated. This
30881 allows the @code{%*} substitution to be used as part of a larger
30882 string. For example, a spec string like this:
30883
30884 @smallexample
30885 %@{mcu=*:--script=%*/memory.ld@}
30886 @end smallexample
30887
30888 @noindent
30889 when matching an option like @option{-mcu=newchip} produces:
30890
30891 @smallexample
30892 --script=newchip/memory.ld
30893 @end smallexample
30894
30895 @item %@{.S:X@}
30896 Substitutes @code{X}, if processing a file with suffix @code{S}.
30897
30898 @item %@{!.S:X@}
30899 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
30900
30901 @item %@{,S:X@}
30902 Substitutes @code{X}, if processing a file for language @code{S}.
30903
30904 @item %@{!,S:X@}
30905 Substitutes @code{X}, if not processing a file for language @code{S}.
30906
30907 @item %@{S|P:X@}
30908 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
30909 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
30910 @code{*} sequences as well, although they have a stronger binding than
30911 the @samp{|}. If @code{%*} appears in @code{X}, all of the
30912 alternatives must be starred, and only the first matching alternative
30913 is substituted.
30914
30915 For example, a spec string like this:
30916
30917 @smallexample
30918 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
30919 @end smallexample
30920
30921 @noindent
30922 outputs the following command-line options from the following input
30923 command-line options:
30924
30925 @smallexample
30926 fred.c -foo -baz
30927 jim.d -bar -boggle
30928 -d fred.c -foo -baz -boggle
30929 -d jim.d -bar -baz -boggle
30930 @end smallexample
30931
30932 @item %@{S:X; T:Y; :D@}
30933
30934 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
30935 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
30936 be as many clauses as you need. This may be combined with @code{.},
30937 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
30938
30939
30940 @end table
30941
30942 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
30943 or similar construct can use a backslash to ignore the special meaning
30944 of the character following it, thus allowing literal matching of a
30945 character that is otherwise specially treated. For example,
30946 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
30947 @option{-std=iso9899:1999} option is given.
30948
30949 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
30950 construct may contain other nested @samp{%} constructs or spaces, or
30951 even newlines. They are processed as usual, as described above.
30952 Trailing white space in @code{X} is ignored. White space may also
30953 appear anywhere on the left side of the colon in these constructs,
30954 except between @code{.} or @code{*} and the corresponding word.
30955
30956 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
30957 handled specifically in these constructs. If another value of
30958 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
30959 @option{-W} switch is found later in the command line, the earlier
30960 switch value is ignored, except with @{@code{S}*@} where @code{S} is
30961 just one letter, which passes all matching options.
30962
30963 The character @samp{|} at the beginning of the predicate text is used to
30964 indicate that a command should be piped to the following command, but
30965 only if @option{-pipe} is specified.
30966
30967 It is built into GCC which switches take arguments and which do not.
30968 (You might think it would be useful to generalize this to allow each
30969 compiler's spec to say which switches take arguments. But this cannot
30970 be done in a consistent fashion. GCC cannot even decide which input
30971 files have been specified without knowing which switches take arguments,
30972 and it must know which input files to compile in order to tell which
30973 compilers to run).
30974
30975 GCC also knows implicitly that arguments starting in @option{-l} are to be
30976 treated as compiler output files, and passed to the linker in their
30977 proper position among the other output files.
30978
30979 @node Environment Variables
30980 @section Environment Variables Affecting GCC
30981 @cindex environment variables
30982
30983 @c man begin ENVIRONMENT
30984 This section describes several environment variables that affect how GCC
30985 operates. Some of them work by specifying directories or prefixes to use
30986 when searching for various kinds of files. Some are used to specify other
30987 aspects of the compilation environment.
30988
30989 Note that you can also specify places to search using options such as
30990 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
30991 take precedence over places specified using environment variables, which
30992 in turn take precedence over those specified by the configuration of GCC@.
30993 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
30994 GNU Compiler Collection (GCC) Internals}.
30995
30996 @table @env
30997 @item LANG
30998 @itemx LC_CTYPE
30999 @c @itemx LC_COLLATE
31000 @itemx LC_MESSAGES
31001 @c @itemx LC_MONETARY
31002 @c @itemx LC_NUMERIC
31003 @c @itemx LC_TIME
31004 @itemx LC_ALL
31005 @findex LANG
31006 @findex LC_CTYPE
31007 @c @findex LC_COLLATE
31008 @findex LC_MESSAGES
31009 @c @findex LC_MONETARY
31010 @c @findex LC_NUMERIC
31011 @c @findex LC_TIME
31012 @findex LC_ALL
31013 @cindex locale
31014 These environment variables control the way that GCC uses
31015 localization information which allows GCC to work with different
31016 national conventions. GCC inspects the locale categories
31017 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
31018 so. These locale categories can be set to any value supported by your
31019 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
31020 Kingdom encoded in UTF-8.
31021
31022 The @env{LC_CTYPE} environment variable specifies character
31023 classification. GCC uses it to determine the character boundaries in
31024 a string; this is needed for some multibyte encodings that contain quote
31025 and escape characters that are otherwise interpreted as a string
31026 end or escape.
31027
31028 The @env{LC_MESSAGES} environment variable specifies the language to
31029 use in diagnostic messages.
31030
31031 If the @env{LC_ALL} environment variable is set, it overrides the value
31032 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
31033 and @env{LC_MESSAGES} default to the value of the @env{LANG}
31034 environment variable. If none of these variables are set, GCC
31035 defaults to traditional C English behavior.
31036
31037 @item TMPDIR
31038 @findex TMPDIR
31039 If @env{TMPDIR} is set, it specifies the directory to use for temporary
31040 files. GCC uses temporary files to hold the output of one stage of
31041 compilation which is to be used as input to the next stage: for example,
31042 the output of the preprocessor, which is the input to the compiler
31043 proper.
31044
31045 @item GCC_COMPARE_DEBUG
31046 @findex GCC_COMPARE_DEBUG
31047 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
31048 @option{-fcompare-debug} to the compiler driver. See the documentation
31049 of this option for more details.
31050
31051 @item GCC_EXEC_PREFIX
31052 @findex GCC_EXEC_PREFIX
31053 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
31054 names of the subprograms executed by the compiler. No slash is added
31055 when this prefix is combined with the name of a subprogram, but you can
31056 specify a prefix that ends with a slash if you wish.
31057
31058 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
31059 an appropriate prefix to use based on the pathname it is invoked with.
31060
31061 If GCC cannot find the subprogram using the specified prefix, it
31062 tries looking in the usual places for the subprogram.
31063
31064 The default value of @env{GCC_EXEC_PREFIX} is
31065 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
31066 the installed compiler. In many cases @var{prefix} is the value
31067 of @code{prefix} when you ran the @file{configure} script.
31068
31069 Other prefixes specified with @option{-B} take precedence over this prefix.
31070
31071 This prefix is also used for finding files such as @file{crt0.o} that are
31072 used for linking.
31073
31074 In addition, the prefix is used in an unusual way in finding the
31075 directories to search for header files. For each of the standard
31076 directories whose name normally begins with @samp{/usr/local/lib/gcc}
31077 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
31078 replacing that beginning with the specified prefix to produce an
31079 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
31080 @file{foo/bar} just before it searches the standard directory
31081 @file{/usr/local/lib/bar}.
31082 If a standard directory begins with the configured
31083 @var{prefix} then the value of @var{prefix} is replaced by
31084 @env{GCC_EXEC_PREFIX} when looking for header files.
31085
31086 @item COMPILER_PATH
31087 @findex COMPILER_PATH
31088 The value of @env{COMPILER_PATH} is a colon-separated list of
31089 directories, much like @env{PATH}. GCC tries the directories thus
31090 specified when searching for subprograms, if it cannot find the
31091 subprograms using @env{GCC_EXEC_PREFIX}.
31092
31093 @item LIBRARY_PATH
31094 @findex LIBRARY_PATH
31095 The value of @env{LIBRARY_PATH} is a colon-separated list of
31096 directories, much like @env{PATH}. When configured as a native compiler,
31097 GCC tries the directories thus specified when searching for special
31098 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
31099 using GCC also uses these directories when searching for ordinary
31100 libraries for the @option{-l} option (but directories specified with
31101 @option{-L} come first).
31102
31103 @item LANG
31104 @findex LANG
31105 @cindex locale definition
31106 This variable is used to pass locale information to the compiler. One way in
31107 which this information is used is to determine the character set to be used
31108 when character literals, string literals and comments are parsed in C and C++.
31109 When the compiler is configured to allow multibyte characters,
31110 the following values for @env{LANG} are recognized:
31111
31112 @table @samp
31113 @item C-JIS
31114 Recognize JIS characters.
31115 @item C-SJIS
31116 Recognize SJIS characters.
31117 @item C-EUCJP
31118 Recognize EUCJP characters.
31119 @end table
31120
31121 If @env{LANG} is not defined, or if it has some other value, then the
31122 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
31123 recognize and translate multibyte characters.
31124 @end table
31125
31126 @noindent
31127 Some additional environment variables affect the behavior of the
31128 preprocessor.
31129
31130 @include cppenv.texi
31131
31132 @c man end
31133
31134 @node Precompiled Headers
31135 @section Using Precompiled Headers
31136 @cindex precompiled headers
31137 @cindex speed of compilation
31138
31139 Often large projects have many header files that are included in every
31140 source file. The time the compiler takes to process these header files
31141 over and over again can account for nearly all of the time required to
31142 build the project. To make builds faster, GCC allows you to
31143 @dfn{precompile} a header file.
31144
31145 To create a precompiled header file, simply compile it as you would any
31146 other file, if necessary using the @option{-x} option to make the driver
31147 treat it as a C or C++ header file. You may want to use a
31148 tool like @command{make} to keep the precompiled header up-to-date when
31149 the headers it contains change.
31150
31151 A precompiled header file is searched for when @code{#include} is
31152 seen in the compilation. As it searches for the included file
31153 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
31154 compiler looks for a precompiled header in each directory just before it
31155 looks for the include file in that directory. The name searched for is
31156 the name specified in the @code{#include} with @samp{.gch} appended. If
31157 the precompiled header file cannot be used, it is ignored.
31158
31159 For instance, if you have @code{#include "all.h"}, and you have
31160 @file{all.h.gch} in the same directory as @file{all.h}, then the
31161 precompiled header file is used if possible, and the original
31162 header is used otherwise.
31163
31164 Alternatively, you might decide to put the precompiled header file in a
31165 directory and use @option{-I} to ensure that directory is searched
31166 before (or instead of) the directory containing the original header.
31167 Then, if you want to check that the precompiled header file is always
31168 used, you can put a file of the same name as the original header in this
31169 directory containing an @code{#error} command.
31170
31171 This also works with @option{-include}. So yet another way to use
31172 precompiled headers, good for projects not designed with precompiled
31173 header files in mind, is to simply take most of the header files used by
31174 a project, include them from another header file, precompile that header
31175 file, and @option{-include} the precompiled header. If the header files
31176 have guards against multiple inclusion, they are skipped because
31177 they've already been included (in the precompiled header).
31178
31179 If you need to precompile the same header file for different
31180 languages, targets, or compiler options, you can instead make a
31181 @emph{directory} named like @file{all.h.gch}, and put each precompiled
31182 header in the directory, perhaps using @option{-o}. It doesn't matter
31183 what you call the files in the directory; every precompiled header in
31184 the directory is considered. The first precompiled header
31185 encountered in the directory that is valid for this compilation is
31186 used; they're searched in no particular order.
31187
31188 There are many other possibilities, limited only by your imagination,
31189 good sense, and the constraints of your build system.
31190
31191 A precompiled header file can be used only when these conditions apply:
31192
31193 @itemize
31194 @item
31195 Only one precompiled header can be used in a particular compilation.
31196
31197 @item
31198 A precompiled header cannot be used once the first C token is seen. You
31199 can have preprocessor directives before a precompiled header; you cannot
31200 include a precompiled header from inside another header.
31201
31202 @item
31203 The precompiled header file must be produced for the same language as
31204 the current compilation. You cannot use a C precompiled header for a C++
31205 compilation.
31206
31207 @item
31208 The precompiled header file must have been produced by the same compiler
31209 binary as the current compilation is using.
31210
31211 @item
31212 Any macros defined before the precompiled header is included must
31213 either be defined in the same way as when the precompiled header was
31214 generated, or must not affect the precompiled header, which usually
31215 means that they don't appear in the precompiled header at all.
31216
31217 The @option{-D} option is one way to define a macro before a
31218 precompiled header is included; using a @code{#define} can also do it.
31219 There are also some options that define macros implicitly, like
31220 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
31221 defined this way.
31222
31223 @item If debugging information is output when using the precompiled
31224 header, using @option{-g} or similar, the same kind of debugging information
31225 must have been output when building the precompiled header. However,
31226 a precompiled header built using @option{-g} can be used in a compilation
31227 when no debugging information is being output.
31228
31229 @item The same @option{-m} options must generally be used when building
31230 and using the precompiled header. @xref{Submodel Options},
31231 for any cases where this rule is relaxed.
31232
31233 @item Each of the following options must be the same when building and using
31234 the precompiled header:
31235
31236 @gccoptlist{-fexceptions}
31237
31238 @item
31239 Some other command-line options starting with @option{-f},
31240 @option{-p}, or @option{-O} must be defined in the same way as when
31241 the precompiled header was generated. At present, it's not clear
31242 which options are safe to change and which are not; the safest choice
31243 is to use exactly the same options when generating and using the
31244 precompiled header. The following are known to be safe:
31245
31246 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
31247 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
31248 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
31249 -pedantic-errors}
31250
31251 @item Address space layout randomization (ASLR) can lead to not binary identical
31252 PCH files. If you rely on stable PCH file contents disable ASLR when generating
31253 PCH files.
31254
31255 @end itemize
31256
31257 For all of these except the last, the compiler automatically
31258 ignores the precompiled header if the conditions aren't met. If you
31259 find an option combination that doesn't work and doesn't cause the
31260 precompiled header to be ignored, please consider filing a bug report,
31261 see @ref{Bugs}.
31262
31263 If you do use differing options when generating and using the
31264 precompiled header, the actual behavior is a mixture of the
31265 behavior for the options. For instance, if you use @option{-g} to
31266 generate the precompiled header but not when using it, you may or may
31267 not get debugging information for routines in the precompiled header.