1 @c Copyright (C) 1988-2019 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
10 @c man begin COPYRIGHT
11 Copyright @copyright{} 1988-2019 Free Software Foundation, Inc.
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.
21 (a) The FSF's Front-Cover Text is:
25 (b) The FSF's Back-Cover Text is:
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.
31 @c Set file name and title for the man page.
33 @settitle GNU project C and C++ compiler
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{}
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}.
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}.
53 For instructions on reporting bugs, see
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@.
64 @chapter GCC Command Options
65 @cindex GCC command options
66 @cindex command options
67 @cindex options, GCC command
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}.
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.
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.
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.
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
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.
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.
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.
141 @xref{Option Index}, for an index to GCC's options.
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
153 * Diagnostic Message Formatting Options:: Controlling how diagnostics should
155 * Warning Options:: How picky should the compiler be?
156 * Debugging Options:: Producing debuggable code.
157 * Optimize Options:: How much optimization?
158 * Instrumentation Options:: Enabling profiling and extra run-time error checking.
159 * Preprocessor Options:: Controlling header files and macro definitions.
160 Also, getting dependency information for Make.
161 * Assembler Options:: Passing options to the assembler.
162 * Link Options:: Specifying libraries and so on.
163 * Directory Options:: Where to find header files and libraries.
164 Where to find the compiler executable files.
165 * Code Gen Options:: Specifying conventions for function calls, data layout
167 * Developer Options:: Printing GCC configuration info, statistics, and
169 * Submodel Options:: Target-specific options, such as compiling for a
170 specific processor variant.
171 * Spec Files:: How to pass switches to sub-processes.
172 * Environment Variables:: Env vars that affect GCC.
173 * Precompiled Headers:: Compiling a header once, and using it many times.
179 @section Option Summary
181 Here is a summary of all the options, grouped by type. Explanations are
182 in the following sections.
185 @item Overall Options
186 @xref{Overall Options,,Options Controlling the Kind of Output}.
187 @gccoptlist{-c -S -E -o @var{file} -x @var{language} @gol
188 -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help --version @gol
189 -pass-exit-codes -pipe -specs=@var{file} -wrapper @gol
190 @@@var{file} -ffile-prefix-map=@var{old}=@var{new} @gol
191 -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
192 -fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
194 @item C Language Options
195 @xref{C Dialect Options,,Options Controlling C Dialect}.
196 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
197 -fpermitted-flt-eval-methods=@var{standard} @gol
198 -aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
199 -fno-asm -fno-builtin -fno-builtin-@var{function} -fgimple@gol
200 -fhosted -ffreestanding @gol
201 -fopenacc -fopenacc-dim=@var{geom} @gol
202 -fopenmp -fopenmp-simd @gol
203 -fms-extensions -fplan9-extensions -fsso-struct=@var{endianness} @gol
204 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
205 -fsigned-bitfields -fsigned-char @gol
206 -funsigned-bitfields -funsigned-char}
208 @item C++ Language Options
209 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
210 @gccoptlist{-fabi-version=@var{n} -fno-access-control @gol
211 -faligned-new=@var{n} -fargs-in-order=@var{n} -fchar8_t -fcheck-new @gol
212 -fconstexpr-depth=@var{n} -fconstexpr-cache-depth=@var{n} @gol
213 -fconstexpr-loop-limit=@var{n} -fconstexpr-ops-limit=@var{n} @gol
214 -fno-elide-constructors @gol
215 -fno-enforce-eh-specs @gol
216 -fno-gnu-keywords @gol
217 -fno-implicit-templates @gol
218 -fno-implicit-inline-templates @gol
219 -fno-implement-inlines -fms-extensions @gol
220 -fnew-inheriting-ctors @gol
221 -fnew-ttp-matching @gol
222 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
223 -fno-optional-diags -fpermissive @gol
224 -fno-pretty-templates @gol
225 -fno-rtti -fsized-deallocation @gol
226 -ftemplate-backtrace-limit=@var{n} @gol
227 -ftemplate-depth=@var{n} @gol
228 -fno-threadsafe-statics -fuse-cxa-atexit @gol
229 -fno-weak -nostdinc++ @gol
230 -fvisibility-inlines-hidden @gol
231 -fvisibility-ms-compat @gol
232 -fext-numeric-literals @gol
233 -Wabi=@var{n} -Wabi-tag -Wcomma-subscript -Wconversion-null @gol
234 -Wctor-dtor-privacy @gol
235 -Wdelete-non-virtual-dtor -Wdeprecated-copy -Wdeprecated-copy-dtor @gol
236 -Wliteral-suffix @gol
237 -Wmultiple-inheritance -Wno-init-list-lifetime @gol
238 -Wnamespaces -Wnarrowing @gol
239 -Wpessimizing-move -Wredundant-move @gol
240 -Wnoexcept -Wnoexcept-type -Wclass-memaccess @gol
241 -Wnon-virtual-dtor -Wreorder -Wregister @gol
242 -Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
243 -Wno-non-template-friend -Wold-style-cast @gol
244 -Woverloaded-virtual -Wno-pmf-conversions @gol
245 -Wno-class-conversion -Wno-terminate @gol
246 -Wsign-promo -Wvirtual-inheritance -Wvolatile}
248 @item Objective-C and Objective-C++ Language Options
249 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
250 Objective-C and Objective-C++ Dialects}.
251 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
252 -fgnu-runtime -fnext-runtime @gol
253 -fno-nil-receivers @gol
254 -fobjc-abi-version=@var{n} @gol
255 -fobjc-call-cxx-cdtors @gol
256 -fobjc-direct-dispatch @gol
257 -fobjc-exceptions @gol
260 -fobjc-std=objc1 @gol
261 -fno-local-ivars @gol
262 -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
263 -freplace-objc-classes @gol
266 -Wassign-intercept @gol
267 -Wno-protocol -Wselector @gol
268 -Wstrict-selector-match @gol
269 -Wundeclared-selector}
271 @item Diagnostic Message Formatting Options
272 @xref{Diagnostic Message Formatting Options,,Options to Control Diagnostic Messages Formatting}.
273 @gccoptlist{-fmessage-length=@var{n} @gol
274 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
275 -fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
276 -fdiagnostics-format=@r{[}text@r{|}json@r{]} @gol
277 -fno-diagnostics-show-option -fno-diagnostics-show-caret @gol
278 -fno-diagnostics-show-labels -fno-diagnostics-show-line-numbers @gol
279 -fdiagnostics-minimum-margin-width=@var{width} @gol
280 -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch @gol
281 -fdiagnostics-show-template-tree -fno-elide-type @gol
284 @item Warning Options
285 @xref{Warning Options,,Options to Request or Suppress Warnings}.
286 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
287 -pedantic-errors @gol
288 -w -Wextra -Wall -Waddress -Waddress-of-packed-member @gol
289 -Waggregate-return -Waligned-new @gol
290 -Walloc-zero -Walloc-size-larger-than=@var{byte-size} @gol
291 -Walloca -Walloca-larger-than=@var{byte-size} @gol
292 -Wno-aggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
293 -Wno-attributes -Wattribute-alias=@var{n} @gol
294 -Wbool-compare -Wbool-operation @gol
295 -Wno-builtin-declaration-mismatch @gol
296 -Wno-builtin-macro-redefined -Wc90-c99-compat -Wc99-c11-compat @gol
297 -Wc++-compat -Wc++11-compat -Wc++14-compat -Wc++17-compat @gol
299 -Wcast-align -Wcast-align=strict -Wcast-function-type -Wcast-qual @gol
300 -Wchar-subscripts -Wcatch-value -Wcatch-value=@var{n} @gol
301 -Wclobbered -Wcomment -Wconditionally-supported @gol
302 -Wconversion -Wcoverage-mismatch -Wno-cpp -Wdangling-else -Wdate-time @gol
303 -Wdelete-incomplete @gol
304 -Wno-attribute-warning @gol
305 -Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
306 -Wdisabled-optimization @gol
307 -Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
308 -Wno-div-by-zero -Wdouble-promotion @gol
309 -Wduplicated-branches -Wduplicated-cond @gol
310 -Wempty-body -Wenum-compare -Wenum-conversion @gol
311 -Wno-endif-labels -Wexpansion-to-defined @gol
312 -Werror -Werror=* -Wextra-semi -Wfatal-errors @gol
313 -Wfloat-equal -Wformat -Wformat=2 @gol
314 -Wno-format-contains-nul -Wno-format-extra-args @gol
315 -Wformat-nonliteral -Wformat-overflow=@var{n} @gol
316 -Wformat-security -Wformat-signedness -Wformat-truncation=@var{n} @gol
317 -Wformat-y2k -Wframe-address @gol
318 -Wframe-larger-than=@var{byte-size} -Wno-free-nonheap-object @gol
319 -Wjump-misses-init @gol
320 -Whsa -Wif-not-aligned @gol
321 -Wignored-qualifiers -Wignored-attributes -Wincompatible-pointer-types @gol
322 -Wimplicit -Wimplicit-fallthrough -Wimplicit-fallthrough=@var{n} @gol
323 -Wimplicit-function-declaration -Wimplicit-int @gol
324 -Winaccessible-base @gol
325 -Winit-self -Winline -Wno-int-conversion -Wint-in-bool-context @gol
326 -Wno-int-to-pointer-cast -Winvalid-memory-model -Wno-invalid-offsetof @gol
327 -Winvalid-pch -Wlarger-than=@var{byte-size} @gol
328 -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
329 -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args @gol
330 -Wmisleading-indentation -Wmissing-attributes -Wmissing-braces @gol
331 -Wmissing-field-initializers -Wmissing-format-attribute @gol
332 -Wmissing-include-dirs -Wmissing-noreturn -Wmissing-profile @gol
333 -Wno-multichar -Wmultistatement-macros -Wnonnull -Wnonnull-compare @gol
334 -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
335 -Wnull-dereference -Wodr -Wno-overflow -Wopenmp-simd @gol
336 -Woverride-init-side-effects -Woverlength-strings @gol
337 -Wpacked -Wpacked-bitfield-compat -Wpacked-not-aligned -Wpadded @gol
338 -Wparentheses -Wno-pedantic-ms-format @gol
339 -Wplacement-new -Wplacement-new=@var{n} @gol
340 -Wpointer-arith -Wpointer-compare -Wno-pointer-to-int-cast @gol
341 -Wno-pragmas -Wno-prio-ctor-dtor -Wredundant-decls @gol
342 -Wrestrict -Wno-return-local-addr @gol
343 -Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
344 -Wshadow=global, -Wshadow=local, -Wshadow=compatible-local @gol
345 -Wshift-overflow -Wshift-overflow=@var{n} @gol
346 -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value @gol
347 -Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
348 -Wno-scalar-storage-order -Wsizeof-pointer-div @gol
349 -Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
350 -Wstack-protector -Wstack-usage=@var{byte-size} -Wstrict-aliasing @gol
351 -Wstrict-aliasing=n -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
352 -Wstringop-overflow=@var{n} -Wstringop-truncation -Wsubobject-linkage @gol
353 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}malloc@r{]} @gol
354 -Wsuggest-final-types @gol -Wsuggest-final-methods -Wsuggest-override @gol
355 -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-enum @gol
356 -Wswitch-unreachable -Wsync-nand @gol
357 -Wsystem-headers -Wtautological-compare -Wtrampolines -Wtrigraphs @gol
358 -Wtype-limits -Wundef @gol
359 -Wuninitialized -Wunknown-pragmas @gol
360 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
361 -Wunused-label -Wunused-local-typedefs -Wunused-macros @gol
362 -Wunused-parameter -Wno-unused-result @gol
363 -Wunused-value -Wunused-variable @gol
364 -Wunused-const-variable -Wunused-const-variable=@var{n} @gol
365 -Wunused-but-set-parameter -Wunused-but-set-variable @gol
366 -Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
367 -Wvla -Wvla-larger-than=@var{byte-size} -Wvolatile-register-var @gol
369 -Wzero-as-null-pointer-constant}
371 @item C and Objective-C-only Warning Options
372 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
373 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
374 -Wold-style-declaration -Wold-style-definition @gol
375 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
376 -Wdeclaration-after-statement -Wpointer-sign}
378 @item Debugging Options
379 @xref{Debugging Options,,Options for Debugging Your Program}.
380 @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol
381 -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
382 -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
383 -gas-loc-support -gno-as-loc-support @gol
384 -gas-locview-support -gno-as-locview-support @gol
385 -gcolumn-info -gno-column-info @gol
386 -gstatement-frontiers -gno-statement-frontiers @gol
387 -gvariable-location-views -gno-variable-location-views @gol
388 -ginternal-reset-location-views -gno-internal-reset-location-views @gol
389 -ginline-points -gno-inline-points @gol
390 -gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
391 -gsplit-dwarf -gdescribe-dies -gno-describe-dies @gol
392 -fdebug-prefix-map=@var{old}=@var{new} -fdebug-types-section @gol
393 -fno-eliminate-unused-debug-types @gol
394 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
395 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
396 -fno-eliminate-unused-debug-symbols -femit-class-debug-always @gol
397 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
398 -fvar-tracking -fvar-tracking-assignments}
400 @item Optimization Options
401 @xref{Optimize Options,,Options that Control Optimization}.
402 @gccoptlist{-faggressive-loop-optimizations @gol
403 -falign-functions[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
404 -falign-jumps[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
405 -falign-labels[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
406 -falign-loops[=@var{n}[:@var{m}:[@var{n2}[:@var{m2}]]]] @gol
407 -fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
408 -fauto-inc-dec -fbranch-probabilities @gol
410 -fcombine-stack-adjustments -fconserve-stack @gol
411 -fcompare-elim -fcprop-registers -fcrossjumping @gol
412 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
413 -fcx-limited-range @gol
414 -fdata-sections -fdce -fdelayed-branch @gol
415 -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
416 -fdevirtualize-at-ltrans -fdse @gol
417 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
418 -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
420 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
421 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
422 -fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
423 -fif-conversion2 -findirect-inlining @gol
424 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
425 -finline-small-functions -fipa-cp -fipa-cp-clone @gol
426 -fipa-bit-cp -fipa-vrp -fipa-pta -fipa-profile -fipa-pure-const @gol
427 -fipa-reference -fipa-reference-addressable @gol
428 -fipa-stack-alignment -fipa-icf -fira-algorithm=@var{algorithm} @gol
429 -flive-patching=@var{level} @gol
430 -fira-region=@var{region} -fira-hoist-pressure @gol
431 -fira-loop-pressure -fno-ira-share-save-slots @gol
432 -fno-ira-share-spill-slots @gol
433 -fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
434 -fivopts -fkeep-inline-functions -fkeep-static-functions @gol
435 -fkeep-static-consts -flimit-function-alignment -flive-range-shrinkage @gol
436 -floop-block -floop-interchange -floop-strip-mine @gol
437 -floop-unroll-and-jam -floop-nest-optimize @gol
438 -floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
439 -flto-partition=@var{alg} -fmerge-all-constants @gol
440 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
441 -fmove-loop-invariants -fno-branch-count-reg @gol
442 -fno-defer-pop -fno-fp-int-builtin-inexact -fno-function-cse @gol
443 -fno-guess-branch-probability -fno-inline -fno-math-errno -fno-peephole @gol
444 -fno-peephole2 -fno-printf-return-value -fno-sched-interblock @gol
445 -fno-sched-spec -fno-signed-zeros @gol
446 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
447 -fomit-frame-pointer -foptimize-sibling-calls @gol
448 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
449 -fprefetch-loop-arrays @gol
450 -fprofile-correction @gol
451 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
452 -fprofile-reorder-functions @gol
453 -freciprocal-math -free -frename-registers -freorder-blocks @gol
454 -freorder-blocks-algorithm=@var{algorithm} @gol
455 -freorder-blocks-and-partition -freorder-functions @gol
456 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
457 -frounding-math -fsave-optimization-record @gol
458 -fsched2-use-superblocks -fsched-pressure @gol
459 -fsched-spec-load -fsched-spec-load-dangerous @gol
460 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
461 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
462 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
463 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
464 -fschedule-fusion @gol
465 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
466 -fselective-scheduling -fselective-scheduling2 @gol
467 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
468 -fsemantic-interposition -fshrink-wrap -fshrink-wrap-separate @gol
469 -fsignaling-nans @gol
470 -fsingle-precision-constant -fsplit-ivs-in-unroller -fsplit-loops@gol
472 -fsplit-wide-types -fsplit-wide-types-early -fssa-backprop -fssa-phiopt @gol
473 -fstdarg-opt -fstore-merging -fstrict-aliasing @gol
474 -fthread-jumps -ftracer -ftree-bit-ccp @gol
475 -ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
476 -ftree-coalesce-vars -ftree-copy-prop -ftree-dce -ftree-dominator-opts @gol
477 -ftree-dse -ftree-forwprop -ftree-fre -fcode-hoisting @gol
478 -ftree-loop-if-convert -ftree-loop-im @gol
479 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
480 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
481 -ftree-loop-vectorize @gol
482 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
483 -ftree-reassoc -ftree-scev-cprop -ftree-sink -ftree-slsr -ftree-sra @gol
484 -ftree-switch-conversion -ftree-tail-merge @gol
485 -ftree-ter -ftree-vectorize -ftree-vrp -funconstrained-commons @gol
486 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
487 -funsafe-math-optimizations -funswitch-loops @gol
488 -fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
489 -fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
490 --param @var{name}=@var{value}
491 -O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
493 @item Program Instrumentation Options
494 @xref{Instrumentation Options,,Program Instrumentation Options}.
495 @gccoptlist{-p -pg -fprofile-arcs --coverage -ftest-coverage @gol
496 -fprofile-abs-path @gol
497 -fprofile-dir=@var{path} -fprofile-generate -fprofile-generate=@var{path} @gol
498 -fprofile-note=@var{path} -fprofile-update=@var{method} @gol
499 -fprofile-filter-files=@var{regex} -fprofile-exclude-files=@var{regex} @gol
500 -fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
501 -fasan-shadow-offset=@var{number} -fsanitize-sections=@var{s1},@var{s2},... @gol
502 -fsanitize-undefined-trap-on-error -fbounds-check @gol
503 -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]} @gol
504 -fstack-protector -fstack-protector-all -fstack-protector-strong @gol
505 -fstack-protector-explicit -fstack-check @gol
506 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
507 -fno-stack-limit -fsplit-stack @gol
508 -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
509 -fvtv-counts -fvtv-debug @gol
510 -finstrument-functions @gol
511 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
512 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}}
514 @item Preprocessor Options
515 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
516 @gccoptlist{-A@var{question}=@var{answer} @gol
517 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
518 -C -CC -D@var{macro}@r{[}=@var{defn}@r{]} @gol
519 -dD -dI -dM -dN -dU @gol
520 -fdebug-cpp -fdirectives-only -fdollars-in-identifiers @gol
521 -fexec-charset=@var{charset} -fextended-identifiers @gol
522 -finput-charset=@var{charset} -fmacro-prefix-map=@var{old}=@var{new} @gol
523 -fmax-include-depth=@var{depth} @gol
524 -fno-canonical-system-headers -fpch-deps -fpch-preprocess @gol
525 -fpreprocessed -ftabstop=@var{width} -ftrack-macro-expansion @gol
526 -fwide-exec-charset=@var{charset} -fworking-directory @gol
527 -H -imacros @var{file} -include @var{file} @gol
528 -M -MD -MF -MG -MM -MMD -MP -MQ -MT @gol
529 -no-integrated-cpp -P -pthread -remap @gol
530 -traditional -traditional-cpp -trigraphs @gol
531 -U@var{macro} -undef @gol
532 -Wp,@var{option} -Xpreprocessor @var{option}}
534 @item Assembler Options
535 @xref{Assembler Options,,Passing Options to the Assembler}.
536 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
539 @xref{Link Options,,Options for Linking}.
540 @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
541 -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol
542 -e @var{entry} --entry=@var{entry} @gol
543 -pie -pthread -r -rdynamic @gol
544 -s -static -static-pie -static-libgcc -static-libstdc++ @gol
545 -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
546 -shared -shared-libgcc -symbolic @gol
547 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
548 -u @var{symbol} -z @var{keyword}}
550 @item Directory Options
551 @xref{Directory Options,,Options for Directory Search}.
552 @gccoptlist{-B@var{prefix} -I@var{dir} -I- @gol
553 -idirafter @var{dir} @gol
554 -imacros @var{file} -imultilib @var{dir} @gol
555 -iplugindir=@var{dir} -iprefix @var{file} @gol
556 -iquote @var{dir} -isysroot @var{dir} -isystem @var{dir} @gol
557 -iwithprefix @var{dir} -iwithprefixbefore @var{dir} @gol
558 -L@var{dir} -no-canonical-prefixes --no-sysroot-suffix @gol
559 -nostdinc -nostdinc++ --sysroot=@var{dir}}
561 @item Code Generation Options
562 @xref{Code Gen Options,,Options for Code Generation Conventions}.
563 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
564 -ffixed-@var{reg} -fexceptions @gol
565 -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
566 -fasynchronous-unwind-tables @gol
568 -finhibit-size-directive -fno-common -fno-ident @gol
569 -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt @gol
570 -fno-jump-tables @gol
571 -frecord-gcc-switches @gol
572 -freg-struct-return -fshort-enums -fshort-wchar @gol
573 -fverbose-asm -fpack-struct[=@var{n}] @gol
574 -fleading-underscore -ftls-model=@var{model} @gol
575 -fstack-reuse=@var{reuse_level} @gol
576 -ftrampolines -ftrapv -fwrapv @gol
577 -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
578 -fstrict-volatile-bitfields -fsync-libcalls}
580 @item Developer Options
581 @xref{Developer Options,,GCC Developer Options}.
582 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
583 -dumpfullversion -fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
584 -fdbg-cnt=@var{counter-value-list} @gol
585 -fdisable-ipa-@var{pass_name} @gol
586 -fdisable-rtl-@var{pass_name} @gol
587 -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
588 -fdisable-tree-@var{pass_name} @gol
589 -fdisable-tree-@var{pass-name}=@var{range-list} @gol
590 -fdump-debug -fdump-earlydebug @gol
591 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
592 -fdump-final-insns@r{[}=@var{file}@r{]} @gol
593 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
595 -fdump-lang-@var{switch} @gol
596 -fdump-lang-@var{switch}-@var{options} @gol
597 -fdump-lang-@var{switch}-@var{options}=@var{filename} @gol
599 -fdump-rtl-@var{pass} -fdump-rtl-@var{pass}=@var{filename} @gol
600 -fdump-statistics @gol
602 -fdump-tree-@var{switch} @gol
603 -fdump-tree-@var{switch}-@var{options} @gol
604 -fdump-tree-@var{switch}-@var{options}=@var{filename} @gol
605 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
606 -fenable-@var{kind}-@var{pass} @gol
607 -fenable-@var{kind}-@var{pass}=@var{range-list} @gol
608 -fira-verbose=@var{n} @gol
609 -flto-report -flto-report-wpa -fmem-report-wpa @gol
610 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report @gol
611 -fopt-info -fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
612 -fprofile-report @gol
613 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
614 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
615 -fstats -fstack-usage -ftime-report -ftime-report-details @gol
616 -fvar-tracking-assignments-toggle -gtoggle @gol
617 -print-file-name=@var{library} -print-libgcc-file-name @gol
618 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
619 -print-prog-name=@var{program} -print-search-dirs -Q @gol
620 -print-sysroot -print-sysroot-headers-suffix @gol
621 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
623 @item Machine-Dependent Options
624 @xref{Submodel Options,,Machine-Dependent Options}.
625 @c This list is ordered alphanumerically by subsection name.
626 @c Try and put the significant identifier (CPU or system) first,
627 @c so users have a clue at guessing where the ones they want will be.
629 @emph{AArch64 Options}
630 @gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
631 -mgeneral-regs-only @gol
632 -mcmodel=tiny -mcmodel=small -mcmodel=large @gol
633 -mstrict-align -mno-strict-align @gol
634 -momit-leaf-frame-pointer @gol
635 -mtls-dialect=desc -mtls-dialect=traditional @gol
636 -mtls-size=@var{size} @gol
637 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 @gol
638 -mlow-precision-recip-sqrt -mlow-precision-sqrt -mlow-precision-div @gol
639 -mpc-relative-literal-loads @gol
640 -msign-return-address=@var{scope} @gol
641 -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}
642 +@var{b-key}]|@var{bti} @gol
643 -march=@var{name} -mcpu=@var{name} -mtune=@var{name} @gol
644 -moverride=@var{string} -mverbose-cost-dump @gol
645 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{sysreg} @gol
646 -mstack-protector-guard-offset=@var{offset} -mtrack-speculation @gol
649 @emph{Adapteva Epiphany Options}
650 @gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
651 -mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
652 -msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
653 -mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
654 -mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
655 -msplit-vecmove-early -m1reg-@var{reg}}
657 @emph{AMD GCN Options}
658 @gccoptlist{-march=@var{gpu} -mtune=@var{gpu} -mstack-size=@var{bytes}}
661 @gccoptlist{-mbarrel-shifter -mjli-always @gol
662 -mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
663 -mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
664 -mea -mno-mpy -mmul32x16 -mmul64 -matomic @gol
665 -mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
666 -mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
667 -mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
668 -mlong-calls -mmedium-calls -msdata -mirq-ctrl-saved @gol
669 -mrgf-banked-regs -mlpc-width=@var{width} -G @var{num} @gol
670 -mvolatile-cache -mtp-regno=@var{regno} @gol
671 -malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
672 -mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
673 -mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
674 -mlra-priority-compact mlra-priority-noncompact -mmillicode @gol
675 -mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
676 -mtune=@var{cpu} -mmultcost=@var{num} -mcode-density-frame @gol
677 -munalign-prob-threshold=@var{probability} -mmpy-option=@var{multo} @gol
678 -mdiv-rem -mcode-density -mll64 -mfpu=@var{fpu} -mrf16 -mbranch-index}
681 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
682 -mabi=@var{name} @gol
683 -mapcs-stack-check -mno-apcs-stack-check @gol
684 -mapcs-reentrant -mno-apcs-reentrant @gol
685 -mgeneral-regs-only @gol
686 -msched-prolog -mno-sched-prolog @gol
687 -mlittle-endian -mbig-endian @gol
689 -mfloat-abi=@var{name} @gol
690 -mfp16-format=@var{name}
691 -mthumb-interwork -mno-thumb-interwork @gol
692 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
693 -mtune=@var{name} -mprint-tune-info @gol
694 -mstructure-size-boundary=@var{n} @gol
695 -mabort-on-noreturn @gol
696 -mlong-calls -mno-long-calls @gol
697 -msingle-pic-base -mno-single-pic-base @gol
698 -mpic-register=@var{reg} @gol
699 -mnop-fun-dllimport @gol
700 -mpoke-function-name @gol
701 -mthumb -marm -mflip-thumb @gol
702 -mtpcs-frame -mtpcs-leaf-frame @gol
703 -mcaller-super-interworking -mcallee-super-interworking @gol
704 -mtp=@var{name} -mtls-dialect=@var{dialect} @gol
705 -mword-relocations @gol
706 -mfix-cortex-m3-ldrd @gol
707 -munaligned-access @gol
708 -mneon-for-64bits @gol
709 -mslow-flash-data @gol
710 -masm-syntax-unified @gol
712 -mverbose-cost-dump @gol
718 @gccoptlist{-mmcu=@var{mcu} -mabsdata -maccumulate-args @gol
719 -mbranch-cost=@var{cost} @gol
720 -mcall-prologues -mgas-isr-prologues -mint8 @gol
721 -mn_flash=@var{size} -mno-interrupts @gol
722 -mmain-is-OS_task -mrelax -mrmw -mstrict-X -mtiny-stack @gol
723 -mfract-convert-truncate @gol
724 -mshort-calls -nodevicelib @gol
725 -Waddr-space-convert -Wmisspelled-isr}
727 @emph{Blackfin Options}
728 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
729 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
730 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
731 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
732 -mno-id-shared-library -mshared-library-id=@var{n} @gol
733 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
734 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
735 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
739 @gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
740 -msim -msdata=@var{sdata-type}}
743 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
744 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
745 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
746 -mstack-align -mdata-align -mconst-align @gol
747 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
748 -melf -maout -melinux -mlinux -sim -sim2 @gol
749 -mmul-bug-workaround -mno-mul-bug-workaround}
752 @gccoptlist{-mmac @gol
753 -mcr16cplus -mcr16c @gol
754 -msim -mint32 -mbit-ops
755 -mdata-model=@var{model}}
758 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol
759 -mbig-endian -EB -mlittle-endian -EL @gol
760 -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol
761 -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol
762 -mdsp -medsp -mvdsp @gol
763 -mdiv -msmart -mhigh-registers -manchor @gol
764 -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol
765 -mbranch-cost=@var{n} -mcse-cc -msched-prolog}
767 @emph{Darwin Options}
768 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
769 -arch_only -bind_at_load -bundle -bundle_loader @gol
770 -client_name -compatibility_version -current_version @gol
772 -dependency-file -dylib_file -dylinker_install_name @gol
773 -dynamic -dynamiclib -exported_symbols_list @gol
774 -filelist -flat_namespace -force_cpusubtype_ALL @gol
775 -force_flat_namespace -headerpad_max_install_names @gol
777 -image_base -init -install_name -keep_private_externs @gol
778 -multi_module -multiply_defined -multiply_defined_unused @gol
779 -noall_load -no_dead_strip_inits_and_terms @gol
780 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
781 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
782 -private_bundle -read_only_relocs -sectalign @gol
783 -sectobjectsymbols -whyload -seg1addr @gol
784 -sectcreate -sectobjectsymbols -sectorder @gol
785 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
786 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
787 -segprot -segs_read_only_addr -segs_read_write_addr @gol
788 -single_module -static -sub_library -sub_umbrella @gol
789 -twolevel_namespace -umbrella -undefined @gol
790 -unexported_symbols_list -weak_reference_mismatches @gol
791 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
792 -mkernel -mone-byte-bool}
794 @emph{DEC Alpha Options}
795 @gccoptlist{-mno-fp-regs -msoft-float @gol
796 -mieee -mieee-with-inexact -mieee-conformant @gol
797 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
798 -mtrap-precision=@var{mode} -mbuild-constants @gol
799 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
800 -mbwx -mmax -mfix -mcix @gol
801 -mfloat-vax -mfloat-ieee @gol
802 -mexplicit-relocs -msmall-data -mlarge-data @gol
803 -msmall-text -mlarge-text @gol
804 -mmemory-latency=@var{time}}
807 @gccoptlist{-mbig-endian -mlittle-endian -mkernel=@var{version}
808 -mframe-limit=@var{bytes}}
811 @gccoptlist{-msmall-model -mno-lsim}
814 @gccoptlist{-msim -mlra -mnodiv -mft32b -mcompress -mnopm}
817 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
818 -mhard-float -msoft-float @gol
819 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
820 -mdouble -mno-double @gol
821 -mmedia -mno-media -mmuladd -mno-muladd @gol
822 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
823 -mlinked-fp -mlong-calls -malign-labels @gol
824 -mlibrary-pic -macc-4 -macc-8 @gol
825 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
826 -moptimize-membar -mno-optimize-membar @gol
827 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
828 -mvliw-branch -mno-vliw-branch @gol
829 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
830 -mno-nested-cond-exec -mtomcat-stats @gol
834 @emph{GNU/Linux Options}
835 @gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
836 -tno-android-cc -tno-android-ld}
838 @emph{H8/300 Options}
839 @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
842 @gccoptlist{-march=@var{architecture-type} @gol
843 -mcaller-copies -mdisable-fpregs -mdisable-indexing @gol
844 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
845 -mfixed-range=@var{register-range} @gol
846 -mjump-in-delay -mlinker-opt -mlong-calls @gol
847 -mlong-load-store -mno-disable-fpregs @gol
848 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
849 -mno-jump-in-delay -mno-long-load-store @gol
850 -mno-portable-runtime -mno-soft-float @gol
851 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
852 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
853 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
854 -munix=@var{unix-std} -nolibdld -static -threads}
857 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
858 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
859 -mconstant-gp -mauto-pic -mfused-madd @gol
860 -minline-float-divide-min-latency @gol
861 -minline-float-divide-max-throughput @gol
862 -mno-inline-float-divide @gol
863 -minline-int-divide-min-latency @gol
864 -minline-int-divide-max-throughput @gol
865 -mno-inline-int-divide @gol
866 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
867 -mno-inline-sqrt @gol
868 -mdwarf2-asm -mearly-stop-bits @gol
869 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
870 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
871 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
872 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
873 -msched-spec-ldc -msched-spec-control-ldc @gol
874 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
875 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
876 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
877 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
880 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
881 -msign-extend-enabled -muser-enabled}
883 @emph{M32R/D Options}
884 @gccoptlist{-m32r2 -m32rx -m32r @gol
886 -malign-loops -mno-align-loops @gol
887 -missue-rate=@var{number} @gol
888 -mbranch-cost=@var{number} @gol
889 -mmodel=@var{code-size-model-type} @gol
890 -msdata=@var{sdata-type} @gol
891 -mno-flush-func -mflush-func=@var{name} @gol
892 -mno-flush-trap -mflush-trap=@var{number} @gol
896 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
898 @emph{M680x0 Options}
899 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
900 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
901 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
902 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
903 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
904 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
905 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
906 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
907 -mxgot -mno-xgot -mlong-jump-table-offsets}
910 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
911 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
912 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
913 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
914 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
917 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
918 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
919 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
920 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
923 @emph{MicroBlaze Options}
924 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
925 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
926 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
927 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
928 -mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model} @gol
929 -mpic-data-is-text-relative}
932 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
933 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
934 -mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
935 -mips16 -mno-mips16 -mflip-mips16 @gol
936 -minterlink-compressed -mno-interlink-compressed @gol
937 -minterlink-mips16 -mno-interlink-mips16 @gol
938 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
939 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
940 -mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
941 -mno-float -msingle-float -mdouble-float @gol
942 -modd-spreg -mno-odd-spreg @gol
943 -mabs=@var{mode} -mnan=@var{encoding} @gol
944 -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
947 -mvirt -mno-virt @gol
950 -mginv -mno-ginv @gol
951 -mmicromips -mno-micromips @gol
953 -mloongson-mmi -mno-loongson-mmi @gol
954 -mloongson-ext -mno-loongson-ext @gol
955 -mloongson-ext2 -mno-loongson-ext2 @gol
956 -mfpu=@var{fpu-type} @gol
957 -msmartmips -mno-smartmips @gol
958 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
959 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
960 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
961 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
962 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
963 -membedded-data -mno-embedded-data @gol
964 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
965 -mcode-readable=@var{setting} @gol
966 -msplit-addresses -mno-split-addresses @gol
967 -mexplicit-relocs -mno-explicit-relocs @gol
968 -mcheck-zero-division -mno-check-zero-division @gol
969 -mdivide-traps -mdivide-breaks @gol
970 -mload-store-pairs -mno-load-store-pairs @gol
971 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
972 -mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
973 -mfix-24k -mno-fix-24k @gol
974 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
975 -mfix-r5900 -mno-fix-r5900 @gol
976 -mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
977 -mfix-vr4120 -mno-fix-vr4120 @gol
978 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
979 -mflush-func=@var{func} -mno-flush-func @gol
980 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
981 -mcompact-branches=@var{policy} @gol
982 -mfp-exceptions -mno-fp-exceptions @gol
983 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
984 -mlxc1-sxc1 -mno-lxc1-sxc1 -mmadd4 -mno-madd4 @gol
985 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address @gol
986 -mframe-header-opt -mno-frame-header-opt}
989 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
990 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
991 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
992 -mno-base-addresses -msingle-exit -mno-single-exit}
994 @emph{MN10300 Options}
995 @gccoptlist{-mmult-bug -mno-mult-bug @gol
996 -mno-am33 -mam33 -mam33-2 -mam34 @gol
997 -mtune=@var{cpu-type} @gol
998 -mreturn-pointer-on-d0 @gol
999 -mno-crt0 -mrelax -mliw -msetlb}
1001 @emph{Moxie Options}
1002 @gccoptlist{-meb -mel -mmul.x -mno-crt0}
1004 @emph{MSP430 Options}
1005 @gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
1007 -mcode-region= -mdata-region= @gol
1008 -msilicon-errata= -msilicon-errata-warn= @gol
1011 @emph{NDS32 Options}
1012 @gccoptlist{-mbig-endian -mlittle-endian @gol
1013 -mreduced-regs -mfull-regs @gol
1014 -mcmov -mno-cmov @gol
1015 -mext-perf -mno-ext-perf @gol
1016 -mext-perf2 -mno-ext-perf2 @gol
1017 -mext-string -mno-ext-string @gol
1018 -mv3push -mno-v3push @gol
1019 -m16bit -mno-16bit @gol
1020 -misr-vector-size=@var{num} @gol
1021 -mcache-block-size=@var{num} @gol
1022 -march=@var{arch} @gol
1023 -mcmodel=@var{code-model} @gol
1024 -mctor-dtor -mrelax}
1026 @emph{Nios II Options}
1027 @gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
1028 -mgprel-sec=@var{regexp} -mr0rel-sec=@var{regexp} @gol
1030 -mno-bypass-cache -mbypass-cache @gol
1031 -mno-cache-volatile -mcache-volatile @gol
1032 -mno-fast-sw-div -mfast-sw-div @gol
1033 -mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
1034 -mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
1035 -mcustom-fpu-cfg=@var{name} @gol
1036 -mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name} @gol
1037 -march=@var{arch} -mbmx -mno-bmx -mcdx -mno-cdx}
1039 @emph{Nvidia PTX Options}
1040 @gccoptlist{-m32 -m64 -mmainkernel -moptimize}
1042 @emph{OpenRISC Options}
1043 @gccoptlist{-mboard=@var{name} -mnewlib -mhard-mul -mhard-div @gol
1044 -msoft-mul -msoft-div @gol
1045 -msoft-float -mhard-float -mdouble-float -munordered-float @gol
1046 -mcmov -mror -mrori -msext -msfimm -mshftimm}
1048 @emph{PDP-11 Options}
1049 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
1050 -mint32 -mno-int16 -mint16 -mno-int32 @gol
1051 -msplit -munix-asm -mdec-asm -mgnu-asm -mlra}
1053 @emph{picoChip Options}
1054 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
1055 -msymbol-as-address -mno-inefficient-warnings}
1057 @emph{PowerPC Options}
1058 See RS/6000 and PowerPC Options.
1061 @gccoptlist{-mmcu=@var{mcu} -minrt -mno-relax -mloop @gol
1062 -mabi=@var{variant} @gol}
1064 @emph{RISC-V Options}
1065 @gccoptlist{-mbranch-cost=@var{N-instruction} @gol
1067 -mabi=@var{ABI-string} @gol
1068 -mfdiv -mno-fdiv @gol
1070 -march=@var{ISA-string} @gol
1071 -mtune=@var{processor-string} @gol
1072 -mpreferred-stack-boundary=@var{num} @gol
1073 -msmall-data-limit=@var{N-bytes} @gol
1074 -msave-restore -mno-save-restore @gol
1075 -mstrict-align -mno-strict-align @gol
1076 -mcmodel=medlow -mcmodel=medany @gol
1077 -mexplicit-relocs -mno-explicit-relocs @gol
1078 -mrelax -mno-relax @gol
1079 -mriscv-attribute -mmo-riscv-attribute @gol
1080 -malign-data=@var{type}}
1083 @gccoptlist{-msim -mmul=none -mmul=g13 -mmul=g14 -mallregs @gol
1084 -mcpu=g10 -mcpu=g13 -mcpu=g14 -mg10 -mg13 -mg14 @gol
1085 -m64bit-doubles -m32bit-doubles -msave-mduc-in-interrupts}
1087 @emph{RS/6000 and PowerPC Options}
1088 @gccoptlist{-mcpu=@var{cpu-type} @gol
1089 -mtune=@var{cpu-type} @gol
1090 -mcmodel=@var{code-model} @gol
1092 -maltivec -mno-altivec @gol
1093 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
1094 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
1095 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
1096 -mfprnd -mno-fprnd @gol
1097 -mcmpb -mno-cmpb -mhard-dfp -mno-hard-dfp @gol
1098 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
1099 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
1100 -malign-power -malign-natural @gol
1101 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
1102 -mupdate -mno-update @gol
1103 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
1104 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
1105 -mstrict-align -mno-strict-align -mrelocatable @gol
1106 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
1107 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
1108 -mdynamic-no-pic -mswdiv -msingle-pic-base @gol
1109 -mprioritize-restricted-insns=@var{priority} @gol
1110 -msched-costly-dep=@var{dependence_type} @gol
1111 -minsert-sched-nops=@var{scheme} @gol
1112 -mcall-aixdesc -mcall-eabi -mcall-freebsd @gol
1113 -mcall-linux -mcall-netbsd -mcall-openbsd @gol
1114 -mcall-sysv -mcall-sysv-eabi -mcall-sysv-noeabi @gol
1115 -mtraceback=@var{traceback_type} @gol
1116 -maix-struct-return -msvr4-struct-return @gol
1117 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
1118 -mlongcall -mno-longcall -mpltseq -mno-pltseq @gol
1119 -mblock-move-inline-limit=@var{num} @gol
1120 -mblock-compare-inline-limit=@var{num} @gol
1121 -mblock-compare-inline-loop-limit=@var{num} @gol
1122 -mstring-compare-inline-limit=@var{num} @gol
1123 -misel -mno-isel @gol
1124 -mvrsave -mno-vrsave @gol
1125 -mmulhw -mno-mulhw @gol
1126 -mdlmzb -mno-dlmzb @gol
1127 -mprototype -mno-prototype @gol
1128 -msim -mmvme -mads -myellowknife -memb -msdata @gol
1129 -msdata=@var{opt} -mreadonly-in-sdata -mvxworks -G @var{num} @gol
1130 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
1131 -mno-recip-precision @gol
1132 -mveclibabi=@var{type} -mfriz -mno-friz @gol
1133 -mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
1134 -msave-toc-indirect -mno-save-toc-indirect @gol
1135 -mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
1136 -mcrypto -mno-crypto -mhtm -mno-htm @gol
1137 -mquad-memory -mno-quad-memory @gol
1138 -mquad-memory-atomic -mno-quad-memory-atomic @gol
1139 -mcompat-align-parm -mno-compat-align-parm @gol
1140 -mfloat128 -mno-float128 -mfloat128-hardware -mno-float128-hardware @gol
1141 -mgnu-attribute -mno-gnu-attribute @gol
1142 -mstack-protector-guard=@var{guard} -mstack-protector-guard-reg=@var{reg} @gol
1143 -mstack-protector-guard-offset=@var{offset} -mpcrel -mno-pcrel}
1146 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1148 -mbig-endian-data -mlittle-endian-data @gol
1151 -mas100-syntax -mno-as100-syntax@gol
1153 -mmax-constant-size=@gol
1156 -mallow-string-insns -mno-allow-string-insns@gol
1158 -mno-warn-multiple-fast-interrupts@gol
1159 -msave-acc-in-interrupts}
1161 @emph{S/390 and zSeries Options}
1162 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1163 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
1164 -mlong-double-64 -mlong-double-128 @gol
1165 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
1166 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
1167 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
1168 -mhtm -mvx -mzvector @gol
1169 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
1170 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
1171 -mhotpatch=@var{halfwords},@var{halfwords}}
1173 @emph{Score Options}
1174 @gccoptlist{-meb -mel @gol
1178 -mscore5 -mscore5u -mscore7 -mscore7d}
1181 @gccoptlist{-m1 -m2 -m2e @gol
1182 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
1184 -m4-nofpu -m4-single-only -m4-single -m4 @gol
1185 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
1186 -mb -ml -mdalign -mrelax @gol
1187 -mbigtable -mfmovd -mrenesas -mno-renesas -mnomacsave @gol
1188 -mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
1189 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
1190 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
1191 -maccumulate-outgoing-args @gol
1192 -matomic-model=@var{atomic-model} @gol
1193 -mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
1194 -mcbranch-force-delay-slot @gol
1195 -mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
1196 -mpretend-cmove -mtas}
1198 @emph{Solaris 2 Options}
1199 @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
1202 @emph{SPARC Options}
1203 @gccoptlist{-mcpu=@var{cpu-type} @gol
1204 -mtune=@var{cpu-type} @gol
1205 -mcmodel=@var{code-model} @gol
1206 -mmemory-model=@var{mem-model} @gol
1207 -m32 -m64 -mapp-regs -mno-app-regs @gol
1208 -mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
1209 -mfpu -mno-fpu -mhard-float -msoft-float @gol
1210 -mhard-quad-float -msoft-quad-float @gol
1211 -mstack-bias -mno-stack-bias @gol
1212 -mstd-struct-return -mno-std-struct-return @gol
1213 -munaligned-doubles -mno-unaligned-doubles @gol
1214 -muser-mode -mno-user-mode @gol
1215 -mv8plus -mno-v8plus -mvis -mno-vis @gol
1216 -mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1217 -mvis4 -mno-vis4 -mvis4b -mno-vis4b @gol
1218 -mcbcond -mno-cbcond -mfmaf -mno-fmaf -mfsmuld -mno-fsmuld @gol
1219 -mpopc -mno-popc -msubxc -mno-subxc @gol
1220 -mfix-at697f -mfix-ut699 -mfix-ut700 -mfix-gr712rc @gol
1223 @emph{System V Options}
1224 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1226 @emph{TILE-Gx Options}
1227 @gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1228 -mcmodel=@var{code-model}}
1230 @emph{TILEPro Options}
1231 @gccoptlist{-mcpu=@var{cpu} -m32}
1234 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1235 -mprolog-function -mno-prolog-function -mspace @gol
1236 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1237 -mapp-regs -mno-app-regs @gol
1238 -mdisable-callt -mno-disable-callt @gol
1239 -mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1240 -mv850e -mv850 -mv850e3v5 @gol
1251 @gccoptlist{-mg -mgnu -munix}
1253 @emph{Visium Options}
1254 @gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1255 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1258 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1259 -mpointer-size=@var{size}}
1261 @emph{VxWorks Options}
1262 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1263 -Xbind-lazy -Xbind-now}
1266 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1267 -mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1268 -mfpmath=@var{unit} @gol
1269 -masm=@var{dialect} -mno-fancy-math-387 @gol
1270 -mno-fp-ret-in-387 -m80387 -mhard-float -msoft-float @gol
1271 -mno-wide-multiply -mrtd -malign-double @gol
1272 -mpreferred-stack-boundary=@var{num} @gol
1273 -mincoming-stack-boundary=@var{num} @gol
1274 -mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1275 -mrecip -mrecip=@var{opt} @gol
1276 -mvzeroupper -mprefer-avx128 -mprefer-vector-width=@var{opt} @gol
1277 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1278 -mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl @gol
1279 -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi -msha -maes @gol
1280 -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mpconfig -mwbnoinvd @gol
1281 -mptwrite -mprefetchwt1 -mclflushopt -mclwb -mxsavec -mxsaves @gol
1282 -msse4a -m3dnow -m3dnowa -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop @gol
1283 -madx -mlzcnt -mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mhle -mlwp @gol
1284 -mmwaitx -mclzero -mpku -mthreads -mgfni -mvaes -mwaitpkg @gol
1285 -mshstk -mmanual-endbr -mforce-indirect-call -mavx512vbmi2 -mavx512bf16 -menqcmd @gol
1286 -mvpclmulqdq -mavx512bitalg -mmovdiri -mmovdir64b -mavx512vpopcntdq @gol
1287 -mavx5124fmaps -mavx512vnni -mavx5124vnniw -mprfchw -mrdpid @gol
1288 -mrdseed -msgx -mavx512vp2intersect@gol
1289 -mcldemote -mms-bitfields -mno-align-stringops -minline-all-stringops @gol
1290 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1291 -mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1292 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1293 -m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1294 -mregparm=@var{num} -msseregparm @gol
1295 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1296 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
1297 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1298 -mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1299 -m32 -m64 -mx32 -m16 -miamcu -mlarge-data-threshold=@var{num} @gol
1300 -msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1301 -minstrument-return=@var{type} -mfentry-name=@var{name} -mfentry-section=@var{name} @gol
1302 -mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1303 -malign-data=@var{type} -mstack-protector-guard=@var{guard} @gol
1304 -mstack-protector-guard-reg=@var{reg} @gol
1305 -mstack-protector-guard-offset=@var{offset} @gol
1306 -mstack-protector-guard-symbol=@var{symbol} @gol
1307 -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol
1308 -mindirect-branch=@var{choice} -mfunction-return=@var{choice} @gol
1309 -mindirect-branch-register}
1311 @emph{x86 Windows Options}
1312 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1313 -mnop-fun-dllimport -mthread @gol
1314 -municode -mwin32 -mwindows -fno-set-stack-executable}
1316 @emph{Xstormy16 Options}
1319 @emph{Xtensa Options}
1320 @gccoptlist{-mconst16 -mno-const16 @gol
1321 -mfused-madd -mno-fused-madd @gol
1323 -mserialize-volatile -mno-serialize-volatile @gol
1324 -mtext-section-literals -mno-text-section-literals @gol
1325 -mauto-litpools -mno-auto-litpools @gol
1326 -mtarget-align -mno-target-align @gol
1327 -mlongcalls -mno-longcalls}
1329 @emph{zSeries Options}
1330 See S/390 and zSeries Options.
1334 @node Overall Options
1335 @section Options Controlling the Kind of Output
1337 Compilation can involve up to four stages: preprocessing, compilation
1338 proper, assembly and linking, always in that order. GCC is capable of
1339 preprocessing and compiling several files either into several
1340 assembler input files, or into one assembler input file; then each
1341 assembler input file produces an object file, and linking combines all
1342 the object files (those newly compiled, and those specified as input)
1343 into an executable file.
1345 @cindex file name suffix
1346 For any given input file, the file name suffix determines what kind of
1347 compilation is done:
1351 C source code that must be preprocessed.
1354 C source code that should not be preprocessed.
1357 C++ source code that should not be preprocessed.
1360 Objective-C source code. Note that you must link with the @file{libobjc}
1361 library to make an Objective-C program work.
1364 Objective-C source code that should not be preprocessed.
1368 Objective-C++ source code. Note that you must link with the @file{libobjc}
1369 library to make an Objective-C++ program work. Note that @samp{.M} refers
1370 to a literal capital M@.
1372 @item @var{file}.mii
1373 Objective-C++ source code that should not be preprocessed.
1376 C, C++, Objective-C or Objective-C++ header file to be turned into a
1377 precompiled header (default), or C, C++ header file to be turned into an
1378 Ada spec (via the @option{-fdump-ada-spec} switch).
1381 @itemx @var{file}.cp
1382 @itemx @var{file}.cxx
1383 @itemx @var{file}.cpp
1384 @itemx @var{file}.CPP
1385 @itemx @var{file}.c++
1387 C++ source code that must be preprocessed. Note that in @samp{.cxx},
1388 the last two letters must both be literally @samp{x}. Likewise,
1389 @samp{.C} refers to a literal capital C@.
1393 Objective-C++ source code that must be preprocessed.
1395 @item @var{file}.mii
1396 Objective-C++ source code that should not be preprocessed.
1400 @itemx @var{file}.hp
1401 @itemx @var{file}.hxx
1402 @itemx @var{file}.hpp
1403 @itemx @var{file}.HPP
1404 @itemx @var{file}.h++
1405 @itemx @var{file}.tcc
1406 C++ header file to be turned into a precompiled header or Ada spec.
1409 @itemx @var{file}.for
1410 @itemx @var{file}.ftn
1411 Fixed form Fortran source code that should not be preprocessed.
1414 @itemx @var{file}.FOR
1415 @itemx @var{file}.fpp
1416 @itemx @var{file}.FPP
1417 @itemx @var{file}.FTN
1418 Fixed form Fortran source code that must be preprocessed (with the traditional
1421 @item @var{file}.f90
1422 @itemx @var{file}.f95
1423 @itemx @var{file}.f03
1424 @itemx @var{file}.f08
1425 Free form Fortran source code that should not be preprocessed.
1427 @item @var{file}.F90
1428 @itemx @var{file}.F95
1429 @itemx @var{file}.F03
1430 @itemx @var{file}.F08
1431 Free form Fortran source code that must be preprocessed (with the
1432 traditional preprocessor).
1437 @item @var{file}.brig
1438 BRIG files (binary representation of HSAIL).
1447 D documentation code (Ddoc).
1449 @item @var{file}.ads
1450 Ada source code file that contains a library unit declaration (a
1451 declaration of a package, subprogram, or generic, or a generic
1452 instantiation), or a library unit renaming declaration (a package,
1453 generic, or subprogram renaming declaration). Such files are also
1456 @item @var{file}.adb
1457 Ada source code file containing a library unit body (a subprogram or
1458 package body). Such files are also called @dfn{bodies}.
1460 @c GCC also knows about some suffixes for languages not yet included:
1468 @itemx @var{file}.sx
1469 Assembler code that must be preprocessed.
1472 An object file to be fed straight into linking.
1473 Any file name with no recognized suffix is treated this way.
1477 You can specify the input language explicitly with the @option{-x} option:
1480 @item -x @var{language}
1481 Specify explicitly the @var{language} for the following input files
1482 (rather than letting the compiler choose a default based on the file
1483 name suffix). This option applies to all following input files until
1484 the next @option{-x} option. Possible values for @var{language} are:
1486 c c-header cpp-output
1487 c++ c++-header c++-cpp-output
1488 objective-c objective-c-header objective-c-cpp-output
1489 objective-c++ objective-c++-header objective-c++-cpp-output
1490 assembler assembler-with-cpp
1493 f77 f77-cpp-input f95 f95-cpp-input
1499 Turn off any specification of a language, so that subsequent files are
1500 handled according to their file name suffixes (as they are if @option{-x}
1501 has not been used at all).
1504 If you only want some of the stages of compilation, you can use
1505 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1506 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1507 @command{gcc} is to stop. Note that some combinations (for example,
1508 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1513 Compile or assemble the source files, but do not link. The linking
1514 stage simply is not done. The ultimate output is in the form of an
1515 object file for each source file.
1517 By default, the object file name for a source file is made by replacing
1518 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1520 Unrecognized input files, not requiring compilation or assembly, are
1525 Stop after the stage of compilation proper; do not assemble. The output
1526 is in the form of an assembler code file for each non-assembler input
1529 By default, the assembler file name for a source file is made by
1530 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1532 Input files that don't require compilation are ignored.
1536 Stop after the preprocessing stage; do not run the compiler proper. The
1537 output is in the form of preprocessed source code, which is sent to the
1540 Input files that don't require preprocessing are ignored.
1542 @cindex output file option
1545 Place output in file @var{file}. This applies to whatever
1546 sort of output is being produced, whether it be an executable file,
1547 an object file, an assembler file or preprocessed C code.
1549 If @option{-o} is not specified, the default is to put an executable
1550 file in @file{a.out}, the object file for
1551 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1552 assembler file in @file{@var{source}.s}, a precompiled header file in
1553 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1558 Print (on standard error output) the commands executed to run the stages
1559 of compilation. Also print the version number of the compiler driver
1560 program and of the preprocessor and the compiler proper.
1564 Like @option{-v} except the commands are not executed and arguments
1565 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1566 This is useful for shell scripts to capture the driver-generated command lines.
1570 Print (on the standard output) a description of the command-line options
1571 understood by @command{gcc}. If the @option{-v} option is also specified
1572 then @option{--help} is also passed on to the various processes
1573 invoked by @command{gcc}, so that they can display the command-line options
1574 they accept. If the @option{-Wextra} option has also been specified
1575 (prior to the @option{--help} option), then command-line options that
1576 have no documentation associated with them are also displayed.
1579 @opindex target-help
1580 Print (on the standard output) a description of target-specific command-line
1581 options for each tool. For some targets extra target-specific
1582 information may also be printed.
1584 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1585 Print (on the standard output) a description of the command-line
1586 options understood by the compiler that fit into all specified classes
1587 and qualifiers. These are the supported classes:
1590 @item @samp{optimizers}
1591 Display all of the optimization options supported by the
1594 @item @samp{warnings}
1595 Display all of the options controlling warning messages
1596 produced by the compiler.
1599 Display target-specific options. Unlike the
1600 @option{--target-help} option however, target-specific options of the
1601 linker and assembler are not displayed. This is because those
1602 tools do not currently support the extended @option{--help=} syntax.
1605 Display the values recognized by the @option{--param}
1608 @item @var{language}
1609 Display the options supported for @var{language}, where
1610 @var{language} is the name of one of the languages supported in this
1614 Display the options that are common to all languages.
1617 These are the supported qualifiers:
1620 @item @samp{undocumented}
1621 Display only those options that are undocumented.
1624 Display options taking an argument that appears after an equal
1625 sign in the same continuous piece of text, such as:
1626 @samp{--help=target}.
1628 @item @samp{separate}
1629 Display options taking an argument that appears as a separate word
1630 following the original option, such as: @samp{-o output-file}.
1633 Thus for example to display all the undocumented target-specific
1634 switches supported by the compiler, use:
1637 --help=target,undocumented
1640 The sense of a qualifier can be inverted by prefixing it with the
1641 @samp{^} character, so for example to display all binary warning
1642 options (i.e., ones that are either on or off and that do not take an
1643 argument) that have a description, use:
1646 --help=warnings,^joined,^undocumented
1649 The argument to @option{--help=} should not consist solely of inverted
1652 Combining several classes is possible, although this usually
1653 restricts the output so much that there is nothing to display. One
1654 case where it does work, however, is when one of the classes is
1655 @var{target}. For example, to display all the target-specific
1656 optimization options, use:
1659 --help=target,optimizers
1662 The @option{--help=} option can be repeated on the command line. Each
1663 successive use displays its requested class of options, skipping
1664 those that have already been displayed. If @option{--help} is also
1665 specified anywhere on the command line then this takes precedence
1666 over any @option{--help=} option.
1668 If the @option{-Q} option appears on the command line before the
1669 @option{--help=} option, then the descriptive text displayed by
1670 @option{--help=} is changed. Instead of describing the displayed
1671 options, an indication is given as to whether the option is enabled,
1672 disabled or set to a specific value (assuming that the compiler
1673 knows this at the point where the @option{--help=} option is used).
1675 Here is a truncated example from the ARM port of @command{gcc}:
1678 % gcc -Q -mabi=2 --help=target -c
1679 The following options are target specific:
1681 -mabort-on-noreturn [disabled]
1685 The output is sensitive to the effects of previous command-line
1686 options, so for example it is possible to find out which optimizations
1687 are enabled at @option{-O2} by using:
1690 -Q -O2 --help=optimizers
1693 Alternatively you can discover which binary optimizations are enabled
1694 by @option{-O3} by using:
1697 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1698 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1699 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1704 Display the version number and copyrights of the invoked GCC@.
1706 @item -pass-exit-codes
1707 @opindex pass-exit-codes
1708 Normally the @command{gcc} program exits with the code of 1 if any
1709 phase of the compiler returns a non-success return code. If you specify
1710 @option{-pass-exit-codes}, the @command{gcc} program instead returns with
1711 the numerically highest error produced by any phase returning an error
1712 indication. The C, C++, and Fortran front ends return 4 if an internal
1713 compiler error is encountered.
1717 Use pipes rather than temporary files for communication between the
1718 various stages of compilation. This fails to work on some systems where
1719 the assembler is unable to read from a pipe; but the GNU assembler has
1722 @item -specs=@var{file}
1724 Process @var{file} after the compiler reads in the standard @file{specs}
1725 file, in order to override the defaults which the @command{gcc} driver
1726 program uses when determining what switches to pass to @command{cc1},
1727 @command{cc1plus}, @command{as}, @command{ld}, etc. More than one
1728 @option{-specs=@var{file}} can be specified on the command line, and they
1729 are processed in order, from left to right. @xref{Spec Files}, for
1730 information about the format of the @var{file}.
1734 Invoke all subcommands under a wrapper program. The name of the
1735 wrapper program and its parameters are passed as a comma separated
1739 gcc -c t.c -wrapper gdb,--args
1743 This invokes all subprograms of @command{gcc} under
1744 @samp{gdb --args}, thus the invocation of @command{cc1} is
1745 @samp{gdb --args cc1 @dots{}}.
1747 @item -ffile-prefix-map=@var{old}=@var{new}
1748 @opindex ffile-prefix-map
1749 When compiling files residing in directory @file{@var{old}}, record
1750 any references to them in the result of the compilation as if the
1751 files resided in directory @file{@var{new}} instead. Specifying this
1752 option is equivalent to specifying all the individual
1753 @option{-f*-prefix-map} options. This can be used to make reproducible
1754 builds that are location independent. See also
1755 @option{-fmacro-prefix-map} and @option{-fdebug-prefix-map}.
1757 @item -fplugin=@var{name}.so
1759 Load the plugin code in file @var{name}.so, assumed to be a
1760 shared object to be dlopen'd by the compiler. The base name of
1761 the shared object file is used to identify the plugin for the
1762 purposes of argument parsing (See
1763 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1764 Each plugin should define the callback functions specified in the
1767 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1768 @opindex fplugin-arg
1769 Define an argument called @var{key} with a value of @var{value}
1770 for the plugin called @var{name}.
1772 @item -fdump-ada-spec@r{[}-slim@r{]}
1773 @opindex fdump-ada-spec
1774 For C and C++ source and include files, generate corresponding Ada specs.
1775 @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1776 GNAT User's Guide}, which provides detailed documentation on this feature.
1778 @item -fada-spec-parent=@var{unit}
1779 @opindex fada-spec-parent
1780 In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1781 Ada specs as child units of parent @var{unit}.
1783 @item -fdump-go-spec=@var{file}
1784 @opindex fdump-go-spec
1785 For input files in any language, generate corresponding Go
1786 declarations in @var{file}. This generates Go @code{const},
1787 @code{type}, @code{var}, and @code{func} declarations which may be a
1788 useful way to start writing a Go interface to code written in some
1791 @include @value{srcdir}/../libiberty/at-file.texi
1795 @section Compiling C++ Programs
1797 @cindex suffixes for C++ source
1798 @cindex C++ source file suffixes
1799 C++ source files conventionally use one of the suffixes @samp{.C},
1800 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1801 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1802 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1803 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1804 files with these names and compiles them as C++ programs even if you
1805 call the compiler the same way as for compiling C programs (usually
1806 with the name @command{gcc}).
1810 However, the use of @command{gcc} does not add the C++ library.
1811 @command{g++} is a program that calls GCC and automatically specifies linking
1812 against the C++ library. It treats @samp{.c},
1813 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1814 files unless @option{-x} is used. This program is also useful when
1815 precompiling a C header file with a @samp{.h} extension for use in C++
1816 compilations. On many systems, @command{g++} is also installed with
1817 the name @command{c++}.
1819 @cindex invoking @command{g++}
1820 When you compile C++ programs, you may specify many of the same
1821 command-line options that you use for compiling programs in any
1822 language; or command-line options meaningful for C and related
1823 languages; or options that are meaningful only for C++ programs.
1824 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1825 explanations of options for languages related to C@.
1826 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1827 explanations of options that are meaningful only for C++ programs.
1829 @node C Dialect Options
1830 @section Options Controlling C Dialect
1831 @cindex dialect options
1832 @cindex language dialect options
1833 @cindex options, dialect
1835 The following options control the dialect of C (or languages derived
1836 from C, such as C++, Objective-C and Objective-C++) that the compiler
1840 @cindex ANSI support
1844 In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1845 equivalent to @option{-std=c++98}.
1847 This turns off certain features of GCC that are incompatible with ISO
1848 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1849 such as the @code{asm} and @code{typeof} keywords, and
1850 predefined macros such as @code{unix} and @code{vax} that identify the
1851 type of system you are using. It also enables the undesirable and
1852 rarely used ISO trigraph feature. For the C compiler,
1853 it disables recognition of C++ style @samp{//} comments as well as
1854 the @code{inline} keyword.
1856 The alternate keywords @code{__asm__}, @code{__extension__},
1857 @code{__inline__} and @code{__typeof__} continue to work despite
1858 @option{-ansi}. You would not want to use them in an ISO C program, of
1859 course, but it is useful to put them in header files that might be included
1860 in compilations done with @option{-ansi}. Alternate predefined macros
1861 such as @code{__unix__} and @code{__vax__} are also available, with or
1862 without @option{-ansi}.
1864 The @option{-ansi} option does not cause non-ISO programs to be
1865 rejected gratuitously. For that, @option{-Wpedantic} is required in
1866 addition to @option{-ansi}. @xref{Warning Options}.
1868 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1869 option is used. Some header files may notice this macro and refrain
1870 from declaring certain functions or defining certain macros that the
1871 ISO standard doesn't call for; this is to avoid interfering with any
1872 programs that might use these names for other things.
1874 Functions that are normally built in but do not have semantics
1875 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1876 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1877 built-in functions provided by GCC}, for details of the functions
1882 Determine the language standard. @xref{Standards,,Language Standards
1883 Supported by GCC}, for details of these standard versions. This option
1884 is currently only supported when compiling C or C++.
1886 The compiler can accept several base standards, such as @samp{c90} or
1887 @samp{c++98}, and GNU dialects of those standards, such as
1888 @samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1889 compiler accepts all programs following that standard plus those
1890 using GNU extensions that do not contradict it. For example,
1891 @option{-std=c90} turns off certain features of GCC that are
1892 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1893 keywords, but not other GNU extensions that do not have a meaning in
1894 ISO C90, such as omitting the middle term of a @code{?:}
1895 expression. On the other hand, when a GNU dialect of a standard is
1896 specified, all features supported by the compiler are enabled, even when
1897 those features change the meaning of the base standard. As a result, some
1898 strict-conforming programs may be rejected. The particular standard
1899 is used by @option{-Wpedantic} to identify which features are GNU
1900 extensions given that version of the standard. For example
1901 @option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1902 comments, while @option{-std=gnu99 -Wpedantic} does not.
1904 A value for this option must be provided; possible values are
1910 Support all ISO C90 programs (certain GNU extensions that conflict
1911 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1913 @item iso9899:199409
1914 ISO C90 as modified in amendment 1.
1920 ISO C99. This standard is substantially completely supported, modulo
1921 bugs and floating-point issues
1922 (mainly but not entirely relating to optional C99 features from
1923 Annexes F and G). See
1924 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1925 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1930 ISO C11, the 2011 revision of the ISO C standard. This standard is
1931 substantially completely supported, modulo bugs, floating-point issues
1932 (mainly but not entirely relating to optional C11 features from
1933 Annexes F and G) and the optional Annexes K (Bounds-checking
1934 interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1940 ISO C17, the 2017 revision of the ISO C standard
1941 (published in 2018). This standard is
1942 same as C11 except for corrections of defects (all of which are also
1943 applied with @option{-std=c11}) and a new value of
1944 @code{__STDC_VERSION__}, and so is supported to the same extent as C11.
1947 The next version of the ISO C standard, still under development. The
1948 support for this version is experimental and incomplete.
1952 GNU dialect of ISO C90 (including some C99 features).
1956 GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1960 GNU dialect of ISO C11.
1961 The name @samp{gnu1x} is deprecated.
1965 GNU dialect of ISO C17. This is the default for C code.
1968 The next version of the ISO C standard, still under development, plus
1969 GNU extensions. The support for this version is experimental and
1974 The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1975 additional defect reports. Same as @option{-ansi} for C++ code.
1979 GNU dialect of @option{-std=c++98}.
1983 The 2011 ISO C++ standard plus amendments.
1984 The name @samp{c++0x} is deprecated.
1988 GNU dialect of @option{-std=c++11}.
1989 The name @samp{gnu++0x} is deprecated.
1993 The 2014 ISO C++ standard plus amendments.
1994 The name @samp{c++1y} is deprecated.
1998 GNU dialect of @option{-std=c++14}.
1999 This is the default for C++ code.
2000 The name @samp{gnu++1y} is deprecated.
2004 The 2017 ISO C++ standard plus amendments.
2005 The name @samp{c++1z} is deprecated.
2009 GNU dialect of @option{-std=c++17}.
2010 The name @samp{gnu++1z} is deprecated.
2013 The next revision of the ISO C++ standard, tentatively planned for
2014 2020. Support is highly experimental, and will almost certainly
2015 change in incompatible ways in future releases.
2018 GNU dialect of @option{-std=c++2a}. Support is highly experimental,
2019 and will almost certainly change in incompatible ways in future
2023 @item -fgnu89-inline
2024 @opindex fgnu89-inline
2025 The option @option{-fgnu89-inline} tells GCC to use the traditional
2026 GNU semantics for @code{inline} functions when in C99 mode.
2027 @xref{Inline,,An Inline Function is As Fast As a Macro}.
2028 Using this option is roughly equivalent to adding the
2029 @code{gnu_inline} function attribute to all inline functions
2030 (@pxref{Function Attributes}).
2032 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
2033 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
2034 specifies the default behavior).
2035 This option is not supported in @option{-std=c90} or
2036 @option{-std=gnu90} mode.
2038 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
2039 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
2040 in effect for @code{inline} functions. @xref{Common Predefined
2041 Macros,,,cpp,The C Preprocessor}.
2043 @item -fpermitted-flt-eval-methods=@var{style}
2044 @opindex fpermitted-flt-eval-methods
2045 @opindex fpermitted-flt-eval-methods=c11
2046 @opindex fpermitted-flt-eval-methods=ts-18661-3
2047 ISO/IEC TS 18661-3 defines new permissible values for
2048 @code{FLT_EVAL_METHOD} that indicate that operations and constants with
2049 a semantic type that is an interchange or extended format should be
2050 evaluated to the precision and range of that type. These new values are
2051 a superset of those permitted under C99/C11, which does not specify the
2052 meaning of other positive values of @code{FLT_EVAL_METHOD}. As such, code
2053 conforming to C11 may not have been written expecting the possibility of
2056 @option{-fpermitted-flt-eval-methods} specifies whether the compiler
2057 should allow only the values of @code{FLT_EVAL_METHOD} specified in C99/C11,
2058 or the extended set of values specified in ISO/IEC TS 18661-3.
2060 @var{style} is either @code{c11} or @code{ts-18661-3} as appropriate.
2062 The default when in a standards compliant mode (@option{-std=c11} or similar)
2063 is @option{-fpermitted-flt-eval-methods=c11}. The default when in a GNU
2064 dialect (@option{-std=gnu11} or similar) is
2065 @option{-fpermitted-flt-eval-methods=ts-18661-3}.
2067 @item -aux-info @var{filename}
2069 Output to the given filename prototyped declarations for all functions
2070 declared and/or defined in a translation unit, including those in header
2071 files. This option is silently ignored in any language other than C@.
2073 Besides declarations, the file indicates, in comments, the origin of
2074 each declaration (source file and line), whether the declaration was
2075 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
2076 @samp{O} for old, respectively, in the first character after the line
2077 number and the colon), and whether it came from a declaration or a
2078 definition (@samp{C} or @samp{F}, respectively, in the following
2079 character). In the case of function definitions, a K&R-style list of
2080 arguments followed by their declarations is also provided, inside
2081 comments, after the declaration.
2083 @item -fallow-parameterless-variadic-functions
2084 @opindex fallow-parameterless-variadic-functions
2085 Accept variadic functions without named parameters.
2087 Although it is possible to define such a function, this is not very
2088 useful as it is not possible to read the arguments. This is only
2089 supported for C as this construct is allowed by C++.
2094 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
2095 keyword, so that code can use these words as identifiers. You can use
2096 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
2097 instead. @option{-ansi} implies @option{-fno-asm}.
2099 In C++, this switch only affects the @code{typeof} keyword, since
2100 @code{asm} and @code{inline} are standard keywords. You may want to
2101 use the @option{-fno-gnu-keywords} flag instead, which has the same
2102 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
2103 switch only affects the @code{asm} and @code{typeof} keywords, since
2104 @code{inline} is a standard keyword in ISO C99.
2107 @itemx -fno-builtin-@var{function}
2108 @opindex fno-builtin
2110 @cindex built-in functions
2111 Don't recognize built-in functions that do not begin with
2112 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
2113 functions provided by GCC}, for details of the functions affected,
2114 including those which are not built-in functions when @option{-ansi} or
2115 @option{-std} options for strict ISO C conformance are used because they
2116 do not have an ISO standard meaning.
2118 GCC normally generates special code to handle certain built-in functions
2119 more efficiently; for instance, calls to @code{alloca} may become single
2120 instructions which adjust the stack directly, and calls to @code{memcpy}
2121 may become inline copy loops. The resulting code is often both smaller
2122 and faster, but since the function calls no longer appear as such, you
2123 cannot set a breakpoint on those calls, nor can you change the behavior
2124 of the functions by linking with a different library. In addition,
2125 when a function is recognized as a built-in function, GCC may use
2126 information about that function to warn about problems with calls to
2127 that function, or to generate more efficient code, even if the
2128 resulting code still contains calls to that function. For example,
2129 warnings are given with @option{-Wformat} for bad calls to
2130 @code{printf} when @code{printf} is built in and @code{strlen} is
2131 known not to modify global memory.
2133 With the @option{-fno-builtin-@var{function}} option
2134 only the built-in function @var{function} is
2135 disabled. @var{function} must not begin with @samp{__builtin_}. If a
2136 function is named that is not built-in in this version of GCC, this
2137 option is ignored. There is no corresponding
2138 @option{-fbuiltin-@var{function}} option; if you wish to enable
2139 built-in functions selectively when using @option{-fno-builtin} or
2140 @option{-ffreestanding}, you may define macros such as:
2143 #define abs(n) __builtin_abs ((n))
2144 #define strcpy(d, s) __builtin_strcpy ((d), (s))
2150 Enable parsing of function definitions marked with @code{__GIMPLE}.
2151 This is an experimental feature that allows unit testing of GIMPLE
2156 @cindex hosted environment
2158 Assert that compilation targets a hosted environment. This implies
2159 @option{-fbuiltin}. A hosted environment is one in which the
2160 entire standard library is available, and in which @code{main} has a return
2161 type of @code{int}. Examples are nearly everything except a kernel.
2162 This is equivalent to @option{-fno-freestanding}.
2164 @item -ffreestanding
2165 @opindex ffreestanding
2166 @cindex hosted environment
2168 Assert that compilation targets a freestanding environment. This
2169 implies @option{-fno-builtin}. A freestanding environment
2170 is one in which the standard library may not exist, and program startup may
2171 not necessarily be at @code{main}. The most obvious example is an OS kernel.
2172 This is equivalent to @option{-fno-hosted}.
2174 @xref{Standards,,Language Standards Supported by GCC}, for details of
2175 freestanding and hosted environments.
2179 @cindex OpenACC accelerator programming
2180 Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
2181 @code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
2182 compiler generates accelerated code according to the OpenACC Application
2183 Programming Interface v2.0 @w{@uref{https://www.openacc.org}}. This option
2184 implies @option{-pthread}, and thus is only supported on targets that
2185 have support for @option{-pthread}.
2187 @item -fopenacc-dim=@var{geom}
2188 @opindex fopenacc-dim
2189 @cindex OpenACC accelerator programming
2190 Specify default compute dimensions for parallel offload regions that do
2191 not explicitly specify. The @var{geom} value is a triple of
2192 ':'-separated sizes, in order 'gang', 'worker' and, 'vector'. A size
2193 can be omitted, to use a target-specific default value.
2197 @cindex OpenMP parallel
2198 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
2199 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
2200 compiler generates parallel code according to the OpenMP Application
2201 Program Interface v4.5 @w{@uref{https://www.openmp.org}}. This option
2202 implies @option{-pthread}, and thus is only supported on targets that
2203 have support for @option{-pthread}. @option{-fopenmp} implies
2204 @option{-fopenmp-simd}.
2207 @opindex fopenmp-simd
2210 Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
2211 in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
2216 When the option @option{-fgnu-tm} is specified, the compiler
2217 generates code for the Linux variant of Intel's current Transactional
2218 Memory ABI specification document (Revision 1.1, May 6 2009). This is
2219 an experimental feature whose interface may change in future versions
2220 of GCC, as the official specification changes. Please note that not
2221 all architectures are supported for this feature.
2223 For more information on GCC's support for transactional memory,
2224 @xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
2225 Transactional Memory Library}.
2227 Note that the transactional memory feature is not supported with
2228 non-call exceptions (@option{-fnon-call-exceptions}).
2230 @item -fms-extensions
2231 @opindex fms-extensions
2232 Accept some non-standard constructs used in Microsoft header files.
2234 In C++ code, this allows member names in structures to be similar
2235 to previous types declarations.
2244 Some cases of unnamed fields in structures and unions are only
2245 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
2246 fields within structs/unions}, for details.
2248 Note that this option is off for all targets except for x86
2249 targets using ms-abi.
2251 @item -fplan9-extensions
2252 @opindex fplan9-extensions
2253 Accept some non-standard constructs used in Plan 9 code.
2255 This enables @option{-fms-extensions}, permits passing pointers to
2256 structures with anonymous fields to functions that expect pointers to
2257 elements of the type of the field, and permits referring to anonymous
2258 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
2259 struct/union fields within structs/unions}, for details. This is only
2260 supported for C, not C++.
2262 @item -fcond-mismatch
2263 @opindex fcond-mismatch
2264 Allow conditional expressions with mismatched types in the second and
2265 third arguments. The value of such an expression is void. This option
2266 is not supported for C++.
2268 @item -flax-vector-conversions
2269 @opindex flax-vector-conversions
2270 Allow implicit conversions between vectors with differing numbers of
2271 elements and/or incompatible element types. This option should not be
2274 @item -funsigned-char
2275 @opindex funsigned-char
2276 Let the type @code{char} be unsigned, like @code{unsigned char}.
2278 Each kind of machine has a default for what @code{char} should
2279 be. It is either like @code{unsigned char} by default or like
2280 @code{signed char} by default.
2282 Ideally, a portable program should always use @code{signed char} or
2283 @code{unsigned char} when it depends on the signedness of an object.
2284 But many programs have been written to use plain @code{char} and
2285 expect it to be signed, or expect it to be unsigned, depending on the
2286 machines they were written for. This option, and its inverse, let you
2287 make such a program work with the opposite default.
2289 The type @code{char} is always a distinct type from each of
2290 @code{signed char} or @code{unsigned char}, even though its behavior
2291 is always just like one of those two.
2294 @opindex fsigned-char
2295 Let the type @code{char} be signed, like @code{signed char}.
2297 Note that this is equivalent to @option{-fno-unsigned-char}, which is
2298 the negative form of @option{-funsigned-char}. Likewise, the option
2299 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2301 @item -fsigned-bitfields
2302 @itemx -funsigned-bitfields
2303 @itemx -fno-signed-bitfields
2304 @itemx -fno-unsigned-bitfields
2305 @opindex fsigned-bitfields
2306 @opindex funsigned-bitfields
2307 @opindex fno-signed-bitfields
2308 @opindex fno-unsigned-bitfields
2309 These options control whether a bit-field is signed or unsigned, when the
2310 declaration does not use either @code{signed} or @code{unsigned}. By
2311 default, such a bit-field is signed, because this is consistent: the
2312 basic integer types such as @code{int} are signed types.
2314 @item -fsso-struct=@var{endianness}
2315 @opindex fsso-struct
2316 Set the default scalar storage order of structures and unions to the
2317 specified endianness. The accepted values are @samp{big-endian},
2318 @samp{little-endian} and @samp{native} for the native endianness of
2319 the target (the default). This option is not supported for C++.
2321 @strong{Warning:} the @option{-fsso-struct} switch causes GCC to generate
2322 code that is not binary compatible with code generated without it if the
2323 specified endianness is not the native endianness of the target.
2326 @node C++ Dialect Options
2327 @section Options Controlling C++ Dialect
2329 @cindex compiler options, C++
2330 @cindex C++ options, command-line
2331 @cindex options, C++
2332 This section describes the command-line options that are only meaningful
2333 for C++ programs. You can also use most of the GNU compiler options
2334 regardless of what language your program is in. For example, you
2335 might compile a file @file{firstClass.C} like this:
2338 g++ -g -fstrict-enums -O -c firstClass.C
2342 In this example, only @option{-fstrict-enums} is an option meant
2343 only for C++ programs; you can use the other options with any
2344 language supported by GCC@.
2346 Some options for compiling C programs, such as @option{-std}, are also
2347 relevant for C++ programs.
2348 @xref{C Dialect Options,,Options Controlling C Dialect}.
2350 Here is a list of options that are @emph{only} for compiling C++ programs:
2354 @item -fabi-version=@var{n}
2355 @opindex fabi-version
2356 Use version @var{n} of the C++ ABI@. The default is version 0.
2358 Version 0 refers to the version conforming most closely to
2359 the C++ ABI specification. Therefore, the ABI obtained using version 0
2360 will change in different versions of G++ as ABI bugs are fixed.
2362 Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2364 Version 2 is the version of the C++ ABI that first appeared in G++
2365 3.4, and was the default through G++ 4.9.
2367 Version 3 corrects an error in mangling a constant address as a
2370 Version 4, which first appeared in G++ 4.5, implements a standard
2371 mangling for vector types.
2373 Version 5, which first appeared in G++ 4.6, corrects the mangling of
2374 attribute const/volatile on function pointer types, decltype of a
2375 plain decl, and use of a function parameter in the declaration of
2378 Version 6, which first appeared in G++ 4.7, corrects the promotion
2379 behavior of C++11 scoped enums and the mangling of template argument
2380 packs, const/static_cast, prefix ++ and --, and a class scope function
2381 used as a template argument.
2383 Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2384 builtin type and corrects the mangling of lambdas in default argument
2387 Version 8, which first appeared in G++ 4.9, corrects the substitution
2388 behavior of function types with function-cv-qualifiers.
2390 Version 9, which first appeared in G++ 5.2, corrects the alignment of
2393 Version 10, which first appeared in G++ 6.1, adds mangling of
2394 attributes that affect type identity, such as ia32 calling convention
2395 attributes (e.g.@: @samp{stdcall}).
2397 Version 11, which first appeared in G++ 7, corrects the mangling of
2398 sizeof... expressions and operator names. For multiple entities with
2399 the same name within a function, that are declared in different scopes,
2400 the mangling now changes starting with the twelfth occurrence. It also
2401 implies @option{-fnew-inheriting-ctors}.
2403 Version 12, which first appeared in G++ 8, corrects the calling
2404 conventions for empty classes on the x86_64 target and for classes
2405 with only deleted copy/move constructors. It accidentally changes the
2406 calling convention for classes with a deleted copy constructor and a
2407 trivial move constructor.
2409 Version 13, which first appeared in G++ 8.2, fixes the accidental
2410 change in version 12.
2412 See also @option{-Wabi}.
2414 @item -fabi-compat-version=@var{n}
2415 @opindex fabi-compat-version
2416 On targets that support strong aliases, G++
2417 works around mangling changes by creating an alias with the correct
2418 mangled name when defining a symbol with an incorrect mangled name.
2419 This switch specifies which ABI version to use for the alias.
2421 With @option{-fabi-version=0} (the default), this defaults to 11 (GCC 7
2422 compatibility). If another ABI version is explicitly selected, this
2423 defaults to 0. For compatibility with GCC versions 3.2 through 4.9,
2424 use @option{-fabi-compat-version=2}.
2426 If this option is not provided but @option{-Wabi=@var{n}} is, that
2427 version is used for compatibility aliases. If this option is provided
2428 along with @option{-Wabi} (without the version), the version from this
2429 option is used for the warning.
2431 @item -fno-access-control
2432 @opindex fno-access-control
2433 @opindex faccess-control
2434 Turn off all access checking. This switch is mainly useful for working
2435 around bugs in the access control code.
2438 @opindex faligned-new
2439 Enable support for C++17 @code{new} of types that require more
2440 alignment than @code{void* ::operator new(std::size_t)} provides. A
2441 numeric argument such as @code{-faligned-new=32} can be used to
2442 specify how much alignment (in bytes) is provided by that function,
2443 but few users will need to override the default of
2444 @code{alignof(std::max_align_t)}.
2446 This flag is enabled by default for @option{-std=c++17}.
2451 @opindex fno-char8_t
2452 Enable support for @code{char8_t} as adopted for C++2a. This includes
2453 the addition of a new @code{char8_t} fundamental type, changes to the
2454 types of UTF-8 string and character literals, new signatures for
2455 user-defined literals, associated standard library updates, and new
2456 @code{__cpp_char8_t} and @code{__cpp_lib_char8_t} feature test macros.
2458 This option enables functions to be overloaded for ordinary and UTF-8
2462 int f(const char *); // #1
2463 int f(const char8_t *); // #2
2464 int v1 = f("text"); // Calls #1
2465 int v2 = f(u8"text"); // Calls #2
2469 and introduces new signatures for user-defined literals:
2472 int operator""_udl1(char8_t);
2473 int v3 = u8'x'_udl1;
2474 int operator""_udl2(const char8_t*, std::size_t);
2475 int v4 = u8"text"_udl2;
2476 template<typename T, T...> int operator""_udl3();
2477 int v5 = u8"text"_udl3;
2481 The change to the types of UTF-8 string and character literals introduces
2482 incompatibilities with ISO C++11 and later standards. For example, the
2483 following code is well-formed under ISO C++11, but is ill-formed when
2484 @option{-fchar8_t} is specified.
2487 char ca[] = u8"xx"; // error: char-array initialized from wide
2489 const char *cp = u8"xx";// error: invalid conversion from
2490 // `const char8_t*' to `const char*'
2492 auto v = f(u8"xx"); // error: invalid conversion from
2493 // `const char8_t*' to `const char*'
2494 std::string s@{u8"xx"@}; // error: no matching function for call to
2495 // `std::basic_string<char>::basic_string()'
2496 using namespace std::literals;
2497 s = u8"xx"s; // error: conversion from
2498 // `basic_string<char8_t>' to non-scalar
2499 // type `basic_string<char>' requested
2504 Check that the pointer returned by @code{operator new} is non-null
2505 before attempting to modify the storage allocated. This check is
2506 normally unnecessary because the C++ standard specifies that
2507 @code{operator new} only returns @code{0} if it is declared
2508 @code{throw()}, in which case the compiler always checks the
2509 return value even without this option. In all other cases, when
2510 @code{operator new} has a non-empty exception specification, memory
2511 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2512 @samp{new (nothrow)}.
2516 Enable support for the C++ Extensions for Concepts Technical
2517 Specification, ISO 19217 (2015), which allows code like
2520 template <class T> concept bool Addable = requires (T t) @{ t + t; @};
2521 template <Addable T> T add (T a, T b) @{ return a + b; @}
2524 @item -fconstexpr-depth=@var{n}
2525 @opindex fconstexpr-depth
2526 Set the maximum nested evaluation depth for C++11 constexpr functions
2527 to @var{n}. A limit is needed to detect endless recursion during
2528 constant expression evaluation. The minimum specified by the standard
2531 @item -fconstexpr-cache-depth=@var{n}
2532 @opindex fconstexpr-cache-depth
2533 Set the maximum level of nested evaluation depth for C++11 constexpr
2534 functions that will be cached to @var{n}. This is a heuristic that
2535 trades off compilation speed (when the cache avoids repeated
2536 calculations) against memory consumption (when the cache grows very
2537 large from highly recursive evaluations). The default is 8. Very few
2538 users are likely to want to adjust it, but if your code does heavy
2539 constexpr calculations you might want to experiment to find which
2540 value works best for you.
2542 @item -fconstexpr-loop-limit=@var{n}
2543 @opindex fconstexpr-loop-limit
2544 Set the maximum number of iterations for a loop in C++14 constexpr functions
2545 to @var{n}. A limit is needed to detect infinite loops during
2546 constant expression evaluation. The default is 262144 (1<<18).
2548 @item -fconstexpr-ops-limit=@var{n}
2549 @opindex fconstexpr-ops-limit
2550 Set the maximum number of operations during a single constexpr evaluation.
2551 Even when number of iterations of a single loop is limited with the above limit,
2552 if there are several nested loops and each of them has many iterations but still
2553 smaller than the above limit, or if in a body of some loop or even outside
2554 of a loop too many expressions need to be evaluated, the resulting constexpr
2555 evaluation might take too long.
2556 The default is 33554432 (1<<25).
2558 @item -fno-elide-constructors
2559 @opindex fno-elide-constructors
2560 @opindex felide-constructors
2561 The C++ standard allows an implementation to omit creating a temporary
2562 that is only used to initialize another object of the same type.
2563 Specifying this option disables that optimization, and forces G++ to
2564 call the copy constructor in all cases. This option also causes G++
2565 to call trivial member functions which otherwise would be expanded inline.
2567 In C++17, the compiler is required to omit these temporaries, but this
2568 option still affects trivial member functions.
2570 @item -fno-enforce-eh-specs
2571 @opindex fno-enforce-eh-specs
2572 @opindex fenforce-eh-specs
2573 Don't generate code to check for violation of exception specifications
2574 at run time. This option violates the C++ standard, but may be useful
2575 for reducing code size in production builds, much like defining
2576 @code{NDEBUG}. This does not give user code permission to throw
2577 exceptions in violation of the exception specifications; the compiler
2578 still optimizes based on the specifications, so throwing an
2579 unexpected exception results in undefined behavior at run time.
2581 @item -fextern-tls-init
2582 @itemx -fno-extern-tls-init
2583 @opindex fextern-tls-init
2584 @opindex fno-extern-tls-init
2585 The C++11 and OpenMP standards allow @code{thread_local} and
2586 @code{threadprivate} variables to have dynamic (runtime)
2587 initialization. To support this, any use of such a variable goes
2588 through a wrapper function that performs any necessary initialization.
2589 When the use and definition of the variable are in the same
2590 translation unit, this overhead can be optimized away, but when the
2591 use is in a different translation unit there is significant overhead
2592 even if the variable doesn't actually need dynamic initialization. If
2593 the programmer can be sure that no use of the variable in a
2594 non-defining TU needs to trigger dynamic initialization (either
2595 because the variable is statically initialized, or a use of the
2596 variable in the defining TU will be executed before any uses in
2597 another TU), they can avoid this overhead with the
2598 @option{-fno-extern-tls-init} option.
2600 On targets that support symbol aliases, the default is
2601 @option{-fextern-tls-init}. On targets that do not support symbol
2602 aliases, the default is @option{-fno-extern-tls-init}.
2604 @item -fno-gnu-keywords
2605 @opindex fno-gnu-keywords
2606 @opindex fgnu-keywords
2607 Do not recognize @code{typeof} as a keyword, so that code can use this
2608 word as an identifier. You can use the keyword @code{__typeof__} instead.
2609 This option is implied by the strict ISO C++ dialects: @option{-ansi},
2610 @option{-std=c++98}, @option{-std=c++11}, etc.
2612 @item -fno-implicit-templates
2613 @opindex fno-implicit-templates
2614 @opindex fimplicit-templates
2615 Never emit code for non-inline templates that are instantiated
2616 implicitly (i.e.@: by use); only emit code for explicit instantiations.
2617 If you use this option, you must take care to structure your code to
2618 include all the necessary explicit instantiations to avoid getting
2619 undefined symbols at link time.
2620 @xref{Template Instantiation}, for more information.
2622 @item -fno-implicit-inline-templates
2623 @opindex fno-implicit-inline-templates
2624 @opindex fimplicit-inline-templates
2625 Don't emit code for implicit instantiations of inline templates, either.
2626 The default is to handle inlines differently so that compiles with and
2627 without optimization need the same set of explicit instantiations.
2629 @item -fno-implement-inlines
2630 @opindex fno-implement-inlines
2631 @opindex fimplement-inlines
2632 To save space, do not emit out-of-line copies of inline functions
2633 controlled by @code{#pragma implementation}. This causes linker
2634 errors if these functions are not inlined everywhere they are called.
2636 @item -fms-extensions
2637 @opindex fms-extensions
2638 Disable Wpedantic warnings about constructs used in MFC, such as implicit
2639 int and getting a pointer to member function via non-standard syntax.
2641 @item -fnew-inheriting-ctors
2642 @opindex fnew-inheriting-ctors
2643 Enable the P0136 adjustment to the semantics of C++11 constructor
2644 inheritance. This is part of C++17 but also considered to be a Defect
2645 Report against C++11 and C++14. This flag is enabled by default
2646 unless @option{-fabi-version=10} or lower is specified.
2648 @item -fnew-ttp-matching
2649 @opindex fnew-ttp-matching
2650 Enable the P0522 resolution to Core issue 150, template template
2651 parameters and default arguments: this allows a template with default
2652 template arguments as an argument for a template template parameter
2653 with fewer template parameters. This flag is enabled by default for
2654 @option{-std=c++17}.
2656 @item -fno-nonansi-builtins
2657 @opindex fno-nonansi-builtins
2658 @opindex fnonansi-builtins
2659 Disable built-in declarations of functions that are not mandated by
2660 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2661 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
2664 @opindex fnothrow-opt
2665 Treat a @code{throw()} exception specification as if it were a
2666 @code{noexcept} specification to reduce or eliminate the text size
2667 overhead relative to a function with no exception specification. If
2668 the function has local variables of types with non-trivial
2669 destructors, the exception specification actually makes the
2670 function smaller because the EH cleanups for those variables can be
2671 optimized away. The semantic effect is that an exception thrown out of
2672 a function with such an exception specification results in a call
2673 to @code{terminate} rather than @code{unexpected}.
2675 @item -fno-operator-names
2676 @opindex fno-operator-names
2677 @opindex foperator-names
2678 Do not treat the operator name keywords @code{and}, @code{bitand},
2679 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2680 synonyms as keywords.
2682 @item -fno-optional-diags
2683 @opindex fno-optional-diags
2684 @opindex foptional-diags
2685 Disable diagnostics that the standard says a compiler does not need to
2686 issue. Currently, the only such diagnostic issued by G++ is the one for
2687 a name having multiple meanings within a class.
2690 @opindex fpermissive
2691 Downgrade some diagnostics about nonconformant code from errors to
2692 warnings. Thus, using @option{-fpermissive} allows some
2693 nonconforming code to compile.
2695 @item -fno-pretty-templates
2696 @opindex fno-pretty-templates
2697 @opindex fpretty-templates
2698 When an error message refers to a specialization of a function
2699 template, the compiler normally prints the signature of the
2700 template followed by the template arguments and any typedefs or
2701 typenames in the signature (e.g.@: @code{void f(T) [with T = int]}
2702 rather than @code{void f(int)}) so that it's clear which template is
2703 involved. When an error message refers to a specialization of a class
2704 template, the compiler omits any template arguments that match
2705 the default template arguments for that template. If either of these
2706 behaviors make it harder to understand the error message rather than
2707 easier, you can use @option{-fno-pretty-templates} to disable them.
2712 Disable generation of information about every class with virtual
2713 functions for use by the C++ run-time type identification features
2714 (@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2715 of the language, you can save some space by using this flag. Note that
2716 exception handling uses the same information, but G++ generates it as
2717 needed. The @code{dynamic_cast} operator can still be used for casts that
2718 do not require run-time type information, i.e.@: casts to @code{void *} or to
2719 unambiguous base classes.
2721 Mixing code compiled with @option{-frtti} with that compiled with
2722 @option{-fno-rtti} may not work. For example, programs may
2723 fail to link if a class compiled with @option{-fno-rtti} is used as a base
2724 for a class compiled with @option{-frtti}.
2726 @item -fsized-deallocation
2727 @opindex fsized-deallocation
2728 Enable the built-in global declarations
2730 void operator delete (void *, std::size_t) noexcept;
2731 void operator delete[] (void *, std::size_t) noexcept;
2733 as introduced in C++14. This is useful for user-defined replacement
2734 deallocation functions that, for example, use the size of the object
2735 to make deallocation faster. Enabled by default under
2736 @option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2737 warns about places that might want to add a definition.
2739 @item -fstrict-enums
2740 @opindex fstrict-enums
2741 Allow the compiler to optimize using the assumption that a value of
2742 enumerated type can only be one of the values of the enumeration (as
2743 defined in the C++ standard; basically, a value that can be
2744 represented in the minimum number of bits needed to represent all the
2745 enumerators). This assumption may not be valid if the program uses a
2746 cast to convert an arbitrary integer value to the enumerated type.
2748 @item -fstrong-eval-order
2749 @opindex fstrong-eval-order
2750 Evaluate member access, array subscripting, and shift expressions in
2751 left-to-right order, and evaluate assignment in right-to-left order,
2752 as adopted for C++17. Enabled by default with @option{-std=c++17}.
2753 @option{-fstrong-eval-order=some} enables just the ordering of member
2754 access and shift expressions, and is the default without
2755 @option{-std=c++17}.
2757 @item -ftemplate-backtrace-limit=@var{n}
2758 @opindex ftemplate-backtrace-limit
2759 Set the maximum number of template instantiation notes for a single
2760 warning or error to @var{n}. The default value is 10.
2762 @item -ftemplate-depth=@var{n}
2763 @opindex ftemplate-depth
2764 Set the maximum instantiation depth for template classes to @var{n}.
2765 A limit on the template instantiation depth is needed to detect
2766 endless recursions during template class instantiation. ANSI/ISO C++
2767 conforming programs must not rely on a maximum depth greater than 17
2768 (changed to 1024 in C++11). The default value is 900, as the compiler
2769 can run out of stack space before hitting 1024 in some situations.
2771 @item -fno-threadsafe-statics
2772 @opindex fno-threadsafe-statics
2773 @opindex fthreadsafe-statics
2774 Do not emit the extra code to use the routines specified in the C++
2775 ABI for thread-safe initialization of local statics. You can use this
2776 option to reduce code size slightly in code that doesn't need to be
2779 @item -fuse-cxa-atexit
2780 @opindex fuse-cxa-atexit
2781 Register destructors for objects with static storage duration with the
2782 @code{__cxa_atexit} function rather than the @code{atexit} function.
2783 This option is required for fully standards-compliant handling of static
2784 destructors, but only works if your C library supports
2785 @code{__cxa_atexit}.
2787 @item -fno-use-cxa-get-exception-ptr
2788 @opindex fno-use-cxa-get-exception-ptr
2789 @opindex fuse-cxa-get-exception-ptr
2790 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2791 causes @code{std::uncaught_exception} to be incorrect, but is necessary
2792 if the runtime routine is not available.
2794 @item -fvisibility-inlines-hidden
2795 @opindex fvisibility-inlines-hidden
2796 This switch declares that the user does not attempt to compare
2797 pointers to inline functions or methods where the addresses of the two functions
2798 are taken in different shared objects.
2800 The effect of this is that GCC may, effectively, mark inline methods with
2801 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2802 appear in the export table of a DSO and do not require a PLT indirection
2803 when used within the DSO@. Enabling this option can have a dramatic effect
2804 on load and link times of a DSO as it massively reduces the size of the
2805 dynamic export table when the library makes heavy use of templates.
2807 The behavior of this switch is not quite the same as marking the
2808 methods as hidden directly, because it does not affect static variables
2809 local to the function or cause the compiler to deduce that
2810 the function is defined in only one shared object.
2812 You may mark a method as having a visibility explicitly to negate the
2813 effect of the switch for that method. For example, if you do want to
2814 compare pointers to a particular inline method, you might mark it as
2815 having default visibility. Marking the enclosing class with explicit
2816 visibility has no effect.
2818 Explicitly instantiated inline methods are unaffected by this option
2819 as their linkage might otherwise cross a shared library boundary.
2820 @xref{Template Instantiation}.
2822 @item -fvisibility-ms-compat
2823 @opindex fvisibility-ms-compat
2824 This flag attempts to use visibility settings to make GCC's C++
2825 linkage model compatible with that of Microsoft Visual Studio.
2827 The flag makes these changes to GCC's linkage model:
2831 It sets the default visibility to @code{hidden}, like
2832 @option{-fvisibility=hidden}.
2835 Types, but not their members, are not hidden by default.
2838 The One Definition Rule is relaxed for types without explicit
2839 visibility specifications that are defined in more than one
2840 shared object: those declarations are permitted if they are
2841 permitted when this option is not used.
2844 In new code it is better to use @option{-fvisibility=hidden} and
2845 export those classes that are intended to be externally visible.
2846 Unfortunately it is possible for code to rely, perhaps accidentally,
2847 on the Visual Studio behavior.
2849 Among the consequences of these changes are that static data members
2850 of the same type with the same name but defined in different shared
2851 objects are different, so changing one does not change the other;
2852 and that pointers to function members defined in different shared
2853 objects may not compare equal. When this flag is given, it is a
2854 violation of the ODR to define types with the same name differently.
2859 Do not use weak symbol support, even if it is provided by the linker.
2860 By default, G++ uses weak symbols if they are available. This
2861 option exists only for testing, and should not be used by end-users;
2862 it results in inferior code and has no benefits. This option may
2863 be removed in a future release of G++.
2867 Do not search for header files in the standard directories specific to
2868 C++, but do still search the other standard directories. (This option
2869 is used when building the C++ library.)
2872 In addition, these optimization, warning, and code generation options
2873 have meanings only for C++ programs:
2876 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2879 Warn when G++ it generates code that is probably not compatible with
2880 the vendor-neutral C++ ABI@. Since G++ now defaults to updating the
2881 ABI with each major release, normally @option{-Wabi} will warn only if
2882 there is a check added later in a release series for an ABI issue
2883 discovered since the initial release. @option{-Wabi} will warn about
2884 more things if an older ABI version is selected (with
2885 @option{-fabi-version=@var{n}}).
2887 @option{-Wabi} can also be used with an explicit version number to
2888 warn about compatibility with a particular @option{-fabi-version}
2889 level, e.g.@: @option{-Wabi=2} to warn about changes relative to
2890 @option{-fabi-version=2}.
2892 If an explicit version number is provided and
2893 @option{-fabi-compat-version} is not specified, the version number
2894 from this option is used for compatibility aliases. If no explicit
2895 version number is provided with this option, but
2896 @option{-fabi-compat-version} is specified, that version number is
2897 used for ABI warnings.
2899 Although an effort has been made to warn about
2900 all such cases, there are probably some cases that are not warned about,
2901 even though G++ is generating incompatible code. There may also be
2902 cases where warnings are emitted even though the code that is generated
2905 You should rewrite your code to avoid these warnings if you are
2906 concerned about the fact that code generated by G++ may not be binary
2907 compatible with code generated by other compilers.
2909 Known incompatibilities in @option{-fabi-version=2} (which was the
2910 default from GCC 3.4 to 4.9) include:
2915 A template with a non-type template parameter of reference type was
2916 mangled incorrectly:
2919 template <int &> struct S @{@};
2923 This was fixed in @option{-fabi-version=3}.
2926 SIMD vector types declared using @code{__attribute ((vector_size))} were
2927 mangled in a non-standard way that does not allow for overloading of
2928 functions taking vectors of different sizes.
2930 The mangling was changed in @option{-fabi-version=4}.
2933 @code{__attribute ((const))} and @code{noreturn} were mangled as type
2934 qualifiers, and @code{decltype} of a plain declaration was folded away.
2936 These mangling issues were fixed in @option{-fabi-version=5}.
2939 Scoped enumerators passed as arguments to a variadic function are
2940 promoted like unscoped enumerators, causing @code{va_arg} to complain.
2941 On most targets this does not actually affect the parameter passing
2942 ABI, as there is no way to pass an argument smaller than @code{int}.
2944 Also, the ABI changed the mangling of template argument packs,
2945 @code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2946 a class scope function used as a template argument.
2948 These issues were corrected in @option{-fabi-version=6}.
2951 Lambdas in default argument scope were mangled incorrectly, and the
2952 ABI changed the mangling of @code{nullptr_t}.
2954 These issues were corrected in @option{-fabi-version=7}.
2957 When mangling a function type with function-cv-qualifiers, the
2958 un-qualified function type was incorrectly treated as a substitution
2961 This was fixed in @option{-fabi-version=8}, the default for GCC 5.1.
2964 @code{decltype(nullptr)} incorrectly had an alignment of 1, leading to
2965 unaligned accesses. Note that this did not affect the ABI of a
2966 function with a @code{nullptr_t} parameter, as parameters have a
2969 This was fixed in @option{-fabi-version=9}, the default for GCC 5.2.
2972 Target-specific attributes that affect the identity of a type, such as
2973 ia32 calling conventions on a function type (stdcall, regparm, etc.),
2974 did not affect the mangled name, leading to name collisions when
2975 function pointers were used as template arguments.
2977 This was fixed in @option{-fabi-version=10}, the default for GCC 6.1.
2981 It also warns about psABI-related changes. The known psABI changes at this
2987 For SysV/x86-64, unions with @code{long double} members are
2988 passed in memory as specified in psABI. For example:
2998 @code{union U} is always passed in memory.
3002 @item -Wabi-tag @r{(C++ and Objective-C++ only)}
3005 Warn when a type with an ABI tag is used in a context that does not
3006 have that ABI tag. See @ref{C++ Attributes} for more information
3009 @item -Wcomma-subscript @r{(C++ and Objective-C++ only)}
3010 @opindex Wcomma-subscript
3011 @opindex Wno-comma-subscript
3012 Warn about uses of a comma expression within a subscripting expression.
3013 This usage was deprecated in C++2a. However, a comma expression wrapped
3014 in @code{( )} is not deprecated. Example:
3018 void f(int *a, int b, int c) @{
3019 a[b,c]; // deprecated
3025 Enabled by default with @option{-std=c++2a}.
3027 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
3028 @opindex Wctor-dtor-privacy
3029 @opindex Wno-ctor-dtor-privacy
3030 Warn when a class seems unusable because all the constructors or
3031 destructors in that class are private, and it has neither friends nor
3032 public static member functions. Also warn if there are no non-private
3033 methods, and there's at least one private member function that isn't
3034 a constructor or destructor.
3036 @item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
3037 @opindex Wdelete-non-virtual-dtor
3038 @opindex Wno-delete-non-virtual-dtor
3039 Warn when @code{delete} is used to destroy an instance of a class that
3040 has virtual functions and non-virtual destructor. It is unsafe to delete
3041 an instance of a derived class through a pointer to a base class if the
3042 base class does not have a virtual destructor. This warning is enabled
3045 @item -Wdeprecated-copy @r{(C++ and Objective-C++ only)}
3046 @opindex Wdeprecated-copy
3047 @opindex Wno-deprecated-copy
3048 Warn that the implicit declaration of a copy constructor or copy
3049 assignment operator is deprecated if the class has a user-provided
3050 copy constructor or copy assignment operator, in C++11 and up. This
3051 warning is enabled by @option{-Wextra}. With
3052 @option{-Wdeprecated-copy-dtor}, also deprecate if the class has a
3053 user-provided destructor.
3055 @item -Wno-init-list-lifetime @r{(C++ and Objective-C++ only)}
3056 @opindex Winit-list-lifetime
3057 @opindex Wno-init-list-lifetime
3058 Do not warn about uses of @code{std::initializer_list} that are likely
3059 to result in dangling pointers. Since the underlying array for an
3060 @code{initializer_list} is handled like a normal C++ temporary object,
3061 it is easy to inadvertently keep a pointer to the array past the end
3062 of the array's lifetime. For example:
3066 If a function returns a temporary @code{initializer_list}, or a local
3067 @code{initializer_list} variable, the array's lifetime ends at the end
3068 of the return statement, so the value returned has a dangling pointer.
3071 If a new-expression creates an @code{initializer_list}, the array only
3072 lives until the end of the enclosing full-expression, so the
3073 @code{initializer_list} in the heap has a dangling pointer.
3076 When an @code{initializer_list} variable is assigned from a
3077 brace-enclosed initializer list, the temporary array created for the
3078 right side of the assignment only lives until the end of the
3079 full-expression, so at the next statement the @code{initializer_list}
3080 variable has a dangling pointer.
3083 // li's initial underlying array lives as long as li
3084 std::initializer_list<int> li = @{ 1,2,3 @};
3085 // assignment changes li to point to a temporary array
3087 // now the temporary is gone and li has a dangling pointer
3088 int i = li.begin()[0] // undefined behavior
3092 When a list constructor stores the @code{begin} pointer from the
3093 @code{initializer_list} argument, this doesn't extend the lifetime of
3094 the array, so if a class variable is constructed from a temporary
3095 @code{initializer_list}, the pointer is left dangling by the end of
3096 the variable declaration statement.
3100 @item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
3101 @opindex Wliteral-suffix
3102 @opindex Wno-literal-suffix
3103 Warn when a string or character literal is followed by a ud-suffix which does
3104 not begin with an underscore. As a conforming extension, GCC treats such
3105 suffixes as separate preprocessing tokens in order to maintain backwards
3106 compatibility with code that uses formatting macros from @code{<inttypes.h>}.
3110 #define __STDC_FORMAT_MACROS
3111 #include <inttypes.h>
3116 printf("My int64: %" PRId64"\n", i64);
3120 In this case, @code{PRId64} is treated as a separate preprocessing token.
3122 Additionally, warn when a user-defined literal operator is declared with
3123 a literal suffix identifier that doesn't begin with an underscore. Literal
3124 suffix identifiers that don't begin with an underscore are reserved for
3125 future standardization.
3127 This warning is enabled by default.
3129 @item -Wlto-type-mismatch
3130 @opindex Wlto-type-mismatch
3131 @opindex Wno-lto-type-mismatch
3133 During the link-time optimization warn about type mismatches in
3134 global declarations from different compilation units.
3135 Requires @option{-flto} to be enabled. Enabled by default.
3137 @item -Wno-narrowing @r{(C++ and Objective-C++ only)}
3139 @opindex Wno-narrowing
3140 For C++11 and later standards, narrowing conversions are diagnosed by default,
3141 as required by the standard. A narrowing conversion from a constant produces
3142 an error, and a narrowing conversion from a non-constant produces a warning,
3143 but @option{-Wno-narrowing} suppresses the diagnostic.
3144 Note that this does not affect the meaning of well-formed code;
3145 narrowing conversions are still considered ill-formed in SFINAE contexts.
3147 With @option{-Wnarrowing} in C++98, warn when a narrowing
3148 conversion prohibited by C++11 occurs within
3152 int i = @{ 2.2 @}; // error: narrowing from double to int
3155 This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
3157 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
3159 @opindex Wno-noexcept
3160 Warn when a noexcept-expression evaluates to false because of a call
3161 to a function that does not have a non-throwing exception
3162 specification (i.e. @code{throw()} or @code{noexcept}) but is known by
3163 the compiler to never throw an exception.
3165 @item -Wnoexcept-type @r{(C++ and Objective-C++ only)}
3166 @opindex Wnoexcept-type
3167 @opindex Wno-noexcept-type
3168 Warn if the C++17 feature making @code{noexcept} part of a function
3169 type changes the mangled name of a symbol relative to C++14. Enabled
3170 by @option{-Wabi} and @option{-Wc++17-compat}.
3175 template <class T> void f(T t) @{ t(); @};
3177 void h() @{ f(g); @}
3181 In C++14, @code{f} calls @code{f<void(*)()>}, but in
3182 C++17 it calls @code{f<void(*)()noexcept>}.
3184 @item -Wclass-memaccess @r{(C++ and Objective-C++ only)}
3185 @opindex Wclass-memaccess
3186 @opindex Wno-class-memaccess
3187 Warn when the destination of a call to a raw memory function such as
3188 @code{memset} or @code{memcpy} is an object of class type, and when writing
3189 into such an object might bypass the class non-trivial or deleted constructor
3190 or copy assignment, violate const-correctness or encapsulation, or corrupt
3191 virtual table pointers. Modifying the representation of such objects may
3192 violate invariants maintained by member functions of the class. For example,
3193 the call to @code{memset} below is undefined because it modifies a non-trivial
3194 class object and is, therefore, diagnosed. The safe way to either initialize
3195 or clear the storage of objects of such types is by using the appropriate
3196 constructor or assignment operator, if one is available.
3198 std::string str = "abc";
3199 memset (&str, 0, sizeof str);
3201 The @option{-Wclass-memaccess} option is enabled by @option{-Wall}.
3202 Explicitly casting the pointer to the class object to @code{void *} or
3203 to a type that can be safely accessed by the raw memory function suppresses
3206 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
3207 @opindex Wnon-virtual-dtor
3208 @opindex Wno-non-virtual-dtor
3209 Warn when a class has virtual functions and an accessible non-virtual
3210 destructor itself or in an accessible polymorphic base class, in which
3211 case it is possible but unsafe to delete an instance of a derived
3212 class through a pointer to the class itself or base class. This
3213 warning is automatically enabled if @option{-Weffc++} is specified.
3215 @item -Wregister @r{(C++ and Objective-C++ only)}
3217 @opindex Wno-register
3218 Warn on uses of the @code{register} storage class specifier, except
3219 when it is part of the GNU @ref{Explicit Register Variables} extension.
3220 The use of the @code{register} keyword as storage class specifier has
3221 been deprecated in C++11 and removed in C++17.
3222 Enabled by default with @option{-std=c++17}.
3224 @item -Wreorder @r{(C++ and Objective-C++ only)}
3226 @opindex Wno-reorder
3227 @cindex reordering, warning
3228 @cindex warning for reordering of member initializers
3229 Warn when the order of member initializers given in the code does not
3230 match the order in which they must be executed. For instance:
3236 A(): j (0), i (1) @{ @}
3241 The compiler rearranges the member initializers for @code{i}
3242 and @code{j} to match the declaration order of the members, emitting
3243 a warning to that effect. This warning is enabled by @option{-Wall}.
3245 @item -Wno-pessimizing-move @r{(C++ and Objective-C++ only)}
3246 @opindex Wpessimizing-move
3247 @opindex Wno-pessimizing-move
3248 This warning warns when a call to @code{std::move} prevents copy
3249 elision. A typical scenario when copy elision can occur is when returning in
3250 a function with a class return type, when the expression being returned is the
3251 name of a non-volatile automatic object, and is not a function parameter, and
3252 has the same type as the function return type.
3262 return std::move (t);
3266 But in this example, the @code{std::move} call prevents copy elision.
3268 This warning is enabled by @option{-Wall}.
3270 @item -Wno-redundant-move @r{(C++ and Objective-C++ only)}
3271 @opindex Wredundant-move
3272 @opindex Wno-redundant-move
3273 This warning warns about redundant calls to @code{std::move}; that is, when
3274 a move operation would have been performed even without the @code{std::move}
3275 call. This happens because the compiler is forced to treat the object as if
3276 it were an rvalue in certain situations such as returning a local variable,
3277 where copy elision isn't applicable. Consider:
3286 return std::move (t);
3290 Here, the @code{std::move} call is redundant. Because G++ implements Core
3291 Issue 1579, another example is:
3294 struct T @{ // convertible to U
3304 return std::move (t);
3307 In this example, copy elision isn't applicable because the type of the
3308 expression being returned and the function return type differ, yet G++
3309 treats the return value as if it were designated by an rvalue.
3311 This warning is enabled by @option{-Wextra}.
3313 @item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
3314 @opindex fext-numeric-literals
3315 @opindex fno-ext-numeric-literals
3316 Accept imaginary, fixed-point, or machine-defined
3317 literal number suffixes as GNU extensions.
3318 When this option is turned off these suffixes are treated
3319 as C++11 user-defined literal numeric suffixes.
3320 This is on by default for all pre-C++11 dialects and all GNU dialects:
3321 @option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
3322 @option{-std=gnu++14}.
3323 This option is off by default
3324 for ISO C++11 onwards (@option{-std=c++11}, ...).
3327 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
3330 @item -Weffc++ @r{(C++ and Objective-C++ only)}
3333 Warn about violations of the following style guidelines from Scott Meyers'
3334 @cite{Effective C++} series of books:
3338 Define a copy constructor and an assignment operator for classes
3339 with dynamically-allocated memory.
3342 Prefer initialization to assignment in constructors.
3345 Have @code{operator=} return a reference to @code{*this}.
3348 Don't try to return a reference when you must return an object.
3351 Distinguish between prefix and postfix forms of increment and
3352 decrement operators.
3355 Never overload @code{&&}, @code{||}, or @code{,}.
3359 This option also enables @option{-Wnon-virtual-dtor}, which is also
3360 one of the effective C++ recommendations. However, the check is
3361 extended to warn about the lack of virtual destructor in accessible
3362 non-polymorphic bases classes too.
3364 When selecting this option, be aware that the standard library
3365 headers do not obey all of these guidelines; use @samp{grep -v}
3366 to filter out those warnings.
3368 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
3369 @opindex Wstrict-null-sentinel
3370 @opindex Wno-strict-null-sentinel
3371 Warn about the use of an uncasted @code{NULL} as sentinel. When
3372 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
3373 to @code{__null}. Although it is a null pointer constant rather than a
3374 null pointer, it is guaranteed to be of the same size as a pointer.
3375 But this use is not portable across different compilers.
3377 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
3378 @opindex Wno-non-template-friend
3379 @opindex Wnon-template-friend
3380 Disable warnings when non-template friend functions are declared
3381 within a template. In very old versions of GCC that predate implementation
3382 of the ISO standard, declarations such as
3383 @samp{friend int foo(int)}, where the name of the friend is an unqualified-id,
3384 could be interpreted as a particular specialization of a template
3385 function; the warning exists to diagnose compatibility problems,
3386 and is enabled by default.
3388 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
3389 @opindex Wold-style-cast
3390 @opindex Wno-old-style-cast
3391 Warn if an old-style (C-style) cast to a non-void type is used within
3392 a C++ program. The new-style casts (@code{dynamic_cast},
3393 @code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
3394 less vulnerable to unintended effects and much easier to search for.
3396 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
3397 @opindex Woverloaded-virtual
3398 @opindex Wno-overloaded-virtual
3399 @cindex overloaded virtual function, warning
3400 @cindex warning for overloaded virtual function
3401 Warn when a function declaration hides virtual functions from a
3402 base class. For example, in:
3409 struct B: public A @{
3414 the @code{A} class version of @code{f} is hidden in @code{B}, and code
3425 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
3426 @opindex Wno-pmf-conversions
3427 @opindex Wpmf-conversions
3428 Disable the diagnostic for converting a bound pointer to member function
3431 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
3432 @opindex Wsign-promo
3433 @opindex Wno-sign-promo
3434 Warn when overload resolution chooses a promotion from unsigned or
3435 enumerated type to a signed type, over a conversion to an unsigned type of
3436 the same size. Previous versions of G++ tried to preserve
3437 unsignedness, but the standard mandates the current behavior.
3439 @item -Wtemplates @r{(C++ and Objective-C++ only)}
3441 @opindex Wno-templates
3442 Warn when a primary template declaration is encountered. Some coding
3443 rules disallow templates, and this may be used to enforce that rule.
3444 The warning is inactive inside a system header file, such as the STL, so
3445 one can still use the STL. One may also instantiate or specialize
3448 @item -Wmultiple-inheritance @r{(C++ and Objective-C++ only)}
3449 @opindex Wmultiple-inheritance
3450 @opindex Wno-multiple-inheritance
3451 Warn when a class is defined with multiple direct base classes. Some
3452 coding rules disallow multiple inheritance, and this may be used to
3453 enforce that rule. The warning is inactive inside a system header file,
3454 such as the STL, so one can still use the STL. One may also define
3455 classes that indirectly use multiple inheritance.
3457 @item -Wvirtual-inheritance
3458 @opindex Wvirtual-inheritance
3459 @opindex Wno-virtual-inheritance
3460 Warn when a class is defined with a virtual direct base class. Some
3461 coding rules disallow multiple inheritance, and this may be used to
3462 enforce that rule. The warning is inactive inside a system header file,
3463 such as the STL, so one can still use the STL. One may also define
3464 classes that indirectly use virtual inheritance.
3467 @opindex Wnamespaces
3468 @opindex Wno-namespaces
3469 Warn when a namespace definition is opened. Some coding rules disallow
3470 namespaces, and this may be used to enforce that rule. The warning is
3471 inactive inside a system header file, such as the STL, so one can still
3472 use the STL. One may also use using directives and qualified names.
3474 @item -Wno-terminate @r{(C++ and Objective-C++ only)}
3476 @opindex Wno-terminate
3477 Disable the warning about a throw-expression that will immediately
3478 result in a call to @code{terminate}.
3480 @item -Wno-class-conversion @r{(C++ and Objective-C++ only)}
3481 @opindex Wno-class-conversion
3482 @opindex Wclass-conversion
3483 Disable the warning about the case when a conversion function converts an
3484 object to the same type, to a base class of that type, or to void; such
3485 a conversion function will never be called.
3487 @item -Wvolatile @r{(C++ and Objective-C++ only)}
3489 @opindex Wno-volatile
3490 Warn about deprecated uses of the @code{volatile} qualifier. This includes
3491 postfix and prefix @code{++} and @code{--} expressions of
3492 @code{volatile}-qualified types, using simple assignments where the left
3493 operand is a @code{volatile}-qualified non-class type for their value,
3494 compound assignments where the left operand is a @code{volatile}-qualified
3495 non-class type, @code{volatile}-qualified function return type,
3496 @code{volatile}-qualified parameter type, and structured bindings of a
3497 @code{volatile}-qualified type. This usage was deprecated in C++20.
3499 Enabled by default with @option{-std=c++2a}.
3502 @node Objective-C and Objective-C++ Dialect Options
3503 @section Options Controlling Objective-C and Objective-C++ Dialects
3505 @cindex compiler options, Objective-C and Objective-C++
3506 @cindex Objective-C and Objective-C++ options, command-line
3507 @cindex options, Objective-C and Objective-C++
3508 (NOTE: This manual does not describe the Objective-C and Objective-C++
3509 languages themselves. @xref{Standards,,Language Standards
3510 Supported by GCC}, for references.)
3512 This section describes the command-line options that are only meaningful
3513 for Objective-C and Objective-C++ programs. You can also use most of
3514 the language-independent GNU compiler options.
3515 For example, you might compile a file @file{some_class.m} like this:
3518 gcc -g -fgnu-runtime -O -c some_class.m
3522 In this example, @option{-fgnu-runtime} is an option meant only for
3523 Objective-C and Objective-C++ programs; you can use the other options with
3524 any language supported by GCC@.
3526 Note that since Objective-C is an extension of the C language, Objective-C
3527 compilations may also use options specific to the C front-end (e.g.,
3528 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
3529 C++-specific options (e.g., @option{-Wabi}).
3531 Here is a list of options that are @emph{only} for compiling Objective-C
3532 and Objective-C++ programs:
3535 @item -fconstant-string-class=@var{class-name}
3536 @opindex fconstant-string-class
3537 Use @var{class-name} as the name of the class to instantiate for each
3538 literal string specified with the syntax @code{@@"@dots{}"}. The default
3539 class name is @code{NXConstantString} if the GNU runtime is being used, and
3540 @code{NSConstantString} if the NeXT runtime is being used (see below). The
3541 @option{-fconstant-cfstrings} option, if also present, overrides the
3542 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
3543 to be laid out as constant CoreFoundation strings.
3546 @opindex fgnu-runtime
3547 Generate object code compatible with the standard GNU Objective-C
3548 runtime. This is the default for most types of systems.
3550 @item -fnext-runtime
3551 @opindex fnext-runtime
3552 Generate output compatible with the NeXT runtime. This is the default
3553 for NeXT-based systems, including Darwin and Mac OS X@. The macro
3554 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
3557 @item -fno-nil-receivers
3558 @opindex fno-nil-receivers
3559 @opindex fnil-receivers
3560 Assume that all Objective-C message dispatches (@code{[receiver
3561 message:arg]}) in this translation unit ensure that the receiver is
3562 not @code{nil}. This allows for more efficient entry points in the
3563 runtime to be used. This option is only available in conjunction with
3564 the NeXT runtime and ABI version 0 or 1.
3566 @item -fobjc-abi-version=@var{n}
3567 @opindex fobjc-abi-version
3568 Use version @var{n} of the Objective-C ABI for the selected runtime.
3569 This option is currently supported only for the NeXT runtime. In that
3570 case, Version 0 is the traditional (32-bit) ABI without support for
3571 properties and other Objective-C 2.0 additions. Version 1 is the
3572 traditional (32-bit) ABI with support for properties and other
3573 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
3574 nothing is specified, the default is Version 0 on 32-bit target
3575 machines, and Version 2 on 64-bit target machines.
3577 @item -fobjc-call-cxx-cdtors
3578 @opindex fobjc-call-cxx-cdtors
3579 For each Objective-C class, check if any of its instance variables is a
3580 C++ object with a non-trivial default constructor. If so, synthesize a
3581 special @code{- (id) .cxx_construct} instance method which runs
3582 non-trivial default constructors on any such instance variables, in order,
3583 and then return @code{self}. Similarly, check if any instance variable
3584 is a C++ object with a non-trivial destructor, and if so, synthesize a
3585 special @code{- (void) .cxx_destruct} method which runs
3586 all such default destructors, in reverse order.
3588 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
3589 methods thusly generated only operate on instance variables
3590 declared in the current Objective-C class, and not those inherited
3591 from superclasses. It is the responsibility of the Objective-C
3592 runtime to invoke all such methods in an object's inheritance
3593 hierarchy. The @code{- (id) .cxx_construct} methods are invoked
3594 by the runtime immediately after a new object instance is allocated;
3595 the @code{- (void) .cxx_destruct} methods are invoked immediately
3596 before the runtime deallocates an object instance.
3598 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
3599 support for invoking the @code{- (id) .cxx_construct} and
3600 @code{- (void) .cxx_destruct} methods.
3602 @item -fobjc-direct-dispatch
3603 @opindex fobjc-direct-dispatch
3604 Allow fast jumps to the message dispatcher. On Darwin this is
3605 accomplished via the comm page.
3607 @item -fobjc-exceptions
3608 @opindex fobjc-exceptions
3609 Enable syntactic support for structured exception handling in
3610 Objective-C, similar to what is offered by C++. This option
3611 is required to use the Objective-C keywords @code{@@try},
3612 @code{@@throw}, @code{@@catch}, @code{@@finally} and
3613 @code{@@synchronized}. This option is available with both the GNU
3614 runtime and the NeXT runtime (but not available in conjunction with
3615 the NeXT runtime on Mac OS X 10.2 and earlier).
3619 Enable garbage collection (GC) in Objective-C and Objective-C++
3620 programs. This option is only available with the NeXT runtime; the
3621 GNU runtime has a different garbage collection implementation that
3622 does not require special compiler flags.
3624 @item -fobjc-nilcheck
3625 @opindex fobjc-nilcheck
3626 For the NeXT runtime with version 2 of the ABI, check for a nil
3627 receiver in method invocations before doing the actual method call.
3628 This is the default and can be disabled using
3629 @option{-fno-objc-nilcheck}. Class methods and super calls are never
3630 checked for nil in this way no matter what this flag is set to.
3631 Currently this flag does nothing when the GNU runtime, or an older
3632 version of the NeXT runtime ABI, is used.
3634 @item -fobjc-std=objc1
3636 Conform to the language syntax of Objective-C 1.0, the language
3637 recognized by GCC 4.0. This only affects the Objective-C additions to
3638 the C/C++ language; it does not affect conformance to C/C++ standards,
3639 which is controlled by the separate C/C++ dialect option flags. When
3640 this option is used with the Objective-C or Objective-C++ compiler,
3641 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3642 This is useful if you need to make sure that your Objective-C code can
3643 be compiled with older versions of GCC@.
3645 @item -freplace-objc-classes
3646 @opindex freplace-objc-classes
3647 Emit a special marker instructing @command{ld(1)} not to statically link in
3648 the resulting object file, and allow @command{dyld(1)} to load it in at
3649 run time instead. This is used in conjunction with the Fix-and-Continue
3650 debugging mode, where the object file in question may be recompiled and
3651 dynamically reloaded in the course of program execution, without the need
3652 to restart the program itself. Currently, Fix-and-Continue functionality
3653 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3658 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3659 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3660 compile time) with static class references that get initialized at load time,
3661 which improves run-time performance. Specifying the @option{-fzero-link} flag
3662 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3663 to be retained. This is useful in Zero-Link debugging mode, since it allows
3664 for individual class implementations to be modified during program execution.
3665 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3666 regardless of command-line options.
3668 @item -fno-local-ivars
3669 @opindex fno-local-ivars
3670 @opindex flocal-ivars
3671 By default instance variables in Objective-C can be accessed as if
3672 they were local variables from within the methods of the class they're
3673 declared in. This can lead to shadowing between instance variables
3674 and other variables declared either locally inside a class method or
3675 globally with the same name. Specifying the @option{-fno-local-ivars}
3676 flag disables this behavior thus avoiding variable shadowing issues.
3678 @item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3679 @opindex fivar-visibility
3680 Set the default instance variable visibility to the specified option
3681 so that instance variables declared outside the scope of any access
3682 modifier directives default to the specified visibility.
3686 Dump interface declarations for all classes seen in the source file to a
3687 file named @file{@var{sourcename}.decl}.
3689 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3690 @opindex Wassign-intercept
3691 @opindex Wno-assign-intercept
3692 Warn whenever an Objective-C assignment is being intercepted by the
3695 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3696 @opindex Wno-protocol
3698 If a class is declared to implement a protocol, a warning is issued for
3699 every method in the protocol that is not implemented by the class. The
3700 default behavior is to issue a warning for every method not explicitly
3701 implemented in the class, even if a method implementation is inherited
3702 from the superclass. If you use the @option{-Wno-protocol} option, then
3703 methods inherited from the superclass are considered to be implemented,
3704 and no warning is issued for them.
3706 @item -Wselector @r{(Objective-C and Objective-C++ only)}
3708 @opindex Wno-selector
3709 Warn if multiple methods of different types for the same selector are
3710 found during compilation. The check is performed on the list of methods
3711 in the final stage of compilation. Additionally, a check is performed
3712 for each selector appearing in a @code{@@selector(@dots{})}
3713 expression, and a corresponding method for that selector has been found
3714 during compilation. Because these checks scan the method table only at
3715 the end of compilation, these warnings are not produced if the final
3716 stage of compilation is not reached, for example because an error is
3717 found during compilation, or because the @option{-fsyntax-only} option is
3720 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3721 @opindex Wstrict-selector-match
3722 @opindex Wno-strict-selector-match
3723 Warn if multiple methods with differing argument and/or return types are
3724 found for a given selector when attempting to send a message using this
3725 selector to a receiver of type @code{id} or @code{Class}. When this flag
3726 is off (which is the default behavior), the compiler omits such warnings
3727 if any differences found are confined to types that share the same size
3730 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3731 @opindex Wundeclared-selector
3732 @opindex Wno-undeclared-selector
3733 Warn if a @code{@@selector(@dots{})} expression referring to an
3734 undeclared selector is found. A selector is considered undeclared if no
3735 method with that name has been declared before the
3736 @code{@@selector(@dots{})} expression, either explicitly in an
3737 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
3738 an @code{@@implementation} section. This option always performs its
3739 checks as soon as a @code{@@selector(@dots{})} expression is found,
3740 while @option{-Wselector} only performs its checks in the final stage of
3741 compilation. This also enforces the coding style convention
3742 that methods and selectors must be declared before being used.
3744 @item -print-objc-runtime-info
3745 @opindex print-objc-runtime-info
3746 Generate C header describing the largest structure that is passed by
3751 @node Diagnostic Message Formatting Options
3752 @section Options to Control Diagnostic Messages Formatting
3753 @cindex options to control diagnostics formatting
3754 @cindex diagnostic messages
3755 @cindex message formatting
3757 Traditionally, diagnostic messages have been formatted irrespective of
3758 the output device's aspect (e.g.@: its width, @dots{}). You can use the
3759 options described below
3760 to control the formatting algorithm for diagnostic messages,
3761 e.g.@: how many characters per line, how often source location
3762 information should be reported. Note that some language front ends may not
3763 honor these options.
3766 @item -fmessage-length=@var{n}
3767 @opindex fmessage-length
3768 Try to format error messages so that they fit on lines of about
3769 @var{n} characters. If @var{n} is zero, then no line-wrapping is
3770 done; each error message appears on a single line. This is the
3771 default for all front ends.
3773 Note - this option also affects the display of the @samp{#error} and
3774 @samp{#warning} pre-processor directives, and the @samp{deprecated}
3775 function/type/variable attribute. It does not however affect the
3776 @samp{pragma GCC warning} and @samp{pragma GCC error} pragmas.
3778 @item -fdiagnostics-show-location=once
3779 @opindex fdiagnostics-show-location
3780 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3781 reporter to emit source location information @emph{once}; that is, in
3782 case the message is too long to fit on a single physical line and has to
3783 be wrapped, the source location won't be emitted (as prefix) again,
3784 over and over, in subsequent continuation lines. This is the default
3787 @item -fdiagnostics-show-location=every-line
3788 Only meaningful in line-wrapping mode. Instructs the diagnostic
3789 messages reporter to emit the same source location information (as
3790 prefix) for physical lines that result from the process of breaking
3791 a message which is too long to fit on a single line.
3793 @item -fdiagnostics-color[=@var{WHEN}]
3794 @itemx -fno-diagnostics-color
3795 @opindex fdiagnostics-color
3796 @cindex highlight, color
3797 @vindex GCC_COLORS @r{environment variable}
3798 Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3799 or @samp{auto}. The default depends on how the compiler has been configured,
3800 it can be any of the above @var{WHEN} options or also @samp{never}
3801 if @env{GCC_COLORS} environment variable isn't present in the environment,
3802 and @samp{auto} otherwise.
3803 @samp{auto} means to use color only when the standard error is a terminal.
3804 The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3805 aliases for @option{-fdiagnostics-color=always} and
3806 @option{-fdiagnostics-color=never}, respectively.
3808 The colors are defined by the environment variable @env{GCC_COLORS}.
3809 Its value is a colon-separated list of capabilities and Select Graphic
3810 Rendition (SGR) substrings. SGR commands are interpreted by the
3811 terminal or terminal emulator. (See the section in the documentation
3812 of your text terminal for permitted values and their meanings as
3813 character attributes.) These substring values are integers in decimal
3814 representation and can be concatenated with semicolons.
3815 Common values to concatenate include
3817 @samp{4} for underline,
3819 @samp{7} for inverse,
3820 @samp{39} for default foreground color,
3821 @samp{30} to @samp{37} for foreground colors,
3822 @samp{90} to @samp{97} for 16-color mode foreground colors,
3823 @samp{38;5;0} to @samp{38;5;255}
3824 for 88-color and 256-color modes foreground colors,
3825 @samp{49} for default background color,
3826 @samp{40} to @samp{47} for background colors,
3827 @samp{100} to @samp{107} for 16-color mode background colors,
3828 and @samp{48;5;0} to @samp{48;5;255}
3829 for 88-color and 256-color modes background colors.
3831 The default @env{GCC_COLORS} is
3833 error=01;31:warning=01;35:note=01;36:range1=32:range2=34:locus=01:\
3834 quote=01:fixit-insert=32:fixit-delete=31:\
3835 diff-filename=01:diff-hunk=32:diff-delete=31:diff-insert=32:\
3839 where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3840 @samp{01;36} is bold cyan, @samp{32} is green, @samp{34} is blue,
3841 @samp{01} is bold, and @samp{31} is red.
3842 Setting @env{GCC_COLORS} to the empty string disables colors.
3843 Supported capabilities are as follows.
3847 @vindex error GCC_COLORS @r{capability}
3848 SGR substring for error: markers.
3851 @vindex warning GCC_COLORS @r{capability}
3852 SGR substring for warning: markers.
3855 @vindex note GCC_COLORS @r{capability}
3856 SGR substring for note: markers.
3859 @vindex range1 GCC_COLORS @r{capability}
3860 SGR substring for first additional range.
3863 @vindex range2 GCC_COLORS @r{capability}
3864 SGR substring for second additional range.
3867 @vindex locus GCC_COLORS @r{capability}
3868 SGR substring for location information, @samp{file:line} or
3869 @samp{file:line:column} etc.
3872 @vindex quote GCC_COLORS @r{capability}
3873 SGR substring for information printed within quotes.
3876 @vindex fixit-insert GCC_COLORS @r{capability}
3877 SGR substring for fix-it hints suggesting text to
3878 be inserted or replaced.
3881 @vindex fixit-delete GCC_COLORS @r{capability}
3882 SGR substring for fix-it hints suggesting text to
3885 @item diff-filename=
3886 @vindex diff-filename GCC_COLORS @r{capability}
3887 SGR substring for filename headers within generated patches.
3890 @vindex diff-hunk GCC_COLORS @r{capability}
3891 SGR substring for the starts of hunks within generated patches.
3894 @vindex diff-delete GCC_COLORS @r{capability}
3895 SGR substring for deleted lines within generated patches.
3898 @vindex diff-insert GCC_COLORS @r{capability}
3899 SGR substring for inserted lines within generated patches.
3902 @vindex type-diff GCC_COLORS @r{capability}
3903 SGR substring for highlighting mismatching types within template
3904 arguments in the C++ frontend.
3907 @item -fno-diagnostics-show-option
3908 @opindex fno-diagnostics-show-option
3909 @opindex fdiagnostics-show-option
3910 By default, each diagnostic emitted includes text indicating the
3911 command-line option that directly controls the diagnostic (if such an
3912 option is known to the diagnostic machinery). Specifying the
3913 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
3915 @item -fno-diagnostics-show-caret
3916 @opindex fno-diagnostics-show-caret
3917 @opindex fdiagnostics-show-caret
3918 By default, each diagnostic emitted includes the original source line
3919 and a caret @samp{^} indicating the column. This option suppresses this
3920 information. The source line is truncated to @var{n} characters, if
3921 the @option{-fmessage-length=n} option is given. When the output is done
3922 to the terminal, the width is limited to the width given by the
3923 @env{COLUMNS} environment variable or, if not set, to the terminal width.
3925 @item -fno-diagnostics-show-labels
3926 @opindex fno-diagnostics-show-labels
3927 @opindex fdiagnostics-show-labels
3928 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3929 diagnostics can label ranges of source code with pertinent information, such
3930 as the types of expressions:
3933 printf ("foo %s bar", long_i + long_j);
3939 This option suppresses the printing of these labels (in the example above,
3940 the vertical bars and the ``char *'' and ``long int'' text).
3942 @item -fno-diagnostics-show-line-numbers
3943 @opindex fno-diagnostics-show-line-numbers
3944 @opindex fdiagnostics-show-line-numbers
3945 By default, when printing source code (via @option{-fdiagnostics-show-caret}),
3946 a left margin is printed, showing line numbers. This option suppresses this
3949 @item -fdiagnostics-minimum-margin-width=@var{width}
3950 @opindex fdiagnostics-minimum-margin-width
3951 This option controls the minimum width of the left margin printed by
3952 @option{-fdiagnostics-show-line-numbers}. It defaults to 6.
3954 @item -fdiagnostics-parseable-fixits
3955 @opindex fdiagnostics-parseable-fixits
3956 Emit fix-it hints in a machine-parseable format, suitable for consumption
3957 by IDEs. For each fix-it, a line will be printed after the relevant
3958 diagnostic, starting with the string ``fix-it:''. For example:
3961 fix-it:"test.c":@{45:3-45:21@}:"gtk_widget_show_all"
3964 The location is expressed as a half-open range, expressed as a count of
3965 bytes, starting at byte 1 for the initial column. In the above example,
3966 bytes 3 through 20 of line 45 of ``test.c'' are to be replaced with the
3970 00000000011111111112222222222
3971 12345678901234567890123456789
3972 gtk_widget_showall (dlg);
3977 The filename and replacement string escape backslash as ``\\", tab as ``\t'',
3978 newline as ``\n'', double quotes as ``\"'', non-printable characters as octal
3979 (e.g. vertical tab as ``\013'').
3981 An empty replacement string indicates that the given range is to be removed.
3982 An empty range (e.g. ``45:3-45:3'') indicates that the string is to
3983 be inserted at the given position.
3985 @item -fdiagnostics-generate-patch
3986 @opindex fdiagnostics-generate-patch
3987 Print fix-it hints to stderr in unified diff format, after any diagnostics
3988 are printed. For example:
3995 void show_cb(GtkDialog *dlg)
3997 - gtk_widget_showall(dlg);
3998 + gtk_widget_show_all(dlg);
4003 The diff may or may not be colorized, following the same rules
4004 as for diagnostics (see @option{-fdiagnostics-color}).
4006 @item -fdiagnostics-show-template-tree
4007 @opindex fdiagnostics-show-template-tree
4009 In the C++ frontend, when printing diagnostics showing mismatching
4010 template types, such as:
4013 could not convert 'std::map<int, std::vector<double> >()'
4014 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4017 the @option{-fdiagnostics-show-template-tree} flag enables printing a
4018 tree-like structure showing the common and differing parts of the types,
4028 The parts that differ are highlighted with color (``double'' and
4029 ``float'' in this case).
4031 @item -fno-elide-type
4032 @opindex fno-elide-type
4033 @opindex felide-type
4034 By default when the C++ frontend prints diagnostics showing mismatching
4035 template types, common parts of the types are printed as ``[...]'' to
4036 simplify the error message. For example:
4039 could not convert 'std::map<int, std::vector<double> >()'
4040 from 'map<[...],vector<double>>' to 'map<[...],vector<float>>
4043 Specifying the @option{-fno-elide-type} flag suppresses that behavior.
4044 This flag also affects the output of the
4045 @option{-fdiagnostics-show-template-tree} flag.
4047 @item -fno-show-column
4048 @opindex fno-show-column
4049 @opindex fshow-column
4050 Do not print column numbers in diagnostics. This may be necessary if
4051 diagnostics are being scanned by a program that does not understand the
4052 column numbers, such as @command{dejagnu}.
4054 @item -fdiagnostics-format=@var{FORMAT}
4055 @opindex fdiagnostics-format
4056 Select a different format for printing diagnostics.
4057 @var{FORMAT} is @samp{text} or @samp{json}.
4058 The default is @samp{text}.
4060 The @samp{json} format consists of a top-level JSON array containing JSON
4061 objects representing the diagnostics.
4063 The JSON is emitted as one line, without formatting; the examples below
4064 have been formatted for clarity.
4066 Diagnostics can have child diagnostics. For example, this error and note:
4069 misleading-indentation.c:15:3: warning: this 'if' clause does not
4070 guard... [-Wmisleading-indentation]
4073 misleading-indentation.c:17:5: note: ...this statement, but the latter
4074 is misleadingly indented as if it were guarded by the 'if'
4080 might be printed in JSON form (after formatting) like this:
4090 "file": "misleading-indentation.c",
4095 "file": "misleading-indentation.c",
4100 "message": "this \u2018if\u2019 clause does not guard...",
4101 "option": "-Wmisleading-indentation",
4109 "file": "misleading-indentation.c",
4114 "message": "...this statement, but the latter is @dots{}"
4123 where the @code{note} is a child of the @code{warning}.
4125 A diagnostic has a @code{kind}. If this is @code{warning}, then there is
4126 an @code{option} key describing the command-line option controlling the
4129 A diagnostic can contain zero or more locations. Each location has up
4130 to three positions within it: a @code{caret} position and optional
4131 @code{start} and @code{finish} positions. A location can also have
4132 an optional @code{label} string. For example, this error:
4135 bad-binary-ops.c:64:23: error: invalid operands to binary + (have 'S' @{aka
4136 'struct s'@} and 'T' @{aka 'struct t'@})
4137 64 | return callee_4a () + callee_4b ();
4138 | ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
4140 | | T @{aka struct t@}
4141 | S @{aka struct s@}
4145 has three locations. Its primary location is at the ``+'' token at column
4146 23. It has two secondary locations, describing the left and right-hand sides
4147 of the expression, which have labels. It might be printed in JSON form as:
4156 "column": 23, "file": "bad-binary-ops.c", "line": 64
4161 "column": 10, "file": "bad-binary-ops.c", "line": 64
4164 "column": 21, "file": "bad-binary-ops.c", "line": 64
4166 "label": "S @{aka struct s@}"
4170 "column": 25, "file": "bad-binary-ops.c", "line": 64
4173 "column": 36, "file": "bad-binary-ops.c", "line": 64
4175 "label": "T @{aka struct t@}"
4178 "message": "invalid operands to binary + @dots{}"
4182 If a diagnostic contains fix-it hints, it has a @code{fixits} array,
4183 consisting of half-open intervals, similar to the output of
4184 @option{-fdiagnostics-parseable-fixits}. For example, this diagnostic
4185 with a replacement fix-it hint:
4188 demo.c:8:15: error: 'struct s' has no member named 'colour'; did you
4190 8 | return ptr->colour;
4196 might be printed in JSON form as:
4231 "message": "\u2018struct s\u2019 has no member named @dots{}"
4236 where the fix-it hint suggests replacing the text from @code{start} up
4237 to but not including @code{next} with @code{string}'s value. Deletions
4238 are expressed via an empty value for @code{string}, insertions by
4239 having @code{start} equal @code{next}.
4243 @node Warning Options
4244 @section Options to Request or Suppress Warnings
4245 @cindex options to control warnings
4246 @cindex warning messages
4247 @cindex messages, warning
4248 @cindex suppressing warnings
4250 Warnings are diagnostic messages that report constructions that
4251 are not inherently erroneous but that are risky or suggest there
4252 may have been an error.
4254 The following language-independent options do not enable specific
4255 warnings but control the kinds of diagnostics produced by GCC@.
4258 @cindex syntax checking
4260 @opindex fsyntax-only
4261 Check the code for syntax errors, but don't do anything beyond that.
4263 @item -fmax-errors=@var{n}
4264 @opindex fmax-errors
4265 Limits the maximum number of error messages to @var{n}, at which point
4266 GCC bails out rather than attempting to continue processing the source
4267 code. If @var{n} is 0 (the default), there is no limit on the number
4268 of error messages produced. If @option{-Wfatal-errors} is also
4269 specified, then @option{-Wfatal-errors} takes precedence over this
4274 Inhibit all warning messages.
4279 Make all warnings into errors.
4284 Make the specified warning into an error. The specifier for a warning
4285 is appended; for example @option{-Werror=switch} turns the warnings
4286 controlled by @option{-Wswitch} into errors. This switch takes a
4287 negative form, to be used to negate @option{-Werror} for specific
4288 warnings; for example @option{-Wno-error=switch} makes
4289 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
4292 The warning message for each controllable warning includes the
4293 option that controls the warning. That option can then be used with
4294 @option{-Werror=} and @option{-Wno-error=} as described above.
4295 (Printing of the option in the warning message can be disabled using the
4296 @option{-fno-diagnostics-show-option} flag.)
4298 Note that specifying @option{-Werror=}@var{foo} automatically implies
4299 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
4302 @item -Wfatal-errors
4303 @opindex Wfatal-errors
4304 @opindex Wno-fatal-errors
4305 This option causes the compiler to abort compilation on the first error
4306 occurred rather than trying to keep going and printing further error
4311 You can request many specific warnings with options beginning with
4312 @samp{-W}, for example @option{-Wimplicit} to request warnings on
4313 implicit declarations. Each of these specific warning options also
4314 has a negative form beginning @samp{-Wno-} to turn off warnings; for
4315 example, @option{-Wno-implicit}. This manual lists only one of the
4316 two forms, whichever is not the default. For further
4317 language-specific options also refer to @ref{C++ Dialect Options} and
4318 @ref{Objective-C and Objective-C++ Dialect Options}.
4320 Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
4321 options, such as @option{-Wunused}, which may turn on further options,
4322 such as @option{-Wunused-value}. The combined effect of positive and
4323 negative forms is that more specific options have priority over less
4324 specific ones, independently of their position in the command-line. For
4325 options of the same specificity, the last one takes effect. Options
4326 enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
4327 as if they appeared at the end of the command-line.
4329 When an unrecognized warning option is requested (e.g.,
4330 @option{-Wunknown-warning}), GCC emits a diagnostic stating
4331 that the option is not recognized. However, if the @option{-Wno-} form
4332 is used, the behavior is slightly different: no diagnostic is
4333 produced for @option{-Wno-unknown-warning} unless other diagnostics
4334 are being produced. This allows the use of new @option{-Wno-} options
4335 with old compilers, but if something goes wrong, the compiler
4336 warns that an unrecognized option is present.
4343 @opindex Wno-pedantic
4344 Issue all the warnings demanded by strict ISO C and ISO C++;
4345 reject all programs that use forbidden extensions, and some other
4346 programs that do not follow ISO C and ISO C++. For ISO C, follows the
4347 version of the ISO C standard specified by any @option{-std} option used.
4349 Valid ISO C and ISO C++ programs should compile properly with or without
4350 this option (though a rare few require @option{-ansi} or a
4351 @option{-std} option specifying the required version of ISO C)@. However,
4352 without this option, certain GNU extensions and traditional C and C++
4353 features are supported as well. With this option, they are rejected.
4355 @option{-Wpedantic} does not cause warning messages for use of the
4356 alternate keywords whose names begin and end with @samp{__}. This alternate
4357 format can also be used to disable warnings for non-ISO @samp{__intN} types,
4358 i.e. @samp{__intN__}.
4359 Pedantic warnings are also disabled in the expression that follows
4360 @code{__extension__}. However, only system header files should use
4361 these escape routes; application programs should avoid them.
4362 @xref{Alternate Keywords}.
4364 Some users try to use @option{-Wpedantic} to check programs for strict ISO
4365 C conformance. They soon find that it does not do quite what they want:
4366 it finds some non-ISO practices, but not all---only those for which
4367 ISO C @emph{requires} a diagnostic, and some others for which
4368 diagnostics have been added.
4370 A feature to report any failure to conform to ISO C might be useful in
4371 some instances, but would require considerable additional work and would
4372 be quite different from @option{-Wpedantic}. We don't have plans to
4373 support such a feature in the near future.
4375 Where the standard specified with @option{-std} represents a GNU
4376 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
4377 corresponding @dfn{base standard}, the version of ISO C on which the GNU
4378 extended dialect is based. Warnings from @option{-Wpedantic} are given
4379 where they are required by the base standard. (It does not make sense
4380 for such warnings to be given only for features not in the specified GNU
4381 C dialect, since by definition the GNU dialects of C include all
4382 features the compiler supports with the given option, and there would be
4383 nothing to warn about.)
4385 @item -pedantic-errors
4386 @opindex pedantic-errors
4387 Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
4388 requires a diagnostic, in some cases where there is undefined behavior
4389 at compile-time and in some other cases that do not prevent compilation
4390 of programs that are valid according to the standard. This is not
4391 equivalent to @option{-Werror=pedantic}, since there are errors enabled
4392 by this option and not enabled by the latter and vice versa.
4397 This enables all the warnings about constructions that some users
4398 consider questionable, and that are easy to avoid (or modify to
4399 prevent the warning), even in conjunction with macros. This also
4400 enables some language-specific warnings described in @ref{C++ Dialect
4401 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
4403 @option{-Wall} turns on the following warning flags:
4405 @gccoptlist{-Waddress @gol
4406 -Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
4408 -Wbool-operation @gol
4409 -Wc++11-compat -Wc++14-compat @gol
4410 -Wcatch-value @r{(C++ and Objective-C++ only)} @gol
4411 -Wchar-subscripts @gol
4413 -Wduplicate-decl-specifier @r{(C and Objective-C only)} @gol
4414 -Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
4415 -Wenum-conversion @r{in C/ObjC;} @gol
4417 -Wint-in-bool-context @gol
4418 -Wimplicit @r{(C and Objective-C only)} @gol
4419 -Wimplicit-int @r{(C and Objective-C only)} @gol
4420 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
4421 -Winit-self @r{(only for C++)} @gol
4422 -Wlogical-not-parentheses @gol
4423 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
4424 -Wmaybe-uninitialized @gol
4425 -Wmemset-elt-size @gol
4426 -Wmemset-transposed-args @gol
4427 -Wmisleading-indentation @r{(only for C/C++)} @gol
4428 -Wmissing-attributes @gol
4429 -Wmissing-braces @r{(only for C/ObjC)} @gol
4430 -Wmultistatement-macros @gol
4431 -Wnarrowing @r{(only for C++)} @gol
4433 -Wnonnull-compare @gol
4436 -Wpessimizing-move @r{(only for C++)} @gol
4441 -Wsequence-point @gol
4442 -Wsign-compare @r{(only in C++)} @gol
4443 -Wsizeof-pointer-div @gol
4444 -Wsizeof-pointer-memaccess @gol
4445 -Wstrict-aliasing @gol
4446 -Wstrict-overflow=1 @gol
4448 -Wtautological-compare @gol
4450 -Wuninitialized @gol
4451 -Wunknown-pragmas @gol
4452 -Wunused-function @gol
4455 -Wunused-variable @gol
4456 -Wvolatile-register-var}
4458 Note that some warning flags are not implied by @option{-Wall}. Some of
4459 them warn about constructions that users generally do not consider
4460 questionable, but which occasionally you might wish to check for;
4461 others warn about constructions that are necessary or hard to avoid in
4462 some cases, and there is no simple way to modify the code to suppress
4463 the warning. Some of them are enabled by @option{-Wextra} but many of
4464 them must be enabled individually.
4470 This enables some extra warning flags that are not enabled by
4471 @option{-Wall}. (This option used to be called @option{-W}. The older
4472 name is still supported, but the newer name is more descriptive.)
4474 @gccoptlist{-Wclobbered @gol
4475 -Wcast-function-type @gol
4476 -Wdeprecated-copy @r{(C++ only)} @gol
4478 -Wignored-qualifiers @gol
4479 -Wimplicit-fallthrough=3 @gol
4480 -Wmissing-field-initializers @gol
4481 -Wmissing-parameter-type @r{(C only)} @gol
4482 -Wold-style-declaration @r{(C only)} @gol
4483 -Woverride-init @gol
4484 -Wsign-compare @r{(C only)} @gol
4485 -Wredundant-move @r{(only for C++)} @gol
4487 -Wuninitialized @gol
4488 -Wshift-negative-value @r{(in C++03 and in C99 and newer)} @gol
4489 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
4490 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}}
4493 The option @option{-Wextra} also prints warning messages for the
4499 A pointer is compared against integer zero with @code{<}, @code{<=},
4500 @code{>}, or @code{>=}.
4503 (C++ only) An enumerator and a non-enumerator both appear in a
4504 conditional expression.
4507 (C++ only) Ambiguous virtual bases.
4510 (C++ only) Subscripting an array that has been declared @code{register}.
4513 (C++ only) Taking the address of a variable that has been declared
4517 (C++ only) A base class is not initialized in the copy constructor
4522 @item -Wchar-subscripts
4523 @opindex Wchar-subscripts
4524 @opindex Wno-char-subscripts
4525 Warn if an array subscript has type @code{char}. This is a common cause
4526 of error, as programmers often forget that this type is signed on some
4528 This warning is enabled by @option{-Wall}.
4530 @item -Wno-coverage-mismatch
4531 @opindex Wno-coverage-mismatch
4532 @opindex Wcoverage-mismatch
4533 Warn if feedback profiles do not match when using the
4534 @option{-fprofile-use} option.
4535 If a source file is changed between compiling with @option{-fprofile-generate}
4536 and with @option{-fprofile-use}, the files with the profile feedback can fail
4537 to match the source file and GCC cannot use the profile feedback
4538 information. By default, this warning is enabled and is treated as an
4539 error. @option{-Wno-coverage-mismatch} can be used to disable the
4540 warning or @option{-Wno-error=coverage-mismatch} can be used to
4541 disable the error. Disabling the error for this warning can result in
4542 poorly optimized code and is useful only in the
4543 case of very minor changes such as bug fixes to an existing code-base.
4544 Completely disabling the warning is not recommended.
4547 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
4549 Suppress warning messages emitted by @code{#warning} directives.
4551 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
4552 @opindex Wdouble-promotion
4553 @opindex Wno-double-promotion
4554 Give a warning when a value of type @code{float} is implicitly
4555 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
4556 floating-point unit implement @code{float} in hardware, but emulate
4557 @code{double} in software. On such a machine, doing computations
4558 using @code{double} values is much more expensive because of the
4559 overhead required for software emulation.
4561 It is easy to accidentally do computations with @code{double} because
4562 floating-point literals are implicitly of type @code{double}. For
4566 float area(float radius)
4568 return 3.14159 * radius * radius;
4572 the compiler performs the entire computation with @code{double}
4573 because the floating-point literal is a @code{double}.
4575 @item -Wduplicate-decl-specifier @r{(C and Objective-C only)}
4576 @opindex Wduplicate-decl-specifier
4577 @opindex Wno-duplicate-decl-specifier
4578 Warn if a declaration has duplicate @code{const}, @code{volatile},
4579 @code{restrict} or @code{_Atomic} specifier. This warning is enabled by
4583 @itemx -Wformat=@var{n}
4586 @opindex ffreestanding
4587 @opindex fno-builtin
4589 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
4590 the arguments supplied have types appropriate to the format string
4591 specified, and that the conversions specified in the format string make
4592 sense. This includes standard functions, and others specified by format
4593 attributes (@pxref{Function Attributes}), in the @code{printf},
4594 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
4595 not in the C standard) families (or other target-specific families).
4596 Which functions are checked without format attributes having been
4597 specified depends on the standard version selected, and such checks of
4598 functions without the attribute specified are disabled by
4599 @option{-ffreestanding} or @option{-fno-builtin}.
4601 The formats are checked against the format features supported by GNU
4602 libc version 2.2. These include all ISO C90 and C99 features, as well
4603 as features from the Single Unix Specification and some BSD and GNU
4604 extensions. Other library implementations may not support all these
4605 features; GCC does not support warning about features that go beyond a
4606 particular library's limitations. However, if @option{-Wpedantic} is used
4607 with @option{-Wformat}, warnings are given about format features not
4608 in the selected standard version (but not for @code{strfmon} formats,
4609 since those are not in any version of the C standard). @xref{C Dialect
4610 Options,,Options Controlling C Dialect}.
4617 Option @option{-Wformat} is equivalent to @option{-Wformat=1}, and
4618 @option{-Wno-format} is equivalent to @option{-Wformat=0}. Since
4619 @option{-Wformat} also checks for null format arguments for several
4620 functions, @option{-Wformat} also implies @option{-Wnonnull}. Some
4621 aspects of this level of format checking can be disabled by the
4622 options: @option{-Wno-format-contains-nul},
4623 @option{-Wno-format-extra-args}, and @option{-Wno-format-zero-length}.
4624 @option{-Wformat} is enabled by @option{-Wall}.
4626 @item -Wno-format-contains-nul
4627 @opindex Wno-format-contains-nul
4628 @opindex Wformat-contains-nul
4629 If @option{-Wformat} is specified, do not warn about format strings that
4632 @item -Wno-format-extra-args
4633 @opindex Wno-format-extra-args
4634 @opindex Wformat-extra-args
4635 If @option{-Wformat} is specified, do not warn about excess arguments to a
4636 @code{printf} or @code{scanf} format function. The C standard specifies
4637 that such arguments are ignored.
4639 Where the unused arguments lie between used arguments that are
4640 specified with @samp{$} operand number specifications, normally
4641 warnings are still given, since the implementation could not know what
4642 type to pass to @code{va_arg} to skip the unused arguments. However,
4643 in the case of @code{scanf} formats, this option suppresses the
4644 warning if the unused arguments are all pointers, since the Single
4645 Unix Specification says that such unused arguments are allowed.
4647 @item -Wformat-overflow
4648 @itemx -Wformat-overflow=@var{level}
4649 @opindex Wformat-overflow
4650 @opindex Wno-format-overflow
4651 Warn about calls to formatted input/output functions such as @code{sprintf}
4652 and @code{vsprintf} that might overflow the destination buffer. When the
4653 exact number of bytes written by a format directive cannot be determined
4654 at compile-time it is estimated based on heuristics that depend on the
4655 @var{level} argument and on optimization. While enabling optimization
4656 will in most cases improve the accuracy of the warning, it may also
4657 result in false positives.
4660 @item -Wformat-overflow
4661 @itemx -Wformat-overflow=1
4662 @opindex Wformat-overflow
4663 @opindex Wno-format-overflow
4664 Level @var{1} of @option{-Wformat-overflow} enabled by @option{-Wformat}
4665 employs a conservative approach that warns only about calls that most
4666 likely overflow the buffer. At this level, numeric arguments to format
4667 directives with unknown values are assumed to have the value of one, and
4668 strings of unknown length to be empty. Numeric arguments that are known
4669 to be bounded to a subrange of their type, or string arguments whose output
4670 is bounded either by their directive's precision or by a finite set of
4671 string literals, are assumed to take on the value within the range that
4672 results in the most bytes on output. For example, the call to @code{sprintf}
4673 below is diagnosed because even with both @var{a} and @var{b} equal to zero,
4674 the terminating NUL character (@code{'\0'}) appended by the function
4675 to the destination buffer will be written past its end. Increasing
4676 the size of the buffer by a single byte is sufficient to avoid the
4677 warning, though it may not be sufficient to avoid the overflow.
4680 void f (int a, int b)
4683 sprintf (buf, "a = %i, b = %i\n", a, b);
4687 @item -Wformat-overflow=2
4688 Level @var{2} warns also about calls that might overflow the destination
4689 buffer given an argument of sufficient length or magnitude. At level
4690 @var{2}, unknown numeric arguments are assumed to have the minimum
4691 representable value for signed types with a precision greater than 1, and
4692 the maximum representable value otherwise. Unknown string arguments whose
4693 length cannot be assumed to be bounded either by the directive's precision,
4694 or by a finite set of string literals they may evaluate to, or the character
4695 array they may point to, are assumed to be 1 character long.
4697 At level @var{2}, the call in the example above is again diagnosed, but
4698 this time because with @var{a} equal to a 32-bit @code{INT_MIN} the first
4699 @code{%i} directive will write some of its digits beyond the end of
4700 the destination buffer. To make the call safe regardless of the values
4701 of the two variables, the size of the destination buffer must be increased
4702 to at least 34 bytes. GCC includes the minimum size of the buffer in
4703 an informational note following the warning.
4705 An alternative to increasing the size of the destination buffer is to
4706 constrain the range of formatted values. The maximum length of string
4707 arguments can be bounded by specifying the precision in the format
4708 directive. When numeric arguments of format directives can be assumed
4709 to be bounded by less than the precision of their type, choosing
4710 an appropriate length modifier to the format specifier will reduce
4711 the required buffer size. For example, if @var{a} and @var{b} in the
4712 example above can be assumed to be within the precision of
4713 the @code{short int} type then using either the @code{%hi} format
4714 directive or casting the argument to @code{short} reduces the maximum
4715 required size of the buffer to 24 bytes.
4718 void f (int a, int b)
4721 sprintf (buf, "a = %hi, b = %i\n", a, (short)b);
4726 @item -Wno-format-zero-length
4727 @opindex Wno-format-zero-length
4728 @opindex Wformat-zero-length
4729 If @option{-Wformat} is specified, do not warn about zero-length formats.
4730 The C standard specifies that zero-length formats are allowed.
4735 Enable @option{-Wformat} plus additional format checks. Currently
4736 equivalent to @option{-Wformat -Wformat-nonliteral -Wformat-security
4739 @item -Wformat-nonliteral
4740 @opindex Wformat-nonliteral
4741 @opindex Wno-format-nonliteral
4742 If @option{-Wformat} is specified, also warn if the format string is not a
4743 string literal and so cannot be checked, unless the format function
4744 takes its format arguments as a @code{va_list}.
4746 @item -Wformat-security
4747 @opindex Wformat-security
4748 @opindex Wno-format-security
4749 If @option{-Wformat} is specified, also warn about uses of format
4750 functions that represent possible security problems. At present, this
4751 warns about calls to @code{printf} and @code{scanf} functions where the
4752 format string is not a string literal and there are no format arguments,
4753 as in @code{printf (foo);}. This may be a security hole if the format
4754 string came from untrusted input and contains @samp{%n}. (This is
4755 currently a subset of what @option{-Wformat-nonliteral} warns about, but
4756 in future warnings may be added to @option{-Wformat-security} that are not
4757 included in @option{-Wformat-nonliteral}.)
4759 @item -Wformat-signedness
4760 @opindex Wformat-signedness
4761 @opindex Wno-format-signedness
4762 If @option{-Wformat} is specified, also warn if the format string
4763 requires an unsigned argument and the argument is signed and vice versa.
4765 @item -Wformat-truncation
4766 @itemx -Wformat-truncation=@var{level}
4767 @opindex Wformat-truncation
4768 @opindex Wno-format-truncation
4769 Warn about calls to formatted input/output functions such as @code{snprintf}
4770 and @code{vsnprintf} that might result in output truncation. When the exact
4771 number of bytes written by a format directive cannot be determined at
4772 compile-time it is estimated based on heuristics that depend on
4773 the @var{level} argument and on optimization. While enabling optimization
4774 will in most cases improve the accuracy of the warning, it may also result
4775 in false positives. Except as noted otherwise, the option uses the same
4776 logic @option{-Wformat-overflow}.
4779 @item -Wformat-truncation
4780 @itemx -Wformat-truncation=1
4781 @opindex Wformat-truncation
4782 @opindex Wno-format-truncation
4783 Level @var{1} of @option{-Wformat-truncation} enabled by @option{-Wformat}
4784 employs a conservative approach that warns only about calls to bounded
4785 functions whose return value is unused and that will most likely result
4786 in output truncation.
4788 @item -Wformat-truncation=2
4789 Level @var{2} warns also about calls to bounded functions whose return
4790 value is used and that might result in truncation given an argument of
4791 sufficient length or magnitude.
4795 @opindex Wformat-y2k
4796 @opindex Wno-format-y2k
4797 If @option{-Wformat} is specified, also warn about @code{strftime}
4798 formats that may yield only a two-digit year.
4803 @opindex Wno-nonnull
4804 Warn about passing a null pointer for arguments marked as
4805 requiring a non-null value by the @code{nonnull} function attribute.
4807 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
4808 can be disabled with the @option{-Wno-nonnull} option.
4810 @item -Wnonnull-compare
4811 @opindex Wnonnull-compare
4812 @opindex Wno-nonnull-compare
4813 Warn when comparing an argument marked with the @code{nonnull}
4814 function attribute against null inside the function.
4816 @option{-Wnonnull-compare} is included in @option{-Wall}. It
4817 can be disabled with the @option{-Wno-nonnull-compare} option.
4819 @item -Wnull-dereference
4820 @opindex Wnull-dereference
4821 @opindex Wno-null-dereference
4822 Warn if the compiler detects paths that trigger erroneous or
4823 undefined behavior due to dereferencing a null pointer. This option
4824 is only active when @option{-fdelete-null-pointer-checks} is active,
4825 which is enabled by optimizations in most targets. The precision of
4826 the warnings depends on the optimization options used.
4828 @item -Winaccessible-base @r{(C++, Objective-C++ only)}
4829 @opindex Winaccessible-base
4830 @opindex Wno-inaccessible-base
4831 Warn when a base class is inaccessible in a class derived from it due to
4832 ambiguity. The warning is enabled by default. Note the warning for virtual
4833 bases is enabled by the @option{-Wextra} option.
4836 struct A @{ int a; @};
4840 struct C : B, A @{ @};
4844 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
4846 @opindex Wno-init-self
4847 Warn about uninitialized variables that are initialized with themselves.
4848 Note this option can only be used with the @option{-Wuninitialized} option.
4850 For example, GCC warns about @code{i} being uninitialized in the
4851 following snippet only when @option{-Winit-self} has been specified:
4862 This warning is enabled by @option{-Wall} in C++.
4864 @item -Wimplicit-int @r{(C and Objective-C only)}
4865 @opindex Wimplicit-int
4866 @opindex Wno-implicit-int
4867 Warn when a declaration does not specify a type.
4868 This warning is enabled by @option{-Wall}.
4870 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
4871 @opindex Wimplicit-function-declaration
4872 @opindex Wno-implicit-function-declaration
4873 Give a warning whenever a function is used before being declared. In
4874 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
4875 enabled by default and it is made into an error by
4876 @option{-pedantic-errors}. This warning is also enabled by
4879 @item -Wimplicit @r{(C and Objective-C only)}
4881 @opindex Wno-implicit
4882 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
4883 This warning is enabled by @option{-Wall}.
4885 @item -Wimplicit-fallthrough
4886 @opindex Wimplicit-fallthrough
4887 @opindex Wno-implicit-fallthrough
4888 @option{-Wimplicit-fallthrough} is the same as @option{-Wimplicit-fallthrough=3}
4889 and @option{-Wno-implicit-fallthrough} is the same as
4890 @option{-Wimplicit-fallthrough=0}.
4892 @item -Wimplicit-fallthrough=@var{n}
4893 @opindex Wimplicit-fallthrough=
4894 Warn when a switch case falls through. For example:
4912 This warning does not warn when the last statement of a case cannot
4913 fall through, e.g. when there is a return statement or a call to function
4914 declared with the noreturn attribute. @option{-Wimplicit-fallthrough=}
4915 also takes into account control flow statements, such as ifs, and only
4916 warns when appropriate. E.g.@:
4926 @} else if (i < 1) @{
4936 Since there are occasions where a switch case fall through is desirable,
4937 GCC provides an attribute, @code{__attribute__ ((fallthrough))}, that is
4938 to be used along with a null statement to suppress this warning that
4939 would normally occur:
4947 __attribute__ ((fallthrough));
4954 C++17 provides a standard way to suppress the @option{-Wimplicit-fallthrough}
4955 warning using @code{[[fallthrough]];} instead of the GNU attribute. In C++11
4956 or C++14 users can use @code{[[gnu::fallthrough]];}, which is a GNU extension.
4957 Instead of these attributes, it is also possible to add a fallthrough comment
4958 to silence the warning. The whole body of the C or C++ style comment should
4959 match the given regular expressions listed below. The option argument @var{n}
4960 specifies what kind of comments are accepted:
4964 @item @option{-Wimplicit-fallthrough=0} disables the warning altogether.
4966 @item @option{-Wimplicit-fallthrough=1} matches @code{.*} regular
4967 expression, any comment is used as fallthrough comment.
4969 @item @option{-Wimplicit-fallthrough=2} case insensitively matches
4970 @code{.*falls?[ \t-]*thr(ough|u).*} regular expression.
4972 @item @option{-Wimplicit-fallthrough=3} case sensitively matches one of the
4973 following regular expressions:
4977 @item @code{-fallthrough}
4979 @item @code{@@fallthrough@@}
4981 @item @code{lint -fallthrough[ \t]*}
4983 @item @code{[ \t.!]*(ELSE,? |INTENTIONAL(LY)? )?@*FALL(S | |-)?THR(OUGH|U)[ \t.!]*(-[^\n\r]*)?}
4985 @item @code{[ \t.!]*(Else,? |Intentional(ly)? )?@*Fall((s | |-)[Tt]|t)hr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4987 @item @code{[ \t.!]*([Ee]lse,? |[Ii]ntentional(ly)? )?@*fall(s | |-)?thr(ough|u)[ \t.!]*(-[^\n\r]*)?}
4991 @item @option{-Wimplicit-fallthrough=4} case sensitively matches one of the
4992 following regular expressions:
4996 @item @code{-fallthrough}
4998 @item @code{@@fallthrough@@}
5000 @item @code{lint -fallthrough[ \t]*}
5002 @item @code{[ \t]*FALLTHR(OUGH|U)[ \t]*}
5006 @item @option{-Wimplicit-fallthrough=5} doesn't recognize any comments as
5007 fallthrough comments, only attributes disable the warning.
5011 The comment needs to be followed after optional whitespace and other comments
5012 by @code{case} or @code{default} keywords or by a user label that precedes some
5013 @code{case} or @code{default} label.
5028 The @option{-Wimplicit-fallthrough=3} warning is enabled by @option{-Wextra}.
5030 @item -Wif-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
5031 @opindex Wif-not-aligned
5032 @opindex Wno-if-not-aligned
5033 Control if warning triggered by the @code{warn_if_not_aligned} attribute
5034 should be issued. This is enabled by default.
5035 Use @option{-Wno-if-not-aligned} to disable it.
5037 @item -Wignored-qualifiers @r{(C and C++ only)}
5038 @opindex Wignored-qualifiers
5039 @opindex Wno-ignored-qualifiers
5040 Warn if the return type of a function has a type qualifier
5041 such as @code{const}. For ISO C such a type qualifier has no effect,
5042 since the value returned by a function is not an lvalue.
5043 For C++, the warning is only emitted for scalar types or @code{void}.
5044 ISO C prohibits qualified @code{void} return types on function
5045 definitions, so such return types always receive a warning
5046 even without this option.
5048 This warning is also enabled by @option{-Wextra}.
5050 @item -Wignored-attributes @r{(C and C++ only)}
5051 @opindex Wignored-attributes
5052 @opindex Wno-ignored-attributes
5053 Warn when an attribute is ignored. This is different from the
5054 @option{-Wattributes} option in that it warns whenever the compiler decides
5055 to drop an attribute, not that the attribute is either unknown, used in a
5056 wrong place, etc. This warning is enabled by default.
5061 Warn if the type of @code{main} is suspicious. @code{main} should be
5062 a function with external linkage, returning int, taking either zero
5063 arguments, two, or three arguments of appropriate types. This warning
5064 is enabled by default in C++ and is enabled by either @option{-Wall}
5065 or @option{-Wpedantic}.
5067 @item -Wmisleading-indentation @r{(C and C++ only)}
5068 @opindex Wmisleading-indentation
5069 @opindex Wno-misleading-indentation
5070 Warn when the indentation of the code does not reflect the block structure.
5071 Specifically, a warning is issued for @code{if}, @code{else}, @code{while}, and
5072 @code{for} clauses with a guarded statement that does not use braces,
5073 followed by an unguarded statement with the same indentation.
5075 In the following example, the call to ``bar'' is misleadingly indented as
5076 if it were guarded by the ``if'' conditional.
5079 if (some_condition ())
5081 bar (); /* Gotcha: this is not guarded by the "if". */
5084 In the case of mixed tabs and spaces, the warning uses the
5085 @option{-ftabstop=} option to determine if the statements line up
5088 The warning is not issued for code involving multiline preprocessor logic
5089 such as the following example.
5094 #if SOME_CONDITION_THAT_DOES_NOT_HOLD
5100 The warning is not issued after a @code{#line} directive, since this
5101 typically indicates autogenerated code, and no assumptions can be made
5102 about the layout of the file that the directive references.
5104 This warning is enabled by @option{-Wall} in C and C++.
5106 @item -Wmissing-attributes
5107 @opindex Wmissing-attributes
5108 @opindex Wno-missing-attributes
5109 Warn when a declaration of a function is missing one or more attributes
5110 that a related function is declared with and whose absence may adversely
5111 affect the correctness or efficiency of generated code. For example,
5112 the warning is issued for declarations of aliases that use attributes
5113 to specify less restrictive requirements than those of their targets.
5114 This typically represents a potential optimization opportunity.
5115 By contrast, the @option{-Wattribute-alias=2} option controls warnings
5116 issued when the alias is more restrictive than the target, which could
5117 lead to incorrect code generation.
5118 Attributes considered include @code{alloc_align}, @code{alloc_size},
5119 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
5120 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
5121 @code{returns_nonnull}, and @code{returns_twice}.
5123 In C++, the warning is issued when an explicit specialization of a primary
5124 template declared with attribute @code{alloc_align}, @code{alloc_size},
5125 @code{assume_aligned}, @code{format}, @code{format_arg}, @code{malloc},
5126 or @code{nonnull} is declared without it. Attributes @code{deprecated},
5127 @code{error}, and @code{warning} suppress the warning.
5128 (@pxref{Function Attributes}).
5130 You can use the @code{copy} attribute to apply the same
5131 set of attributes to a declaration as that on another declaration without
5132 explicitly enumerating the attributes. This attribute can be applied
5133 to declarations of functions (@pxref{Common Function Attributes}),
5134 variables (@pxref{Common Variable Attributes}), or types
5135 (@pxref{Common Type Attributes}).
5137 @option{-Wmissing-attributes} is enabled by @option{-Wall}.
5139 For example, since the declaration of the primary function template
5140 below makes use of both attribute @code{malloc} and @code{alloc_size}
5141 the declaration of the explicit specialization of the template is
5142 diagnosed because it is missing one of the attributes.
5146 T* __attribute__ ((malloc, alloc_size (1)))
5150 void* __attribute__ ((malloc)) // missing alloc_size
5151 allocate<void> (size_t);
5154 @item -Wmissing-braces
5155 @opindex Wmissing-braces
5156 @opindex Wno-missing-braces
5157 Warn if an aggregate or union initializer is not fully bracketed. In
5158 the following example, the initializer for @code{a} is not fully
5159 bracketed, but that for @code{b} is fully bracketed. This warning is
5160 enabled by @option{-Wall} in C.
5163 int a[2][2] = @{ 0, 1, 2, 3 @};
5164 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
5167 This warning is enabled by @option{-Wall}.
5169 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
5170 @opindex Wmissing-include-dirs
5171 @opindex Wno-missing-include-dirs
5172 Warn if a user-supplied include directory does not exist.
5174 @item -Wmissing-profile
5175 @opindex Wmissing-profile
5176 @opindex Wno-missing-profile
5177 Warn if feedback profiles are missing when using the
5178 @option{-fprofile-use} option.
5179 This option diagnoses those cases where a new function or a new file is added
5180 to the user code between compiling with @option{-fprofile-generate} and with
5181 @option{-fprofile-use}, without regenerating the profiles. In these cases, the
5182 profile feedback data files do not contain any profile feedback information for
5183 the newly added function or file respectively. Also, in the case when profile
5184 count data (.gcda) files are removed, GCC cannot use any profile feedback
5185 information. In all these cases, warnings are issued to inform the user that a
5186 profile generation step is due. @option{-Wno-missing-profile} can be used to
5187 disable the warning. Ignoring the warning can result in poorly optimized code.
5188 Completely disabling the warning is not recommended and should be done only
5189 when non-existent profile data is justified.
5191 @item -Wmultistatement-macros
5192 @opindex Wmultistatement-macros
5193 @opindex Wno-multistatement-macros
5194 Warn about unsafe multiple statement macros that appear to be guarded
5195 by a clause such as @code{if}, @code{else}, @code{for}, @code{switch}, or
5196 @code{while}, in which only the first statement is actually guarded after
5197 the macro is expanded.
5202 #define DOIT x++; y++
5207 will increment @code{y} unconditionally, not just when @code{c} holds.
5208 The can usually be fixed by wrapping the macro in a do-while loop:
5210 #define DOIT do @{ x++; y++; @} while (0)
5215 This warning is enabled by @option{-Wall} in C and C++.
5218 @opindex Wparentheses
5219 @opindex Wno-parentheses
5220 Warn if parentheses are omitted in certain contexts, such
5221 as when there is an assignment in a context where a truth value
5222 is expected, or when operators are nested whose precedence people
5223 often get confused about.
5225 Also warn if a comparison like @code{x<=y<=z} appears; this is
5226 equivalent to @code{(x<=y ? 1 : 0) <= z}, which is a different
5227 interpretation from that of ordinary mathematical notation.
5229 Also warn for dangerous uses of the GNU extension to
5230 @code{?:} with omitted middle operand. When the condition
5231 in the @code{?}: operator is a boolean expression, the omitted value is
5232 always 1. Often programmers expect it to be a value computed
5233 inside the conditional expression instead.
5235 For C++ this also warns for some cases of unnecessary parentheses in
5236 declarations, which can indicate an attempt at a function call instead
5240 // Declares a local variable called mymutex.
5241 std::unique_lock<std::mutex> (mymutex);
5242 // User meant std::unique_lock<std::mutex> lock (mymutex);
5246 This warning is enabled by @option{-Wall}.
5248 @item -Wsequence-point
5249 @opindex Wsequence-point
5250 @opindex Wno-sequence-point
5251 Warn about code that may have undefined semantics because of violations
5252 of sequence point rules in the C and C++ standards.
5254 The C and C++ standards define the order in which expressions in a C/C++
5255 program are evaluated in terms of @dfn{sequence points}, which represent
5256 a partial ordering between the execution of parts of the program: those
5257 executed before the sequence point, and those executed after it. These
5258 occur after the evaluation of a full expression (one which is not part
5259 of a larger expression), after the evaluation of the first operand of a
5260 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
5261 function is called (but after the evaluation of its arguments and the
5262 expression denoting the called function), and in certain other places.
5263 Other than as expressed by the sequence point rules, the order of
5264 evaluation of subexpressions of an expression is not specified. All
5265 these rules describe only a partial order rather than a total order,
5266 since, for example, if two functions are called within one expression
5267 with no sequence point between them, the order in which the functions
5268 are called is not specified. However, the standards committee have
5269 ruled that function calls do not overlap.
5271 It is not specified when between sequence points modifications to the
5272 values of objects take effect. Programs whose behavior depends on this
5273 have undefined behavior; the C and C++ standards specify that ``Between
5274 the previous and next sequence point an object shall have its stored
5275 value modified at most once by the evaluation of an expression.
5276 Furthermore, the prior value shall be read only to determine the value
5277 to be stored.''. If a program breaks these rules, the results on any
5278 particular implementation are entirely unpredictable.
5280 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
5281 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
5282 diagnosed by this option, and it may give an occasional false positive
5283 result, but in general it has been found fairly effective at detecting
5284 this sort of problem in programs.
5286 The C++17 standard will define the order of evaluation of operands in
5287 more cases: in particular it requires that the right-hand side of an
5288 assignment be evaluated before the left-hand side, so the above
5289 examples are no longer undefined. But this warning will still warn
5290 about them, to help people avoid writing code that is undefined in C
5291 and earlier revisions of C++.
5293 The standard is worded confusingly, therefore there is some debate
5294 over the precise meaning of the sequence point rules in subtle cases.
5295 Links to discussions of the problem, including proposed formal
5296 definitions, may be found on the GCC readings page, at
5297 @uref{http://gcc.gnu.org/@/readings.html}.
5299 This warning is enabled by @option{-Wall} for C and C++.
5301 @item -Wno-return-local-addr
5302 @opindex Wno-return-local-addr
5303 @opindex Wreturn-local-addr
5304 Do not warn about returning a pointer (or in C++, a reference) to a
5305 variable that goes out of scope after the function returns.
5308 @opindex Wreturn-type
5309 @opindex Wno-return-type
5310 Warn whenever a function is defined with a return type that defaults
5311 to @code{int}. Also warn about any @code{return} statement with no
5312 return value in a function whose return type is not @code{void}
5313 (falling off the end of the function body is considered returning
5316 For C only, warn about a @code{return} statement with an expression in a
5317 function whose return type is @code{void}, unless the expression type is
5318 also @code{void}. As a GNU extension, the latter case is accepted
5319 without a warning unless @option{-Wpedantic} is used. Attempting
5320 to use the return value of a non-@code{void} function other than @code{main}
5321 that flows off the end by reaching the closing curly brace that terminates
5322 the function is undefined.
5324 Unlike in C, in C++, flowing off the end of a non-@code{void} function other
5325 than @code{main} results in undefined behavior even when the value of
5326 the function is not used.
5328 This warning is enabled by default in C++ and by @option{-Wall} otherwise.
5330 @item -Wshift-count-negative
5331 @opindex Wshift-count-negative
5332 @opindex Wno-shift-count-negative
5333 Warn if shift count is negative. This warning is enabled by default.
5335 @item -Wshift-count-overflow
5336 @opindex Wshift-count-overflow
5337 @opindex Wno-shift-count-overflow
5338 Warn if shift count >= width of type. This warning is enabled by default.
5340 @item -Wshift-negative-value
5341 @opindex Wshift-negative-value
5342 @opindex Wno-shift-negative-value
5343 Warn if left shifting a negative value. This warning is enabled by
5344 @option{-Wextra} in C99 and C++11 modes (and newer).
5346 @item -Wshift-overflow
5347 @itemx -Wshift-overflow=@var{n}
5348 @opindex Wshift-overflow
5349 @opindex Wno-shift-overflow
5350 Warn about left shift overflows. This warning is enabled by
5351 default in C99 and C++11 modes (and newer).
5354 @item -Wshift-overflow=1
5355 This is the warning level of @option{-Wshift-overflow} and is enabled
5356 by default in C99 and C++11 modes (and newer). This warning level does
5357 not warn about left-shifting 1 into the sign bit. (However, in C, such
5358 an overflow is still rejected in contexts where an integer constant expression
5359 is required.) No warning is emitted in C++2A mode (and newer), as signed left
5362 @item -Wshift-overflow=2
5363 This warning level also warns about left-shifting 1 into the sign bit,
5364 unless C++14 mode (or newer) is active.
5370 Warn whenever a @code{switch} statement has an index of enumerated type
5371 and lacks a @code{case} for one or more of the named codes of that
5372 enumeration. (The presence of a @code{default} label prevents this
5373 warning.) @code{case} labels outside the enumeration range also
5374 provoke warnings when this option is used (even if there is a
5375 @code{default} label).
5376 This warning is enabled by @option{-Wall}.
5378 @item -Wswitch-default
5379 @opindex Wswitch-default
5380 @opindex Wno-switch-default
5381 Warn whenever a @code{switch} statement does not have a @code{default}
5385 @opindex Wswitch-enum
5386 @opindex Wno-switch-enum
5387 Warn whenever a @code{switch} statement has an index of enumerated type
5388 and lacks a @code{case} for one or more of the named codes of that
5389 enumeration. @code{case} labels outside the enumeration range also
5390 provoke warnings when this option is used. The only difference
5391 between @option{-Wswitch} and this option is that this option gives a
5392 warning about an omitted enumeration code even if there is a
5393 @code{default} label.
5396 @opindex Wswitch-bool
5397 @opindex Wno-switch-bool
5398 Warn whenever a @code{switch} statement has an index of boolean type
5399 and the case values are outside the range of a boolean type.
5400 It is possible to suppress this warning by casting the controlling
5401 expression to a type other than @code{bool}. For example:
5404 switch ((int) (a == 4))
5410 This warning is enabled by default for C and C++ programs.
5412 @item -Wswitch-outside-range
5413 @opindex Wswitch-outside-range
5414 @opindex Wno-switch-outside-range
5415 Warn whenever a @code{switch} case has a value that is outside of its
5416 respective type range. This warning is enabled by default for
5419 @item -Wswitch-unreachable
5420 @opindex Wswitch-unreachable
5421 @opindex Wno-switch-unreachable
5422 Warn whenever a @code{switch} statement contains statements between the
5423 controlling expression and the first case label, which will never be
5424 executed. For example:
5436 @option{-Wswitch-unreachable} does not warn if the statement between the
5437 controlling expression and the first case label is just a declaration:
5450 This warning is enabled by default for C and C++ programs.
5452 @item -Wsync-nand @r{(C and C++ only)}
5454 @opindex Wno-sync-nand
5455 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
5456 built-in functions are used. These functions changed semantics in GCC 4.4.
5458 @item -Wunused-but-set-parameter
5459 @opindex Wunused-but-set-parameter
5460 @opindex Wno-unused-but-set-parameter
5461 Warn whenever a function parameter is assigned to, but otherwise unused
5462 (aside from its declaration).
5464 To suppress this warning use the @code{unused} attribute
5465 (@pxref{Variable Attributes}).
5467 This warning is also enabled by @option{-Wunused} together with
5470 @item -Wunused-but-set-variable
5471 @opindex Wunused-but-set-variable
5472 @opindex Wno-unused-but-set-variable
5473 Warn whenever a local variable is assigned to, but otherwise unused
5474 (aside from its declaration).
5475 This warning is enabled by @option{-Wall}.
5477 To suppress this warning use the @code{unused} attribute
5478 (@pxref{Variable Attributes}).
5480 This warning is also enabled by @option{-Wunused}, which is enabled
5483 @item -Wunused-function
5484 @opindex Wunused-function
5485 @opindex Wno-unused-function
5486 Warn whenever a static function is declared but not defined or a
5487 non-inline static function is unused.
5488 This warning is enabled by @option{-Wall}.
5490 @item -Wunused-label
5491 @opindex Wunused-label
5492 @opindex Wno-unused-label
5493 Warn whenever a label is declared but not used.
5494 This warning is enabled by @option{-Wall}.
5496 To suppress this warning use the @code{unused} attribute
5497 (@pxref{Variable Attributes}).
5499 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
5500 @opindex Wunused-local-typedefs
5501 @opindex Wno-unused-local-typedefs
5502 Warn when a typedef locally defined in a function is not used.
5503 This warning is enabled by @option{-Wall}.
5505 @item -Wunused-parameter
5506 @opindex Wunused-parameter
5507 @opindex Wno-unused-parameter
5508 Warn whenever a function parameter is unused aside from its declaration.
5510 To suppress this warning use the @code{unused} attribute
5511 (@pxref{Variable Attributes}).
5513 @item -Wno-unused-result
5514 @opindex Wunused-result
5515 @opindex Wno-unused-result
5516 Do not warn if a caller of a function marked with attribute
5517 @code{warn_unused_result} (@pxref{Function Attributes}) does not use
5518 its return value. The default is @option{-Wunused-result}.
5520 @item -Wunused-variable
5521 @opindex Wunused-variable
5522 @opindex Wno-unused-variable
5523 Warn whenever a local or static variable is unused aside from its
5524 declaration. This option implies @option{-Wunused-const-variable=1} for C,
5525 but not for C++. This warning is enabled by @option{-Wall}.
5527 To suppress this warning use the @code{unused} attribute
5528 (@pxref{Variable Attributes}).
5530 @item -Wunused-const-variable
5531 @itemx -Wunused-const-variable=@var{n}
5532 @opindex Wunused-const-variable
5533 @opindex Wno-unused-const-variable
5534 Warn whenever a constant static variable is unused aside from its declaration.
5535 @option{-Wunused-const-variable=1} is enabled by @option{-Wunused-variable}
5536 for C, but not for C++. In C this declares variable storage, but in C++ this
5537 is not an error since const variables take the place of @code{#define}s.
5539 To suppress this warning use the @code{unused} attribute
5540 (@pxref{Variable Attributes}).
5543 @item -Wunused-const-variable=1
5544 This is the warning level that is enabled by @option{-Wunused-variable} for
5545 C. It warns only about unused static const variables defined in the main
5546 compilation unit, but not about static const variables declared in any
5549 @item -Wunused-const-variable=2
5550 This warning level also warns for unused constant static variables in
5551 headers (excluding system headers). This is the warning level of
5552 @option{-Wunused-const-variable} and must be explicitly requested since
5553 in C++ this isn't an error and in C it might be harder to clean up all
5557 @item -Wunused-value
5558 @opindex Wunused-value
5559 @opindex Wno-unused-value
5560 Warn whenever a statement computes a result that is explicitly not
5561 used. To suppress this warning cast the unused expression to
5562 @code{void}. This includes an expression-statement or the left-hand
5563 side of a comma expression that contains no side effects. For example,
5564 an expression such as @code{x[i,j]} causes a warning, while
5565 @code{x[(void)i,j]} does not.
5567 This warning is enabled by @option{-Wall}.
5572 All the above @option{-Wunused} options combined.
5574 In order to get a warning about an unused function parameter, you must
5575 either specify @option{-Wextra -Wunused} (note that @option{-Wall} implies
5576 @option{-Wunused}), or separately specify @option{-Wunused-parameter}.
5578 @item -Wuninitialized
5579 @opindex Wuninitialized
5580 @opindex Wno-uninitialized
5581 Warn if an automatic variable is used without first being initialized
5582 or if a variable may be clobbered by a @code{setjmp} call. In C++,
5583 warn if a non-static reference or non-static @code{const} member
5584 appears in a class without constructors.
5586 If you want to warn about code that uses the uninitialized value of the
5587 variable in its own initializer, use the @option{-Winit-self} option.
5589 These warnings occur for individual uninitialized or clobbered
5590 elements of structure, union or array variables as well as for
5591 variables that are uninitialized or clobbered as a whole. They do
5592 not occur for variables or elements declared @code{volatile}. Because
5593 these warnings depend on optimization, the exact variables or elements
5594 for which there are warnings depends on the precise optimization
5595 options and version of GCC used.
5597 Note that there may be no warning about a variable that is used only
5598 to compute a value that itself is never used, because such
5599 computations may be deleted by data flow analysis before the warnings
5602 @item -Winvalid-memory-model
5603 @opindex Winvalid-memory-model
5604 @opindex Wno-invalid-memory-model
5605 Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins},
5606 and the C11 atomic generic functions with a memory consistency argument
5607 that is either invalid for the operation or outside the range of values
5608 of the @code{memory_order} enumeration. For example, since the
5609 @code{__atomic_store} and @code{__atomic_store_n} built-ins are only
5610 defined for the relaxed, release, and sequentially consistent memory
5611 orders the following code is diagnosed:
5616 __atomic_store_n (i, 0, memory_order_consume);
5620 @option{-Winvalid-memory-model} is enabled by default.
5622 @item -Wmaybe-uninitialized
5623 @opindex Wmaybe-uninitialized
5624 @opindex Wno-maybe-uninitialized
5625 For an automatic (i.e.@: local) variable, if there exists a path from the
5626 function entry to a use of the variable that is initialized, but there exist
5627 some other paths for which the variable is not initialized, the compiler
5628 emits a warning if it cannot prove the uninitialized paths are not
5629 executed at run time.
5631 These warnings are only possible in optimizing compilation, because otherwise
5632 GCC does not keep track of the state of variables.
5634 These warnings are made optional because GCC may not be able to determine when
5635 the code is correct in spite of appearing to have an error. Here is one
5636 example of how this can happen:
5656 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
5657 always initialized, but GCC doesn't know this. To suppress the
5658 warning, you need to provide a default case with assert(0) or
5661 @cindex @code{longjmp} warnings
5662 This option also warns when a non-volatile automatic variable might be
5663 changed by a call to @code{longjmp}.
5664 The compiler sees only the calls to @code{setjmp}. It cannot know
5665 where @code{longjmp} will be called; in fact, a signal handler could
5666 call it at any point in the code. As a result, you may get a warning
5667 even when there is in fact no problem because @code{longjmp} cannot
5668 in fact be called at the place that would cause a problem.
5670 Some spurious warnings can be avoided if you declare all the functions
5671 you use that never return as @code{noreturn}. @xref{Function
5674 This warning is enabled by @option{-Wall} or @option{-Wextra}.
5676 @item -Wunknown-pragmas
5677 @opindex Wunknown-pragmas
5678 @opindex Wno-unknown-pragmas
5679 @cindex warning for unknown pragmas
5680 @cindex unknown pragmas, warning
5681 @cindex pragmas, warning of unknown
5682 Warn when a @code{#pragma} directive is encountered that is not understood by
5683 GCC@. If this command-line option is used, warnings are even issued
5684 for unknown pragmas in system header files. This is not the case if
5685 the warnings are only enabled by the @option{-Wall} command-line option.
5688 @opindex Wno-pragmas
5690 Do not warn about misuses of pragmas, such as incorrect parameters,
5691 invalid syntax, or conflicts between pragmas. See also
5692 @option{-Wunknown-pragmas}.
5694 @item -Wno-prio-ctor-dtor
5695 @opindex Wno-prio-ctor-dtor
5696 @opindex Wprio-ctor-dtor
5697 Do not warn if a priority from 0 to 100 is used for constructor or destructor.
5698 The use of constructor and destructor attributes allow you to assign a
5699 priority to the constructor/destructor to control its order of execution
5700 before @code{main} is called or after it returns. The priority values must be
5701 greater than 100 as the compiler reserves priority values between 0--100 for
5704 @item -Wstrict-aliasing
5705 @opindex Wstrict-aliasing
5706 @opindex Wno-strict-aliasing
5707 This option is only active when @option{-fstrict-aliasing} is active.
5708 It warns about code that might break the strict aliasing rules that the
5709 compiler is using for optimization. The warning does not catch all
5710 cases, but does attempt to catch the more common pitfalls. It is
5711 included in @option{-Wall}.
5712 It is equivalent to @option{-Wstrict-aliasing=3}
5714 @item -Wstrict-aliasing=n
5715 @opindex Wstrict-aliasing=n
5716 This option is only active when @option{-fstrict-aliasing} is active.
5717 It warns about code that might break the strict aliasing rules that the
5718 compiler is using for optimization.
5719 Higher levels correspond to higher accuracy (fewer false positives).
5720 Higher levels also correspond to more effort, similar to the way @option{-O}
5722 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=3}.
5724 Level 1: Most aggressive, quick, least accurate.
5725 Possibly useful when higher levels
5726 do not warn but @option{-fstrict-aliasing} still breaks the code, as it has very few
5727 false negatives. However, it has many false positives.
5728 Warns for all pointer conversions between possibly incompatible types,
5729 even if never dereferenced. Runs in the front end only.
5731 Level 2: Aggressive, quick, not too precise.
5732 May still have many false positives (not as many as level 1 though),
5733 and few false negatives (but possibly more than level 1).
5734 Unlike level 1, it only warns when an address is taken. Warns about
5735 incomplete types. Runs in the front end only.
5737 Level 3 (default for @option{-Wstrict-aliasing}):
5738 Should have very few false positives and few false
5739 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
5740 Takes care of the common pun+dereference pattern in the front end:
5741 @code{*(int*)&some_float}.
5742 If optimization is enabled, it also runs in the back end, where it deals
5743 with multiple statement cases using flow-sensitive points-to information.
5744 Only warns when the converted pointer is dereferenced.
5745 Does not warn about incomplete types.
5747 @item -Wstrict-overflow
5748 @itemx -Wstrict-overflow=@var{n}
5749 @opindex Wstrict-overflow
5750 @opindex Wno-strict-overflow
5751 This option is only active when signed overflow is undefined.
5752 It warns about cases where the compiler optimizes based on the
5753 assumption that signed overflow does not occur. Note that it does not
5754 warn about all cases where the code might overflow: it only warns
5755 about cases where the compiler implements some optimization. Thus
5756 this warning depends on the optimization level.
5758 An optimization that assumes that signed overflow does not occur is
5759 perfectly safe if the values of the variables involved are such that
5760 overflow never does, in fact, occur. Therefore this warning can
5761 easily give a false positive: a warning about code that is not
5762 actually a problem. To help focus on important issues, several
5763 warning levels are defined. No warnings are issued for the use of
5764 undefined signed overflow when estimating how many iterations a loop
5765 requires, in particular when determining whether a loop will be
5769 @item -Wstrict-overflow=1
5770 Warn about cases that are both questionable and easy to avoid. For
5771 example the compiler simplifies
5772 @code{x + 1 > x} to @code{1}. This level of
5773 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
5774 are not, and must be explicitly requested.
5776 @item -Wstrict-overflow=2
5777 Also warn about other cases where a comparison is simplified to a
5778 constant. For example: @code{abs (x) >= 0}. This can only be
5779 simplified when signed integer overflow is undefined, because
5780 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
5781 zero. @option{-Wstrict-overflow} (with no level) is the same as
5782 @option{-Wstrict-overflow=2}.
5784 @item -Wstrict-overflow=3
5785 Also warn about other cases where a comparison is simplified. For
5786 example: @code{x + 1 > 1} is simplified to @code{x > 0}.
5788 @item -Wstrict-overflow=4
5789 Also warn about other simplifications not covered by the above cases.
5790 For example: @code{(x * 10) / 5} is simplified to @code{x * 2}.
5792 @item -Wstrict-overflow=5
5793 Also warn about cases where the compiler reduces the magnitude of a
5794 constant involved in a comparison. For example: @code{x + 2 > y} is
5795 simplified to @code{x + 1 >= y}. This is reported only at the
5796 highest warning level because this simplification applies to many
5797 comparisons, so this warning level gives a very large number of
5801 @item -Wstringop-overflow
5802 @itemx -Wstringop-overflow=@var{type}
5803 @opindex Wstringop-overflow
5804 @opindex Wno-stringop-overflow
5805 Warn for calls to string manipulation functions such as @code{memcpy} and
5806 @code{strcpy} that are determined to overflow the destination buffer. The
5807 optional argument is one greater than the type of Object Size Checking to
5808 perform to determine the size of the destination. @xref{Object Size Checking}.
5809 The argument is meaningful only for functions that operate on character arrays
5810 but not for raw memory functions like @code{memcpy} which always make use
5811 of Object Size type-0. The option also warns for calls that specify a size
5812 in excess of the largest possible object or at most @code{SIZE_MAX / 2} bytes.
5813 The option produces the best results with optimization enabled but can detect
5814 a small subset of simple buffer overflows even without optimization in
5815 calls to the GCC built-in functions like @code{__builtin_memcpy} that
5816 correspond to the standard functions. In any case, the option warns about
5817 just a subset of buffer overflows detected by the corresponding overflow
5818 checking built-ins. For example, the option will issue a warning for
5819 the @code{strcpy} call below because it copies at least 5 characters
5820 (the string @code{"blue"} including the terminating NUL) into the buffer
5824 enum Color @{ blue, purple, yellow @};
5825 const char* f (enum Color clr)
5827 static char buf [4];
5831 case blue: str = "blue"; break;
5832 case purple: str = "purple"; break;
5833 case yellow: str = "yellow"; break;
5836 return strcpy (buf, str); // warning here
5840 Option @option{-Wstringop-overflow=2} is enabled by default.
5843 @item -Wstringop-overflow
5844 @itemx -Wstringop-overflow=1
5845 @opindex Wstringop-overflow
5846 @opindex Wno-stringop-overflow
5847 The @option{-Wstringop-overflow=1} option uses type-zero Object Size Checking
5848 to determine the sizes of destination objects. This is the default setting
5849 of the option. At this setting the option will not warn for writes past
5850 the end of subobjects of larger objects accessed by pointers unless the
5851 size of the largest surrounding object is known. When the destination may
5852 be one of several objects it is assumed to be the largest one of them. On
5853 Linux systems, when optimization is enabled at this setting the option warns
5854 for the same code as when the @code{_FORTIFY_SOURCE} macro is defined to
5857 @item -Wstringop-overflow=2
5858 The @option{-Wstringop-overflow=2} option uses type-one Object Size Checking
5859 to determine the sizes of destination objects. At this setting the option
5860 will warn about overflows when writing to members of the largest complete
5861 objects whose exact size is known. It will, however, not warn for excessive
5862 writes to the same members of unknown objects referenced by pointers since
5863 they may point to arrays containing unknown numbers of elements.
5865 @item -Wstringop-overflow=3
5866 The @option{-Wstringop-overflow=3} option uses type-two Object Size Checking
5867 to determine the sizes of destination objects. At this setting the option
5868 warns about overflowing the smallest object or data member. This is the
5869 most restrictive setting of the option that may result in warnings for safe
5872 @item -Wstringop-overflow=4
5873 The @option{-Wstringop-overflow=4} option uses type-three Object Size Checking
5874 to determine the sizes of destination objects. At this setting the option
5875 will warn about overflowing any data members, and when the destination is
5876 one of several objects it uses the size of the largest of them to decide
5877 whether to issue a warning. Similarly to @option{-Wstringop-overflow=3} this
5878 setting of the option may result in warnings for benign code.
5881 @item -Wstringop-truncation
5882 @opindex Wstringop-truncation
5883 @opindex Wno-stringop-truncation
5884 Warn for calls to bounded string manipulation functions such as @code{strncat},
5885 @code{strncpy}, and @code{stpncpy} that may either truncate the copied string
5886 or leave the destination unchanged.
5888 In the following example, the call to @code{strncat} specifies a bound that
5889 is less than the length of the source string. As a result, the copy of
5890 the source will be truncated and so the call is diagnosed. To avoid the
5891 warning use @code{bufsize - strlen (buf) - 1)} as the bound.
5894 void append (char *buf, size_t bufsize)
5896 strncat (buf, ".txt", 3);
5900 As another example, the following call to @code{strncpy} results in copying
5901 to @code{d} just the characters preceding the terminating NUL, without
5902 appending the NUL to the end. Assuming the result of @code{strncpy} is
5903 necessarily a NUL-terminated string is a common mistake, and so the call
5904 is diagnosed. To avoid the warning when the result is not expected to be
5905 NUL-terminated, call @code{memcpy} instead.
5908 void copy (char *d, const char *s)
5910 strncpy (d, s, strlen (s));
5914 In the following example, the call to @code{strncpy} specifies the size
5915 of the destination buffer as the bound. If the length of the source
5916 string is equal to or greater than this size the result of the copy will
5917 not be NUL-terminated. Therefore, the call is also diagnosed. To avoid
5918 the warning, specify @code{sizeof buf - 1} as the bound and set the last
5919 element of the buffer to @code{NUL}.
5922 void copy (const char *s)
5925 strncpy (buf, s, sizeof buf);
5930 In situations where a character array is intended to store a sequence
5931 of bytes with no terminating @code{NUL} such an array may be annotated
5932 with attribute @code{nonstring} to avoid this warning. Such arrays,
5933 however, are not suitable arguments to functions that expect
5934 @code{NUL}-terminated strings. To help detect accidental misuses of
5935 such arrays GCC issues warnings unless it can prove that the use is
5936 safe. @xref{Common Variable Attributes}.
5938 @item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{|}cold@r{|}malloc@r{]}
5939 @opindex Wsuggest-attribute=
5940 @opindex Wno-suggest-attribute=
5941 Warn for cases where adding an attribute may be beneficial. The
5942 attributes currently supported are listed below.
5945 @item -Wsuggest-attribute=pure
5946 @itemx -Wsuggest-attribute=const
5947 @itemx -Wsuggest-attribute=noreturn
5948 @itemx -Wmissing-noreturn
5949 @itemx -Wsuggest-attribute=malloc
5950 @opindex Wsuggest-attribute=pure
5951 @opindex Wno-suggest-attribute=pure
5952 @opindex Wsuggest-attribute=const
5953 @opindex Wno-suggest-attribute=const
5954 @opindex Wsuggest-attribute=noreturn
5955 @opindex Wno-suggest-attribute=noreturn
5956 @opindex Wmissing-noreturn
5957 @opindex Wno-missing-noreturn
5958 @opindex Wsuggest-attribute=malloc
5959 @opindex Wno-suggest-attribute=malloc
5961 Warn about functions that might be candidates for attributes
5962 @code{pure}, @code{const} or @code{noreturn} or @code{malloc}. The compiler
5963 only warns for functions visible in other compilation units or (in the case of
5964 @code{pure} and @code{const}) if it cannot prove that the function returns
5965 normally. A function returns normally if it doesn't contain an infinite loop or
5966 return abnormally by throwing, calling @code{abort} or trapping. This analysis
5967 requires option @option{-fipa-pure-const}, which is enabled by default at
5968 @option{-O} and higher. Higher optimization levels improve the accuracy
5971 @item -Wsuggest-attribute=format
5972 @itemx -Wmissing-format-attribute
5973 @opindex Wsuggest-attribute=format
5974 @opindex Wmissing-format-attribute
5975 @opindex Wno-suggest-attribute=format
5976 @opindex Wno-missing-format-attribute
5980 Warn about function pointers that might be candidates for @code{format}
5981 attributes. Note these are only possible candidates, not absolute ones.
5982 GCC guesses that function pointers with @code{format} attributes that
5983 are used in assignment, initialization, parameter passing or return
5984 statements should have a corresponding @code{format} attribute in the
5985 resulting type. I.e.@: the left-hand side of the assignment or
5986 initialization, the type of the parameter variable, or the return type
5987 of the containing function respectively should also have a @code{format}
5988 attribute to avoid the warning.
5990 GCC also warns about function definitions that might be
5991 candidates for @code{format} attributes. Again, these are only
5992 possible candidates. GCC guesses that @code{format} attributes
5993 might be appropriate for any function that calls a function like
5994 @code{vprintf} or @code{vscanf}, but this might not always be the
5995 case, and some functions for which @code{format} attributes are
5996 appropriate may not be detected.
5998 @item -Wsuggest-attribute=cold
5999 @opindex Wsuggest-attribute=cold
6000 @opindex Wno-suggest-attribute=cold
6002 Warn about functions that might be candidates for @code{cold} attribute. This
6003 is based on static detection and generally will only warn about functions which
6004 always leads to a call to another @code{cold} function such as wrappers of
6005 C++ @code{throw} or fatal error reporting functions leading to @code{abort}.
6008 @item -Wsuggest-final-types
6009 @opindex Wno-suggest-final-types
6010 @opindex Wsuggest-final-types
6011 Warn about types with virtual methods where code quality would be improved
6012 if the type were declared with the C++11 @code{final} specifier,
6014 declared in an anonymous namespace. This allows GCC to more aggressively
6015 devirtualize the polymorphic calls. This warning is more effective with
6016 link-time optimization,
6017 where the information about the class hierarchy graph is
6020 @item -Wsuggest-final-methods
6021 @opindex Wno-suggest-final-methods
6022 @opindex Wsuggest-final-methods
6023 Warn about virtual methods where code quality would be improved if the method
6024 were declared with the C++11 @code{final} specifier,
6025 or, if possible, its type were
6026 declared in an anonymous namespace or with the @code{final} specifier.
6028 more effective with link-time optimization, where the information about the
6029 class hierarchy graph is more complete. It is recommended to first consider
6030 suggestions of @option{-Wsuggest-final-types} and then rebuild with new
6033 @item -Wsuggest-override
6034 Warn about overriding virtual functions that are not marked with the override
6038 @opindex Wno-alloc-zero
6039 @opindex Walloc-zero
6040 Warn about calls to allocation functions decorated with attribute
6041 @code{alloc_size} that specify zero bytes, including those to the built-in
6042 forms of the functions @code{aligned_alloc}, @code{alloca}, @code{calloc},
6043 @code{malloc}, and @code{realloc}. Because the behavior of these functions
6044 when called with a zero size differs among implementations (and in the case
6045 of @code{realloc} has been deprecated) relying on it may result in subtle
6046 portability bugs and should be avoided.
6048 @item -Walloc-size-larger-than=@var{byte-size}
6049 @opindex Walloc-size-larger-than=
6050 @opindex Wno-alloc-size-larger-than
6051 Warn about calls to functions decorated with attribute @code{alloc_size}
6052 that attempt to allocate objects larger than the specified number of bytes,
6053 or where the result of the size computation in an integer type with infinite
6054 precision would exceed the value of @samp{PTRDIFF_MAX} on the target.
6055 @option{-Walloc-size-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6056 Warnings controlled by the option can be disabled either by specifying
6057 @var{byte-size} of @samp{SIZE_MAX} or more or by
6058 @option{-Wno-alloc-size-larger-than}.
6059 @xref{Function Attributes}.
6061 @item -Wno-alloc-size-larger-than
6062 @opindex Wno-alloc-size-larger-than
6063 Disable @option{-Walloc-size-larger-than=} warnings. The option is
6064 equivalent to @option{-Walloc-size-larger-than=}@samp{SIZE_MAX} or
6070 This option warns on all uses of @code{alloca} in the source.
6072 @item -Walloca-larger-than=@var{byte-size}
6073 @opindex Walloca-larger-than=
6074 @opindex Wno-alloca-larger-than
6075 This option warns on calls to @code{alloca} with an integer argument whose
6076 value is either zero, or that is not bounded by a controlling predicate
6077 that limits its value to at most @var{byte-size}. It also warns for calls
6078 to @code{alloca} where the bound value is unknown. Arguments of non-integer
6079 types are considered unbounded even if they appear to be constrained to
6082 For example, a bounded case of @code{alloca} could be:
6085 void func (size_t n)
6096 In the above example, passing @code{-Walloca-larger-than=1000} would not
6097 issue a warning because the call to @code{alloca} is known to be at most
6098 1000 bytes. However, if @code{-Walloca-larger-than=500} were passed,
6099 the compiler would emit a warning.
6101 Unbounded uses, on the other hand, are uses of @code{alloca} with no
6102 controlling predicate constraining its integer argument. For example:
6107 void *p = alloca (n);
6112 If @code{-Walloca-larger-than=500} were passed, the above would trigger
6113 a warning, but this time because of the lack of bounds checking.
6115 Note, that even seemingly correct code involving signed integers could
6119 void func (signed int n)
6129 In the above example, @var{n} could be negative, causing a larger than
6130 expected argument to be implicitly cast into the @code{alloca} call.
6132 This option also warns when @code{alloca} is used in a loop.
6134 @option{-Walloca-larger-than=}@samp{PTRDIFF_MAX} is enabled by default
6135 but is usually only effective when @option{-ftree-vrp} is active (default
6136 for @option{-O2} and above).
6138 See also @option{-Wvla-larger-than=}@samp{byte-size}.
6140 @item -Wno-alloca-larger-than
6141 @opindex Wno-alloca-larger-than
6142 Disable @option{-Walloca-larger-than=} warnings. The option is
6143 equivalent to @option{-Walloca-larger-than=}@samp{SIZE_MAX} or larger.
6145 @item -Warray-bounds
6146 @itemx -Warray-bounds=@var{n}
6147 @opindex Wno-array-bounds
6148 @opindex Warray-bounds
6149 This option is only active when @option{-ftree-vrp} is active
6150 (default for @option{-O2} and above). It warns about subscripts to arrays
6151 that are always out of bounds. This warning is enabled by @option{-Wall}.
6154 @item -Warray-bounds=1
6155 This is the warning level of @option{-Warray-bounds} and is enabled
6156 by @option{-Wall}; higher levels are not, and must be explicitly requested.
6158 @item -Warray-bounds=2
6159 This warning level also warns about out of bounds access for
6160 arrays at the end of a struct and for arrays accessed through
6161 pointers. This warning level may give a larger number of
6162 false positives and is deactivated by default.
6165 @item -Wattribute-alias=@var{n}
6166 @itemx -Wno-attribute-alias
6167 @opindex Wattribute-alias
6168 @opindex Wno-attribute-alias
6169 Warn about declarations using the @code{alias} and similar attributes whose
6170 target is incompatible with the type of the alias.
6171 @xref{Function Attributes,,Declaring Attributes of Functions}.
6174 @item -Wattribute-alias=1
6175 The default warning level of the @option{-Wattribute-alias} option diagnoses
6176 incompatibilities between the type of the alias declaration and that of its
6177 target. Such incompatibilities are typically indicative of bugs.
6179 @item -Wattribute-alias=2
6181 At this level @option{-Wattribute-alias} also diagnoses cases where
6182 the attributes of the alias declaration are more restrictive than the
6183 attributes applied to its target. These mismatches can potentially
6184 result in incorrect code generation. In other cases they may be
6185 benign and could be resolved simply by adding the missing attribute to
6186 the target. For comparison, see the @option{-Wmissing-attributes}
6187 option, which controls diagnostics when the alias declaration is less
6188 restrictive than the target, rather than more restrictive.
6190 Attributes considered include @code{alloc_align}, @code{alloc_size},
6191 @code{cold}, @code{const}, @code{hot}, @code{leaf}, @code{malloc},
6192 @code{nonnull}, @code{noreturn}, @code{nothrow}, @code{pure},
6193 @code{returns_nonnull}, and @code{returns_twice}.
6196 @option{-Wattribute-alias} is equivalent to @option{-Wattribute-alias=1}.
6197 This is the default. You can disable these warnings with either
6198 @option{-Wno-attribute-alias} or @option{-Wattribute-alias=0}.
6200 @item -Wbool-compare
6201 @opindex Wno-bool-compare
6202 @opindex Wbool-compare
6203 Warn about boolean expression compared with an integer value different from
6204 @code{true}/@code{false}. For instance, the following comparison is
6209 if ((n > 1) == 2) @{ @dots{} @}
6211 This warning is enabled by @option{-Wall}.
6213 @item -Wbool-operation
6214 @opindex Wno-bool-operation
6215 @opindex Wbool-operation
6216 Warn about suspicious operations on expressions of a boolean type. For
6217 instance, bitwise negation of a boolean is very likely a bug in the program.
6218 For C, this warning also warns about incrementing or decrementing a boolean,
6219 which rarely makes sense. (In C++, decrementing a boolean is always invalid.
6220 Incrementing a boolean is invalid in C++17, and deprecated otherwise.)
6222 This warning is enabled by @option{-Wall}.
6224 @item -Wduplicated-branches
6225 @opindex Wno-duplicated-branches
6226 @opindex Wduplicated-branches
6227 Warn when an if-else has identical branches. This warning detects cases like
6234 It doesn't warn when both branches contain just a null statement. This warning
6235 also warn for conditional operators:
6237 int i = x ? *p : *p;
6240 @item -Wduplicated-cond
6241 @opindex Wno-duplicated-cond
6242 @opindex Wduplicated-cond
6243 Warn about duplicated conditions in an if-else-if chain. For instance,
6244 warn for the following code:
6246 if (p->q != NULL) @{ @dots{} @}
6247 else if (p->q != NULL) @{ @dots{} @}
6250 @item -Wframe-address
6251 @opindex Wno-frame-address
6252 @opindex Wframe-address
6253 Warn when the @samp{__builtin_frame_address} or @samp{__builtin_return_address}
6254 is called with an argument greater than 0. Such calls may return indeterminate
6255 values or crash the program. The warning is included in @option{-Wall}.
6257 @item -Wno-discarded-qualifiers @r{(C and Objective-C only)}
6258 @opindex Wno-discarded-qualifiers
6259 @opindex Wdiscarded-qualifiers
6260 Do not warn if type qualifiers on pointers are being discarded.
6261 Typically, the compiler warns if a @code{const char *} variable is
6262 passed to a function that takes a @code{char *} parameter. This option
6263 can be used to suppress such a warning.
6265 @item -Wno-discarded-array-qualifiers @r{(C and Objective-C only)}
6266 @opindex Wno-discarded-array-qualifiers
6267 @opindex Wdiscarded-array-qualifiers
6268 Do not warn if type qualifiers on arrays which are pointer targets
6269 are being discarded. Typically, the compiler warns if a
6270 @code{const int (*)[]} variable is passed to a function that
6271 takes a @code{int (*)[]} parameter. This option can be used to
6272 suppress such a warning.
6274 @item -Wno-incompatible-pointer-types @r{(C and Objective-C only)}
6275 @opindex Wno-incompatible-pointer-types
6276 @opindex Wincompatible-pointer-types
6277 Do not warn when there is a conversion between pointers that have incompatible
6278 types. This warning is for cases not covered by @option{-Wno-pointer-sign},
6279 which warns for pointer argument passing or assignment with different
6282 @item -Wno-int-conversion @r{(C and Objective-C only)}
6283 @opindex Wno-int-conversion
6284 @opindex Wint-conversion
6285 Do not warn about incompatible integer to pointer and pointer to integer
6286 conversions. This warning is about implicit conversions; for explicit
6287 conversions the warnings @option{-Wno-int-to-pointer-cast} and
6288 @option{-Wno-pointer-to-int-cast} may be used.
6290 @item -Wno-div-by-zero
6291 @opindex Wno-div-by-zero
6292 @opindex Wdiv-by-zero
6293 Do not warn about compile-time integer division by zero. Floating-point
6294 division by zero is not warned about, as it can be a legitimate way of
6295 obtaining infinities and NaNs.
6297 @item -Wsystem-headers
6298 @opindex Wsystem-headers
6299 @opindex Wno-system-headers
6300 @cindex warnings from system headers
6301 @cindex system headers, warnings from
6302 Print warning messages for constructs found in system header files.
6303 Warnings from system headers are normally suppressed, on the assumption
6304 that they usually do not indicate real problems and would only make the
6305 compiler output harder to read. Using this command-line option tells
6306 GCC to emit warnings from system headers as if they occurred in user
6307 code. However, note that using @option{-Wall} in conjunction with this
6308 option does @emph{not} warn about unknown pragmas in system
6309 headers---for that, @option{-Wunknown-pragmas} must also be used.
6311 @item -Wtautological-compare
6312 @opindex Wtautological-compare
6313 @opindex Wno-tautological-compare
6314 Warn if a self-comparison always evaluates to true or false. This
6315 warning detects various mistakes such as:
6319 if (i > i) @{ @dots{} @}
6322 This warning also warns about bitwise comparisons that always evaluate
6323 to true or false, for instance:
6325 if ((a & 16) == 10) @{ @dots{} @}
6327 will always be false.
6329 This warning is enabled by @option{-Wall}.
6332 @opindex Wtrampolines
6333 @opindex Wno-trampolines
6334 Warn about trampolines generated for pointers to nested functions.
6335 A trampoline is a small piece of data or code that is created at run
6336 time on the stack when the address of a nested function is taken, and is
6337 used to call the nested function indirectly. For some targets, it is
6338 made up of data only and thus requires no special treatment. But, for
6339 most targets, it is made up of code and thus requires the stack to be
6340 made executable in order for the program to work properly.
6343 @opindex Wfloat-equal
6344 @opindex Wno-float-equal
6345 Warn if floating-point values are used in equality comparisons.
6347 The idea behind this is that sometimes it is convenient (for the
6348 programmer) to consider floating-point values as approximations to
6349 infinitely precise real numbers. If you are doing this, then you need
6350 to compute (by analyzing the code, or in some other way) the maximum or
6351 likely maximum error that the computation introduces, and allow for it
6352 when performing comparisons (and when producing output, but that's a
6353 different problem). In particular, instead of testing for equality, you
6354 should check to see whether the two values have ranges that overlap; and
6355 this is done with the relational operators, so equality comparisons are
6358 @item -Wtraditional @r{(C and Objective-C only)}
6359 @opindex Wtraditional
6360 @opindex Wno-traditional
6361 Warn about certain constructs that behave differently in traditional and
6362 ISO C@. Also warn about ISO C constructs that have no traditional C
6363 equivalent, and/or problematic constructs that should be avoided.
6367 Macro parameters that appear within string literals in the macro body.
6368 In traditional C macro replacement takes place within string literals,
6369 but in ISO C it does not.
6372 In traditional C, some preprocessor directives did not exist.
6373 Traditional preprocessors only considered a line to be a directive
6374 if the @samp{#} appeared in column 1 on the line. Therefore
6375 @option{-Wtraditional} warns about directives that traditional C
6376 understands but ignores because the @samp{#} does not appear as the
6377 first character on the line. It also suggests you hide directives like
6378 @code{#pragma} not understood by traditional C by indenting them. Some
6379 traditional implementations do not recognize @code{#elif}, so this option
6380 suggests avoiding it altogether.
6383 A function-like macro that appears without arguments.
6386 The unary plus operator.
6389 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating-point
6390 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
6391 constants.) Note, these suffixes appear in macros defined in the system
6392 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
6393 Use of these macros in user code might normally lead to spurious
6394 warnings, however GCC's integrated preprocessor has enough context to
6395 avoid warning in these cases.
6398 A function declared external in one block and then used after the end of
6402 A @code{switch} statement has an operand of type @code{long}.
6405 A non-@code{static} function declaration follows a @code{static} one.
6406 This construct is not accepted by some traditional C compilers.
6409 The ISO type of an integer constant has a different width or
6410 signedness from its traditional type. This warning is only issued if
6411 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
6412 typically represent bit patterns, are not warned about.
6415 Usage of ISO string concatenation is detected.
6418 Initialization of automatic aggregates.
6421 Identifier conflicts with labels. Traditional C lacks a separate
6422 namespace for labels.
6425 Initialization of unions. If the initializer is zero, the warning is
6426 omitted. This is done under the assumption that the zero initializer in
6427 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
6428 initializer warnings and relies on default initialization to zero in the
6432 Conversions by prototypes between fixed/floating-point values and vice
6433 versa. The absence of these prototypes when compiling with traditional
6434 C causes serious problems. This is a subset of the possible
6435 conversion warnings; for the full set use @option{-Wtraditional-conversion}.
6438 Use of ISO C style function definitions. This warning intentionally is
6439 @emph{not} issued for prototype declarations or variadic functions
6440 because these ISO C features appear in your code when using
6441 libiberty's traditional C compatibility macros, @code{PARAMS} and
6442 @code{VPARAMS}. This warning is also bypassed for nested functions
6443 because that feature is already a GCC extension and thus not relevant to
6444 traditional C compatibility.
6447 @item -Wtraditional-conversion @r{(C and Objective-C only)}
6448 @opindex Wtraditional-conversion
6449 @opindex Wno-traditional-conversion
6450 Warn if a prototype causes a type conversion that is different from what
6451 would happen to the same argument in the absence of a prototype. This
6452 includes conversions of fixed point to floating and vice versa, and
6453 conversions changing the width or signedness of a fixed-point argument
6454 except when the same as the default promotion.
6456 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
6457 @opindex Wdeclaration-after-statement
6458 @opindex Wno-declaration-after-statement
6459 Warn when a declaration is found after a statement in a block. This
6460 construct, known from C++, was introduced with ISO C99 and is by default
6461 allowed in GCC@. It is not supported by ISO C90. @xref{Mixed Declarations}.
6466 Warn whenever a local variable or type declaration shadows another
6467 variable, parameter, type, class member (in C++), or instance variable
6468 (in Objective-C) or whenever a built-in function is shadowed. Note
6469 that in C++, the compiler warns if a local variable shadows an
6470 explicit typedef, but not if it shadows a struct/class/enum.
6471 Same as @option{-Wshadow=global}.
6473 @item -Wno-shadow-ivar @r{(Objective-C only)}
6474 @opindex Wno-shadow-ivar
6475 @opindex Wshadow-ivar
6476 Do not warn whenever a local variable shadows an instance variable in an
6479 @item -Wshadow=global
6480 @opindex Wshadow=local
6481 The default for @option{-Wshadow}. Warns for any (global) shadowing.
6483 @item -Wshadow=local
6484 @opindex Wshadow=local
6485 Warn when a local variable shadows another local variable or parameter.
6486 This warning is enabled by @option{-Wshadow=global}.
6488 @item -Wshadow=compatible-local
6489 @opindex Wshadow=compatible-local
6490 Warn when a local variable shadows another local variable or parameter
6491 whose type is compatible with that of the shadowing variable. In C++,
6492 type compatibility here means the type of the shadowing variable can be
6493 converted to that of the shadowed variable. The creation of this flag
6494 (in addition to @option{-Wshadow=local}) is based on the idea that when
6495 a local variable shadows another one of incompatible type, it is most
6496 likely intentional, not a bug or typo, as shown in the following example:
6500 for (SomeIterator i = SomeObj.begin(); i != SomeObj.end(); ++i)
6502 for (int i = 0; i < N; ++i)
6511 Since the two variable @code{i} in the example above have incompatible types,
6512 enabling only @option{-Wshadow=compatible-local} will not emit a warning.
6513 Because their types are incompatible, if a programmer accidentally uses one
6514 in place of the other, type checking will catch that and emit an error or
6515 warning. So not warning (about shadowing) in this case will not lead to
6516 undetected bugs. Use of this flag instead of @option{-Wshadow=local} can
6517 possibly reduce the number of warnings triggered by intentional shadowing.
6519 This warning is enabled by @option{-Wshadow=local}.
6521 @item -Wlarger-than=@var{byte-size}
6522 @opindex Wlarger-than=
6523 @opindex Wlarger-than-@var{byte-size}
6524 Warn whenever an object is defined whose size exceeds @var{byte-size}.
6525 @option{-Wlarger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6526 Warnings controlled by the option can be disabled either by specifying
6527 @var{byte-size} of @samp{SIZE_MAX} or more or by
6528 @option{-Wno-larger-than}.
6530 @item -Wno-larger-than
6531 @opindex Wno-larger-than
6532 Disable @option{-Wlarger-than=} warnings. The option is equivalent
6533 to @option{-Wlarger-than=}@samp{SIZE_MAX} or larger.
6535 @item -Wframe-larger-than=@var{byte-size}
6536 @opindex Wframe-larger-than=
6537 @opindex Wno-frame-larger-than
6538 Warn if the size of a function frame exceeds @var{byte-size}.
6539 The computation done to determine the stack frame size is approximate
6540 and not conservative.
6541 The actual requirements may be somewhat greater than @var{byte-size}
6542 even if you do not get a warning. In addition, any space allocated
6543 via @code{alloca}, variable-length arrays, or related constructs
6544 is not included by the compiler when determining
6545 whether or not to issue a warning.
6546 @option{-Wframe-larger-than=}@samp{PTRDIFF_MAX} is enabled by default.
6547 Warnings controlled by the option can be disabled either by specifying
6548 @var{byte-size} of @samp{SIZE_MAX} or more or by
6549 @option{-Wno-frame-larger-than}.
6551 @item -Wno-frame-larger-than
6552 @opindex Wno-frame-larger-than
6553 Disable @option{-Wframe-larger-than=} warnings. The option is equivalent
6554 to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger.
6556 @item -Wno-free-nonheap-object
6557 @opindex Wno-free-nonheap-object
6558 @opindex Wfree-nonheap-object
6559 Do not warn when attempting to free an object that was not allocated
6562 @item -Wstack-usage=@var{byte-size}
6563 @opindex Wstack-usage
6564 @opindex Wno-stack-usage
6565 Warn if the stack usage of a function might exceed @var{byte-size}.
6566 The computation done to determine the stack usage is conservative.
6567 Any space allocated via @code{alloca}, variable-length arrays, or related
6568 constructs is included by the compiler when determining whether or not to
6571 The message is in keeping with the output of @option{-fstack-usage}.
6575 If the stack usage is fully static but exceeds the specified amount, it's:
6578 warning: stack usage is 1120 bytes
6581 If the stack usage is (partly) dynamic but bounded, it's:
6584 warning: stack usage might be 1648 bytes
6587 If the stack usage is (partly) dynamic and not bounded, it's:
6590 warning: stack usage might be unbounded
6594 @option{-Wstack-usage=}@samp{PTRDIFF_MAX} is enabled by default.
6595 Warnings controlled by the option can be disabled either by specifying
6596 @var{byte-size} of @samp{SIZE_MAX} or more or by
6597 @option{-Wno-stack-usage}.
6599 @item -Wno-stack-usage
6600 @opindex Wno-stack-usage
6601 Disable @option{-Wstack-usage=} warnings. The option is equivalent
6602 to @option{-Wstack-usage=}@samp{SIZE_MAX} or larger.
6604 @item -Wunsafe-loop-optimizations
6605 @opindex Wunsafe-loop-optimizations
6606 @opindex Wno-unsafe-loop-optimizations
6607 Warn if the loop cannot be optimized because the compiler cannot
6608 assume anything on the bounds of the loop indices. With
6609 @option{-funsafe-loop-optimizations} warn if the compiler makes
6612 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
6613 @opindex Wno-pedantic-ms-format
6614 @opindex Wpedantic-ms-format
6615 When used in combination with @option{-Wformat}
6616 and @option{-pedantic} without GNU extensions, this option
6617 disables the warnings about non-ISO @code{printf} / @code{scanf} format
6618 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets,
6619 which depend on the MS runtime.
6622 @opindex Waligned-new
6623 @opindex Wno-aligned-new
6624 Warn about a new-expression of a type that requires greater alignment
6625 than the @code{alignof(std::max_align_t)} but uses an allocation
6626 function without an explicit alignment parameter. This option is
6627 enabled by @option{-Wall}.
6629 Normally this only warns about global allocation functions, but
6630 @option{-Waligned-new=all} also warns about class member allocation
6633 @item -Wplacement-new
6634 @itemx -Wplacement-new=@var{n}
6635 @opindex Wplacement-new
6636 @opindex Wno-placement-new
6637 Warn about placement new expressions with undefined behavior, such as
6638 constructing an object in a buffer that is smaller than the type of
6639 the object. For example, the placement new expression below is diagnosed
6640 because it attempts to construct an array of 64 integers in a buffer only
6646 This warning is enabled by default.
6649 @item -Wplacement-new=1
6650 This is the default warning level of @option{-Wplacement-new}. At this
6651 level the warning is not issued for some strictly undefined constructs that
6652 GCC allows as extensions for compatibility with legacy code. For example,
6653 the following @code{new} expression is not diagnosed at this level even
6654 though it has undefined behavior according to the C++ standard because
6655 it writes past the end of the one-element array.
6657 struct S @{ int n, a[1]; @};
6658 S *s = (S *)malloc (sizeof *s + 31 * sizeof s->a[0]);
6659 new (s->a)int [32]();
6662 @item -Wplacement-new=2
6663 At this level, in addition to diagnosing all the same constructs as at level
6664 1, a diagnostic is also issued for placement new expressions that construct
6665 an object in the last member of structure whose type is an array of a single
6666 element and whose size is less than the size of the object being constructed.
6667 While the previous example would be diagnosed, the following construct makes
6668 use of the flexible member array extension to avoid the warning at level 2.
6670 struct S @{ int n, a[]; @};
6671 S *s = (S *)malloc (sizeof *s + 32 * sizeof s->a[0]);
6672 new (s->a)int [32]();
6677 @item -Wpointer-arith
6678 @opindex Wpointer-arith
6679 @opindex Wno-pointer-arith
6680 Warn about anything that depends on the ``size of'' a function type or
6681 of @code{void}. GNU C assigns these types a size of 1, for
6682 convenience in calculations with @code{void *} pointers and pointers
6683 to functions. In C++, warn also when an arithmetic operation involves
6684 @code{NULL}. This warning is also enabled by @option{-Wpedantic}.
6686 @item -Wpointer-compare
6687 @opindex Wpointer-compare
6688 @opindex Wno-pointer-compare
6689 Warn if a pointer is compared with a zero character constant. This usually
6690 means that the pointer was meant to be dereferenced. For example:
6693 const char *p = foo ();
6698 Note that the code above is invalid in C++11.
6700 This warning is enabled by default.
6703 @opindex Wtype-limits
6704 @opindex Wno-type-limits
6705 Warn if a comparison is always true or always false due to the limited
6706 range of the data type, but do not warn for constant expressions. For
6707 example, warn if an unsigned variable is compared against zero with
6708 @code{<} or @code{>=}. This warning is also enabled by
6711 @item -Wabsolute-value @r{(C and Objective-C only)}
6712 @opindex Wabsolute-value
6713 @opindex Wno-absolute-value
6714 Warn for calls to standard functions that compute the absolute value
6715 of an argument when a more appropriate standard function is available.
6716 For example, calling @code{abs(3.14)} triggers the warning because the
6717 appropriate function to call to compute the absolute value of a double
6718 argument is @code{fabs}. The option also triggers warnings when the
6719 argument in a call to such a function has an unsigned type. This
6720 warning can be suppressed with an explicit type cast and it is also
6721 enabled by @option{-Wextra}.
6723 @include cppwarnopts.texi
6725 @item -Wbad-function-cast @r{(C and Objective-C only)}
6726 @opindex Wbad-function-cast
6727 @opindex Wno-bad-function-cast
6728 Warn when a function call is cast to a non-matching type.
6729 For example, warn if a call to a function returning an integer type
6730 is cast to a pointer type.
6732 @item -Wc90-c99-compat @r{(C and Objective-C only)}
6733 @opindex Wc90-c99-compat
6734 @opindex Wno-c90-c99-compat
6735 Warn about features not present in ISO C90, but present in ISO C99.
6736 For instance, warn about use of variable length arrays, @code{long long}
6737 type, @code{bool} type, compound literals, designated initializers, and so
6738 on. This option is independent of the standards mode. Warnings are disabled
6739 in the expression that follows @code{__extension__}.
6741 @item -Wc99-c11-compat @r{(C and Objective-C only)}
6742 @opindex Wc99-c11-compat
6743 @opindex Wno-c99-c11-compat
6744 Warn about features not present in ISO C99, but present in ISO C11.
6745 For instance, warn about use of anonymous structures and unions,
6746 @code{_Atomic} type qualifier, @code{_Thread_local} storage-class specifier,
6747 @code{_Alignas} specifier, @code{Alignof} operator, @code{_Generic} keyword,
6748 and so on. This option is independent of the standards mode. Warnings are
6749 disabled in the expression that follows @code{__extension__}.
6751 @item -Wc++-compat @r{(C and Objective-C only)}
6752 @opindex Wc++-compat
6753 @opindex Wno-c++-compat
6754 Warn about ISO C constructs that are outside of the common subset of
6755 ISO C and ISO C++, e.g.@: request for implicit conversion from
6756 @code{void *} to a pointer to non-@code{void} type.
6758 @item -Wc++11-compat @r{(C++ and Objective-C++ only)}
6759 @opindex Wc++11-compat
6760 @opindex Wno-c++11-compat
6761 Warn about C++ constructs whose meaning differs between ISO C++ 1998
6762 and ISO C++ 2011, e.g., identifiers in ISO C++ 1998 that are keywords
6763 in ISO C++ 2011. This warning turns on @option{-Wnarrowing} and is
6764 enabled by @option{-Wall}.
6766 @item -Wc++14-compat @r{(C++ and Objective-C++ only)}
6767 @opindex Wc++14-compat
6768 @opindex Wno-c++14-compat
6769 Warn about C++ constructs whose meaning differs between ISO C++ 2011
6770 and ISO C++ 2014. This warning is enabled by @option{-Wall}.
6772 @item -Wc++17-compat @r{(C++ and Objective-C++ only)}
6773 @opindex Wc++17-compat
6774 @opindex Wno-c++17-compat
6775 Warn about C++ constructs whose meaning differs between ISO C++ 2014
6776 and ISO C++ 2017. This warning is enabled by @option{-Wall}.
6778 @item -Wc++20-compat @r{(C++ and Objective-C++ only)}
6779 @opindex Wc++20-compat
6780 @opindex Wno-c++20-compat
6781 Warn about C++ constructs whose meaning differs between ISO C++ 2017
6782 and ISO C++ 2020. This warning is enabled by @option{-Wall}.
6786 @opindex Wno-cast-qual
6787 Warn whenever a pointer is cast so as to remove a type qualifier from
6788 the target type. For example, warn if a @code{const char *} is cast
6789 to an ordinary @code{char *}.
6791 Also warn when making a cast that introduces a type qualifier in an
6792 unsafe way. For example, casting @code{char **} to @code{const char **}
6793 is unsafe, as in this example:
6796 /* p is char ** value. */
6797 const char **q = (const char **) p;
6798 /* Assignment of readonly string to const char * is OK. */
6800 /* Now char** pointer points to read-only memory. */
6805 @opindex Wcast-align
6806 @opindex Wno-cast-align
6807 Warn whenever a pointer is cast such that the required alignment of the
6808 target is increased. For example, warn if a @code{char *} is cast to
6809 an @code{int *} on machines where integers can only be accessed at
6810 two- or four-byte boundaries.
6812 @item -Wcast-align=strict
6813 @opindex Wcast-align=strict
6814 Warn whenever a pointer is cast such that the required alignment of the
6815 target is increased. For example, warn if a @code{char *} is cast to
6816 an @code{int *} regardless of the target machine.
6818 @item -Wcast-function-type
6819 @opindex Wcast-function-type
6820 @opindex Wno-cast-function-type
6821 Warn when a function pointer is cast to an incompatible function pointer.
6822 In a cast involving function types with a variable argument list only
6823 the types of initial arguments that are provided are considered.
6824 Any parameter of pointer-type matches any other pointer-type. Any benign
6825 differences in integral types are ignored, like @code{int} vs.@: @code{long}
6826 on ILP32 targets. Likewise type qualifiers are ignored. The function
6827 type @code{void (*) (void)} is special and matches everything, which can
6828 be used to suppress this warning.
6829 In a cast involving pointer to member types this warning warns whenever
6830 the type cast is changing the pointer to member type.
6831 This warning is enabled by @option{-Wextra}.
6833 @item -Wwrite-strings
6834 @opindex Wwrite-strings
6835 @opindex Wno-write-strings
6836 When compiling C, give string constants the type @code{const
6837 char[@var{length}]} so that copying the address of one into a
6838 non-@code{const} @code{char *} pointer produces a warning. These
6839 warnings help you find at compile time code that can try to write
6840 into a string constant, but only if you have been very careful about
6841 using @code{const} in declarations and prototypes. Otherwise, it is
6842 just a nuisance. This is why we did not make @option{-Wall} request
6845 When compiling C++, warn about the deprecated conversion from string
6846 literals to @code{char *}. This warning is enabled by default for C++
6850 @itemx -Wcatch-value=@var{n} @r{(C++ and Objective-C++ only)}
6851 @opindex Wcatch-value
6852 @opindex Wno-catch-value
6853 Warn about catch handlers that do not catch via reference.
6854 With @option{-Wcatch-value=1} (or @option{-Wcatch-value} for short)
6855 warn about polymorphic class types that are caught by value.
6856 With @option{-Wcatch-value=2} warn about all class types that are caught
6857 by value. With @option{-Wcatch-value=3} warn about all types that are
6858 not caught by reference. @option{-Wcatch-value} is enabled by @option{-Wall}.
6862 @opindex Wno-clobbered
6863 Warn for variables that might be changed by @code{longjmp} or
6864 @code{vfork}. This warning is also enabled by @option{-Wextra}.
6866 @item -Wconditionally-supported @r{(C++ and Objective-C++ only)}
6867 @opindex Wconditionally-supported
6868 @opindex Wno-conditionally-supported
6869 Warn for conditionally-supported (C++11 [intro.defs]) constructs.
6872 @opindex Wconversion
6873 @opindex Wno-conversion
6874 Warn for implicit conversions that may alter a value. This includes
6875 conversions between real and integer, like @code{abs (x)} when
6876 @code{x} is @code{double}; conversions between signed and unsigned,
6877 like @code{unsigned ui = -1}; and conversions to smaller types, like
6878 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
6879 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
6880 changed by the conversion like in @code{abs (2.0)}. Warnings about
6881 conversions between signed and unsigned integers can be disabled by
6882 using @option{-Wno-sign-conversion}.
6884 For C++, also warn for confusing overload resolution for user-defined
6885 conversions; and conversions that never use a type conversion
6886 operator: conversions to @code{void}, the same type, a base class or a
6887 reference to them. Warnings about conversions between signed and
6888 unsigned integers are disabled by default in C++ unless
6889 @option{-Wsign-conversion} is explicitly enabled.
6891 @item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
6892 @opindex Wconversion-null
6893 @opindex Wno-conversion-null
6894 Do not warn for conversions between @code{NULL} and non-pointer
6895 types. @option{-Wconversion-null} is enabled by default.
6897 @item -Wzero-as-null-pointer-constant @r{(C++ and Objective-C++ only)}
6898 @opindex Wzero-as-null-pointer-constant
6899 @opindex Wno-zero-as-null-pointer-constant
6900 Warn when a literal @samp{0} is used as null pointer constant. This can
6901 be useful to facilitate the conversion to @code{nullptr} in C++11.
6903 @item -Wsubobject-linkage @r{(C++ and Objective-C++ only)}
6904 @opindex Wsubobject-linkage
6905 @opindex Wno-subobject-linkage
6906 Warn if a class type has a base or a field whose type uses the anonymous
6907 namespace or depends on a type with no linkage. If a type A depends on
6908 a type B with no or internal linkage, defining it in multiple
6909 translation units would be an ODR violation because the meaning of B
6910 is different in each translation unit. If A only appears in a single
6911 translation unit, the best way to silence the warning is to give it
6912 internal linkage by putting it in an anonymous namespace as well. The
6913 compiler doesn't give this warning for types defined in the main .C
6914 file, as those are unlikely to have multiple definitions.
6915 @option{-Wsubobject-linkage} is enabled by default.
6917 @item -Wdangling-else
6918 @opindex Wdangling-else
6919 @opindex Wno-dangling-else
6920 Warn about constructions where there may be confusion to which
6921 @code{if} statement an @code{else} branch belongs. Here is an example of
6936 In C/C++, every @code{else} branch belongs to the innermost possible
6937 @code{if} statement, which in this example is @code{if (b)}. This is
6938 often not what the programmer expected, as illustrated in the above
6939 example by indentation the programmer chose. When there is the
6940 potential for this confusion, GCC issues a warning when this flag
6941 is specified. To eliminate the warning, add explicit braces around
6942 the innermost @code{if} statement so there is no way the @code{else}
6943 can belong to the enclosing @code{if}. The resulting code
6960 This warning is enabled by @option{-Wparentheses}.
6964 @opindex Wno-date-time
6965 Warn when macros @code{__TIME__}, @code{__DATE__} or @code{__TIMESTAMP__}
6966 are encountered as they might prevent bit-wise-identical reproducible
6969 @item -Wdelete-incomplete @r{(C++ and Objective-C++ only)}
6970 @opindex Wdelete-incomplete
6971 @opindex Wno-delete-incomplete
6972 Warn when deleting a pointer to incomplete type, which may cause
6973 undefined behavior at runtime. This warning is enabled by default.
6975 @item -Wuseless-cast @r{(C++ and Objective-C++ only)}
6976 @opindex Wuseless-cast
6977 @opindex Wno-useless-cast
6978 Warn when an expression is casted to its own type.
6981 @opindex Wempty-body
6982 @opindex Wno-empty-body
6983 Warn if an empty body occurs in an @code{if}, @code{else} or @code{do
6984 while} statement. This warning is also enabled by @option{-Wextra}.
6986 @item -Wenum-compare
6987 @opindex Wenum-compare
6988 @opindex Wno-enum-compare
6989 Warn about a comparison between values of different enumerated types.
6990 In C++ enumerated type mismatches in conditional expressions are also
6991 diagnosed and the warning is enabled by default. In C this warning is
6992 enabled by @option{-Wall}.
6994 @item -Wenum-conversion @r{(C, Objective-C only)}
6995 @opindex Wenum-conversion
6996 @opindex Wno-enum-conversion
6997 Warn when a value of enumerated type is implicitly converted to a
6998 different enumerated type. This warning is enabled by @option{-Wextra}.
7000 @item -Wextra-semi @r{(C++, Objective-C++ only)}
7001 @opindex Wextra-semi
7002 @opindex Wno-extra-semi
7003 Warn about redundant semicolon after in-class function definition.
7005 @item -Wjump-misses-init @r{(C, Objective-C only)}
7006 @opindex Wjump-misses-init
7007 @opindex Wno-jump-misses-init
7008 Warn if a @code{goto} statement or a @code{switch} statement jumps
7009 forward across the initialization of a variable, or jumps backward to a
7010 label after the variable has been initialized. This only warns about
7011 variables that are initialized when they are declared. This warning is
7012 only supported for C and Objective-C; in C++ this sort of branch is an
7015 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
7016 can be disabled with the @option{-Wno-jump-misses-init} option.
7018 @item -Wsign-compare
7019 @opindex Wsign-compare
7020 @opindex Wno-sign-compare
7021 @cindex warning for comparison of signed and unsigned values
7022 @cindex comparison of signed and unsigned values, warning
7023 @cindex signed and unsigned values, comparison warning
7024 Warn when a comparison between signed and unsigned values could produce
7025 an incorrect result when the signed value is converted to unsigned.
7026 In C++, this warning is also enabled by @option{-Wall}. In C, it is
7027 also enabled by @option{-Wextra}.
7029 @item -Wsign-conversion
7030 @opindex Wsign-conversion
7031 @opindex Wno-sign-conversion
7032 Warn for implicit conversions that may change the sign of an integer
7033 value, like assigning a signed integer expression to an unsigned
7034 integer variable. An explicit cast silences the warning. In C, this
7035 option is enabled also by @option{-Wconversion}.
7037 @item -Wfloat-conversion
7038 @opindex Wfloat-conversion
7039 @opindex Wno-float-conversion
7040 Warn for implicit conversions that reduce the precision of a real value.
7041 This includes conversions from real to integer, and from higher precision
7042 real to lower precision real values. This option is also enabled by
7043 @option{-Wconversion}.
7045 @item -Wno-scalar-storage-order
7046 @opindex Wno-scalar-storage-order
7047 @opindex Wscalar-storage-order
7048 Do not warn on suspicious constructs involving reverse scalar storage order.
7050 @item -Wsized-deallocation @r{(C++ and Objective-C++ only)}
7051 @opindex Wsized-deallocation
7052 @opindex Wno-sized-deallocation
7053 Warn about a definition of an unsized deallocation function
7055 void operator delete (void *) noexcept;
7056 void operator delete[] (void *) noexcept;
7058 without a definition of the corresponding sized deallocation function
7060 void operator delete (void *, std::size_t) noexcept;
7061 void operator delete[] (void *, std::size_t) noexcept;
7063 or vice versa. Enabled by @option{-Wextra} along with
7064 @option{-fsized-deallocation}.
7066 @item -Wsizeof-pointer-div
7067 @opindex Wsizeof-pointer-div
7068 @opindex Wno-sizeof-pointer-div
7069 Warn for suspicious divisions of two sizeof expressions that divide
7070 the pointer size by the element size, which is the usual way to compute
7071 the array size but won't work out correctly with pointers. This warning
7072 warns e.g.@: about @code{sizeof (ptr) / sizeof (ptr[0])} if @code{ptr} is
7073 not an array, but a pointer. This warning is enabled by @option{-Wall}.
7075 @item -Wsizeof-pointer-memaccess
7076 @opindex Wsizeof-pointer-memaccess
7077 @opindex Wno-sizeof-pointer-memaccess
7078 Warn for suspicious length parameters to certain string and memory built-in
7079 functions if the argument uses @code{sizeof}. This warning triggers for
7080 example for @code{memset (ptr, 0, sizeof (ptr));} if @code{ptr} is not
7081 an array, but a pointer, and suggests a possible fix, or about
7082 @code{memcpy (&foo, ptr, sizeof (&foo));}. @option{-Wsizeof-pointer-memaccess}
7083 also warns about calls to bounded string copy functions like @code{strncat}
7084 or @code{strncpy} that specify as the bound a @code{sizeof} expression of
7085 the source array. For example, in the following function the call to
7086 @code{strncat} specifies the size of the source string as the bound. That
7087 is almost certainly a mistake and so the call is diagnosed.
7089 void make_file (const char *name)
7091 char path[PATH_MAX];
7092 strncpy (path, name, sizeof path - 1);
7093 strncat (path, ".text", sizeof ".text");
7098 The @option{-Wsizeof-pointer-memaccess} option is enabled by @option{-Wall}.
7100 @item -Wsizeof-array-argument
7101 @opindex Wsizeof-array-argument
7102 @opindex Wno-sizeof-array-argument
7103 Warn when the @code{sizeof} operator is applied to a parameter that is
7104 declared as an array in a function definition. This warning is enabled by
7105 default for C and C++ programs.
7107 @item -Wmemset-elt-size
7108 @opindex Wmemset-elt-size
7109 @opindex Wno-memset-elt-size
7110 Warn for suspicious calls to the @code{memset} built-in function, if the
7111 first argument references an array, and the third argument is a number
7112 equal to the number of elements, but not equal to the size of the array
7113 in memory. This indicates that the user has omitted a multiplication by
7114 the element size. This warning is enabled by @option{-Wall}.
7116 @item -Wmemset-transposed-args
7117 @opindex Wmemset-transposed-args
7118 @opindex Wno-memset-transposed-args
7119 Warn for suspicious calls to the @code{memset} built-in function where
7120 the second argument is not zero and the third argument is zero. For
7121 example, the call @code{memset (buf, sizeof buf, 0)} is diagnosed because
7122 @code{memset (buf, 0, sizeof buf)} was meant instead. The diagnostic
7123 is only emitted if the third argument is a literal zero. Otherwise, if
7124 it is an expression that is folded to zero, or a cast of zero to some
7125 type, it is far less likely that the arguments have been mistakenly
7126 transposed and no warning is emitted. This warning is enabled
7131 @opindex Wno-address
7132 Warn about suspicious uses of memory addresses. These include using
7133 the address of a function in a conditional expression, such as
7134 @code{void func(void); if (func)}, and comparisons against the memory
7135 address of a string literal, such as @code{if (x == "abc")}. Such
7136 uses typically indicate a programmer error: the address of a function
7137 always evaluates to true, so their use in a conditional usually
7138 indicate that the programmer forgot the parentheses in a function
7139 call; and comparisons against string literals result in unspecified
7140 behavior and are not portable in C, so they usually indicate that the
7141 programmer intended to use @code{strcmp}. This warning is enabled by
7144 @item -Waddress-of-packed-member
7145 @opindex Waddress-of-packed-member
7146 @opindex Wno-address-of-packed-member
7147 Warn when the address of packed member of struct or union is taken,
7148 which usually results in an unaligned pointer value. This is
7152 @opindex Wlogical-op
7153 @opindex Wno-logical-op
7154 Warn about suspicious uses of logical operators in expressions.
7155 This includes using logical operators in contexts where a
7156 bit-wise operator is likely to be expected. Also warns when
7157 the operands of a logical operator are the same:
7160 if (a < 0 && a < 0) @{ @dots{} @}
7163 @item -Wlogical-not-parentheses
7164 @opindex Wlogical-not-parentheses
7165 @opindex Wno-logical-not-parentheses
7166 Warn about logical not used on the left hand side operand of a comparison.
7167 This option does not warn if the right operand is considered to be a boolean
7168 expression. Its purpose is to detect suspicious code like the following:
7172 if (!a > 1) @{ @dots{} @}
7175 It is possible to suppress the warning by wrapping the LHS into
7178 if ((!a) > 1) @{ @dots{} @}
7181 This warning is enabled by @option{-Wall}.
7183 @item -Waggregate-return
7184 @opindex Waggregate-return
7185 @opindex Wno-aggregate-return
7186 Warn if any functions that return structures or unions are defined or
7187 called. (In languages where you can return an array, this also elicits
7190 @item -Wno-aggressive-loop-optimizations
7191 @opindex Wno-aggressive-loop-optimizations
7192 @opindex Waggressive-loop-optimizations
7193 Warn if in a loop with constant number of iterations the compiler detects
7194 undefined behavior in some statement during one or more of the iterations.
7196 @item -Wno-attributes
7197 @opindex Wno-attributes
7198 @opindex Wattributes
7199 Do not warn if an unexpected @code{__attribute__} is used, such as
7200 unrecognized attributes, function attributes applied to variables,
7201 etc. This does not stop errors for incorrect use of supported
7204 @item -Wno-builtin-declaration-mismatch
7205 @opindex Wno-builtin-declaration-mismatch
7206 @opindex Wbuiltin-declaration-mismatch
7207 Warn if a built-in function is declared with an incompatible signature
7208 or as a non-function, or when a built-in function declared with a type
7209 that does not include a prototype is called with arguments whose promoted
7210 types do not match those expected by the function. When @option{-Wextra}
7211 is specified, also warn when a built-in function that takes arguments is
7212 declared without a prototype. The @option{-Wno-builtin-declaration-mismatch}
7213 warning is enabled by default. To avoid the warning include the appropriate
7214 header to bring the prototypes of built-in functions into scope.
7216 For example, the call to @code{memset} below is diagnosed by the warning
7217 because the function expects a value of type @code{size_t} as its argument
7218 but the type of @code{32} is @code{int}. With @option{-Wextra},
7219 the declaration of the function is diagnosed as well.
7221 extern void* memset ();
7224 memset (d, '\0', 32);
7228 @item -Wno-builtin-macro-redefined
7229 @opindex Wno-builtin-macro-redefined
7230 @opindex Wbuiltin-macro-redefined
7231 Do not warn if certain built-in macros are redefined. This suppresses
7232 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
7233 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
7235 @item -Wstrict-prototypes @r{(C and Objective-C only)}
7236 @opindex Wstrict-prototypes
7237 @opindex Wno-strict-prototypes
7238 Warn if a function is declared or defined without specifying the
7239 argument types. (An old-style function definition is permitted without
7240 a warning if preceded by a declaration that specifies the argument
7243 @item -Wold-style-declaration @r{(C and Objective-C only)}
7244 @opindex Wold-style-declaration
7245 @opindex Wno-old-style-declaration
7246 Warn for obsolescent usages, according to the C Standard, in a
7247 declaration. For example, warn if storage-class specifiers like
7248 @code{static} are not the first things in a declaration. This warning
7249 is also enabled by @option{-Wextra}.
7251 @item -Wold-style-definition @r{(C and Objective-C only)}
7252 @opindex Wold-style-definition
7253 @opindex Wno-old-style-definition
7254 Warn if an old-style function definition is used. A warning is given
7255 even if there is a previous prototype.
7257 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
7258 @opindex Wmissing-parameter-type
7259 @opindex Wno-missing-parameter-type
7260 A function parameter is declared without a type specifier in K&R-style
7267 This warning is also enabled by @option{-Wextra}.
7269 @item -Wmissing-prototypes @r{(C and Objective-C only)}
7270 @opindex Wmissing-prototypes
7271 @opindex Wno-missing-prototypes
7272 Warn if a global function is defined without a previous prototype
7273 declaration. This warning is issued even if the definition itself
7274 provides a prototype. Use this option to detect global functions
7275 that do not have a matching prototype declaration in a header file.
7276 This option is not valid for C++ because all function declarations
7277 provide prototypes and a non-matching declaration declares an
7278 overload rather than conflict with an earlier declaration.
7279 Use @option{-Wmissing-declarations} to detect missing declarations in C++.
7281 @item -Wmissing-declarations
7282 @opindex Wmissing-declarations
7283 @opindex Wno-missing-declarations
7284 Warn if a global function is defined without a previous declaration.
7285 Do so even if the definition itself provides a prototype.
7286 Use this option to detect global functions that are not declared in
7287 header files. In C, no warnings are issued for functions with previous
7288 non-prototype declarations; use @option{-Wmissing-prototypes} to detect
7289 missing prototypes. In C++, no warnings are issued for function templates,
7290 or for inline functions, or for functions in anonymous namespaces.
7292 @item -Wmissing-field-initializers
7293 @opindex Wmissing-field-initializers
7294 @opindex Wno-missing-field-initializers
7298 Warn if a structure's initializer has some fields missing. For
7299 example, the following code causes such a warning, because
7300 @code{x.h} is implicitly zero:
7303 struct s @{ int f, g, h; @};
7304 struct s x = @{ 3, 4 @};
7307 This option does not warn about designated initializers, so the following
7308 modification does not trigger a warning:
7311 struct s @{ int f, g, h; @};
7312 struct s x = @{ .f = 3, .g = 4 @};
7315 In C this option does not warn about the universal zero initializer
7319 struct s @{ int f, g, h; @};
7320 struct s x = @{ 0 @};
7323 Likewise, in C++ this option does not warn about the empty @{ @}
7324 initializer, for example:
7327 struct s @{ int f, g, h; @};
7331 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
7332 warnings without this one, use @option{-Wextra -Wno-missing-field-initializers}.
7334 @item -Wno-multichar
7335 @opindex Wno-multichar
7337 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
7338 Usually they indicate a typo in the user's code, as they have
7339 implementation-defined values, and should not be used in portable code.
7341 @item -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]}
7342 @opindex Wnormalized=
7343 @opindex Wnormalized
7344 @opindex Wno-normalized
7347 @cindex character set, input normalization
7348 In ISO C and ISO C++, two identifiers are different if they are
7349 different sequences of characters. However, sometimes when characters
7350 outside the basic ASCII character set are used, you can have two
7351 different character sequences that look the same. To avoid confusion,
7352 the ISO 10646 standard sets out some @dfn{normalization rules} which
7353 when applied ensure that two sequences that look the same are turned into
7354 the same sequence. GCC can warn you if you are using identifiers that
7355 have not been normalized; this option controls that warning.
7357 There are four levels of warning supported by GCC@. The default is
7358 @option{-Wnormalized=nfc}, which warns about any identifier that is
7359 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
7360 recommended form for most uses. It is equivalent to
7361 @option{-Wnormalized}.
7363 Unfortunately, there are some characters allowed in identifiers by
7364 ISO C and ISO C++ that, when turned into NFC, are not allowed in
7365 identifiers. That is, there's no way to use these symbols in portable
7366 ISO C or C++ and have all your identifiers in NFC@.
7367 @option{-Wnormalized=id} suppresses the warning for these characters.
7368 It is hoped that future versions of the standards involved will correct
7369 this, which is why this option is not the default.
7371 You can switch the warning off for all characters by writing
7372 @option{-Wnormalized=none} or @option{-Wno-normalized}. You should
7373 only do this if you are using some other normalization scheme (like
7374 ``D''), because otherwise you can easily create bugs that are
7375 literally impossible to see.
7377 Some characters in ISO 10646 have distinct meanings but look identical
7378 in some fonts or display methodologies, especially once formatting has
7379 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
7380 LETTER N'', displays just like a regular @code{n} that has been
7381 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
7382 normalization scheme to convert all these into a standard form as
7383 well, and GCC warns if your code is not in NFKC if you use
7384 @option{-Wnormalized=nfkc}. This warning is comparable to warning
7385 about every identifier that contains the letter O because it might be
7386 confused with the digit 0, and so is not the default, but may be
7387 useful as a local coding convention if the programming environment
7388 cannot be fixed to display these characters distinctly.
7390 @item -Wno-attribute-warning
7391 @opindex Wno-attribute-warning
7392 @opindex Wattribute-warning
7393 Do not warn about usage of functions (@pxref{Function Attributes})
7394 declared with @code{warning} attribute. By default, this warning is
7395 enabled. @option{-Wno-attribute-warning} can be used to disable the
7396 warning or @option{-Wno-error=attribute-warning} can be used to
7397 disable the error when compiled with @option{-Werror} flag.
7399 @item -Wno-deprecated
7400 @opindex Wno-deprecated
7401 @opindex Wdeprecated
7402 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
7404 @item -Wno-deprecated-declarations
7405 @opindex Wno-deprecated-declarations
7406 @opindex Wdeprecated-declarations
7407 Do not warn about uses of functions (@pxref{Function Attributes}),
7408 variables (@pxref{Variable Attributes}), and types (@pxref{Type
7409 Attributes}) marked as deprecated by using the @code{deprecated}
7413 @opindex Wno-overflow
7415 Do not warn about compile-time overflow in constant expressions.
7420 Warn about One Definition Rule violations during link-time optimization.
7424 @opindex Wopenmp-simd
7425 @opindex Wno-openmp-simd
7426 Warn if the vectorizer cost model overrides the OpenMP
7427 simd directive set by user. The @option{-fsimd-cost-model=unlimited}
7428 option can be used to relax the cost model.
7430 @item -Woverride-init @r{(C and Objective-C only)}
7431 @opindex Woverride-init
7432 @opindex Wno-override-init
7436 Warn if an initialized field without side effects is overridden when
7437 using designated initializers (@pxref{Designated Inits, , Designated
7440 This warning is included in @option{-Wextra}. To get other
7441 @option{-Wextra} warnings without this one, use @option{-Wextra
7442 -Wno-override-init}.
7444 @item -Woverride-init-side-effects @r{(C and Objective-C only)}
7445 @opindex Woverride-init-side-effects
7446 @opindex Wno-override-init-side-effects
7447 Warn if an initialized field with side effects is overridden when
7448 using designated initializers (@pxref{Designated Inits, , Designated
7449 Initializers}). This warning is enabled by default.
7454 Warn if a structure is given the packed attribute, but the packed
7455 attribute has no effect on the layout or size of the structure.
7456 Such structures may be mis-aligned for little benefit. For
7457 instance, in this code, the variable @code{f.x} in @code{struct bar}
7458 is misaligned even though @code{struct bar} does not itself
7459 have the packed attribute:
7466 @} __attribute__((packed));
7474 @item -Wpacked-bitfield-compat
7475 @opindex Wpacked-bitfield-compat
7476 @opindex Wno-packed-bitfield-compat
7477 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
7478 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
7479 the change can lead to differences in the structure layout. GCC
7480 informs you when the offset of such a field has changed in GCC 4.4.
7481 For example there is no longer a 4-bit padding between field @code{a}
7482 and @code{b} in this structure:
7489 @} __attribute__ ((packed));
7492 This warning is enabled by default. Use
7493 @option{-Wno-packed-bitfield-compat} to disable this warning.
7495 @item -Wpacked-not-aligned @r{(C, C++, Objective-C and Objective-C++ only)}
7496 @opindex Wpacked-not-aligned
7497 @opindex Wno-packed-not-aligned
7498 Warn if a structure field with explicitly specified alignment in a
7499 packed struct or union is misaligned. For example, a warning will
7500 be issued on @code{struct S}, like, @code{warning: alignment 1 of
7501 'struct S' is less than 8}, in this code:
7505 struct __attribute__ ((aligned (8))) S8 @{ char a[8]; @};
7506 struct __attribute__ ((packed)) S @{
7512 This warning is enabled by @option{-Wall}.
7517 Warn if padding is included in a structure, either to align an element
7518 of the structure or to align the whole structure. Sometimes when this
7519 happens it is possible to rearrange the fields of the structure to
7520 reduce the padding and so make the structure smaller.
7522 @item -Wredundant-decls
7523 @opindex Wredundant-decls
7524 @opindex Wno-redundant-decls
7525 Warn if anything is declared more than once in the same scope, even in
7526 cases where multiple declaration is valid and changes nothing.
7530 @opindex Wno-restrict
7531 Warn when an object referenced by a @code{restrict}-qualified parameter
7532 (or, in C++, a @code{__restrict}-qualified parameter) is aliased by another
7533 argument, or when copies between such objects overlap. For example,
7534 the call to the @code{strcpy} function below attempts to truncate the string
7535 by replacing its initial characters with the last four. However, because
7536 the call writes the terminating NUL into @code{a[4]}, the copies overlap and
7537 the call is diagnosed.
7542 char a[] = "abcd1234";
7547 The @option{-Wrestrict} option detects some instances of simple overlap
7548 even without optimization but works best at @option{-O2} and above. It
7549 is included in @option{-Wall}.
7551 @item -Wnested-externs @r{(C and Objective-C only)}
7552 @opindex Wnested-externs
7553 @opindex Wno-nested-externs
7554 Warn if an @code{extern} declaration is encountered within a function.
7556 @item -Wno-inherited-variadic-ctor
7557 @opindex Winherited-variadic-ctor
7558 @opindex Wno-inherited-variadic-ctor
7559 Suppress warnings about use of C++11 inheriting constructors when the
7560 base class inherited from has a C variadic constructor; the warning is
7561 on by default because the ellipsis is not inherited.
7566 Warn if a function that is declared as inline cannot be inlined.
7567 Even with this option, the compiler does not warn about failures to
7568 inline functions declared in system headers.
7570 The compiler uses a variety of heuristics to determine whether or not
7571 to inline a function. For example, the compiler takes into account
7572 the size of the function being inlined and the amount of inlining
7573 that has already been done in the current function. Therefore,
7574 seemingly insignificant changes in the source program can cause the
7575 warnings produced by @option{-Winline} to appear or disappear.
7577 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
7578 @opindex Wno-invalid-offsetof
7579 @opindex Winvalid-offsetof
7580 Suppress warnings from applying the @code{offsetof} macro to a non-POD
7581 type. According to the 2014 ISO C++ standard, applying @code{offsetof}
7582 to a non-standard-layout type is undefined. In existing C++ implementations,
7583 however, @code{offsetof} typically gives meaningful results.
7584 This flag is for users who are aware that they are
7585 writing nonportable code and who have deliberately chosen to ignore the
7588 The restrictions on @code{offsetof} may be relaxed in a future version
7589 of the C++ standard.
7591 @item -Wint-in-bool-context
7592 @opindex Wint-in-bool-context
7593 @opindex Wno-int-in-bool-context
7594 Warn for suspicious use of integer values where boolean values are expected,
7595 such as conditional expressions (?:) using non-boolean integer constants in
7596 boolean context, like @code{if (a <= b ? 2 : 3)}. Or left shifting of signed
7597 integers in boolean context, like @code{for (a = 0; 1 << a; a++);}. Likewise
7598 for all kinds of multiplications regardless of the data type.
7599 This warning is enabled by @option{-Wall}.
7601 @item -Wno-int-to-pointer-cast
7602 @opindex Wno-int-to-pointer-cast
7603 @opindex Wint-to-pointer-cast
7604 Suppress warnings from casts to pointer type of an integer of a
7605 different size. In C++, casting to a pointer type of smaller size is
7606 an error. @option{Wint-to-pointer-cast} is enabled by default.
7609 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
7610 @opindex Wno-pointer-to-int-cast
7611 @opindex Wpointer-to-int-cast
7612 Suppress warnings from casts from a pointer to an integer type of a
7616 @opindex Winvalid-pch
7617 @opindex Wno-invalid-pch
7618 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
7619 the search path but cannot be used.
7623 @opindex Wno-long-long
7624 Warn if @code{long long} type is used. This is enabled by either
7625 @option{-Wpedantic} or @option{-Wtraditional} in ISO C90 and C++98
7626 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
7628 @item -Wvariadic-macros
7629 @opindex Wvariadic-macros
7630 @opindex Wno-variadic-macros
7631 Warn if variadic macros are used in ISO C90 mode, or if the GNU
7632 alternate syntax is used in ISO C99 mode. This is enabled by either
7633 @option{-Wpedantic} or @option{-Wtraditional}. To inhibit the warning
7634 messages, use @option{-Wno-variadic-macros}.
7638 @opindex Wno-varargs
7639 Warn upon questionable usage of the macros used to handle variable
7640 arguments like @code{va_start}. This is default. To inhibit the
7641 warning messages, use @option{-Wno-varargs}.
7643 @item -Wvector-operation-performance
7644 @opindex Wvector-operation-performance
7645 @opindex Wno-vector-operation-performance
7646 Warn if vector operation is not implemented via SIMD capabilities of the
7647 architecture. Mainly useful for the performance tuning.
7648 Vector operation can be implemented @code{piecewise}, which means that the
7649 scalar operation is performed on every vector element;
7650 @code{in parallel}, which means that the vector operation is implemented
7651 using scalars of wider type, which normally is more performance efficient;
7652 and @code{as a single scalar}, which means that vector fits into a
7655 @item -Wno-virtual-move-assign
7656 @opindex Wvirtual-move-assign
7657 @opindex Wno-virtual-move-assign
7658 Suppress warnings about inheriting from a virtual base with a
7659 non-trivial C++11 move assignment operator. This is dangerous because
7660 if the virtual base is reachable along more than one path, it is
7661 moved multiple times, which can mean both objects end up in the
7662 moved-from state. If the move assignment operator is written to avoid
7663 moving from a moved-from object, this warning can be disabled.
7668 Warn if a variable-length array is used in the code.
7669 @option{-Wno-vla} prevents the @option{-Wpedantic} warning of
7670 the variable-length array.
7672 @item -Wvla-larger-than=@var{byte-size}
7673 @opindex Wvla-larger-than=
7674 @opindex Wno-vla-larger-than
7675 If this option is used, the compiler will warn for declarations of
7676 variable-length arrays whose size is either unbounded, or bounded
7677 by an argument that allows the array size to exceed @var{byte-size}
7678 bytes. This is similar to how @option{-Walloca-larger-than=}@var{byte-size}
7679 works, but with variable-length arrays.
7681 Note that GCC may optimize small variable-length arrays of a known
7682 value into plain arrays, so this warning may not get triggered for
7685 @option{-Wvla-larger-than=}@samp{PTRDIFF_MAX} is enabled by default but
7686 is typically only effective when @option{-ftree-vrp} is active (default
7687 for @option{-O2} and above).
7689 See also @option{-Walloca-larger-than=@var{byte-size}}.
7691 @item -Wno-vla-larger-than
7692 @opindex Wno-vla-larger-than
7693 Disable @option{-Wvla-larger-than=} warnings. The option is equivalent
7694 to @option{-Wvla-larger-than=}@samp{SIZE_MAX} or larger.
7696 @item -Wvolatile-register-var
7697 @opindex Wvolatile-register-var
7698 @opindex Wno-volatile-register-var
7699 Warn if a register variable is declared volatile. The volatile
7700 modifier does not inhibit all optimizations that may eliminate reads
7701 and/or writes to register variables. This warning is enabled by
7704 @item -Wdisabled-optimization
7705 @opindex Wdisabled-optimization
7706 @opindex Wno-disabled-optimization
7707 Warn if a requested optimization pass is disabled. This warning does
7708 not generally indicate that there is anything wrong with your code; it
7709 merely indicates that GCC's optimizers are unable to handle the code
7710 effectively. Often, the problem is that your code is too big or too
7711 complex; GCC refuses to optimize programs when the optimization
7712 itself is likely to take inordinate amounts of time.
7714 @item -Wpointer-sign @r{(C and Objective-C only)}
7715 @opindex Wpointer-sign
7716 @opindex Wno-pointer-sign
7717 Warn for pointer argument passing or assignment with different signedness.
7718 This option is only supported for C and Objective-C@. It is implied by
7719 @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
7720 @option{-Wno-pointer-sign}.
7722 @item -Wstack-protector
7723 @opindex Wstack-protector
7724 @opindex Wno-stack-protector
7725 This option is only active when @option{-fstack-protector} is active. It
7726 warns about functions that are not protected against stack smashing.
7728 @item -Woverlength-strings
7729 @opindex Woverlength-strings
7730 @opindex Wno-overlength-strings
7731 Warn about string constants that are longer than the ``minimum
7732 maximum'' length specified in the C standard. Modern compilers
7733 generally allow string constants that are much longer than the
7734 standard's minimum limit, but very portable programs should avoid
7735 using longer strings.
7737 The limit applies @emph{after} string constant concatenation, and does
7738 not count the trailing NUL@. In C90, the limit was 509 characters; in
7739 C99, it was raised to 4095. C++98 does not specify a normative
7740 minimum maximum, so we do not diagnose overlength strings in C++@.
7742 This option is implied by @option{-Wpedantic}, and can be disabled with
7743 @option{-Wno-overlength-strings}.
7745 @item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
7746 @opindex Wunsuffixed-float-constants
7747 @opindex Wno-unsuffixed-float-constants
7749 Issue a warning for any floating constant that does not have
7750 a suffix. When used together with @option{-Wsystem-headers} it
7751 warns about such constants in system header files. This can be useful
7752 when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
7753 from the decimal floating-point extension to C99.
7755 @item -Wno-designated-init @r{(C and Objective-C only)}
7756 Suppress warnings when a positional initializer is used to initialize
7757 a structure that has been marked with the @code{designated_init}
7761 Issue a warning when HSAIL cannot be emitted for the compiled function or
7766 @node Debugging Options
7767 @section Options for Debugging Your Program
7768 @cindex options, debugging
7769 @cindex debugging information options
7771 To tell GCC to emit extra information for use by a debugger, in almost
7772 all cases you need only to add @option{-g} to your other options.
7774 GCC allows you to use @option{-g} with
7775 @option{-O}. The shortcuts taken by optimized code may occasionally
7776 be surprising: some variables you declared may not exist
7777 at all; flow of control may briefly move where you did not expect it;
7778 some statements may not be executed because they compute constant
7779 results or their values are already at hand; some statements may
7780 execute in different places because they have been moved out of loops.
7781 Nevertheless it is possible to debug optimized output. This makes
7782 it reasonable to use the optimizer for programs that might have bugs.
7784 If you are not using some other optimization option, consider
7785 using @option{-Og} (@pxref{Optimize Options}) with @option{-g}.
7786 With no @option{-O} option at all, some compiler passes that collect
7787 information useful for debugging do not run at all, so that
7788 @option{-Og} may result in a better debugging experience.
7793 Produce debugging information in the operating system's native format
7794 (stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
7797 On most systems that use stabs format, @option{-g} enables use of extra
7798 debugging information that only GDB can use; this extra information
7799 makes debugging work better in GDB but probably makes other debuggers
7801 refuse to read the program. If you want to control for certain whether
7802 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
7803 @option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
7807 Produce debugging information for use by GDB@. This means to use the
7808 most expressive format available (DWARF, stabs, or the native format
7809 if neither of those are supported), including GDB extensions if at all
7813 @itemx -gdwarf-@var{version}
7815 Produce debugging information in DWARF format (if that is supported).
7816 The value of @var{version} may be either 2, 3, 4 or 5; the default version
7817 for most targets is 4. DWARF Version 5 is only experimental.
7819 Note that with DWARF Version 2, some ports require and always
7820 use some non-conflicting DWARF 3 extensions in the unwind tables.
7822 Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
7823 for maximum benefit.
7825 GCC no longer supports DWARF Version 1, which is substantially
7826 different than Version 2 and later. For historical reasons, some
7827 other DWARF-related options such as
7828 @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2
7829 in their names, but apply to all currently-supported versions of DWARF.
7833 Produce debugging information in stabs format (if that is supported),
7834 without GDB extensions. This is the format used by DBX on most BSD
7835 systems. On MIPS, Alpha and System V Release 4 systems this option
7836 produces stabs debugging output that is not understood by DBX@.
7837 On System V Release 4 systems this option requires the GNU assembler.
7841 Produce debugging information in stabs format (if that is supported),
7842 using GNU extensions understood only by the GNU debugger (GDB)@. The
7843 use of these extensions is likely to make other debuggers crash or
7844 refuse to read the program.
7848 Produce debugging information in XCOFF format (if that is supported).
7849 This is the format used by the DBX debugger on IBM RS/6000 systems.
7853 Produce debugging information in XCOFF format (if that is supported),
7854 using GNU extensions understood only by the GNU debugger (GDB)@. The
7855 use of these extensions is likely to make other debuggers crash or
7856 refuse to read the program, and may cause assemblers other than the GNU
7857 assembler (GAS) to fail with an error.
7861 Produce debugging information in Alpha/VMS debug format (if that is
7862 supported). This is the format used by DEBUG on Alpha/VMS systems.
7865 @itemx -ggdb@var{level}
7866 @itemx -gstabs@var{level}
7867 @itemx -gxcoff@var{level}
7868 @itemx -gvms@var{level}
7869 Request debugging information and also use @var{level} to specify how
7870 much information. The default level is 2.
7872 Level 0 produces no debug information at all. Thus, @option{-g0} negates
7875 Level 1 produces minimal information, enough for making backtraces in
7876 parts of the program that you don't plan to debug. This includes
7877 descriptions of functions and external variables, and line number
7878 tables, but no information about local variables.
7880 Level 3 includes extra information, such as all the macro definitions
7881 present in the program. Some debuggers support macro expansion when
7882 you use @option{-g3}.
7884 If you use multiple @option{-g} options, with or without level numbers,
7885 the last such option is the one that is effective.
7887 @option{-gdwarf} does not accept a concatenated debug level, to avoid
7888 confusion with @option{-gdwarf-@var{level}}.
7889 Instead use an additional @option{-g@var{level}} option to change the
7890 debug level for DWARF.
7892 @item -fno-eliminate-unused-debug-symbols
7893 @opindex feliminate-unused-debug-symbols
7894 @opindex fno-eliminate-unused-debug-symbols
7895 By default, no debug information is produced for symbols that are not actually
7896 used. Use this option if you want debug information for all symbols.
7898 @item -femit-class-debug-always
7899 @opindex femit-class-debug-always
7900 Instead of emitting debugging information for a C++ class in only one
7901 object file, emit it in all object files using the class. This option
7902 should be used only with debuggers that are unable to handle the way GCC
7903 normally emits debugging information for classes because using this
7904 option increases the size of debugging information by as much as a
7907 @item -fno-merge-debug-strings
7908 @opindex fmerge-debug-strings
7909 @opindex fno-merge-debug-strings
7910 Direct the linker to not merge together strings in the debugging
7911 information that are identical in different object files. Merging is
7912 not supported by all assemblers or linkers. Merging decreases the size
7913 of the debug information in the output file at the cost of increasing
7914 link processing time. Merging is enabled by default.
7916 @item -fdebug-prefix-map=@var{old}=@var{new}
7917 @opindex fdebug-prefix-map
7918 When compiling files residing in directory @file{@var{old}}, record
7919 debugging information describing them as if the files resided in
7920 directory @file{@var{new}} instead. This can be used to replace a
7921 build-time path with an install-time path in the debug info. It can
7922 also be used to change an absolute path to a relative path by using
7923 @file{.} for @var{new}. This can give more reproducible builds, which
7924 are location independent, but may require an extra command to tell GDB
7925 where to find the source files. See also @option{-ffile-prefix-map}.
7927 @item -fvar-tracking
7928 @opindex fvar-tracking
7929 Run variable tracking pass. It computes where variables are stored at each
7930 position in code. Better debugging information is then generated
7931 (if the debugging information format supports this information).
7933 It is enabled by default when compiling with optimization (@option{-Os},
7934 @option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
7935 the debug info format supports it.
7937 @item -fvar-tracking-assignments
7938 @opindex fvar-tracking-assignments
7939 @opindex fno-var-tracking-assignments
7940 Annotate assignments to user variables early in the compilation and
7941 attempt to carry the annotations over throughout the compilation all the
7942 way to the end, in an attempt to improve debug information while
7943 optimizing. Use of @option{-gdwarf-4} is recommended along with it.
7945 It can be enabled even if var-tracking is disabled, in which case
7946 annotations are created and maintained, but discarded at the end.
7947 By default, this flag is enabled together with @option{-fvar-tracking},
7948 except when selective scheduling is enabled.
7951 @opindex gsplit-dwarf
7952 Separate as much DWARF debugging information as possible into a
7953 separate output file with the extension @file{.dwo}. This option allows
7954 the build system to avoid linking files with debug information. To
7955 be useful, this option requires a debugger capable of reading @file{.dwo}
7958 @item -gdescribe-dies
7959 @opindex gdescribe-dies
7960 Add description attributes to some DWARF DIEs that have no name attribute,
7961 such as artificial variables, external references and call site
7966 Generate DWARF @code{.debug_pubnames} and @code{.debug_pubtypes} sections.
7968 @item -ggnu-pubnames
7969 @opindex ggnu-pubnames
7970 Generate @code{.debug_pubnames} and @code{.debug_pubtypes} sections in a format
7971 suitable for conversion into a GDB@ index. This option is only useful
7972 with a linker that can produce GDB@ index version 7.
7974 @item -fdebug-types-section
7975 @opindex fdebug-types-section
7976 @opindex fno-debug-types-section
7977 When using DWARF Version 4 or higher, type DIEs can be put into
7978 their own @code{.debug_types} section instead of making them part of the
7979 @code{.debug_info} section. It is more efficient to put them in a separate
7980 comdat section since the linker can then remove duplicates.
7981 But not all DWARF consumers support @code{.debug_types} sections yet
7982 and on some objects @code{.debug_types} produces larger instead of smaller
7983 debugging information.
7985 @item -grecord-gcc-switches
7986 @itemx -gno-record-gcc-switches
7987 @opindex grecord-gcc-switches
7988 @opindex gno-record-gcc-switches
7989 This switch causes the command-line options used to invoke the
7990 compiler that may affect code generation to be appended to the
7991 DW_AT_producer attribute in DWARF debugging information. The options
7992 are concatenated with spaces separating them from each other and from
7993 the compiler version.
7994 It is enabled by default.
7995 See also @option{-frecord-gcc-switches} for another
7996 way of storing compiler options into the object file.
7998 @item -gstrict-dwarf
7999 @opindex gstrict-dwarf
8000 Disallow using extensions of later DWARF standard version than selected
8001 with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
8002 DWARF extensions from later standard versions is allowed.
8004 @item -gno-strict-dwarf
8005 @opindex gno-strict-dwarf
8006 Allow using extensions of later DWARF standard version than selected with
8007 @option{-gdwarf-@var{version}}.
8009 @item -gas-loc-support
8010 @opindex gas-loc-support
8011 Inform the compiler that the assembler supports @code{.loc} directives.
8012 It may then use them for the assembler to generate DWARF2+ line number
8015 This is generally desirable, because assembler-generated line-number
8016 tables are a lot more compact than those the compiler can generate
8019 This option will be enabled by default if, at GCC configure time, the
8020 assembler was found to support such directives.
8022 @item -gno-as-loc-support
8023 @opindex gno-as-loc-support
8024 Force GCC to generate DWARF2+ line number tables internally, if DWARF2+
8025 line number tables are to be generated.
8027 @item -gas-locview-support
8028 @opindex gas-locview-support
8029 Inform the compiler that the assembler supports @code{view} assignment
8030 and reset assertion checking in @code{.loc} directives.
8032 This option will be enabled by default if, at GCC configure time, the
8033 assembler was found to support them.
8035 @item -gno-as-locview-support
8036 Force GCC to assign view numbers internally, if
8037 @option{-gvariable-location-views} are explicitly requested.
8040 @itemx -gno-column-info
8041 @opindex gcolumn-info
8042 @opindex gno-column-info
8043 Emit location column information into DWARF debugging information, rather
8044 than just file and line.
8045 This option is enabled by default.
8047 @item -gstatement-frontiers
8048 @itemx -gno-statement-frontiers
8049 @opindex gstatement-frontiers
8050 @opindex gno-statement-frontiers
8051 This option causes GCC to create markers in the internal representation
8052 at the beginning of statements, and to keep them roughly in place
8053 throughout compilation, using them to guide the output of @code{is_stmt}
8054 markers in the line number table. This is enabled by default when
8055 compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
8056 @dots{}), and outputting DWARF 2 debug information at the normal level.
8058 @item -gvariable-location-views
8059 @itemx -gvariable-location-views=incompat5
8060 @itemx -gno-variable-location-views
8061 @opindex gvariable-location-views
8062 @opindex gvariable-location-views=incompat5
8063 @opindex gno-variable-location-views
8064 Augment variable location lists with progressive view numbers implied
8065 from the line number table. This enables debug information consumers to
8066 inspect state at certain points of the program, even if no instructions
8067 associated with the corresponding source locations are present at that
8068 point. If the assembler lacks support for view numbers in line number
8069 tables, this will cause the compiler to emit the line number table,
8070 which generally makes them somewhat less compact. The augmented line
8071 number tables and location lists are fully backward-compatible, so they
8072 can be consumed by debug information consumers that are not aware of
8073 these augmentations, but they won't derive any benefit from them either.
8075 This is enabled by default when outputting DWARF 2 debug information at
8076 the normal level, as long as there is assembler support,
8077 @option{-fvar-tracking-assignments} is enabled and
8078 @option{-gstrict-dwarf} is not. When assembler support is not
8079 available, this may still be enabled, but it will force GCC to output
8080 internal line number tables, and if
8081 @option{-ginternal-reset-location-views} is not enabled, that will most
8082 certainly lead to silently mismatching location views.
8084 There is a proposed representation for view numbers that is not backward
8085 compatible with the location list format introduced in DWARF 5, that can
8086 be enabled with @option{-gvariable-location-views=incompat5}. This
8087 option may be removed in the future, is only provided as a reference
8088 implementation of the proposed representation. Debug information
8089 consumers are not expected to support this extended format, and they
8090 would be rendered unable to decode location lists using it.
8092 @item -ginternal-reset-location-views
8093 @itemx -gnointernal-reset-location-views
8094 @opindex ginternal-reset-location-views
8095 @opindex gno-internal-reset-location-views
8096 Attempt to determine location views that can be omitted from location
8097 view lists. This requires the compiler to have very accurate insn
8098 length estimates, which isn't always the case, and it may cause
8099 incorrect view lists to be generated silently when using an assembler
8100 that does not support location view lists. The GNU assembler will flag
8101 any such error as a @code{view number mismatch}. This is only enabled
8102 on ports that define a reliable estimation function.
8104 @item -ginline-points
8105 @itemx -gno-inline-points
8106 @opindex ginline-points
8107 @opindex gno-inline-points
8108 Generate extended debug information for inlined functions. Location
8109 view tracking markers are inserted at inlined entry points, so that
8110 address and view numbers can be computed and output in debug
8111 information. This can be enabled independently of location views, in
8112 which case the view numbers won't be output, but it can only be enabled
8113 along with statement frontiers, and it is only enabled by default if
8114 location views are enabled.
8116 @item -gz@r{[}=@var{type}@r{]}
8118 Produce compressed debug sections in DWARF format, if that is supported.
8119 If @var{type} is not given, the default type depends on the capabilities
8120 of the assembler and linker used. @var{type} may be one of
8121 @samp{none} (don't compress debug sections), @samp{zlib} (use zlib
8122 compression in ELF gABI format), or @samp{zlib-gnu} (use zlib
8123 compression in traditional GNU format). If the linker doesn't support
8124 writing compressed debug sections, the option is rejected. Otherwise,
8125 if the assembler does not support them, @option{-gz} is silently ignored
8126 when producing object files.
8128 @item -femit-struct-debug-baseonly
8129 @opindex femit-struct-debug-baseonly
8130 Emit debug information for struct-like types
8131 only when the base name of the compilation source file
8132 matches the base name of file in which the struct is defined.
8134 This option substantially reduces the size of debugging information,
8135 but at significant potential loss in type information to the debugger.
8136 See @option{-femit-struct-debug-reduced} for a less aggressive option.
8137 See @option{-femit-struct-debug-detailed} for more detailed control.
8139 This option works only with DWARF debug output.
8141 @item -femit-struct-debug-reduced
8142 @opindex femit-struct-debug-reduced
8143 Emit debug information for struct-like types
8144 only when the base name of the compilation source file
8145 matches the base name of file in which the type is defined,
8146 unless the struct is a template or defined in a system header.
8148 This option significantly reduces the size of debugging information,
8149 with some potential loss in type information to the debugger.
8150 See @option{-femit-struct-debug-baseonly} for a more aggressive option.
8151 See @option{-femit-struct-debug-detailed} for more detailed control.
8153 This option works only with DWARF debug output.
8155 @item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
8156 @opindex femit-struct-debug-detailed
8157 Specify the struct-like types
8158 for which the compiler generates debug information.
8159 The intent is to reduce duplicate struct debug information
8160 between different object files within the same program.
8162 This option is a detailed version of
8163 @option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
8164 which serves for most needs.
8166 A specification has the syntax@*
8167 [@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
8169 The optional first word limits the specification to
8170 structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
8171 A struct type is used directly when it is the type of a variable, member.
8172 Indirect uses arise through pointers to structs.
8173 That is, when use of an incomplete struct is valid, the use is indirect.
8175 @samp{struct one direct; struct two * indirect;}.
8177 The optional second word limits the specification to
8178 ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
8179 Generic structs are a bit complicated to explain.
8180 For C++, these are non-explicit specializations of template classes,
8181 or non-template classes within the above.
8182 Other programming languages have generics,
8183 but @option{-femit-struct-debug-detailed} does not yet implement them.
8185 The third word specifies the source files for those
8186 structs for which the compiler should emit debug information.
8187 The values @samp{none} and @samp{any} have the normal meaning.
8188 The value @samp{base} means that
8189 the base of name of the file in which the type declaration appears
8190 must match the base of the name of the main compilation file.
8191 In practice, this means that when compiling @file{foo.c}, debug information
8192 is generated for types declared in that file and @file{foo.h},
8193 but not other header files.
8194 The value @samp{sys} means those types satisfying @samp{base}
8195 or declared in system or compiler headers.
8197 You may need to experiment to determine the best settings for your application.
8199 The default is @option{-femit-struct-debug-detailed=all}.
8201 This option works only with DWARF debug output.
8203 @item -fno-dwarf2-cfi-asm
8204 @opindex fdwarf2-cfi-asm
8205 @opindex fno-dwarf2-cfi-asm
8206 Emit DWARF unwind info as compiler generated @code{.eh_frame} section
8207 instead of using GAS @code{.cfi_*} directives.
8209 @item -fno-eliminate-unused-debug-types
8210 @opindex feliminate-unused-debug-types
8211 @opindex fno-eliminate-unused-debug-types
8212 Normally, when producing DWARF output, GCC avoids producing debug symbol
8213 output for types that are nowhere used in the source file being compiled.
8214 Sometimes it is useful to have GCC emit debugging
8215 information for all types declared in a compilation
8216 unit, regardless of whether or not they are actually used
8217 in that compilation unit, for example
8218 if, in the debugger, you want to cast a value to a type that is
8219 not actually used in your program (but is declared). More often,
8220 however, this results in a significant amount of wasted space.
8223 @node Optimize Options
8224 @section Options That Control Optimization
8225 @cindex optimize options
8226 @cindex options, optimization
8228 These options control various sorts of optimizations.
8230 Without any optimization option, the compiler's goal is to reduce the
8231 cost of compilation and to make debugging produce the expected
8232 results. Statements are independent: if you stop the program with a
8233 breakpoint between statements, you can then assign a new value to any
8234 variable or change the program counter to any other statement in the
8235 function and get exactly the results you expect from the source
8238 Turning on optimization flags makes the compiler attempt to improve
8239 the performance and/or code size at the expense of compilation time
8240 and possibly the ability to debug the program.
8242 The compiler performs optimization based on the knowledge it has of the
8243 program. Compiling multiple files at once to a single output file mode allows
8244 the compiler to use information gained from all of the files when compiling
8247 Not all optimizations are controlled directly by a flag. Only
8248 optimizations that have a flag are listed in this section.
8250 Most optimizations are completely disabled at @option{-O0} or if an
8251 @option{-O} level is not set on the command line, even if individual
8252 optimization flags are specified. Similarly, @option{-Og} suppresses
8253 many optimization passes.
8255 Depending on the target and how GCC was configured, a slightly different
8256 set of optimizations may be enabled at each @option{-O} level than
8257 those listed here. You can invoke GCC with @option{-Q --help=optimizers}
8258 to find out the exact set of optimizations that are enabled at each level.
8259 @xref{Overall Options}, for examples.
8266 Optimize. Optimizing compilation takes somewhat more time, and a lot
8267 more memory for a large function.
8269 With @option{-O}, the compiler tries to reduce code size and execution
8270 time, without performing any optimizations that take a great deal of
8273 @c Note that in addition to the default_options_table list in opts.c,
8274 @c several optimization flags default to true but control optimization
8275 @c passes that are explicitly disabled at -O0.
8277 @option{-O} turns on the following optimization flags:
8279 @c Please keep the following list alphabetized.
8280 @gccoptlist{-fauto-inc-dec @gol
8281 -fbranch-count-reg @gol
8282 -fcombine-stack-adjustments @gol
8284 -fcprop-registers @gol
8287 -fdelayed-branch @gol
8289 -fforward-propagate @gol
8290 -fguess-branch-probability @gol
8291 -fif-conversion @gol
8292 -fif-conversion2 @gol
8293 -finline-functions-called-once @gol
8295 -fipa-pure-const @gol
8296 -fipa-reference @gol
8297 -fipa-reference-addressable @gol
8298 -fmerge-constants @gol
8299 -fmove-loop-invariants @gol
8300 -fomit-frame-pointer @gol
8301 -freorder-blocks @gol
8303 -fshrink-wrap-separate @gol
8304 -fsplit-wide-types @gol
8310 -ftree-coalesce-vars @gol
8311 -ftree-copy-prop @gol
8313 -ftree-dominator-opts @gol
8315 -ftree-forwprop @gol
8319 -ftree-scev-cprop @gol
8328 Optimize even more. GCC performs nearly all supported optimizations
8329 that do not involve a space-speed tradeoff.
8330 As compared to @option{-O}, this option increases both compilation time
8331 and the performance of the generated code.
8333 @option{-O2} turns on all optimization flags specified by @option{-O}. It
8334 also turns on the following optimization flags:
8336 @c Please keep the following list alphabetized!
8337 @gccoptlist{-falign-functions -falign-jumps @gol
8338 -falign-labels -falign-loops @gol
8340 -fcode-hoisting @gol
8342 -fcse-follow-jumps -fcse-skip-blocks @gol
8343 -fdelete-null-pointer-checks @gol
8344 -fdevirtualize -fdevirtualize-speculatively @gol
8345 -fexpensive-optimizations @gol
8347 -fgcse -fgcse-lm @gol
8348 -fhoist-adjacent-loads @gol
8349 -finline-functions @gol
8350 -finline-small-functions @gol
8351 -findirect-inlining @gol
8352 -fipa-bit-cp -fipa-cp -fipa-icf @gol
8353 -fipa-ra -fipa-sra -fipa-vrp @gol
8354 -fisolate-erroneous-paths-dereference @gol
8356 -foptimize-sibling-calls @gol
8357 -foptimize-strlen @gol
8358 -fpartial-inlining @gol
8360 -freorder-blocks-algorithm=stc @gol
8361 -freorder-blocks-and-partition -freorder-functions @gol
8362 -frerun-cse-after-loop @gol
8363 -fschedule-insns -fschedule-insns2 @gol
8364 -fsched-interblock -fsched-spec @gol
8365 -fstore-merging @gol
8366 -fstrict-aliasing @gol
8368 -ftree-builtin-call-dce @gol
8370 -ftree-switch-conversion -ftree-tail-merge @gol
8373 Please note the warning under @option{-fgcse} about
8374 invoking @option{-O2} on programs that use computed gotos.
8378 Optimize yet more. @option{-O3} turns on all optimizations specified
8379 by @option{-O2} and also turns on the following optimization flags:
8381 @c Please keep the following list alphabetized!
8382 @gccoptlist{-fgcse-after-reload @gol
8384 -floop-interchange @gol
8385 -floop-unroll-and-jam @gol
8387 -fpredictive-commoning @gol
8389 -ftree-loop-distribute-patterns @gol
8390 -ftree-loop-distribution @gol
8391 -ftree-loop-vectorize @gol
8392 -ftree-partial-pre @gol
8393 -ftree-slp-vectorize @gol
8394 -funswitch-loops @gol
8395 -fvect-cost-model @gol
8396 -fversion-loops-for-strides}
8400 Reduce compilation time and make debugging produce the expected
8401 results. This is the default.
8405 Optimize for size. @option{-Os} enables all @option{-O2} optimizations
8406 except those that often increase code size:
8408 @gccoptlist{-falign-functions -falign-jumps @gol
8409 -falign-labels -falign-loops @gol
8410 -fprefetch-loop-arrays -freorder-blocks-algorithm=stc}
8412 It also enables @option{-finline-functions}, causes the compiler to tune for
8413 code size rather than execution speed, and performs further optimizations
8414 designed to reduce code size.
8418 Disregard strict standards compliance. @option{-Ofast} enables all
8419 @option{-O3} optimizations. It also enables optimizations that are not
8420 valid for all standard-compliant programs.
8421 It turns on @option{-ffast-math} and the Fortran-specific
8422 @option{-fstack-arrays}, unless @option{-fmax-stack-var-size} is
8423 specified, and @option{-fno-protect-parens}.
8427 Optimize debugging experience. @option{-Og} should be the optimization
8428 level of choice for the standard edit-compile-debug cycle, offering
8429 a reasonable level of optimization while maintaining fast compilation
8430 and a good debugging experience. It is a better choice than @option{-O0}
8431 for producing debuggable code because some compiler passes
8432 that collect debug information are disabled at @option{-O0}.
8434 Like @option{-O0}, @option{-Og} completely disables a number of
8435 optimization passes so that individual options controlling them have
8436 no effect. Otherwise @option{-Og} enables all @option{-O1}
8437 optimization flags except for those that may interfere with debugging:
8439 @gccoptlist{-fbranch-count-reg -fdelayed-branch @gol
8440 -fdse -fif-conversion -fif-conversion2 @gol
8441 -finline-functions-called-once @gol
8442 -fmove-loop-invariants -fssa-phiopt @gol
8443 -ftree-bit-ccp -ftree-dse -ftree-pta -ftree-sra}
8447 If you use multiple @option{-O} options, with or without level numbers,
8448 the last such option is the one that is effective.
8450 Options of the form @option{-f@var{flag}} specify machine-independent
8451 flags. Most flags have both positive and negative forms; the negative
8452 form of @option{-ffoo} is @option{-fno-foo}. In the table
8453 below, only one of the forms is listed---the one you typically
8454 use. You can figure out the other form by either removing @samp{no-}
8457 The following options control specific optimizations. They are either
8458 activated by @option{-O} options or are related to ones that are. You
8459 can use the following flags in the rare cases when ``fine-tuning'' of
8460 optimizations to be performed is desired.
8463 @item -fno-defer-pop
8464 @opindex fno-defer-pop
8466 For machines that must pop arguments after a function call, always pop
8467 the arguments as soon as each function returns.
8468 At levels @option{-O1} and higher, @option{-fdefer-pop} is the default;
8469 this allows the compiler to let arguments accumulate on the stack for several
8470 function calls and pop them all at once.
8472 @item -fforward-propagate
8473 @opindex fforward-propagate
8474 Perform a forward propagation pass on RTL@. The pass tries to combine two
8475 instructions and checks if the result can be simplified. If loop unrolling
8476 is active, two passes are performed and the second is scheduled after
8479 This option is enabled by default at optimization levels @option{-O},
8480 @option{-O2}, @option{-O3}, @option{-Os}.
8482 @item -ffp-contract=@var{style}
8483 @opindex ffp-contract
8484 @option{-ffp-contract=off} disables floating-point expression contraction.
8485 @option{-ffp-contract=fast} enables floating-point expression contraction
8486 such as forming of fused multiply-add operations if the target has
8487 native support for them.
8488 @option{-ffp-contract=on} enables floating-point expression contraction
8489 if allowed by the language standard. This is currently not implemented
8490 and treated equal to @option{-ffp-contract=off}.
8492 The default is @option{-ffp-contract=fast}.
8494 @item -fomit-frame-pointer
8495 @opindex fomit-frame-pointer
8496 Omit the frame pointer in functions that don't need one. This avoids the
8497 instructions to save, set up and restore the frame pointer; on many targets
8498 it also makes an extra register available.
8500 On some targets this flag has no effect because the standard calling sequence
8501 always uses a frame pointer, so it cannot be omitted.
8503 Note that @option{-fno-omit-frame-pointer} doesn't guarantee the frame pointer
8504 is used in all functions. Several targets always omit the frame pointer in
8507 Enabled by default at @option{-O} and higher.
8509 @item -foptimize-sibling-calls
8510 @opindex foptimize-sibling-calls
8511 Optimize sibling and tail recursive calls.
8513 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8515 @item -foptimize-strlen
8516 @opindex foptimize-strlen
8517 Optimize various standard C string functions (e.g.@: @code{strlen},
8518 @code{strchr} or @code{strcpy}) and
8519 their @code{_FORTIFY_SOURCE} counterparts into faster alternatives.
8521 Enabled at levels @option{-O2}, @option{-O3}.
8526 Do not expand any functions inline apart from those marked with
8527 the @code{always_inline} attribute. This is the default when not
8530 Single functions can be exempted from inlining by marking them
8531 with the @code{noinline} attribute.
8533 @item -finline-small-functions
8534 @opindex finline-small-functions
8535 Integrate functions into their callers when their body is smaller than expected
8536 function call code (so overall size of program gets smaller). The compiler
8537 heuristically decides which functions are simple enough to be worth integrating
8538 in this way. This inlining applies to all functions, even those not declared
8541 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8543 @item -findirect-inlining
8544 @opindex findirect-inlining
8545 Inline also indirect calls that are discovered to be known at compile
8546 time thanks to previous inlining. This option has any effect only
8547 when inlining itself is turned on by the @option{-finline-functions}
8548 or @option{-finline-small-functions} options.
8550 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8552 @item -finline-functions
8553 @opindex finline-functions
8554 Consider all functions for inlining, even if they are not declared inline.
8555 The compiler heuristically decides which functions are worth integrating
8558 If all calls to a given function are integrated, and the function is
8559 declared @code{static}, then the function is normally not output as
8560 assembler code in its own right.
8562 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. Also enabled
8563 by @option{-fprofile-use} and @option{-fauto-profile}.
8565 @item -finline-functions-called-once
8566 @opindex finline-functions-called-once
8567 Consider all @code{static} functions called once for inlining into their
8568 caller even if they are not marked @code{inline}. If a call to a given
8569 function is integrated, then the function is not output as assembler code
8572 Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os},
8573 but not @option{-Og}.
8575 @item -fearly-inlining
8576 @opindex fearly-inlining
8577 Inline functions marked by @code{always_inline} and functions whose body seems
8578 smaller than the function call overhead early before doing
8579 @option{-fprofile-generate} instrumentation and real inlining pass. Doing so
8580 makes profiling significantly cheaper and usually inlining faster on programs
8581 having large chains of nested wrapper functions.
8587 Perform interprocedural scalar replacement of aggregates, removal of
8588 unused parameters and replacement of parameters passed by reference
8589 by parameters passed by value.
8591 Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
8593 @item -finline-limit=@var{n}
8594 @opindex finline-limit
8595 By default, GCC limits the size of functions that can be inlined. This flag
8596 allows coarse control of this limit. @var{n} is the size of functions that
8597 can be inlined in number of pseudo instructions.
8599 Inlining is actually controlled by a number of parameters, which may be
8600 specified individually by using @option{--param @var{name}=@var{value}}.
8601 The @option{-finline-limit=@var{n}} option sets some of these parameters
8605 @item max-inline-insns-single
8606 is set to @var{n}/2.
8607 @item max-inline-insns-auto
8608 is set to @var{n}/2.
8611 See below for a documentation of the individual
8612 parameters controlling inlining and for the defaults of these parameters.
8614 @emph{Note:} there may be no value to @option{-finline-limit} that results
8615 in default behavior.
8617 @emph{Note:} pseudo instruction represents, in this particular context, an
8618 abstract measurement of function's size. In no way does it represent a count
8619 of assembly instructions and as such its exact meaning might change from one
8620 release to an another.
8622 @item -fno-keep-inline-dllexport
8623 @opindex fno-keep-inline-dllexport
8624 @opindex fkeep-inline-dllexport
8625 This is a more fine-grained version of @option{-fkeep-inline-functions},
8626 which applies only to functions that are declared using the @code{dllexport}
8627 attribute or declspec. @xref{Function Attributes,,Declaring Attributes of
8630 @item -fkeep-inline-functions
8631 @opindex fkeep-inline-functions
8632 In C, emit @code{static} functions that are declared @code{inline}
8633 into the object file, even if the function has been inlined into all
8634 of its callers. This switch does not affect functions using the
8635 @code{extern inline} extension in GNU C90@. In C++, emit any and all
8636 inline functions into the object file.
8638 @item -fkeep-static-functions
8639 @opindex fkeep-static-functions
8640 Emit @code{static} functions into the object file, even if the function
8643 @item -fkeep-static-consts
8644 @opindex fkeep-static-consts
8645 Emit variables declared @code{static const} when optimization isn't turned
8646 on, even if the variables aren't referenced.
8648 GCC enables this option by default. If you want to force the compiler to
8649 check if a variable is referenced, regardless of whether or not
8650 optimization is turned on, use the @option{-fno-keep-static-consts} option.
8652 @item -fmerge-constants
8653 @opindex fmerge-constants
8654 Attempt to merge identical constants (string constants and floating-point
8655 constants) across compilation units.
8657 This option is the default for optimized compilation if the assembler and
8658 linker support it. Use @option{-fno-merge-constants} to inhibit this
8661 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
8663 @item -fmerge-all-constants
8664 @opindex fmerge-all-constants
8665 Attempt to merge identical constants and identical variables.
8667 This option implies @option{-fmerge-constants}. In addition to
8668 @option{-fmerge-constants} this considers e.g.@: even constant initialized
8669 arrays or initialized constant variables with integral or floating-point
8670 types. Languages like C or C++ require each variable, including multiple
8671 instances of the same variable in recursive calls, to have distinct locations,
8672 so using this option results in non-conforming
8675 @item -fmodulo-sched
8676 @opindex fmodulo-sched
8677 Perform swing modulo scheduling immediately before the first scheduling
8678 pass. This pass looks at innermost loops and reorders their
8679 instructions by overlapping different iterations.
8681 @item -fmodulo-sched-allow-regmoves
8682 @opindex fmodulo-sched-allow-regmoves
8683 Perform more aggressive SMS-based modulo scheduling with register moves
8684 allowed. By setting this flag certain anti-dependences edges are
8685 deleted, which triggers the generation of reg-moves based on the
8686 life-range analysis. This option is effective only with
8687 @option{-fmodulo-sched} enabled.
8689 @item -fno-branch-count-reg
8690 @opindex fno-branch-count-reg
8691 @opindex fbranch-count-reg
8692 Disable the optimization pass that scans for opportunities to use
8693 ``decrement and branch'' instructions on a count register instead of
8694 instruction sequences that decrement a register, compare it against zero, and
8695 then branch based upon the result. This option is only meaningful on
8696 architectures that support such instructions, which include x86, PowerPC,
8697 IA-64 and S/390. Note that the @option{-fno-branch-count-reg} option
8698 doesn't remove the decrement and branch instructions from the generated
8699 instruction stream introduced by other optimization passes.
8701 The default is @option{-fbranch-count-reg} at @option{-O1} and higher,
8702 except for @option{-Og}.
8704 @item -fno-function-cse
8705 @opindex fno-function-cse
8706 @opindex ffunction-cse
8707 Do not put function addresses in registers; make each instruction that
8708 calls a constant function contain the function's address explicitly.
8710 This option results in less efficient code, but some strange hacks
8711 that alter the assembler output may be confused by the optimizations
8712 performed when this option is not used.
8714 The default is @option{-ffunction-cse}
8716 @item -fno-zero-initialized-in-bss
8717 @opindex fno-zero-initialized-in-bss
8718 @opindex fzero-initialized-in-bss
8719 If the target supports a BSS section, GCC by default puts variables that
8720 are initialized to zero into BSS@. This can save space in the resulting
8723 This option turns off this behavior because some programs explicitly
8724 rely on variables going to the data section---e.g., so that the
8725 resulting executable can find the beginning of that section and/or make
8726 assumptions based on that.
8728 The default is @option{-fzero-initialized-in-bss}.
8730 @item -fthread-jumps
8731 @opindex fthread-jumps
8732 Perform optimizations that check to see if a jump branches to a
8733 location where another comparison subsumed by the first is found. If
8734 so, the first branch is redirected to either the destination of the
8735 second branch or a point immediately following it, depending on whether
8736 the condition is known to be true or false.
8738 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8740 @item -fsplit-wide-types
8741 @opindex fsplit-wide-types
8742 When using a type that occupies multiple registers, such as @code{long
8743 long} on a 32-bit system, split the registers apart and allocate them
8744 independently. This normally generates better code for those types,
8745 but may make debugging more difficult.
8747 Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
8750 @item -fsplit-wide-types-early
8751 @opindex fsplit-wide-types-early
8752 Fully split wide types early, instead of very late.
8753 This option has no effect unless @option{-fsplit-wide-types} is turned on.
8755 This is the default on some targets.
8757 @item -fcse-follow-jumps
8758 @opindex fcse-follow-jumps
8759 In common subexpression elimination (CSE), scan through jump instructions
8760 when the target of the jump is not reached by any other path. For
8761 example, when CSE encounters an @code{if} statement with an
8762 @code{else} clause, CSE follows the jump when the condition
8765 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8767 @item -fcse-skip-blocks
8768 @opindex fcse-skip-blocks
8769 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
8770 follow jumps that conditionally skip over blocks. When CSE
8771 encounters a simple @code{if} statement with no else clause,
8772 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
8773 body of the @code{if}.
8775 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8777 @item -frerun-cse-after-loop
8778 @opindex frerun-cse-after-loop
8779 Re-run common subexpression elimination after loop optimizations are
8782 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8786 Perform a global common subexpression elimination pass.
8787 This pass also performs global constant and copy propagation.
8789 @emph{Note:} When compiling a program using computed gotos, a GCC
8790 extension, you may get better run-time performance if you disable
8791 the global common subexpression elimination pass by adding
8792 @option{-fno-gcse} to the command line.
8794 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8798 When @option{-fgcse-lm} is enabled, global common subexpression elimination
8799 attempts to move loads that are only killed by stores into themselves. This
8800 allows a loop containing a load/store sequence to be changed to a load outside
8801 the loop, and a copy/store within the loop.
8803 Enabled by default when @option{-fgcse} is enabled.
8807 When @option{-fgcse-sm} is enabled, a store motion pass is run after
8808 global common subexpression elimination. This pass attempts to move
8809 stores out of loops. When used in conjunction with @option{-fgcse-lm},
8810 loops containing a load/store sequence can be changed to a load before
8811 the loop and a store after the loop.
8813 Not enabled at any optimization level.
8817 When @option{-fgcse-las} is enabled, the global common subexpression
8818 elimination pass eliminates redundant loads that come after stores to the
8819 same memory location (both partial and full redundancies).
8821 Not enabled at any optimization level.
8823 @item -fgcse-after-reload
8824 @opindex fgcse-after-reload
8825 When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8826 pass is performed after reload. The purpose of this pass is to clean up
8829 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
8831 @item -faggressive-loop-optimizations
8832 @opindex faggressive-loop-optimizations
8833 This option tells the loop optimizer to use language constraints to
8834 derive bounds for the number of iterations of a loop. This assumes that
8835 loop code does not invoke undefined behavior by for example causing signed
8836 integer overflows or out-of-bound array accesses. The bounds for the
8837 number of iterations of a loop are used to guide loop unrolling and peeling
8838 and loop exit test optimizations.
8839 This option is enabled by default.
8841 @item -funconstrained-commons
8842 @opindex funconstrained-commons
8843 This option tells the compiler that variables declared in common blocks
8844 (e.g.@: Fortran) may later be overridden with longer trailing arrays. This
8845 prevents certain optimizations that depend on knowing the array bounds.
8847 @item -fcrossjumping
8848 @opindex fcrossjumping
8849 Perform cross-jumping transformation.
8850 This transformation unifies equivalent code and saves code size. The
8851 resulting code may or may not perform better than without cross-jumping.
8853 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8855 @item -fauto-inc-dec
8856 @opindex fauto-inc-dec
8857 Combine increments or decrements of addresses with memory accesses.
8858 This pass is always skipped on architectures that do not have
8859 instructions to support this. Enabled by default at @option{-O} and
8860 higher on architectures that support this.
8864 Perform dead code elimination (DCE) on RTL@.
8865 Enabled by default at @option{-O} and higher.
8869 Perform dead store elimination (DSE) on RTL@.
8870 Enabled by default at @option{-O} and higher.
8872 @item -fif-conversion
8873 @opindex fif-conversion
8874 Attempt to transform conditional jumps into branch-less equivalents. This
8875 includes use of conditional moves, min, max, set flags and abs instructions, and
8876 some tricks doable by standard arithmetics. The use of conditional execution
8877 on chips where it is available is controlled by @option{-fif-conversion2}.
8879 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8880 not with @option{-Og}.
8882 @item -fif-conversion2
8883 @opindex fif-conversion2
8884 Use conditional execution (where available) to transform conditional jumps into
8885 branch-less equivalents.
8887 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}, but
8888 not with @option{-Og}.
8890 @item -fdeclone-ctor-dtor
8891 @opindex fdeclone-ctor-dtor
8892 The C++ ABI requires multiple entry points for constructors and
8893 destructors: one for a base subobject, one for a complete object, and
8894 one for a virtual destructor that calls operator delete afterwards.
8895 For a hierarchy with virtual bases, the base and complete variants are
8896 clones, which means two copies of the function. With this option, the
8897 base and complete variants are changed to be thunks that call a common
8900 Enabled by @option{-Os}.
8902 @item -fdelete-null-pointer-checks
8903 @opindex fdelete-null-pointer-checks
8904 Assume that programs cannot safely dereference null pointers, and that
8905 no code or data element resides at address zero.
8906 This option enables simple constant
8907 folding optimizations at all optimization levels. In addition, other
8908 optimization passes in GCC use this flag to control global dataflow
8909 analyses that eliminate useless checks for null pointers; these assume
8910 that a memory access to address zero always results in a trap, so
8911 that if a pointer is checked after it has already been dereferenced,
8914 Note however that in some environments this assumption is not true.
8915 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
8916 for programs that depend on that behavior.
8918 This option is enabled by default on most targets. On Nios II ELF, it
8919 defaults to off. On AVR, CR16, and MSP430, this option is completely disabled.
8921 Passes that use the dataflow information
8922 are enabled independently at different optimization levels.
8924 @item -fdevirtualize
8925 @opindex fdevirtualize
8926 Attempt to convert calls to virtual functions to direct calls. This
8927 is done both within a procedure and interprocedurally as part of
8928 indirect inlining (@option{-findirect-inlining}) and interprocedural constant
8929 propagation (@option{-fipa-cp}).
8930 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8932 @item -fdevirtualize-speculatively
8933 @opindex fdevirtualize-speculatively
8934 Attempt to convert calls to virtual functions to speculative direct calls.
8935 Based on the analysis of the type inheritance graph, determine for a given call
8936 the set of likely targets. If the set is small, preferably of size 1, change
8937 the call into a conditional deciding between direct and indirect calls. The
8938 speculative calls enable more optimizations, such as inlining. When they seem
8939 useless after further optimization, they are converted back into original form.
8941 @item -fdevirtualize-at-ltrans
8942 @opindex fdevirtualize-at-ltrans
8943 Stream extra information needed for aggressive devirtualization when running
8944 the link-time optimizer in local transformation mode.
8945 This option enables more devirtualization but
8946 significantly increases the size of streamed data. For this reason it is
8947 disabled by default.
8949 @item -fexpensive-optimizations
8950 @opindex fexpensive-optimizations
8951 Perform a number of minor optimizations that are relatively expensive.
8953 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
8957 Attempt to remove redundant extension instructions. This is especially
8958 helpful for the x86-64 architecture, which implicitly zero-extends in 64-bit
8959 registers after writing to their lower 32-bit half.
8961 Enabled for Alpha, AArch64 and x86 at levels @option{-O2},
8962 @option{-O3}, @option{-Os}.
8964 @item -fno-lifetime-dse
8965 @opindex fno-lifetime-dse
8966 @opindex flifetime-dse
8967 In C++ the value of an object is only affected by changes within its
8968 lifetime: when the constructor begins, the object has an indeterminate
8969 value, and any changes during the lifetime of the object are dead when
8970 the object is destroyed. Normally dead store elimination will take
8971 advantage of this; if your code relies on the value of the object
8972 storage persisting beyond the lifetime of the object, you can use this
8973 flag to disable this optimization. To preserve stores before the
8974 constructor starts (e.g.@: because your operator new clears the object
8975 storage) but still treat the object as dead after the destructor you,
8976 can use @option{-flifetime-dse=1}. The default behavior can be
8977 explicitly selected with @option{-flifetime-dse=2}.
8978 @option{-flifetime-dse=0} is equivalent to @option{-fno-lifetime-dse}.
8980 @item -flive-range-shrinkage
8981 @opindex flive-range-shrinkage
8982 Attempt to decrease register pressure through register live range
8983 shrinkage. This is helpful for fast processors with small or moderate
8986 @item -fira-algorithm=@var{algorithm}
8987 @opindex fira-algorithm
8988 Use the specified coloring algorithm for the integrated register
8989 allocator. The @var{algorithm} argument can be @samp{priority}, which
8990 specifies Chow's priority coloring, or @samp{CB}, which specifies
8991 Chaitin-Briggs coloring. Chaitin-Briggs coloring is not implemented
8992 for all architectures, but for those targets that do support it, it is
8993 the default because it generates better code.
8995 @item -fira-region=@var{region}
8996 @opindex fira-region
8997 Use specified regions for the integrated register allocator. The
8998 @var{region} argument should be one of the following:
9003 Use all loops as register allocation regions.
9004 This can give the best results for machines with a small and/or
9005 irregular register set.
9008 Use all loops except for loops with small register pressure
9009 as the regions. This value usually gives
9010 the best results in most cases and for most architectures,
9011 and is enabled by default when compiling with optimization for speed
9012 (@option{-O}, @option{-O2}, @dots{}).
9015 Use all functions as a single region.
9016 This typically results in the smallest code size, and is enabled by default for
9017 @option{-Os} or @option{-O0}.
9021 @item -fira-hoist-pressure
9022 @opindex fira-hoist-pressure
9023 Use IRA to evaluate register pressure in the code hoisting pass for
9024 decisions to hoist expressions. This option usually results in smaller
9025 code, but it can slow the compiler down.
9027 This option is enabled at level @option{-Os} for all targets.
9029 @item -fira-loop-pressure
9030 @opindex fira-loop-pressure
9031 Use IRA to evaluate register pressure in loops for decisions to move
9032 loop invariants. This option usually results in generation
9033 of faster and smaller code on machines with large register files (>= 32
9034 registers), but it can slow the compiler down.
9036 This option is enabled at level @option{-O3} for some targets.
9038 @item -fno-ira-share-save-slots
9039 @opindex fno-ira-share-save-slots
9040 @opindex fira-share-save-slots
9041 Disable sharing of stack slots used for saving call-used hard
9042 registers living through a call. Each hard register gets a
9043 separate stack slot, and as a result function stack frames are
9046 @item -fno-ira-share-spill-slots
9047 @opindex fno-ira-share-spill-slots
9048 @opindex fira-share-spill-slots
9049 Disable sharing of stack slots allocated for pseudo-registers. Each
9050 pseudo-register that does not get a hard register gets a separate
9051 stack slot, and as a result function stack frames are larger.
9055 Enable CFG-sensitive rematerialization in LRA. Instead of loading
9056 values of spilled pseudos, LRA tries to rematerialize (recalculate)
9057 values if it is profitable.
9059 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9061 @item -fdelayed-branch
9062 @opindex fdelayed-branch
9063 If supported for the target machine, attempt to reorder instructions
9064 to exploit instruction slots available after delayed branch
9067 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
9068 but not at @option{-Og}.
9070 @item -fschedule-insns
9071 @opindex fschedule-insns
9072 If supported for the target machine, attempt to reorder instructions to
9073 eliminate execution stalls due to required data being unavailable. This
9074 helps machines that have slow floating point or memory load instructions
9075 by allowing other instructions to be issued until the result of the load
9076 or floating-point instruction is required.
9078 Enabled at levels @option{-O2}, @option{-O3}.
9080 @item -fschedule-insns2
9081 @opindex fschedule-insns2
9082 Similar to @option{-fschedule-insns}, but requests an additional pass of
9083 instruction scheduling after register allocation has been done. This is
9084 especially useful on machines with a relatively small number of
9085 registers and where memory load instructions take more than one cycle.
9087 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9089 @item -fno-sched-interblock
9090 @opindex fno-sched-interblock
9091 @opindex fsched-interblock
9092 Disable instruction scheduling across basic blocks, which
9093 is normally enabled when scheduling before register allocation, i.e.@:
9094 with @option{-fschedule-insns} or at @option{-O2} or higher.
9096 @item -fno-sched-spec
9097 @opindex fno-sched-spec
9098 @opindex fsched-spec
9099 Disable speculative motion of non-load instructions, which
9100 is normally enabled when scheduling before register allocation, i.e.@:
9101 with @option{-fschedule-insns} or at @option{-O2} or higher.
9103 @item -fsched-pressure
9104 @opindex fsched-pressure
9105 Enable register pressure sensitive insn scheduling before register
9106 allocation. This only makes sense when scheduling before register
9107 allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
9108 @option{-O2} or higher. Usage of this option can improve the
9109 generated code and decrease its size by preventing register pressure
9110 increase above the number of available hard registers and subsequent
9111 spills in register allocation.
9113 @item -fsched-spec-load
9114 @opindex fsched-spec-load
9115 Allow speculative motion of some load instructions. This only makes
9116 sense when scheduling before register allocation, i.e.@: with
9117 @option{-fschedule-insns} or at @option{-O2} or higher.
9119 @item -fsched-spec-load-dangerous
9120 @opindex fsched-spec-load-dangerous
9121 Allow speculative motion of more load instructions. This only makes
9122 sense when scheduling before register allocation, i.e.@: with
9123 @option{-fschedule-insns} or at @option{-O2} or higher.
9125 @item -fsched-stalled-insns
9126 @itemx -fsched-stalled-insns=@var{n}
9127 @opindex fsched-stalled-insns
9128 Define how many insns (if any) can be moved prematurely from the queue
9129 of stalled insns into the ready list during the second scheduling pass.
9130 @option{-fno-sched-stalled-insns} means that no insns are moved
9131 prematurely, @option{-fsched-stalled-insns=0} means there is no limit
9132 on how many queued insns can be moved prematurely.
9133 @option{-fsched-stalled-insns} without a value is equivalent to
9134 @option{-fsched-stalled-insns=1}.
9136 @item -fsched-stalled-insns-dep
9137 @itemx -fsched-stalled-insns-dep=@var{n}
9138 @opindex fsched-stalled-insns-dep
9139 Define how many insn groups (cycles) are examined for a dependency
9140 on a stalled insn that is a candidate for premature removal from the queue
9141 of stalled insns. This has an effect only during the second scheduling pass,
9142 and only if @option{-fsched-stalled-insns} is used.
9143 @option{-fno-sched-stalled-insns-dep} is equivalent to
9144 @option{-fsched-stalled-insns-dep=0}.
9145 @option{-fsched-stalled-insns-dep} without a value is equivalent to
9146 @option{-fsched-stalled-insns-dep=1}.
9148 @item -fsched2-use-superblocks
9149 @opindex fsched2-use-superblocks
9150 When scheduling after register allocation, use superblock scheduling.
9151 This allows motion across basic block boundaries,
9152 resulting in faster schedules. This option is experimental, as not all machine
9153 descriptions used by GCC model the CPU closely enough to avoid unreliable
9154 results from the algorithm.
9156 This only makes sense when scheduling after register allocation, i.e.@: with
9157 @option{-fschedule-insns2} or at @option{-O2} or higher.
9159 @item -fsched-group-heuristic
9160 @opindex fsched-group-heuristic
9161 Enable the group heuristic in the scheduler. This heuristic favors
9162 the instruction that belongs to a schedule group. This is enabled
9163 by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9164 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9166 @item -fsched-critical-path-heuristic
9167 @opindex fsched-critical-path-heuristic
9168 Enable the critical-path heuristic in the scheduler. This heuristic favors
9169 instructions on the critical path. This is enabled by default when
9170 scheduling is enabled, i.e.@: with @option{-fschedule-insns}
9171 or @option{-fschedule-insns2} or at @option{-O2} or higher.
9173 @item -fsched-spec-insn-heuristic
9174 @opindex fsched-spec-insn-heuristic
9175 Enable the speculative instruction heuristic in the scheduler. This
9176 heuristic favors speculative instructions with greater dependency weakness.
9177 This is enabled by default when scheduling is enabled, i.e.@:
9178 with @option{-fschedule-insns} or @option{-fschedule-insns2}
9179 or at @option{-O2} or higher.
9181 @item -fsched-rank-heuristic
9182 @opindex fsched-rank-heuristic
9183 Enable the rank heuristic in the scheduler. This heuristic favors
9184 the instruction belonging to a basic block with greater size or frequency.
9185 This is enabled by default when scheduling is enabled, i.e.@:
9186 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9187 at @option{-O2} or higher.
9189 @item -fsched-last-insn-heuristic
9190 @opindex fsched-last-insn-heuristic
9191 Enable the last-instruction heuristic in the scheduler. This heuristic
9192 favors the instruction that is less dependent on the last instruction
9193 scheduled. This is enabled by default when scheduling is enabled,
9194 i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9195 at @option{-O2} or higher.
9197 @item -fsched-dep-count-heuristic
9198 @opindex fsched-dep-count-heuristic
9199 Enable the dependent-count heuristic in the scheduler. This heuristic
9200 favors the instruction that has more instructions depending on it.
9201 This is enabled by default when scheduling is enabled, i.e.@:
9202 with @option{-fschedule-insns} or @option{-fschedule-insns2} or
9203 at @option{-O2} or higher.
9205 @item -freschedule-modulo-scheduled-loops
9206 @opindex freschedule-modulo-scheduled-loops
9207 Modulo scheduling is performed before traditional scheduling. If a loop
9208 is modulo scheduled, later scheduling passes may change its schedule.
9209 Use this option to control that behavior.
9211 @item -fselective-scheduling
9212 @opindex fselective-scheduling
9213 Schedule instructions using selective scheduling algorithm. Selective
9214 scheduling runs instead of the first scheduler pass.
9216 @item -fselective-scheduling2
9217 @opindex fselective-scheduling2
9218 Schedule instructions using selective scheduling algorithm. Selective
9219 scheduling runs instead of the second scheduler pass.
9221 @item -fsel-sched-pipelining
9222 @opindex fsel-sched-pipelining
9223 Enable software pipelining of innermost loops during selective scheduling.
9224 This option has no effect unless one of @option{-fselective-scheduling} or
9225 @option{-fselective-scheduling2} is turned on.
9227 @item -fsel-sched-pipelining-outer-loops
9228 @opindex fsel-sched-pipelining-outer-loops
9229 When pipelining loops during selective scheduling, also pipeline outer loops.
9230 This option has no effect unless @option{-fsel-sched-pipelining} is turned on.
9232 @item -fsemantic-interposition
9233 @opindex fsemantic-interposition
9234 Some object formats, like ELF, allow interposing of symbols by the
9236 This means that for symbols exported from the DSO, the compiler cannot perform
9237 interprocedural propagation, inlining and other optimizations in anticipation
9238 that the function or variable in question may change. While this feature is
9239 useful, for example, to rewrite memory allocation functions by a debugging
9240 implementation, it is expensive in the terms of code quality.
9241 With @option{-fno-semantic-interposition} the compiler assumes that
9242 if interposition happens for functions the overwriting function will have
9243 precisely the same semantics (and side effects).
9244 Similarly if interposition happens
9245 for variables, the constructor of the variable will be the same. The flag
9246 has no effect for functions explicitly declared inline
9247 (where it is never allowed for interposition to change semantics)
9248 and for symbols explicitly declared weak.
9251 @opindex fshrink-wrap
9252 Emit function prologues only before parts of the function that need it,
9253 rather than at the top of the function. This flag is enabled by default at
9254 @option{-O} and higher.
9256 @item -fshrink-wrap-separate
9257 @opindex fshrink-wrap-separate
9258 Shrink-wrap separate parts of the prologue and epilogue separately, so that
9259 those parts are only executed when needed.
9260 This option is on by default, but has no effect unless @option{-fshrink-wrap}
9261 is also turned on and the target supports this.
9263 @item -fcaller-saves
9264 @opindex fcaller-saves
9265 Enable allocation of values to registers that are clobbered by
9266 function calls, by emitting extra instructions to save and restore the
9267 registers around such calls. Such allocation is done only when it
9268 seems to result in better code.
9270 This option is always enabled by default on certain machines, usually
9271 those which have no call-preserved registers to use instead.
9273 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9275 @item -fcombine-stack-adjustments
9276 @opindex fcombine-stack-adjustments
9277 Tracks stack adjustments (pushes and pops) and stack memory references
9278 and then tries to find ways to combine them.
9280 Enabled by default at @option{-O1} and higher.
9284 Use caller save registers for allocation if those registers are not used by
9285 any called function. In that case it is not necessary to save and restore
9286 them around calls. This is only possible if called functions are part of
9287 same compilation unit as current function and they are compiled before it.
9289 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}, however the option
9290 is disabled if generated code will be instrumented for profiling
9291 (@option{-p}, or @option{-pg}) or if callee's register usage cannot be known
9292 exactly (this happens on targets that do not expose prologues
9293 and epilogues in RTL).
9295 @item -fconserve-stack
9296 @opindex fconserve-stack
9297 Attempt to minimize stack usage. The compiler attempts to use less
9298 stack space, even if that makes the program slower. This option
9299 implies setting the @option{large-stack-frame} parameter to 100
9300 and the @option{large-stack-frame-growth} parameter to 400.
9302 @item -ftree-reassoc
9303 @opindex ftree-reassoc
9304 Perform reassociation on trees. This flag is enabled by default
9305 at @option{-O} and higher.
9307 @item -fcode-hoisting
9308 @opindex fcode-hoisting
9309 Perform code hoisting. Code hoisting tries to move the
9310 evaluation of expressions executed on all paths to the function exit
9311 as early as possible. This is especially useful as a code size
9312 optimization, but it often helps for code speed as well.
9313 This flag is enabled by default at @option{-O2} and higher.
9317 Perform partial redundancy elimination (PRE) on trees. This flag is
9318 enabled by default at @option{-O2} and @option{-O3}.
9320 @item -ftree-partial-pre
9321 @opindex ftree-partial-pre
9322 Make partial redundancy elimination (PRE) more aggressive. This flag is
9323 enabled by default at @option{-O3}.
9325 @item -ftree-forwprop
9326 @opindex ftree-forwprop
9327 Perform forward propagation on trees. This flag is enabled by default
9328 at @option{-O} and higher.
9332 Perform full redundancy elimination (FRE) on trees. The difference
9333 between FRE and PRE is that FRE only considers expressions
9334 that are computed on all paths leading to the redundant computation.
9335 This analysis is faster than PRE, though it exposes fewer redundancies.
9336 This flag is enabled by default at @option{-O} and higher.
9338 @item -ftree-phiprop
9339 @opindex ftree-phiprop
9340 Perform hoisting of loads from conditional pointers on trees. This
9341 pass is enabled by default at @option{-O} and higher.
9343 @item -fhoist-adjacent-loads
9344 @opindex fhoist-adjacent-loads
9345 Speculatively hoist loads from both branches of an if-then-else if the
9346 loads are from adjacent locations in the same structure and the target
9347 architecture has a conditional move instruction. This flag is enabled
9348 by default at @option{-O2} and higher.
9350 @item -ftree-copy-prop
9351 @opindex ftree-copy-prop
9352 Perform copy propagation on trees. This pass eliminates unnecessary
9353 copy operations. This flag is enabled by default at @option{-O} and
9356 @item -fipa-pure-const
9357 @opindex fipa-pure-const
9358 Discover which functions are pure or constant.
9359 Enabled by default at @option{-O} and higher.
9361 @item -fipa-reference
9362 @opindex fipa-reference
9363 Discover which static variables do not escape the
9365 Enabled by default at @option{-O} and higher.
9367 @item -fipa-reference-addressable
9368 @opindex fipa-reference-addressable
9369 Discover read-only, write-only and non-addressable static variables.
9370 Enabled by default at @option{-O} and higher.
9372 @item -fipa-stack-alignment
9373 @opindex fipa-stack-alignment
9374 Reduce stack alignment on call sites if possible.
9379 Perform interprocedural pointer analysis and interprocedural modification
9380 and reference analysis. This option can cause excessive memory and
9381 compile-time usage on large compilation units. It is not enabled by
9382 default at any optimization level.
9385 @opindex fipa-profile
9386 Perform interprocedural profile propagation. The functions called only from
9387 cold functions are marked as cold. Also functions executed once (such as
9388 @code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
9389 functions and loop less parts of functions executed once are then optimized for
9391 Enabled by default at @option{-O} and higher.
9395 Perform interprocedural constant propagation.
9396 This optimization analyzes the program to determine when values passed
9397 to functions are constants and then optimizes accordingly.
9398 This optimization can substantially increase performance
9399 if the application has constants passed to functions.
9400 This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
9401 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9403 @item -fipa-cp-clone
9404 @opindex fipa-cp-clone
9405 Perform function cloning to make interprocedural constant propagation stronger.
9406 When enabled, interprocedural constant propagation performs function cloning
9407 when externally visible function can be called with constant arguments.
9408 Because this optimization can create multiple copies of functions,
9409 it may significantly increase code size
9410 (see @option{--param ipcp-unit-growth=@var{value}}).
9411 This flag is enabled by default at @option{-O3}.
9412 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9415 @opindex fipa-bit-cp
9416 When enabled, perform interprocedural bitwise constant
9417 propagation. This flag is enabled by default at @option{-O2} and
9418 by @option{-fprofile-use} and @option{-fauto-profile}.
9419 It requires that @option{-fipa-cp} is enabled.
9423 When enabled, perform interprocedural propagation of value
9424 ranges. This flag is enabled by default at @option{-O2}. It requires
9425 that @option{-fipa-cp} is enabled.
9429 Perform Identical Code Folding for functions and read-only variables.
9430 The optimization reduces code size and may disturb unwind stacks by replacing
9431 a function by equivalent one with a different name. The optimization works
9432 more effectively with link-time optimization enabled.
9434 Although the behavior is similar to the Gold Linker's ICF optimization, GCC ICF
9435 works on different levels and thus the optimizations are not same - there are
9436 equivalences that are found only by GCC and equivalences found only by Gold.
9438 This flag is enabled by default at @option{-O2} and @option{-Os}.
9440 @item -flive-patching=@var{level}
9441 @opindex flive-patching
9442 Control GCC's optimizations to produce output suitable for live-patching.
9444 If the compiler's optimization uses a function's body or information extracted
9445 from its body to optimize/change another function, the latter is called an
9446 impacted function of the former. If a function is patched, its impacted
9447 functions should be patched too.
9449 The impacted functions are determined by the compiler's interprocedural
9450 optimizations. For example, a caller is impacted when inlining a function
9452 cloning a function and changing its caller to call this new clone,
9453 or extracting a function's pureness/constness information to optimize
9454 its direct or indirect callers, etc.
9456 Usually, the more IPA optimizations enabled, the larger the number of
9457 impacted functions for each function. In order to control the number of
9458 impacted functions and more easily compute the list of impacted function,
9459 IPA optimizations can be partially enabled at two different levels.
9461 The @var{level} argument should be one of the following:
9467 Only enable inlining and cloning optimizations, which includes inlining,
9468 cloning, interprocedural scalar replacement of aggregates and partial inlining.
9469 As a result, when patching a function, all its callers and its clones'
9470 callers are impacted, therefore need to be patched as well.
9472 @option{-flive-patching=inline-clone} disables the following optimization flags:
9473 @gccoptlist{-fwhole-program -fipa-pta -fipa-reference -fipa-ra @gol
9474 -fipa-icf -fipa-icf-functions -fipa-icf-variables @gol
9475 -fipa-bit-cp -fipa-vrp -fipa-pure-const -fipa-reference-addressable @gol
9476 -fipa-stack-alignment}
9478 @item inline-only-static
9480 Only enable inlining of static functions.
9481 As a result, when patching a static function, all its callers are impacted
9482 and so need to be patched as well.
9484 In addition to all the flags that @option{-flive-patching=inline-clone}
9486 @option{-flive-patching=inline-only-static} disables the following additional
9488 @gccoptlist{-fipa-cp-clone -fipa-sra -fpartial-inlining -fipa-cp}
9492 When @option{-flive-patching} is specified without any value, the default value
9493 is @var{inline-clone}.
9495 This flag is disabled by default.
9497 Note that @option{-flive-patching} is not supported with link-time optimization
9500 @item -fisolate-erroneous-paths-dereference
9501 @opindex fisolate-erroneous-paths-dereference
9502 Detect paths that trigger erroneous or undefined behavior due to
9503 dereferencing a null pointer. Isolate those paths from the main control
9504 flow and turn the statement with erroneous or undefined behavior into a trap.
9505 This flag is enabled by default at @option{-O2} and higher and depends on
9506 @option{-fdelete-null-pointer-checks} also being enabled.
9508 @item -fisolate-erroneous-paths-attribute
9509 @opindex fisolate-erroneous-paths-attribute
9510 Detect paths that trigger erroneous or undefined behavior due to a null value
9511 being used in a way forbidden by a @code{returns_nonnull} or @code{nonnull}
9512 attribute. Isolate those paths from the main control flow and turn the
9513 statement with erroneous or undefined behavior into a trap. This is not
9514 currently enabled, but may be enabled by @option{-O2} in the future.
9518 Perform forward store motion on trees. This flag is
9519 enabled by default at @option{-O} and higher.
9521 @item -ftree-bit-ccp
9522 @opindex ftree-bit-ccp
9523 Perform sparse conditional bit constant propagation on trees and propagate
9524 pointer alignment information.
9525 This pass only operates on local scalar variables and is enabled by default
9526 at @option{-O1} and higher, except for @option{-Og}.
9527 It requires that @option{-ftree-ccp} is enabled.
9531 Perform sparse conditional constant propagation (CCP) on trees. This
9532 pass only operates on local scalar variables and is enabled by default
9533 at @option{-O} and higher.
9535 @item -fssa-backprop
9536 @opindex fssa-backprop
9537 Propagate information about uses of a value up the definition chain
9538 in order to simplify the definitions. For example, this pass strips
9539 sign operations if the sign of a value never matters. The flag is
9540 enabled by default at @option{-O} and higher.
9543 @opindex fssa-phiopt
9544 Perform pattern matching on SSA PHI nodes to optimize conditional
9545 code. This pass is enabled by default at @option{-O1} and higher,
9546 except for @option{-Og}.
9548 @item -ftree-switch-conversion
9549 @opindex ftree-switch-conversion
9550 Perform conversion of simple initializations in a switch to
9551 initializations from a scalar array. This flag is enabled by default
9552 at @option{-O2} and higher.
9554 @item -ftree-tail-merge
9555 @opindex ftree-tail-merge
9556 Look for identical code sequences. When found, replace one with a jump to the
9557 other. This optimization is known as tail merging or cross jumping. This flag
9558 is enabled by default at @option{-O2} and higher. The compilation time
9560 be limited using @option{max-tail-merge-comparisons} parameter and
9561 @option{max-tail-merge-iterations} parameter.
9565 Perform dead code elimination (DCE) on trees. This flag is enabled by
9566 default at @option{-O} and higher.
9568 @item -ftree-builtin-call-dce
9569 @opindex ftree-builtin-call-dce
9570 Perform conditional dead code elimination (DCE) for calls to built-in functions
9571 that may set @code{errno} but are otherwise free of side effects. This flag is
9572 enabled by default at @option{-O2} and higher if @option{-Os} is not also
9575 @item -ffinite-loops
9576 @opindex ffinite-loops
9577 @opindex fno-finite-loops
9578 Assume that a loop with an exit will eventually take the exit and not loop
9579 indefinitely. This allows the compiler to remove loops that otherwise have
9580 no side-effects, not considering eventual endless looping as such.
9582 This option is enabled by default at @option{-O2}.
9584 @item -ftree-dominator-opts
9585 @opindex ftree-dominator-opts
9586 Perform a variety of simple scalar cleanups (constant/copy
9587 propagation, redundancy elimination, range propagation and expression
9588 simplification) based on a dominator tree traversal. This also
9589 performs jump threading (to reduce jumps to jumps). This flag is
9590 enabled by default at @option{-O} and higher.
9594 Perform dead store elimination (DSE) on trees. A dead store is a store into
9595 a memory location that is later overwritten by another store without
9596 any intervening loads. In this case the earlier store can be deleted. This
9597 flag is enabled by default at @option{-O} and higher.
9601 Perform loop header copying on trees. This is beneficial since it increases
9602 effectiveness of code motion optimizations. It also saves one jump. This flag
9603 is enabled by default at @option{-O} and higher. It is not enabled
9604 for @option{-Os}, since it usually increases code size.
9606 @item -ftree-loop-optimize
9607 @opindex ftree-loop-optimize
9608 Perform loop optimizations on trees. This flag is enabled by default
9609 at @option{-O} and higher.
9611 @item -ftree-loop-linear
9612 @itemx -floop-strip-mine
9614 @opindex ftree-loop-linear
9615 @opindex floop-strip-mine
9616 @opindex floop-block
9617 Perform loop nest optimizations. Same as
9618 @option{-floop-nest-optimize}. To use this code transformation, GCC has
9619 to be configured with @option{--with-isl} to enable the Graphite loop
9620 transformation infrastructure.
9622 @item -fgraphite-identity
9623 @opindex fgraphite-identity
9624 Enable the identity transformation for graphite. For every SCoP we generate
9625 the polyhedral representation and transform it back to gimple. Using
9626 @option{-fgraphite-identity} we can check the costs or benefits of the
9627 GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
9628 are also performed by the code generator isl, like index splitting and
9629 dead code elimination in loops.
9631 @item -floop-nest-optimize
9632 @opindex floop-nest-optimize
9633 Enable the isl based loop nest optimizer. This is a generic loop nest
9634 optimizer based on the Pluto optimization algorithms. It calculates a loop
9635 structure optimized for data-locality and parallelism. This option
9638 @item -floop-parallelize-all
9639 @opindex floop-parallelize-all
9640 Use the Graphite data dependence analysis to identify loops that can
9641 be parallelized. Parallelize all the loops that can be analyzed to
9642 not contain loop carried dependences without checking that it is
9643 profitable to parallelize the loops.
9645 @item -ftree-coalesce-vars
9646 @opindex ftree-coalesce-vars
9647 While transforming the program out of the SSA representation, attempt to
9648 reduce copying by coalescing versions of different user-defined
9649 variables, instead of just compiler temporaries. This may severely
9650 limit the ability to debug an optimized program compiled with
9651 @option{-fno-var-tracking-assignments}. In the negated form, this flag
9652 prevents SSA coalescing of user variables. This option is enabled by
9653 default if optimization is enabled, and it does very little otherwise.
9655 @item -ftree-loop-if-convert
9656 @opindex ftree-loop-if-convert
9657 Attempt to transform conditional jumps in the innermost loops to
9658 branch-less equivalents. The intent is to remove control-flow from
9659 the innermost loops in order to improve the ability of the
9660 vectorization pass to handle these loops. This is enabled by default
9661 if vectorization is enabled.
9663 @item -ftree-loop-distribution
9664 @opindex ftree-loop-distribution
9665 Perform loop distribution. This flag can improve cache performance on
9666 big loop bodies and allow further loop optimizations, like
9667 parallelization or vectorization, to take place. For example, the loop
9683 This flag is enabled by default at @option{-O3}.
9684 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9686 @item -ftree-loop-distribute-patterns
9687 @opindex ftree-loop-distribute-patterns
9688 Perform loop distribution of patterns that can be code generated with
9689 calls to a library. This flag is enabled by default at @option{-O3}, and
9690 by @option{-fprofile-use} and @option{-fauto-profile}.
9692 This pass distributes the initialization loops and generates a call to
9693 memset zero. For example, the loop
9709 and the initialization loop is transformed into a call to memset zero.
9710 This flag is enabled by default at @option{-O3}.
9711 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9713 @item -floop-interchange
9714 @opindex floop-interchange
9715 Perform loop interchange outside of graphite. This flag can improve cache
9716 performance on loop nest and allow further loop optimizations, like
9717 vectorization, to take place. For example, the loop
9719 for (int i = 0; i < N; i++)
9720 for (int j = 0; j < N; j++)
9721 for (int k = 0; k < N; k++)
9722 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9726 for (int i = 0; i < N; i++)
9727 for (int k = 0; k < N; k++)
9728 for (int j = 0; j < N; j++)
9729 c[i][j] = c[i][j] + a[i][k]*b[k][j];
9731 This flag is enabled by default at @option{-O3}.
9732 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9734 @item -floop-unroll-and-jam
9735 @opindex floop-unroll-and-jam
9736 Apply unroll and jam transformations on feasible loops. In a loop
9737 nest this unrolls the outer loop by some factor and fuses the resulting
9738 multiple inner loops. This flag is enabled by default at @option{-O3}.
9739 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9741 @item -ftree-loop-im
9742 @opindex ftree-loop-im
9743 Perform loop invariant motion on trees. This pass moves only invariants that
9744 are hard to handle at RTL level (function calls, operations that expand to
9745 nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
9746 operands of conditions that are invariant out of the loop, so that we can use
9747 just trivial invariantness analysis in loop unswitching. The pass also includes
9750 @item -ftree-loop-ivcanon
9751 @opindex ftree-loop-ivcanon
9752 Create a canonical counter for number of iterations in loops for which
9753 determining number of iterations requires complicated analysis. Later
9754 optimizations then may determine the number easily. Useful especially
9755 in connection with unrolling.
9757 @item -ftree-scev-cprop
9758 @opindex ftree-scev-cprop
9759 Perform final value replacement. If a variable is modified in a loop
9760 in such a way that its value when exiting the loop can be determined using
9761 only its initial value and the number of loop iterations, replace uses of
9762 the final value by such a computation, provided it is sufficiently cheap.
9763 This reduces data dependencies and may allow further simplifications.
9764 Enabled by default at @option{-O} and higher.
9768 Perform induction variable optimizations (strength reduction, induction
9769 variable merging and induction variable elimination) on trees.
9771 @item -ftree-parallelize-loops=n
9772 @opindex ftree-parallelize-loops
9773 Parallelize loops, i.e., split their iteration space to run in n threads.
9774 This is only possible for loops whose iterations are independent
9775 and can be arbitrarily reordered. The optimization is only
9776 profitable on multiprocessor machines, for loops that are CPU-intensive,
9777 rather than constrained e.g.@: by memory bandwidth. This option
9778 implies @option{-pthread}, and thus is only supported on targets
9779 that have support for @option{-pthread}.
9783 Perform function-local points-to analysis on trees. This flag is
9784 enabled by default at @option{-O1} and higher, except for @option{-Og}.
9788 Perform scalar replacement of aggregates. This pass replaces structure
9789 references with scalars to prevent committing structures to memory too
9790 early. This flag is enabled by default at @option{-O1} and higher,
9791 except for @option{-Og}.
9793 @item -fstore-merging
9794 @opindex fstore-merging
9795 Perform merging of narrow stores to consecutive memory addresses. This pass
9796 merges contiguous stores of immediate values narrower than a word into fewer
9797 wider stores to reduce the number of instructions. This is enabled by default
9798 at @option{-O2} and higher as well as @option{-Os}.
9802 Perform temporary expression replacement during the SSA->normal phase. Single
9803 use/single def temporaries are replaced at their use location with their
9804 defining expression. This results in non-GIMPLE code, but gives the expanders
9805 much more complex trees to work on resulting in better RTL generation. This is
9806 enabled by default at @option{-O} and higher.
9810 Perform straight-line strength reduction on trees. This recognizes related
9811 expressions involving multiplications and replaces them by less expensive
9812 calculations when possible. This is enabled by default at @option{-O} and
9815 @item -ftree-vectorize
9816 @opindex ftree-vectorize
9817 Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
9818 and @option{-ftree-slp-vectorize} if not explicitly specified.
9820 @item -ftree-loop-vectorize
9821 @opindex ftree-loop-vectorize
9822 Perform loop vectorization on trees. This flag is enabled by default at
9823 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9824 and @option{-fauto-profile}.
9826 @item -ftree-slp-vectorize
9827 @opindex ftree-slp-vectorize
9828 Perform basic block vectorization on trees. This flag is enabled by default at
9829 @option{-O3} and by @option{-ftree-vectorize}, @option{-fprofile-use},
9830 and @option{-fauto-profile}.
9832 @item -fvect-cost-model=@var{model}
9833 @opindex fvect-cost-model
9834 Alter the cost model used for vectorization. The @var{model} argument
9835 should be one of @samp{unlimited}, @samp{dynamic} or @samp{cheap}.
9836 With the @samp{unlimited} model the vectorized code-path is assumed
9837 to be profitable while with the @samp{dynamic} model a runtime check
9838 guards the vectorized code-path to enable it only for iteration
9839 counts that will likely execute faster than when executing the original
9840 scalar loop. The @samp{cheap} model disables vectorization of
9841 loops where doing so would be cost prohibitive for example due to
9842 required runtime checks for data dependence or alignment but otherwise
9843 is equal to the @samp{dynamic} model.
9844 The default cost model depends on other optimization flags and is
9845 either @samp{dynamic} or @samp{cheap}.
9847 @item -fsimd-cost-model=@var{model}
9848 @opindex fsimd-cost-model
9849 Alter the cost model used for vectorization of loops marked with the OpenMP
9850 simd directive. The @var{model} argument should be one of
9851 @samp{unlimited}, @samp{dynamic}, @samp{cheap}. All values of @var{model}
9852 have the same meaning as described in @option{-fvect-cost-model} and by
9853 default a cost model defined with @option{-fvect-cost-model} is used.
9857 Perform Value Range Propagation on trees. This is similar to the
9858 constant propagation pass, but instead of values, ranges of values are
9859 propagated. This allows the optimizers to remove unnecessary range
9860 checks like array bound checks and null pointer checks. This is
9861 enabled by default at @option{-O2} and higher. Null pointer check
9862 elimination is only done if @option{-fdelete-null-pointer-checks} is
9866 @opindex fsplit-paths
9867 Split paths leading to loop backedges. This can improve dead code
9868 elimination and common subexpression elimination. This is enabled by
9869 default at @option{-O3} and above.
9871 @item -fsplit-ivs-in-unroller
9872 @opindex fsplit-ivs-in-unroller
9873 Enables expression of values of induction variables in later iterations
9874 of the unrolled loop using the value in the first iteration. This breaks
9875 long dependency chains, thus improving efficiency of the scheduling passes.
9877 A combination of @option{-fweb} and CSE is often sufficient to obtain the
9878 same effect. However, that is not reliable in cases where the loop body
9879 is more complicated than a single basic block. It also does not work at all
9880 on some architectures due to restrictions in the CSE pass.
9882 This optimization is enabled by default.
9884 @item -fvariable-expansion-in-unroller
9885 @opindex fvariable-expansion-in-unroller
9886 With this option, the compiler creates multiple copies of some
9887 local variables when unrolling a loop, which can result in superior code.
9889 This optimization is enabled by default for PowerPC targets, but disabled
9890 by default otherwise.
9892 @item -fpartial-inlining
9893 @opindex fpartial-inlining
9894 Inline parts of functions. This option has any effect only
9895 when inlining itself is turned on by the @option{-finline-functions}
9896 or @option{-finline-small-functions} options.
9898 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9900 @item -fpredictive-commoning
9901 @opindex fpredictive-commoning
9902 Perform predictive commoning optimization, i.e., reusing computations
9903 (especially memory loads and stores) performed in previous
9904 iterations of loops.
9906 This option is enabled at level @option{-O3}.
9907 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
9909 @item -fprefetch-loop-arrays
9910 @opindex fprefetch-loop-arrays
9911 If supported by the target machine, generate instructions to prefetch
9912 memory to improve the performance of loops that access large arrays.
9914 This option may generate better or worse code; results are highly
9915 dependent on the structure of loops within the source code.
9917 Disabled at level @option{-Os}.
9919 @item -fno-printf-return-value
9920 @opindex fno-printf-return-value
9921 @opindex fprintf-return-value
9922 Do not substitute constants for known return value of formatted output
9923 functions such as @code{sprintf}, @code{snprintf}, @code{vsprintf}, and
9924 @code{vsnprintf} (but not @code{printf} of @code{fprintf}). This
9925 transformation allows GCC to optimize or even eliminate branches based
9926 on the known return value of these functions called with arguments that
9927 are either constant, or whose values are known to be in a range that
9928 makes determining the exact return value possible. For example, when
9929 @option{-fprintf-return-value} is in effect, both the branch and the
9930 body of the @code{if} statement (but not the call to @code{snprint})
9931 can be optimized away when @code{i} is a 32-bit or smaller integer
9932 because the return value is guaranteed to be at most 8.
9936 if (snprintf (buf, "%08x", i) >= sizeof buf)
9940 The @option{-fprintf-return-value} option relies on other optimizations
9941 and yields best results with @option{-O2} and above. It works in tandem
9942 with the @option{-Wformat-overflow} and @option{-Wformat-truncation}
9943 options. The @option{-fprintf-return-value} option is enabled by default.
9946 @itemx -fno-peephole2
9947 @opindex fno-peephole
9949 @opindex fno-peephole2
9951 Disable any machine-specific peephole optimizations. The difference
9952 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
9953 are implemented in the compiler; some targets use one, some use the
9954 other, a few use both.
9956 @option{-fpeephole} is enabled by default.
9957 @option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
9959 @item -fno-guess-branch-probability
9960 @opindex fno-guess-branch-probability
9961 @opindex fguess-branch-probability
9962 Do not guess branch probabilities using heuristics.
9964 GCC uses heuristics to guess branch probabilities if they are
9965 not provided by profiling feedback (@option{-fprofile-arcs}). These
9966 heuristics are based on the control flow graph. If some branch probabilities
9967 are specified by @code{__builtin_expect}, then the heuristics are
9968 used to guess branch probabilities for the rest of the control flow graph,
9969 taking the @code{__builtin_expect} info into account. The interactions
9970 between the heuristics and @code{__builtin_expect} can be complex, and in
9971 some cases, it may be useful to disable the heuristics so that the effects
9972 of @code{__builtin_expect} are easier to understand.
9974 It is also possible to specify expected probability of the expression
9975 with @code{__builtin_expect_with_probability} built-in function.
9977 The default is @option{-fguess-branch-probability} at levels
9978 @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9980 @item -freorder-blocks
9981 @opindex freorder-blocks
9982 Reorder basic blocks in the compiled function in order to reduce number of
9983 taken branches and improve code locality.
9985 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
9987 @item -freorder-blocks-algorithm=@var{algorithm}
9988 @opindex freorder-blocks-algorithm
9989 Use the specified algorithm for basic block reordering. The
9990 @var{algorithm} argument can be @samp{simple}, which does not increase
9991 code size (except sometimes due to secondary effects like alignment),
9992 or @samp{stc}, the ``software trace cache'' algorithm, which tries to
9993 put all often executed code together, minimizing the number of branches
9994 executed by making extra copies of code.
9996 The default is @samp{simple} at levels @option{-O}, @option{-Os}, and
9997 @samp{stc} at levels @option{-O2}, @option{-O3}.
9999 @item -freorder-blocks-and-partition
10000 @opindex freorder-blocks-and-partition
10001 In addition to reordering basic blocks in the compiled function, in order
10002 to reduce number of taken branches, partitions hot and cold basic blocks
10003 into separate sections of the assembly and @file{.o} files, to improve
10004 paging and cache locality performance.
10006 This optimization is automatically turned off in the presence of
10007 exception handling or unwind tables (on targets using setjump/longjump or target specific scheme), for linkonce sections, for functions with a user-defined
10008 section attribute and on any architecture that does not support named
10009 sections. When @option{-fsplit-stack} is used this option is not
10010 enabled by default (to avoid linker errors), but may be enabled
10011 explicitly (if using a working linker).
10013 Enabled for x86 at levels @option{-O2}, @option{-O3}, @option{-Os}.
10015 @item -freorder-functions
10016 @opindex freorder-functions
10017 Reorder functions in the object file in order to
10018 improve code locality. This is implemented by using special
10019 subsections @code{.text.hot} for most frequently executed functions and
10020 @code{.text.unlikely} for unlikely executed functions. Reordering is done by
10021 the linker so object file format must support named sections and linker must
10022 place them in a reasonable way.
10024 This option isn't effective unless you either provide profile feedback
10025 (see @option{-fprofile-arcs} for details) or manually annotate functions with
10026 @code{hot} or @code{cold} attributes (@pxref{Common Function Attributes}).
10028 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10030 @item -fstrict-aliasing
10031 @opindex fstrict-aliasing
10032 Allow the compiler to assume the strictest aliasing rules applicable to
10033 the language being compiled. For C (and C++), this activates
10034 optimizations based on the type of expressions. In particular, an
10035 object of one type is assumed never to reside at the same address as an
10036 object of a different type, unless the types are almost the same. For
10037 example, an @code{unsigned int} can alias an @code{int}, but not a
10038 @code{void*} or a @code{double}. A character type may alias any other
10041 @anchor{Type-punning}Pay special attention to code like this:
10054 The practice of reading from a different union member than the one most
10055 recently written to (called ``type-punning'') is common. Even with
10056 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
10057 is accessed through the union type. So, the code above works as
10058 expected. @xref{Structures unions enumerations and bit-fields
10059 implementation}. However, this code might not:
10070 Similarly, access by taking the address, casting the resulting pointer
10071 and dereferencing the result has undefined behavior, even if the cast
10072 uses a union type, e.g.:
10076 return ((union a_union *) &d)->i;
10080 The @option{-fstrict-aliasing} option is enabled at levels
10081 @option{-O2}, @option{-O3}, @option{-Os}.
10083 @item -falign-functions
10084 @itemx -falign-functions=@var{n}
10085 @itemx -falign-functions=@var{n}:@var{m}
10086 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}
10087 @itemx -falign-functions=@var{n}:@var{m}:@var{n2}:@var{m2}
10088 @opindex falign-functions
10089 Align the start of functions to the next power-of-two greater than
10090 @var{n}, skipping up to @var{m}-1 bytes. This ensures that at least
10091 the first @var{m} bytes of the function can be fetched by the CPU
10092 without crossing an @var{n}-byte alignment boundary.
10094 If @var{m} is not specified, it defaults to @var{n}.
10096 Examples: @option{-falign-functions=32} aligns functions to the next
10097 32-byte boundary, @option{-falign-functions=24} aligns to the next
10098 32-byte boundary only if this can be done by skipping 23 bytes or less,
10099 @option{-falign-functions=32:7} aligns to the next
10100 32-byte boundary only if this can be done by skipping 6 bytes or less.
10102 The second pair of @var{n2}:@var{m2} values allows you to specify
10103 a secondary alignment: @option{-falign-functions=64:7:32:3} aligns to
10104 the next 64-byte boundary if this can be done by skipping 6 bytes or less,
10105 otherwise aligns to the next 32-byte boundary if this can be done
10106 by skipping 2 bytes or less.
10107 If @var{m2} is not specified, it defaults to @var{n2}.
10109 Some assemblers only support this flag when @var{n} is a power of two;
10110 in that case, it is rounded up.
10112 @option{-fno-align-functions} and @option{-falign-functions=1} are
10113 equivalent and mean that functions are not aligned.
10115 If @var{n} is not specified or is zero, use a machine-dependent default.
10116 The maximum allowed @var{n} option value is 65536.
10118 Enabled at levels @option{-O2}, @option{-O3}.
10120 @item -flimit-function-alignment
10121 If this option is enabled, the compiler tries to avoid unnecessarily
10122 overaligning functions. It attempts to instruct the assembler to align
10123 by the amount specified by @option{-falign-functions}, but not to
10124 skip more bytes than the size of the function.
10126 @item -falign-labels
10127 @itemx -falign-labels=@var{n}
10128 @itemx -falign-labels=@var{n}:@var{m}
10129 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}
10130 @itemx -falign-labels=@var{n}:@var{m}:@var{n2}:@var{m2}
10131 @opindex falign-labels
10132 Align all branch targets to a power-of-two boundary.
10134 Parameters of this option are analogous to the @option{-falign-functions} option.
10135 @option{-fno-align-labels} and @option{-falign-labels=1} are
10136 equivalent and mean that labels are not aligned.
10138 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
10139 are greater than this value, then their values are used instead.
10141 If @var{n} is not specified or is zero, use a machine-dependent default
10142 which is very likely to be @samp{1}, meaning no alignment.
10143 The maximum allowed @var{n} option value is 65536.
10145 Enabled at levels @option{-O2}, @option{-O3}.
10147 @item -falign-loops
10148 @itemx -falign-loops=@var{n}
10149 @itemx -falign-loops=@var{n}:@var{m}
10150 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}
10151 @itemx -falign-loops=@var{n}:@var{m}:@var{n2}:@var{m2}
10152 @opindex falign-loops
10153 Align loops to a power-of-two boundary. If the loops are executed
10154 many times, this makes up for any execution of the dummy padding
10157 Parameters of this option are analogous to the @option{-falign-functions} option.
10158 @option{-fno-align-loops} and @option{-falign-loops=1} are
10159 equivalent and mean that loops are not aligned.
10160 The maximum allowed @var{n} option value is 65536.
10162 If @var{n} is not specified or is zero, use a machine-dependent default.
10164 Enabled at levels @option{-O2}, @option{-O3}.
10166 @item -falign-jumps
10167 @itemx -falign-jumps=@var{n}
10168 @itemx -falign-jumps=@var{n}:@var{m}
10169 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}
10170 @itemx -falign-jumps=@var{n}:@var{m}:@var{n2}:@var{m2}
10171 @opindex falign-jumps
10172 Align branch targets to a power-of-two boundary, for branch targets
10173 where the targets can only be reached by jumping. In this case,
10174 no dummy operations need be executed.
10176 Parameters of this option are analogous to the @option{-falign-functions} option.
10177 @option{-fno-align-jumps} and @option{-falign-jumps=1} are
10178 equivalent and mean that loops are not aligned.
10180 If @var{n} is not specified or is zero, use a machine-dependent default.
10181 The maximum allowed @var{n} option value is 65536.
10183 Enabled at levels @option{-O2}, @option{-O3}.
10185 @item -funit-at-a-time
10186 @opindex funit-at-a-time
10187 This option is left for compatibility reasons. @option{-funit-at-a-time}
10188 has no effect, while @option{-fno-unit-at-a-time} implies
10189 @option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
10191 Enabled by default.
10193 @item -fno-toplevel-reorder
10194 @opindex fno-toplevel-reorder
10195 @opindex ftoplevel-reorder
10196 Do not reorder top-level functions, variables, and @code{asm}
10197 statements. Output them in the same order that they appear in the
10198 input file. When this option is used, unreferenced static variables
10199 are not removed. This option is intended to support existing code
10200 that relies on a particular ordering. For new code, it is better to
10201 use attributes when possible.
10203 @option{-ftoplevel-reorder} is the default at @option{-O1} and higher, and
10204 also at @option{-O0} if @option{-fsection-anchors} is explicitly requested.
10205 Additionally @option{-fno-toplevel-reorder} implies
10206 @option{-fno-section-anchors}.
10210 Constructs webs as commonly used for register allocation purposes and assign
10211 each web individual pseudo register. This allows the register allocation pass
10212 to operate on pseudos directly, but also strengthens several other optimization
10213 passes, such as CSE, loop optimizer and trivial dead code remover. It can,
10214 however, make debugging impossible, since variables no longer stay in a
10217 Enabled by default with @option{-funroll-loops}.
10219 @item -fwhole-program
10220 @opindex fwhole-program
10221 Assume that the current compilation unit represents the whole program being
10222 compiled. All public functions and variables with the exception of @code{main}
10223 and those merged by attribute @code{externally_visible} become static functions
10224 and in effect are optimized more aggressively by interprocedural optimizers.
10226 This option should not be used in combination with @option{-flto}.
10227 Instead relying on a linker plugin should provide safer and more precise
10230 @item -flto[=@var{n}]
10232 This option runs the standard link-time optimizer. When invoked
10233 with source code, it generates GIMPLE (one of GCC's internal
10234 representations) and writes it to special ELF sections in the object
10235 file. When the object files are linked together, all the function
10236 bodies are read from these ELF sections and instantiated as if they
10237 had been part of the same translation unit.
10239 To use the link-time optimizer, @option{-flto} and optimization
10240 options should be specified at compile time and during the final link.
10241 It is recommended that you compile all the files participating in the
10242 same link with the same options and also specify those options at
10247 gcc -c -O2 -flto foo.c
10248 gcc -c -O2 -flto bar.c
10249 gcc -o myprog -flto -O2 foo.o bar.o
10252 The first two invocations to GCC save a bytecode representation
10253 of GIMPLE into special ELF sections inside @file{foo.o} and
10254 @file{bar.o}. The final invocation reads the GIMPLE bytecode from
10255 @file{foo.o} and @file{bar.o}, merges the two files into a single
10256 internal image, and compiles the result as usual. Since both
10257 @file{foo.o} and @file{bar.o} are merged into a single image, this
10258 causes all the interprocedural analyses and optimizations in GCC to
10259 work across the two files as if they were a single one. This means,
10260 for example, that the inliner is able to inline functions in
10261 @file{bar.o} into functions in @file{foo.o} and vice-versa.
10263 Another (simpler) way to enable link-time optimization is:
10266 gcc -o myprog -flto -O2 foo.c bar.c
10269 The above generates bytecode for @file{foo.c} and @file{bar.c},
10270 merges them together into a single GIMPLE representation and optimizes
10271 them as usual to produce @file{myprog}.
10273 The important thing to keep in mind is that to enable link-time
10274 optimizations you need to use the GCC driver to perform the link step.
10275 GCC automatically performs link-time optimization if any of the
10276 objects involved were compiled with the @option{-flto} command-line option.
10277 You can always override
10278 the automatic decision to do link-time optimization
10279 by passing @option{-fno-lto} to the link command.
10281 To make whole program optimization effective, it is necessary to make
10282 certain whole program assumptions. The compiler needs to know
10283 what functions and variables can be accessed by libraries and runtime
10284 outside of the link-time optimized unit. When supported by the linker,
10285 the linker plugin (see @option{-fuse-linker-plugin}) passes information
10286 to the compiler about used and externally visible symbols. When
10287 the linker plugin is not available, @option{-fwhole-program} should be
10288 used to allow the compiler to make these assumptions, which leads
10289 to more aggressive optimization decisions.
10291 When a file is compiled with @option{-flto} without
10292 @option{-fuse-linker-plugin}, the generated object file is larger than
10293 a regular object file because it contains GIMPLE bytecodes and the usual
10294 final code (see @option{-ffat-lto-objects}. This means that
10295 object files with LTO information can be linked as normal object
10296 files; if @option{-fno-lto} is passed to the linker, no
10297 interprocedural optimizations are applied. Note that when
10298 @option{-fno-fat-lto-objects} is enabled the compile stage is faster
10299 but you cannot perform a regular, non-LTO link on them.
10301 When producing the final binary, GCC only
10302 applies link-time optimizations to those files that contain bytecode.
10303 Therefore, you can mix and match object files and libraries with
10304 GIMPLE bytecodes and final object code. GCC automatically selects
10305 which files to optimize in LTO mode and which files to link without
10306 further processing.
10308 Generally, options specified at link time override those
10309 specified at compile time, although in some cases GCC attempts to infer
10310 link-time options from the settings used to compile the input files.
10312 If you do not specify an optimization level option @option{-O} at
10313 link time, then GCC uses the highest optimization level
10314 used when compiling the object files. Note that it is generally
10315 ineffective to specify an optimization level option only at link time and
10316 not at compile time, for two reasons. First, compiling without
10317 optimization suppresses compiler passes that gather information
10318 needed for effective optimization at link time. Second, some early
10319 optimization passes can be performed only at compile time and
10322 There are some code generation flags preserved by GCC when
10323 generating bytecodes, as they need to be used during the final link.
10324 Currently, the following options and their settings are taken from
10325 the first object file that explicitly specifies them:
10326 @option{-fPIC}, @option{-fpic}, @option{-fpie}, @option{-fcommon},
10327 @option{-fexceptions}, @option{-fnon-call-exceptions}, @option{-fgnu-tm}
10328 and all the @option{-m} target flags.
10330 Certain ABI-changing flags are required to match in all compilation units,
10331 and trying to override this at link time with a conflicting value
10332 is ignored. This includes options such as @option{-freg-struct-return}
10333 and @option{-fpcc-struct-return}.
10335 Other options such as @option{-ffp-contract}, @option{-fno-strict-overflow},
10336 @option{-fwrapv}, @option{-fno-trapv} or @option{-fno-strict-aliasing}
10337 are passed through to the link stage and merged conservatively for
10338 conflicting translation units. Specifically
10339 @option{-fno-strict-overflow}, @option{-fwrapv} and @option{-fno-trapv} take
10340 precedence; and for example @option{-ffp-contract=off} takes precedence
10341 over @option{-ffp-contract=fast}. You can override them at link time.
10343 To enable debug info generation you need to supply @option{-g} at
10344 compile-time. If any of the input files at link time were built
10345 with debug info generation enabled the link will enable debug info
10346 generation as well. Any elaborate debug info settings
10347 like the dwarf level @option{-gdwarf-5} need to be explicitly repeated
10348 at the linker command line and mixing different settings in different
10349 translation units is discouraged.
10351 If LTO encounters objects with C linkage declared with incompatible
10352 types in separate translation units to be linked together (undefined
10353 behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
10354 issued. The behavior is still undefined at run time. Similar
10355 diagnostics may be raised for other languages.
10357 Another feature of LTO is that it is possible to apply interprocedural
10358 optimizations on files written in different languages:
10362 g++ -c -flto bar.cc
10363 gfortran -c -flto baz.f90
10364 g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
10367 Notice that the final link is done with @command{g++} to get the C++
10368 runtime libraries and @option{-lgfortran} is added to get the Fortran
10369 runtime libraries. In general, when mixing languages in LTO mode, you
10370 should use the same link command options as when mixing languages in a
10371 regular (non-LTO) compilation.
10373 If object files containing GIMPLE bytecode are stored in a library archive, say
10374 @file{libfoo.a}, it is possible to extract and use them in an LTO link if you
10375 are using a linker with plugin support. To create static libraries suitable
10376 for LTO, use @command{gcc-ar} and @command{gcc-ranlib} instead of @command{ar}
10377 and @command{ranlib};
10378 to show the symbols of object files with GIMPLE bytecode, use
10379 @command{gcc-nm}. Those commands require that @command{ar}, @command{ranlib}
10380 and @command{nm} have been compiled with plugin support. At link time, use the
10381 flag @option{-fuse-linker-plugin} to ensure that the library participates in
10382 the LTO optimization process:
10385 gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
10388 With the linker plugin enabled, the linker extracts the needed
10389 GIMPLE files from @file{libfoo.a} and passes them on to the running GCC
10390 to make them part of the aggregated GIMPLE image to be optimized.
10392 If you are not using a linker with plugin support and/or do not
10393 enable the linker plugin, then the objects inside @file{libfoo.a}
10394 are extracted and linked as usual, but they do not participate
10395 in the LTO optimization process. In order to make a static library suitable
10396 for both LTO optimization and usual linkage, compile its object files with
10397 @option{-flto} @option{-ffat-lto-objects}.
10399 Link-time optimizations do not require the presence of the whole program to
10400 operate. If the program does not require any symbols to be exported, it is
10401 possible to combine @option{-flto} and @option{-fwhole-program} to allow
10402 the interprocedural optimizers to use more aggressive assumptions which may
10403 lead to improved optimization opportunities.
10404 Use of @option{-fwhole-program} is not needed when linker plugin is
10405 active (see @option{-fuse-linker-plugin}).
10407 The current implementation of LTO makes no
10408 attempt to generate bytecode that is portable between different
10409 types of hosts. The bytecode files are versioned and there is a
10410 strict version check, so bytecode files generated in one version of
10411 GCC do not work with an older or newer version of GCC.
10413 Link-time optimization does not work well with generation of debugging
10414 information on systems other than those using a combination of ELF and
10417 If you specify the optional @var{n}, the optimization and code
10418 generation done at link time is executed in parallel using @var{n}
10419 parallel jobs by utilizing an installed @command{make} program. The
10420 environment variable @env{MAKE} may be used to override the program
10423 You can also specify @option{-flto=jobserver} to use GNU make's
10424 job server mode to determine the number of parallel jobs. This
10425 is useful when the Makefile calling GCC is already executing in parallel.
10426 You must prepend a @samp{+} to the command recipe in the parent Makefile
10427 for this to work. This option likely only works if @env{MAKE} is
10428 GNU make. Even without the option value, GCC tries to automatically
10429 detect a running GNU make's job server.
10431 Use @option{-flto=auto} to use GNU make's job server, if available,
10432 or otherwise fall back to autodetection of the number of CPU threads
10433 present in your system.
10435 @item -flto-partition=@var{alg}
10436 @opindex flto-partition
10437 Specify the partitioning algorithm used by the link-time optimizer.
10438 The value is either @samp{1to1} to specify a partitioning mirroring
10439 the original source files or @samp{balanced} to specify partitioning
10440 into equally sized chunks (whenever possible) or @samp{max} to create
10441 new partition for every symbol where possible. Specifying @samp{none}
10442 as an algorithm disables partitioning and streaming completely.
10443 The default value is @samp{balanced}. While @samp{1to1} can be used
10444 as an workaround for various code ordering issues, the @samp{max}
10445 partitioning is intended for internal testing only.
10446 The value @samp{one} specifies that exactly one partition should be
10447 used while the value @samp{none} bypasses partitioning and executes
10448 the link-time optimization step directly from the WPA phase.
10450 @item -flto-compression-level=@var{n}
10451 @opindex flto-compression-level
10452 This option specifies the level of compression used for intermediate
10453 language written to LTO object files, and is only meaningful in
10454 conjunction with LTO mode (@option{-flto}). Valid
10455 values are 0 (no compression) to 9 (maximum compression). Values
10456 outside this range are clamped to either 0 or 9. If the option is not
10457 given, a default balanced compression setting is used.
10459 @item -fuse-linker-plugin
10460 @opindex fuse-linker-plugin
10461 Enables the use of a linker plugin during link-time optimization. This
10462 option relies on plugin support in the linker, which is available in gold
10463 or in GNU ld 2.21 or newer.
10465 This option enables the extraction of object files with GIMPLE bytecode out
10466 of library archives. This improves the quality of optimization by exposing
10467 more code to the link-time optimizer. This information specifies what
10468 symbols can be accessed externally (by non-LTO object or during dynamic
10469 linking). Resulting code quality improvements on binaries (and shared
10470 libraries that use hidden visibility) are similar to @option{-fwhole-program}.
10471 See @option{-flto} for a description of the effect of this flag and how to
10474 This option is enabled by default when LTO support in GCC is enabled
10475 and GCC was configured for use with
10476 a linker supporting plugins (GNU ld 2.21 or newer or gold).
10478 @item -ffat-lto-objects
10479 @opindex ffat-lto-objects
10480 Fat LTO objects are object files that contain both the intermediate language
10481 and the object code. This makes them usable for both LTO linking and normal
10482 linking. This option is effective only when compiling with @option{-flto}
10483 and is ignored at link time.
10485 @option{-fno-fat-lto-objects} improves compilation time over plain LTO, but
10486 requires the complete toolchain to be aware of LTO. It requires a linker with
10487 linker plugin support for basic functionality. Additionally,
10488 @command{nm}, @command{ar} and @command{ranlib}
10489 need to support linker plugins to allow a full-featured build environment
10490 (capable of building static libraries etc). GCC provides the @command{gcc-ar},
10491 @command{gcc-nm}, @command{gcc-ranlib} wrappers to pass the right options
10492 to these tools. With non fat LTO makefiles need to be modified to use them.
10494 Note that modern binutils provide plugin auto-load mechanism.
10495 Installing the linker plugin into @file{$libdir/bfd-plugins} has the same
10496 effect as usage of the command wrappers (@command{gcc-ar}, @command{gcc-nm} and
10497 @command{gcc-ranlib}).
10499 The default is @option{-fno-fat-lto-objects} on targets with linker plugin
10502 @item -fcompare-elim
10503 @opindex fcompare-elim
10504 After register allocation and post-register allocation instruction splitting,
10505 identify arithmetic instructions that compute processor flags similar to a
10506 comparison operation based on that arithmetic. If possible, eliminate the
10507 explicit comparison operation.
10509 This pass only applies to certain targets that cannot explicitly represent
10510 the comparison operation before register allocation is complete.
10512 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10514 @item -fcprop-registers
10515 @opindex fcprop-registers
10516 After register allocation and post-register allocation instruction splitting,
10517 perform a copy-propagation pass to try to reduce scheduling dependencies
10518 and occasionally eliminate the copy.
10520 Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
10522 @item -fprofile-correction
10523 @opindex fprofile-correction
10524 Profiles collected using an instrumented binary for multi-threaded programs may
10525 be inconsistent due to missed counter updates. When this option is specified,
10526 GCC uses heuristics to correct or smooth out such inconsistencies. By
10527 default, GCC emits an error message when an inconsistent profile is detected.
10529 This option is enabled by @option{-fauto-profile}.
10531 @item -fprofile-use
10532 @itemx -fprofile-use=@var{path}
10533 @opindex fprofile-use
10534 Enable profile feedback-directed optimizations,
10535 and the following optimizations, many of which
10536 are generally profitable only with profile feedback available:
10538 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10539 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10540 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10541 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10542 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10543 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10544 -fprofile-reorder-functions}
10546 Before you can use this option, you must first generate profiling information.
10547 @xref{Instrumentation Options}, for information about the
10548 @option{-fprofile-generate} option.
10550 By default, GCC emits an error message if the feedback profiles do not
10551 match the source code. This error can be turned into a warning by using
10552 @option{-Wno-error=coverage-mismatch}. Note this may result in poorly
10553 optimized code. Additionally, by default, GCC also emits a warning message if
10554 the feedback profiles do not exist (see @option{-Wmissing-profile}).
10556 If @var{path} is specified, GCC looks at the @var{path} to find
10557 the profile feedback data files. See @option{-fprofile-dir}.
10559 @item -fauto-profile
10560 @itemx -fauto-profile=@var{path}
10561 @opindex fauto-profile
10562 Enable sampling-based feedback-directed optimizations,
10563 and the following optimizations,
10564 many of which are generally profitable only with profile feedback available:
10566 @gccoptlist{-fbranch-probabilities -fprofile-values @gol
10567 -funroll-loops -fpeel-loops -ftracer -fvpt @gol
10568 -finline-functions -fipa-cp -fipa-cp-clone -fipa-bit-cp @gol
10569 -fpredictive-commoning -fsplit-loops -funswitch-loops @gol
10570 -fgcse-after-reload -ftree-loop-vectorize -ftree-slp-vectorize @gol
10571 -fvect-cost-model=dynamic -ftree-loop-distribute-patterns @gol
10572 -fprofile-correction}
10574 @var{path} is the name of a file containing AutoFDO profile information.
10575 If omitted, it defaults to @file{fbdata.afdo} in the current directory.
10577 Producing an AutoFDO profile data file requires running your program
10578 with the @command{perf} utility on a supported GNU/Linux target system.
10579 For more information, see @uref{https://perf.wiki.kernel.org/}.
10583 perf record -e br_inst_retired:near_taken -b -o perf.data \
10587 Then use the @command{create_gcov} tool to convert the raw profile data
10588 to a format that can be used by GCC.@ You must also supply the
10589 unstripped binary for your program to this tool.
10590 See @uref{https://github.com/google/autofdo}.
10594 create_gcov --binary=your_program.unstripped --profile=perf.data \
10595 --gcov=profile.afdo
10599 The following options control compiler behavior regarding floating-point
10600 arithmetic. These options trade off between speed and
10601 correctness. All must be specifically enabled.
10604 @item -ffloat-store
10605 @opindex ffloat-store
10606 Do not store floating-point variables in registers, and inhibit other
10607 options that might change whether a floating-point value is taken from a
10608 register or memory.
10610 @cindex floating-point precision
10611 This option prevents undesirable excess precision on machines such as
10612 the 68000 where the floating registers (of the 68881) keep more
10613 precision than a @code{double} is supposed to have. Similarly for the
10614 x86 architecture. For most programs, the excess precision does only
10615 good, but a few programs rely on the precise definition of IEEE floating
10616 point. Use @option{-ffloat-store} for such programs, after modifying
10617 them to store all pertinent intermediate computations into variables.
10619 @item -fexcess-precision=@var{style}
10620 @opindex fexcess-precision
10621 This option allows further control over excess precision on machines
10622 where floating-point operations occur in a format with more precision or
10623 range than the IEEE standard and interchange floating-point types. By
10624 default, @option{-fexcess-precision=fast} is in effect; this means that
10625 operations may be carried out in a wider precision than the types specified
10626 in the source if that would result in faster code, and it is unpredictable
10627 when rounding to the types specified in the source code takes place.
10628 When compiling C, if @option{-fexcess-precision=standard} is specified then
10629 excess precision follows the rules specified in ISO C99; in particular,
10630 both casts and assignments cause values to be rounded to their
10631 semantic types (whereas @option{-ffloat-store} only affects
10632 assignments). This option is enabled by default for C if a strict
10633 conformance option such as @option{-std=c99} is used.
10634 @option{-ffast-math} enables @option{-fexcess-precision=fast} by default
10635 regardless of whether a strict conformance option is used.
10638 @option{-fexcess-precision=standard} is not implemented for languages
10639 other than C. On the x86, it has no effect if @option{-mfpmath=sse}
10640 or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
10641 semantics apply without excess precision, and in the latter, rounding
10645 @opindex ffast-math
10646 Sets the options @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
10647 @option{-ffinite-math-only}, @option{-fno-rounding-math},
10648 @option{-fno-signaling-nans}, @option{-fcx-limited-range} and
10649 @option{-fexcess-precision=fast}.
10651 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
10653 This option is not turned on by any @option{-O} option besides
10654 @option{-Ofast} since it can result in incorrect output for programs
10655 that depend on an exact implementation of IEEE or ISO rules/specifications
10656 for math functions. It may, however, yield faster code for programs
10657 that do not require the guarantees of these specifications.
10659 @item -fno-math-errno
10660 @opindex fno-math-errno
10661 @opindex fmath-errno
10662 Do not set @code{errno} after calling math functions that are executed
10663 with a single instruction, e.g., @code{sqrt}. A program that relies on
10664 IEEE exceptions for math error handling may want to use this flag
10665 for speed while maintaining IEEE arithmetic compatibility.
10667 This option is not turned on by any @option{-O} option since
10668 it can result in incorrect output for programs that depend on
10669 an exact implementation of IEEE or ISO rules/specifications for
10670 math functions. It may, however, yield faster code for programs
10671 that do not require the guarantees of these specifications.
10673 The default is @option{-fmath-errno}.
10675 On Darwin systems, the math library never sets @code{errno}. There is
10676 therefore no reason for the compiler to consider the possibility that
10677 it might, and @option{-fno-math-errno} is the default.
10679 @item -funsafe-math-optimizations
10680 @opindex funsafe-math-optimizations
10682 Allow optimizations for floating-point arithmetic that (a) assume
10683 that arguments and results are valid and (b) may violate IEEE or
10684 ANSI standards. When used at link time, it may include libraries
10685 or startup files that change the default FPU control word or other
10686 similar optimizations.
10688 This option is not turned on by any @option{-O} option since
10689 it can result in incorrect output for programs that depend on
10690 an exact implementation of IEEE or ISO rules/specifications for
10691 math functions. It may, however, yield faster code for programs
10692 that do not require the guarantees of these specifications.
10693 Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
10694 @option{-fassociative-math} and @option{-freciprocal-math}.
10696 The default is @option{-fno-unsafe-math-optimizations}.
10698 @item -fassociative-math
10699 @opindex fassociative-math
10701 Allow re-association of operands in series of floating-point operations.
10702 This violates the ISO C and C++ language standard by possibly changing
10703 computation result. NOTE: re-ordering may change the sign of zero as
10704 well as ignore NaNs and inhibit or create underflow or overflow (and
10705 thus cannot be used on code that relies on rounding behavior like
10706 @code{(x + 2**52) - 2**52}. May also reorder floating-point comparisons
10707 and thus may not be used when ordered comparisons are required.
10708 This option requires that both @option{-fno-signed-zeros} and
10709 @option{-fno-trapping-math} be in effect. Moreover, it doesn't make
10710 much sense with @option{-frounding-math}. For Fortran the option
10711 is automatically enabled when both @option{-fno-signed-zeros} and
10712 @option{-fno-trapping-math} are in effect.
10714 The default is @option{-fno-associative-math}.
10716 @item -freciprocal-math
10717 @opindex freciprocal-math
10719 Allow the reciprocal of a value to be used instead of dividing by
10720 the value if this enables optimizations. For example @code{x / y}
10721 can be replaced with @code{x * (1/y)}, which is useful if @code{(1/y)}
10722 is subject to common subexpression elimination. Note that this loses
10723 precision and increases the number of flops operating on the value.
10725 The default is @option{-fno-reciprocal-math}.
10727 @item -ffinite-math-only
10728 @opindex ffinite-math-only
10729 Allow optimizations for floating-point arithmetic that assume
10730 that arguments and results are not NaNs or +-Infs.
10732 This option is not turned on by any @option{-O} option since
10733 it can result in incorrect output for programs that depend on
10734 an exact implementation of IEEE or ISO rules/specifications for
10735 math functions. It may, however, yield faster code for programs
10736 that do not require the guarantees of these specifications.
10738 The default is @option{-fno-finite-math-only}.
10740 @item -fno-signed-zeros
10741 @opindex fno-signed-zeros
10742 @opindex fsigned-zeros
10743 Allow optimizations for floating-point arithmetic that ignore the
10744 signedness of zero. IEEE arithmetic specifies the behavior of
10745 distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
10746 of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
10747 This option implies that the sign of a zero result isn't significant.
10749 The default is @option{-fsigned-zeros}.
10751 @item -fno-trapping-math
10752 @opindex fno-trapping-math
10753 @opindex ftrapping-math
10754 Compile code assuming that floating-point operations cannot generate
10755 user-visible traps. These traps include division by zero, overflow,
10756 underflow, inexact result and invalid operation. This option requires
10757 that @option{-fno-signaling-nans} be in effect. Setting this option may
10758 allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
10760 This option should never be turned on by any @option{-O} option since
10761 it can result in incorrect output for programs that depend on
10762 an exact implementation of IEEE or ISO rules/specifications for
10765 The default is @option{-ftrapping-math}.
10767 @item -frounding-math
10768 @opindex frounding-math
10769 Disable transformations and optimizations that assume default floating-point
10770 rounding behavior. This is round-to-zero for all floating point
10771 to integer conversions, and round-to-nearest for all other arithmetic
10772 truncations. This option should be specified for programs that change
10773 the FP rounding mode dynamically, or that may be executed with a
10774 non-default rounding mode. This option disables constant folding of
10775 floating-point expressions at compile time (which may be affected by
10776 rounding mode) and arithmetic transformations that are unsafe in the
10777 presence of sign-dependent rounding modes.
10779 The default is @option{-fno-rounding-math}.
10781 This option is experimental and does not currently guarantee to
10782 disable all GCC optimizations that are affected by rounding mode.
10783 Future versions of GCC may provide finer control of this setting
10784 using C99's @code{FENV_ACCESS} pragma. This command-line option
10785 will be used to specify the default state for @code{FENV_ACCESS}.
10787 @item -fsignaling-nans
10788 @opindex fsignaling-nans
10789 Compile code assuming that IEEE signaling NaNs may generate user-visible
10790 traps during floating-point operations. Setting this option disables
10791 optimizations that may change the number of exceptions visible with
10792 signaling NaNs. This option implies @option{-ftrapping-math}.
10794 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
10797 The default is @option{-fno-signaling-nans}.
10799 This option is experimental and does not currently guarantee to
10800 disable all GCC optimizations that affect signaling NaN behavior.
10802 @item -fno-fp-int-builtin-inexact
10803 @opindex fno-fp-int-builtin-inexact
10804 @opindex ffp-int-builtin-inexact
10805 Do not allow the built-in functions @code{ceil}, @code{floor},
10806 @code{round} and @code{trunc}, and their @code{float} and @code{long
10807 double} variants, to generate code that raises the ``inexact''
10808 floating-point exception for noninteger arguments. ISO C99 and C11
10809 allow these functions to raise the ``inexact'' exception, but ISO/IEC
10810 TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these
10811 functions to do so.
10813 The default is @option{-ffp-int-builtin-inexact}, allowing the
10814 exception to be raised. This option does nothing unless
10815 @option{-ftrapping-math} is in effect.
10817 Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions
10818 generate a call to a library function then the ``inexact'' exception
10819 may be raised if the library implementation does not follow TS 18661.
10821 @item -fsingle-precision-constant
10822 @opindex fsingle-precision-constant
10823 Treat floating-point constants as single precision instead of
10824 implicitly converting them to double-precision constants.
10826 @item -fcx-limited-range
10827 @opindex fcx-limited-range
10828 When enabled, this option states that a range reduction step is not
10829 needed when performing complex division. Also, there is no checking
10830 whether the result of a complex multiplication or division is @code{NaN
10831 + I*NaN}, with an attempt to rescue the situation in that case. The
10832 default is @option{-fno-cx-limited-range}, but is enabled by
10833 @option{-ffast-math}.
10835 This option controls the default setting of the ISO C99
10836 @code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
10839 @item -fcx-fortran-rules
10840 @opindex fcx-fortran-rules
10841 Complex multiplication and division follow Fortran rules. Range
10842 reduction is done as part of complex division, but there is no checking
10843 whether the result of a complex multiplication or division is @code{NaN
10844 + I*NaN}, with an attempt to rescue the situation in that case.
10846 The default is @option{-fno-cx-fortran-rules}.
10850 The following options control optimizations that may improve
10851 performance, but are not enabled by any @option{-O} options. This
10852 section includes experimental options that may produce broken code.
10855 @item -fbranch-probabilities
10856 @opindex fbranch-probabilities
10857 After running a program compiled with @option{-fprofile-arcs}
10858 (@pxref{Instrumentation Options}),
10859 you can compile it a second time using
10860 @option{-fbranch-probabilities}, to improve optimizations based on
10861 the number of times each branch was taken. When a program
10862 compiled with @option{-fprofile-arcs} exits, it saves arc execution
10863 counts to a file called @file{@var{sourcename}.gcda} for each source
10864 file. The information in this data file is very dependent on the
10865 structure of the generated code, so you must use the same source code
10866 and the same optimization options for both compilations.
10868 With @option{-fbranch-probabilities}, GCC puts a
10869 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
10870 These can be used to improve optimization. Currently, they are only
10871 used in one place: in @file{reorg.c}, instead of guessing which path a
10872 branch is most likely to take, the @samp{REG_BR_PROB} values are used to
10873 exactly determine which path is taken more often.
10875 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10877 @item -fprofile-values
10878 @opindex fprofile-values
10879 If combined with @option{-fprofile-arcs}, it adds code so that some
10880 data about values of expressions in the program is gathered.
10882 With @option{-fbranch-probabilities}, it reads back the data gathered
10883 from profiling values of expressions for usage in optimizations.
10885 Enabled by @option{-fprofile-generate}, @option{-fprofile-use}, and
10886 @option{-fauto-profile}.
10888 @item -fprofile-reorder-functions
10889 @opindex fprofile-reorder-functions
10890 Function reordering based on profile instrumentation collects
10891 first time of execution of a function and orders these functions
10892 in ascending order.
10894 Enabled with @option{-fprofile-use}.
10898 If combined with @option{-fprofile-arcs}, this option instructs the compiler
10899 to add code to gather information about values of expressions.
10901 With @option{-fbranch-probabilities}, it reads back the data gathered
10902 and actually performs the optimizations based on them.
10903 Currently the optimizations include specialization of division operations
10904 using the knowledge about the value of the denominator.
10906 Enabled with @option{-fprofile-use} and @option{-fauto-profile}.
10908 @item -frename-registers
10909 @opindex frename-registers
10910 Attempt to avoid false dependencies in scheduled code by making use
10911 of registers left over after register allocation. This optimization
10912 most benefits processors with lots of registers. Depending on the
10913 debug information format adopted by the target, however, it can
10914 make debugging impossible, since variables no longer stay in
10915 a ``home register''.
10917 Enabled by default with @option{-funroll-loops}.
10919 @item -fschedule-fusion
10920 @opindex fschedule-fusion
10921 Performs a target dependent pass over the instruction stream to schedule
10922 instructions of same type together because target machine can execute them
10923 more efficiently if they are adjacent to each other in the instruction flow.
10925 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
10929 Perform tail duplication to enlarge superblock size. This transformation
10930 simplifies the control flow of the function allowing other optimizations to do
10933 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10935 @item -funroll-loops
10936 @opindex funroll-loops
10937 Unroll loops whose number of iterations can be determined at compile time or
10938 upon entry to the loop. @option{-funroll-loops} implies
10939 @option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
10940 It also turns on complete loop peeling (i.e.@: complete removal of loops with
10941 a small constant number of iterations). This option makes code larger, and may
10942 or may not make it run faster.
10944 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10946 @item -funroll-all-loops
10947 @opindex funroll-all-loops
10948 Unroll all loops, even if their number of iterations is uncertain when
10949 the loop is entered. This usually makes programs run more slowly.
10950 @option{-funroll-all-loops} implies the same options as
10951 @option{-funroll-loops}.
10954 @opindex fpeel-loops
10955 Peels loops for which there is enough information that they do not
10956 roll much (from profile feedback or static analysis). It also turns on
10957 complete loop peeling (i.e.@: complete removal of loops with small constant
10958 number of iterations).
10960 Enabled by @option{-O3}, @option{-fprofile-use}, and @option{-fauto-profile}.
10962 @item -fmove-loop-invariants
10963 @opindex fmove-loop-invariants
10964 Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
10965 at level @option{-O1} and higher, except for @option{-Og}.
10967 @item -fsplit-loops
10968 @opindex fsplit-loops
10969 Split a loop into two if it contains a condition that's always true
10970 for one side of the iteration space and false for the other.
10972 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10974 @item -funswitch-loops
10975 @opindex funswitch-loops
10976 Move branches with loop invariant conditions out of the loop, with duplicates
10977 of the loop on both branches (modified according to result of the condition).
10979 Enabled by @option{-fprofile-use} and @option{-fauto-profile}.
10981 @item -fversion-loops-for-strides
10982 @opindex fversion-loops-for-strides
10983 If a loop iterates over an array with a variable stride, create another
10984 version of the loop that assumes the stride is always one. For example:
10987 for (int i = 0; i < n; ++i)
10988 x[i * stride] = @dots{};
10995 for (int i = 0; i < n; ++i)
10998 for (int i = 0; i < n; ++i)
10999 x[i * stride] = @dots{};
11002 This is particularly useful for assumed-shape arrays in Fortran where
11003 (for example) it allows better vectorization assuming contiguous accesses.
11004 This flag is enabled by default at @option{-O3}.
11005 It is also enabled by @option{-fprofile-use} and @option{-fauto-profile}.
11007 @item -ffunction-sections
11008 @itemx -fdata-sections
11009 @opindex ffunction-sections
11010 @opindex fdata-sections
11011 Place each function or data item into its own section in the output
11012 file if the target supports arbitrary sections. The name of the
11013 function or the name of the data item determines the section's name
11014 in the output file.
11016 Use these options on systems where the linker can perform optimizations to
11017 improve locality of reference in the instruction space. Most systems using the
11018 ELF object format have linkers with such optimizations. On AIX, the linker
11019 rearranges sections (CSECTs) based on the call graph. The performance impact
11022 Together with a linker garbage collection (linker @option{--gc-sections}
11023 option) these options may lead to smaller statically-linked executables (after
11026 On ELF/DWARF systems these options do not degenerate the quality of the debug
11027 information. There could be issues with other object files/debug info formats.
11029 Only use these options when there are significant benefits from doing so. When
11030 you specify these options, the assembler and linker create larger object and
11031 executable files and are also slower. These options affect code generation.
11032 They prevent optimizations by the compiler and assembler using relative
11033 locations inside a translation unit since the locations are unknown until
11034 link time. An example of such an optimization is relaxing calls to short call
11038 @opindex fstdarg-opt
11039 Optimize the prologue of variadic argument functions with respect to usage of
11042 @item -fsection-anchors
11043 @opindex fsection-anchors
11044 Try to reduce the number of symbolic address calculations by using
11045 shared ``anchor'' symbols to address nearby objects. This transformation
11046 can help to reduce the number of GOT entries and GOT accesses on some
11049 For example, the implementation of the following function @code{foo}:
11052 static int a, b, c;
11053 int foo (void) @{ return a + b + c; @}
11057 usually calculates the addresses of all three variables, but if you
11058 compile it with @option{-fsection-anchors}, it accesses the variables
11059 from a common anchor point instead. The effect is similar to the
11060 following pseudocode (which isn't valid C):
11065 register int *xr = &x;
11066 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
11070 Not all targets support this option.
11072 @item --param @var{name}=@var{value}
11074 In some places, GCC uses various constants to control the amount of
11075 optimization that is done. For example, GCC does not inline functions
11076 that contain more than a certain number of instructions. You can
11077 control some of these constants on the command line using the
11078 @option{--param} option.
11080 The names of specific parameters, and the meaning of the values, are
11081 tied to the internals of the compiler, and are subject to change
11082 without notice in future releases.
11084 In order to get minimal, maximal and default value of a parameter,
11085 one can use @option{--help=param -Q} options.
11087 In each case, the @var{value} is an integer. The allowable choices for
11091 @item predictable-branch-outcome
11092 When branch is predicted to be taken with probability lower than this threshold
11093 (in percent), then it is considered well predictable.
11095 @item max-rtl-if-conversion-insns
11096 RTL if-conversion tries to remove conditional branches around a block and
11097 replace them with conditionally executed instructions. This parameter
11098 gives the maximum number of instructions in a block which should be
11099 considered for if-conversion. The compiler will
11100 also use other heuristics to decide whether if-conversion is likely to be
11103 @item max-rtl-if-conversion-predictable-cost
11104 @itemx max-rtl-if-conversion-unpredictable-cost
11105 RTL if-conversion will try to remove conditional branches around a block
11106 and replace them with conditionally executed instructions. These parameters
11107 give the maximum permissible cost for the sequence that would be generated
11108 by if-conversion depending on whether the branch is statically determined
11109 to be predictable or not. The units for this parameter are the same as
11110 those for the GCC internal seq_cost metric. The compiler will try to
11111 provide a reasonable default for this parameter using the BRANCH_COST
11114 @item max-crossjump-edges
11115 The maximum number of incoming edges to consider for cross-jumping.
11116 The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
11117 the number of edges incoming to each block. Increasing values mean
11118 more aggressive optimization, making the compilation time increase with
11119 probably small improvement in executable size.
11121 @item min-crossjump-insns
11122 The minimum number of instructions that must be matched at the end
11123 of two blocks before cross-jumping is performed on them. This
11124 value is ignored in the case where all instructions in the block being
11125 cross-jumped from are matched.
11127 @item max-grow-copy-bb-insns
11128 The maximum code size expansion factor when copying basic blocks
11129 instead of jumping. The expansion is relative to a jump instruction.
11131 @item max-goto-duplication-insns
11132 The maximum number of instructions to duplicate to a block that jumps
11133 to a computed goto. To avoid @math{O(N^2)} behavior in a number of
11134 passes, GCC factors computed gotos early in the compilation process,
11135 and unfactors them as late as possible. Only computed jumps at the
11136 end of a basic blocks with no more than max-goto-duplication-insns are
11139 @item max-delay-slot-insn-search
11140 The maximum number of instructions to consider when looking for an
11141 instruction to fill a delay slot. If more than this arbitrary number of
11142 instructions are searched, the time savings from filling the delay slot
11143 are minimal, so stop searching. Increasing values mean more
11144 aggressive optimization, making the compilation time increase with probably
11145 small improvement in execution time.
11147 @item max-delay-slot-live-search
11148 When trying to fill delay slots, the maximum number of instructions to
11149 consider when searching for a block with valid live register
11150 information. Increasing this arbitrarily chosen value means more
11151 aggressive optimization, increasing the compilation time. This parameter
11152 should be removed when the delay slot code is rewritten to maintain the
11153 control-flow graph.
11155 @item max-gcse-memory
11156 The approximate maximum amount of memory that can be allocated in
11157 order to perform the global common subexpression elimination
11158 optimization. If more memory than specified is required, the
11159 optimization is not done.
11161 @item max-gcse-insertion-ratio
11162 If the ratio of expression insertions to deletions is larger than this value
11163 for any expression, then RTL PRE inserts or removes the expression and thus
11164 leaves partially redundant computations in the instruction stream.
11166 @item max-pending-list-length
11167 The maximum number of pending dependencies scheduling allows
11168 before flushing the current state and starting over. Large functions
11169 with few branches or calls can create excessively large lists which
11170 needlessly consume memory and resources.
11172 @item max-modulo-backtrack-attempts
11173 The maximum number of backtrack attempts the scheduler should make
11174 when modulo scheduling a loop. Larger values can exponentially increase
11177 @item max-inline-insns-single
11178 @item max-inline-insns-single-O2
11179 Several parameters control the tree inliner used in GCC@. This number sets the
11180 maximum number of instructions (counted in GCC's internal representation) in a
11181 single function that the tree inliner considers for inlining. This only
11182 affects functions declared inline and methods implemented in a class
11185 For functions compiled with optimization levels
11186 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-single} is
11187 applied. In other cases @option{max-inline-insns-single-O2} is applied.
11190 @item max-inline-insns-auto
11191 @item max-inline-insns-auto-O2
11192 When you use @option{-finline-functions} (included in @option{-O3}),
11193 a lot of functions that would otherwise not be considered for inlining
11194 by the compiler are investigated. To those functions, a different
11195 (more restrictive) limit compared to functions declared inline can
11198 For functions compiled with optimization levels
11199 @option{-O3} and @option{-Ofast} parameter @option{max-inline-insns-auto} is
11200 applied. In other cases @option{max-inline-insns-auto-O2} is applied.
11202 @item max-inline-insns-small
11203 This is bound applied to calls which are considered relevant with
11204 @option{-finline-small-functions}.
11206 @item max-inline-insns-size
11207 This is bound applied to calls which are optimized for size. Small growth
11208 may be desirable to anticipate optimization oppurtunities exposed by inlining.
11210 @item uninlined-function-insns
11211 Number of instructions accounted by inliner for function overhead such as
11212 function prologue and epilogue.
11214 @item uninlined-function-time
11215 Extra time accounted by inliner for function overhead such as time needed to
11216 execute function prologue and epilogue
11218 @item uninlined-thunk-insns
11219 @item uninlined-thunk-time
11220 Same as @option{--param uninlined-function-insns} and
11221 @option{--param uninlined-function-time} but applied to function thunks
11223 @item inline-min-speedup
11224 @item inline-min-speedup-O2
11225 When estimated performance improvement of caller + callee runtime exceeds this
11226 threshold (in percent), the function can be inlined regardless of the limit on
11227 @option{--param max-inline-insns-single} and @option{--param
11228 max-inline-insns-auto}.
11230 For functions compiled with optimization levels
11231 @option{-O3} and @option{-Ofast} parameter @option{inline-min-speedup} is
11232 applied. In other cases @option{inline-min-speedup-O2} is applied.
11234 @item large-function-insns
11235 The limit specifying really large functions. For functions larger than this
11236 limit after inlining, inlining is constrained by
11237 @option{--param large-function-growth}. This parameter is useful primarily
11238 to avoid extreme compilation time caused by non-linear algorithms used by the
11241 @item large-function-growth
11242 Specifies maximal growth of large function caused by inlining in percents.
11243 For example, parameter value 100 limits large function growth to 2.0 times
11246 @item large-unit-insns
11247 The limit specifying large translation unit. Growth caused by inlining of
11248 units larger than this limit is limited by @option{--param inline-unit-growth}.
11249 For small units this might be too tight.
11250 For example, consider a unit consisting of function A
11251 that is inline and B that just calls A three times. If B is small relative to
11252 A, the growth of unit is 300\% and yet such inlining is very sane. For very
11253 large units consisting of small inlineable functions, however, the overall unit
11254 growth limit is needed to avoid exponential explosion of code size. Thus for
11255 smaller units, the size is increased to @option{--param large-unit-insns}
11256 before applying @option{--param inline-unit-growth}.
11258 @item inline-unit-growth
11259 Specifies maximal overall growth of the compilation unit caused by inlining.
11260 For example, parameter value 20 limits unit growth to 1.2 times the original
11261 size. Cold functions (either marked cold via an attribute or by profile
11262 feedback) are not accounted into the unit size.
11264 @item ipcp-unit-growth
11265 Specifies maximal overall growth of the compilation unit caused by
11266 interprocedural constant propagation. For example, parameter value 10 limits
11267 unit growth to 1.1 times the original size.
11269 @item large-stack-frame
11270 The limit specifying large stack frames. While inlining the algorithm is trying
11271 to not grow past this limit too much.
11273 @item large-stack-frame-growth
11274 Specifies maximal growth of large stack frames caused by inlining in percents.
11275 For example, parameter value 1000 limits large stack frame growth to 11 times
11278 @item max-inline-insns-recursive
11279 @itemx max-inline-insns-recursive-auto
11280 Specifies the maximum number of instructions an out-of-line copy of a
11281 self-recursive inline
11282 function can grow into by performing recursive inlining.
11284 @option{--param max-inline-insns-recursive} applies to functions
11286 For functions not declared inline, recursive inlining
11287 happens only when @option{-finline-functions} (included in @option{-O3}) is
11288 enabled; @option{--param max-inline-insns-recursive-auto} applies instead.
11290 @item max-inline-recursive-depth
11291 @itemx max-inline-recursive-depth-auto
11292 Specifies the maximum recursion depth used for recursive inlining.
11294 @option{--param max-inline-recursive-depth} applies to functions
11295 declared inline. For functions not declared inline, recursive inlining
11296 happens only when @option{-finline-functions} (included in @option{-O3}) is
11297 enabled; @option{--param max-inline-recursive-depth-auto} applies instead.
11299 @item min-inline-recursive-probability
11300 Recursive inlining is profitable only for function having deep recursion
11301 in average and can hurt for function having little recursion depth by
11302 increasing the prologue size or complexity of function body to other
11305 When profile feedback is available (see @option{-fprofile-generate}) the actual
11306 recursion depth can be guessed from the probability that function recurses
11307 via a given call expression. This parameter limits inlining only to call
11308 expressions whose probability exceeds the given threshold (in percents).
11310 @item early-inlining-insns
11311 @item early-inlining-insns-O2
11312 Specify growth that the early inliner can make. In effect it increases
11313 the amount of inlining for code having a large abstraction penalty.
11315 For functions compiled with optimization levels
11316 @option{-O3} and @option{-Ofast} parameter @option{early-inlining-insns} is
11317 applied. In other cases @option{early-inlining-insns-O2} is applied.
11319 @item max-early-inliner-iterations
11320 Limit of iterations of the early inliner. This basically bounds
11321 the number of nested indirect calls the early inliner can resolve.
11322 Deeper chains are still handled by late inlining.
11324 @item comdat-sharing-probability
11325 Probability (in percent) that C++ inline function with comdat visibility
11326 are shared across multiple compilation units.
11328 @item profile-func-internal-id
11329 A parameter to control whether to use function internal id in profile
11330 database lookup. If the value is 0, the compiler uses an id that
11331 is based on function assembler name and filename, which makes old profile
11332 data more tolerant to source changes such as function reordering etc.
11334 @item min-vect-loop-bound
11335 The minimum number of iterations under which loops are not vectorized
11336 when @option{-ftree-vectorize} is used. The number of iterations after
11337 vectorization needs to be greater than the value specified by this option
11338 to allow vectorization.
11340 @item gcse-cost-distance-ratio
11341 Scaling factor in calculation of maximum distance an expression
11342 can be moved by GCSE optimizations. This is currently supported only in the
11343 code hoisting pass. The bigger the ratio, the more aggressive code hoisting
11344 is with simple expressions, i.e., the expressions that have cost
11345 less than @option{gcse-unrestricted-cost}. Specifying 0 disables
11346 hoisting of simple expressions.
11348 @item gcse-unrestricted-cost
11349 Cost, roughly measured as the cost of a single typical machine
11350 instruction, at which GCSE optimizations do not constrain
11351 the distance an expression can travel. This is currently
11352 supported only in the code hoisting pass. The lesser the cost,
11353 the more aggressive code hoisting is. Specifying 0
11354 allows all expressions to travel unrestricted distances.
11356 @item max-hoist-depth
11357 The depth of search in the dominator tree for expressions to hoist.
11358 This is used to avoid quadratic behavior in hoisting algorithm.
11359 The value of 0 does not limit on the search, but may slow down compilation
11362 @item max-tail-merge-comparisons
11363 The maximum amount of similar bbs to compare a bb with. This is used to
11364 avoid quadratic behavior in tree tail merging.
11366 @item max-tail-merge-iterations
11367 The maximum amount of iterations of the pass over the function. This is used to
11368 limit compilation time in tree tail merging.
11370 @item store-merging-allow-unaligned
11371 Allow the store merging pass to introduce unaligned stores if it is legal to
11374 @item max-stores-to-merge
11375 The maximum number of stores to attempt to merge into wider stores in the store
11378 @item max-unrolled-insns
11379 The maximum number of instructions that a loop may have to be unrolled.
11380 If a loop is unrolled, this parameter also determines how many times
11381 the loop code is unrolled.
11383 @item max-average-unrolled-insns
11384 The maximum number of instructions biased by probabilities of their execution
11385 that a loop may have to be unrolled. If a loop is unrolled,
11386 this parameter also determines how many times the loop code is unrolled.
11388 @item max-unroll-times
11389 The maximum number of unrollings of a single loop.
11391 @item max-peeled-insns
11392 The maximum number of instructions that a loop may have to be peeled.
11393 If a loop is peeled, this parameter also determines how many times
11394 the loop code is peeled.
11396 @item max-peel-times
11397 The maximum number of peelings of a single loop.
11399 @item max-peel-branches
11400 The maximum number of branches on the hot path through the peeled sequence.
11402 @item max-completely-peeled-insns
11403 The maximum number of insns of a completely peeled loop.
11405 @item max-completely-peel-times
11406 The maximum number of iterations of a loop to be suitable for complete peeling.
11408 @item max-completely-peel-loop-nest-depth
11409 The maximum depth of a loop nest suitable for complete peeling.
11411 @item max-unswitch-insns
11412 The maximum number of insns of an unswitched loop.
11414 @item max-unswitch-level
11415 The maximum number of branches unswitched in a single loop.
11417 @item lim-expensive
11418 The minimum cost of an expensive expression in the loop invariant motion.
11420 @item iv-consider-all-candidates-bound
11421 Bound on number of candidates for induction variables, below which
11422 all candidates are considered for each use in induction variable
11423 optimizations. If there are more candidates than this,
11424 only the most relevant ones are considered to avoid quadratic time complexity.
11426 @item iv-max-considered-uses
11427 The induction variable optimizations give up on loops that contain more
11428 induction variable uses.
11430 @item iv-always-prune-cand-set-bound
11431 If the number of candidates in the set is smaller than this value,
11432 always try to remove unnecessary ivs from the set
11433 when adding a new one.
11435 @item avg-loop-niter
11436 Average number of iterations of a loop.
11438 @item dse-max-object-size
11439 Maximum size (in bytes) of objects tracked bytewise by dead store elimination.
11440 Larger values may result in larger compilation times.
11442 @item dse-max-alias-queries-per-store
11443 Maximum number of queries into the alias oracle per store.
11444 Larger values result in larger compilation times and may result in more
11445 removed dead stores.
11447 @item scev-max-expr-size
11448 Bound on size of expressions used in the scalar evolutions analyzer.
11449 Large expressions slow the analyzer.
11451 @item scev-max-expr-complexity
11452 Bound on the complexity of the expressions in the scalar evolutions analyzer.
11453 Complex expressions slow the analyzer.
11455 @item max-tree-if-conversion-phi-args
11456 Maximum number of arguments in a PHI supported by TREE if conversion
11457 unless the loop is marked with simd pragma.
11459 @item vect-max-version-for-alignment-checks
11460 The maximum number of run-time checks that can be performed when
11461 doing loop versioning for alignment in the vectorizer.
11463 @item vect-max-version-for-alias-checks
11464 The maximum number of run-time checks that can be performed when
11465 doing loop versioning for alias in the vectorizer.
11467 @item vect-max-peeling-for-alignment
11468 The maximum number of loop peels to enhance access alignment
11469 for vectorizer. Value -1 means no limit.
11471 @item max-iterations-to-track
11472 The maximum number of iterations of a loop the brute-force algorithm
11473 for analysis of the number of iterations of the loop tries to evaluate.
11475 @item hot-bb-count-fraction
11476 The denominator n of fraction 1/n of the maximal execution count of a
11477 basic block in the entire program that a basic block needs to at least
11478 have in order to be considered hot. The default is 10000, which means
11479 that a basic block is considered hot if its execution count is greater
11480 than 1/10000 of the maximal execution count. 0 means that it is never
11481 considered hot. Used in non-LTO mode.
11483 @item hot-bb-count-ws-permille
11484 The number of most executed permilles, ranging from 0 to 1000, of the
11485 profiled execution of the entire program to which the execution count
11486 of a basic block must be part of in order to be considered hot. The
11487 default is 990, which means that a basic block is considered hot if
11488 its execution count contributes to the upper 990 permilles, or 99.0%,
11489 of the profiled execution of the entire program. 0 means that it is
11490 never considered hot. Used in LTO mode.
11492 @item hot-bb-frequency-fraction
11493 The denominator n of fraction 1/n of the execution frequency of the
11494 entry block of a function that a basic block of this function needs
11495 to at least have in order to be considered hot. The default is 1000,
11496 which means that a basic block is considered hot in a function if it
11497 is executed more frequently than 1/1000 of the frequency of the entry
11498 block of the function. 0 means that it is never considered hot.
11500 @item unlikely-bb-count-fraction
11501 The denominator n of fraction 1/n of the number of profiled runs of
11502 the entire program below which the execution count of a basic block
11503 must be in order for the basic block to be considered unlikely executed.
11504 The default is 20, which means that a basic block is considered unlikely
11505 executed if it is executed in fewer than 1/20, or 5%, of the runs of
11506 the program. 0 means that it is always considered unlikely executed.
11508 @item max-predicted-iterations
11509 The maximum number of loop iterations we predict statically. This is useful
11510 in cases where a function contains a single loop with known bound and
11511 another loop with unknown bound.
11512 The known number of iterations is predicted correctly, while
11513 the unknown number of iterations average to roughly 10. This means that the
11514 loop without bounds appears artificially cold relative to the other one.
11516 @item builtin-expect-probability
11517 Control the probability of the expression having the specified value. This
11518 parameter takes a percentage (i.e.@: 0 ... 100) as input.
11520 @item builtin-string-cmp-inline-length
11521 The maximum length of a constant string for a builtin string cmp call
11522 eligible for inlining.
11524 @item align-threshold
11526 Select fraction of the maximal frequency of executions of a basic block in
11527 a function to align the basic block.
11529 @item align-loop-iterations
11531 A loop expected to iterate at least the selected number of iterations is
11534 @item tracer-dynamic-coverage
11535 @itemx tracer-dynamic-coverage-feedback
11537 This value is used to limit superblock formation once the given percentage of
11538 executed instructions is covered. This limits unnecessary code size
11541 The @option{tracer-dynamic-coverage-feedback} parameter
11542 is used only when profile
11543 feedback is available. The real profiles (as opposed to statically estimated
11544 ones) are much less balanced allowing the threshold to be larger value.
11546 @item tracer-max-code-growth
11547 Stop tail duplication once code growth has reached given percentage. This is
11548 a rather artificial limit, as most of the duplicates are eliminated later in
11549 cross jumping, so it may be set to much higher values than is the desired code
11552 @item tracer-min-branch-ratio
11554 Stop reverse growth when the reverse probability of best edge is less than this
11555 threshold (in percent).
11557 @item tracer-min-branch-probability
11558 @itemx tracer-min-branch-probability-feedback
11560 Stop forward growth if the best edge has probability lower than this
11563 Similarly to @option{tracer-dynamic-coverage} two parameters are
11564 provided. @option{tracer-min-branch-probability-feedback} is used for
11565 compilation with profile feedback and @option{tracer-min-branch-probability}
11566 compilation without. The value for compilation with profile feedback
11567 needs to be more conservative (higher) in order to make tracer
11570 @item stack-clash-protection-guard-size
11571 Specify the size of the operating system provided stack guard as
11572 2 raised to @var{num} bytes. Higher values may reduce the
11573 number of explicit probes, but a value larger than the operating system
11574 provided guard will leave code vulnerable to stack clash style attacks.
11576 @item stack-clash-protection-probe-interval
11577 Stack clash protection involves probing stack space as it is allocated. This
11578 param controls the maximum distance between probes into the stack as 2 raised
11579 to @var{num} bytes. Higher values may reduce the number of explicit probes, but a value
11580 larger than the operating system provided guard will leave code vulnerable to
11581 stack clash style attacks.
11583 @item max-cse-path-length
11585 The maximum number of basic blocks on path that CSE considers.
11587 @item max-cse-insns
11588 The maximum number of instructions CSE processes before flushing.
11590 @item ggc-min-expand
11592 GCC uses a garbage collector to manage its own memory allocation. This
11593 parameter specifies the minimum percentage by which the garbage
11594 collector's heap should be allowed to expand between collections.
11595 Tuning this may improve compilation speed; it has no effect on code
11598 The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
11599 RAM >= 1GB@. If @code{getrlimit} is available, the notion of ``RAM'' is
11600 the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
11601 GCC is not able to calculate RAM on a particular platform, the lower
11602 bound of 30% is used. Setting this parameter and
11603 @option{ggc-min-heapsize} to zero causes a full collection to occur at
11604 every opportunity. This is extremely slow, but can be useful for
11607 @item ggc-min-heapsize
11609 Minimum size of the garbage collector's heap before it begins bothering
11610 to collect garbage. The first collection occurs after the heap expands
11611 by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
11612 tuning this may improve compilation speed, and has no effect on code
11615 The default is the smaller of RAM/8, RLIMIT_RSS, or a limit that
11616 tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
11617 with a lower bound of 4096 (four megabytes) and an upper bound of
11618 131072 (128 megabytes). If GCC is not able to calculate RAM on a
11619 particular platform, the lower bound is used. Setting this parameter
11620 very large effectively disables garbage collection. Setting this
11621 parameter and @option{ggc-min-expand} to zero causes a full collection
11622 to occur at every opportunity.
11624 @item max-reload-search-insns
11625 The maximum number of instruction reload should look backward for equivalent
11626 register. Increasing values mean more aggressive optimization, making the
11627 compilation time increase with probably slightly better performance.
11629 @item max-cselib-memory-locations
11630 The maximum number of memory locations cselib should take into account.
11631 Increasing values mean more aggressive optimization, making the compilation time
11632 increase with probably slightly better performance.
11634 @item max-sched-ready-insns
11635 The maximum number of instructions ready to be issued the scheduler should
11636 consider at any given time during the first scheduling pass. Increasing
11637 values mean more thorough searches, making the compilation time increase
11638 with probably little benefit.
11640 @item max-sched-region-blocks
11641 The maximum number of blocks in a region to be considered for
11642 interblock scheduling.
11644 @item max-pipeline-region-blocks
11645 The maximum number of blocks in a region to be considered for
11646 pipelining in the selective scheduler.
11648 @item max-sched-region-insns
11649 The maximum number of insns in a region to be considered for
11650 interblock scheduling.
11652 @item max-pipeline-region-insns
11653 The maximum number of insns in a region to be considered for
11654 pipelining in the selective scheduler.
11656 @item min-spec-prob
11657 The minimum probability (in percents) of reaching a source block
11658 for interblock speculative scheduling.
11660 @item max-sched-extend-regions-iters
11661 The maximum number of iterations through CFG to extend regions.
11662 A value of 0 disables region extensions.
11664 @item max-sched-insn-conflict-delay
11665 The maximum conflict delay for an insn to be considered for speculative motion.
11667 @item sched-spec-prob-cutoff
11668 The minimal probability of speculation success (in percents), so that
11669 speculative insns are scheduled.
11671 @item sched-state-edge-prob-cutoff
11672 The minimum probability an edge must have for the scheduler to save its
11675 @item sched-mem-true-dep-cost
11676 Minimal distance (in CPU cycles) between store and load targeting same
11679 @item selsched-max-lookahead
11680 The maximum size of the lookahead window of selective scheduling. It is a
11681 depth of search for available instructions.
11683 @item selsched-max-sched-times
11684 The maximum number of times that an instruction is scheduled during
11685 selective scheduling. This is the limit on the number of iterations
11686 through which the instruction may be pipelined.
11688 @item selsched-insns-to-rename
11689 The maximum number of best instructions in the ready list that are considered
11690 for renaming in the selective scheduler.
11693 The minimum value of stage count that swing modulo scheduler
11696 @item max-last-value-rtl
11697 The maximum size measured as number of RTLs that can be recorded in an expression
11698 in combiner for a pseudo register as last known value of that register.
11700 @item max-combine-insns
11701 The maximum number of instructions the RTL combiner tries to combine.
11703 @item integer-share-limit
11704 Small integer constants can use a shared data structure, reducing the
11705 compiler's memory usage and increasing its speed. This sets the maximum
11706 value of a shared integer constant.
11708 @item ssp-buffer-size
11709 The minimum size of buffers (i.e.@: arrays) that receive stack smashing
11710 protection when @option{-fstack-protection} is used.
11712 @item min-size-for-stack-sharing
11713 The minimum size of variables taking part in stack slot sharing when not
11716 @item max-jump-thread-duplication-stmts
11717 Maximum number of statements allowed in a block that needs to be
11718 duplicated when threading jumps.
11720 @item max-fields-for-field-sensitive
11721 Maximum number of fields in a structure treated in
11722 a field sensitive manner during pointer analysis.
11724 @item prefetch-latency
11725 Estimate on average number of instructions that are executed before
11726 prefetch finishes. The distance prefetched ahead is proportional
11727 to this constant. Increasing this number may also lead to less
11728 streams being prefetched (see @option{simultaneous-prefetches}).
11730 @item simultaneous-prefetches
11731 Maximum number of prefetches that can run at the same time.
11733 @item l1-cache-line-size
11734 The size of cache line in L1 data cache, in bytes.
11736 @item l1-cache-size
11737 The size of L1 data cache, in kilobytes.
11739 @item l2-cache-size
11740 The size of L2 data cache, in kilobytes.
11742 @item prefetch-dynamic-strides
11743 Whether the loop array prefetch pass should issue software prefetch hints
11744 for strides that are non-constant. In some cases this may be
11745 beneficial, though the fact the stride is non-constant may make it
11746 hard to predict when there is clear benefit to issuing these hints.
11748 Set to 1 if the prefetch hints should be issued for non-constant
11749 strides. Set to 0 if prefetch hints should be issued only for strides that
11750 are known to be constant and below @option{prefetch-minimum-stride}.
11752 @item prefetch-minimum-stride
11753 Minimum constant stride, in bytes, to start using prefetch hints for. If
11754 the stride is less than this threshold, prefetch hints will not be issued.
11756 This setting is useful for processors that have hardware prefetchers, in
11757 which case there may be conflicts between the hardware prefetchers and
11758 the software prefetchers. If the hardware prefetchers have a maximum
11759 stride they can handle, it should be used here to improve the use of
11760 software prefetchers.
11762 A value of -1 means we don't have a threshold and therefore
11763 prefetch hints can be issued for any constant stride.
11765 This setting is only useful for strides that are known and constant.
11767 @item loop-interchange-max-num-stmts
11768 The maximum number of stmts in a loop to be interchanged.
11770 @item loop-interchange-stride-ratio
11771 The minimum ratio between stride of two loops for interchange to be profitable.
11773 @item min-insn-to-prefetch-ratio
11774 The minimum ratio between the number of instructions and the
11775 number of prefetches to enable prefetching in a loop.
11777 @item prefetch-min-insn-to-mem-ratio
11778 The minimum ratio between the number of instructions and the
11779 number of memory references to enable prefetching in a loop.
11781 @item use-canonical-types
11782 Whether the compiler should use the ``canonical'' type system.
11783 Should always be 1, which uses a more efficient internal
11784 mechanism for comparing types in C++ and Objective-C++. However, if
11785 bugs in the canonical type system are causing compilation failures,
11786 set this value to 0 to disable canonical types.
11788 @item switch-conversion-max-branch-ratio
11789 Switch initialization conversion refuses to create arrays that are
11790 bigger than @option{switch-conversion-max-branch-ratio} times the number of
11791 branches in the switch.
11793 @item max-partial-antic-length
11794 Maximum length of the partial antic set computed during the tree
11795 partial redundancy elimination optimization (@option{-ftree-pre}) when
11796 optimizing at @option{-O3} and above. For some sorts of source code
11797 the enhanced partial redundancy elimination optimization can run away,
11798 consuming all of the memory available on the host machine. This
11799 parameter sets a limit on the length of the sets that are computed,
11800 which prevents the runaway behavior. Setting a value of 0 for
11801 this parameter allows an unlimited set length.
11803 @item rpo-vn-max-loop-depth
11804 Maximum loop depth that is value-numbered optimistically.
11805 When the limit hits the innermost
11806 @var{rpo-vn-max-loop-depth} loops and the outermost loop in the
11807 loop nest are value-numbered optimistically and the remaining ones not.
11809 @item sccvn-max-alias-queries-per-access
11810 Maximum number of alias-oracle queries we perform when looking for
11811 redundancies for loads and stores. If this limit is hit the search
11812 is aborted and the load or store is not considered redundant. The
11813 number of queries is algorithmically limited to the number of
11814 stores on all paths from the load to the function entry.
11816 @item ira-max-loops-num
11817 IRA uses regional register allocation by default. If a function
11818 contains more loops than the number given by this parameter, only at most
11819 the given number of the most frequently-executed loops form regions
11820 for regional register allocation.
11822 @item ira-max-conflict-table-size
11823 Although IRA uses a sophisticated algorithm to compress the conflict
11824 table, the table can still require excessive amounts of memory for
11825 huge functions. If the conflict table for a function could be more
11826 than the size in MB given by this parameter, the register allocator
11827 instead uses a faster, simpler, and lower-quality
11828 algorithm that does not require building a pseudo-register conflict table.
11830 @item ira-loop-reserved-regs
11831 IRA can be used to evaluate more accurate register pressure in loops
11832 for decisions to move loop invariants (see @option{-O3}). The number
11833 of available registers reserved for some other purposes is given
11834 by this parameter. Default of the parameter
11835 is the best found from numerous experiments.
11837 @item lra-inheritance-ebb-probability-cutoff
11838 LRA tries to reuse values reloaded in registers in subsequent insns.
11839 This optimization is called inheritance. EBB is used as a region to
11840 do this optimization. The parameter defines a minimal fall-through
11841 edge probability in percentage used to add BB to inheritance EBB in
11842 LRA. The default value was chosen
11843 from numerous runs of SPEC2000 on x86-64.
11845 @item loop-invariant-max-bbs-in-loop
11846 Loop invariant motion can be very expensive, both in compilation time and
11847 in amount of needed compile-time memory, with very large loops. Loops
11848 with more basic blocks than this parameter won't have loop invariant
11849 motion optimization performed on them.
11851 @item loop-max-datarefs-for-datadeps
11852 Building data dependencies is expensive for very large loops. This
11853 parameter limits the number of data references in loops that are
11854 considered for data dependence analysis. These large loops are no
11855 handled by the optimizations using loop data dependencies.
11857 @item max-vartrack-size
11858 Sets a maximum number of hash table slots to use during variable
11859 tracking dataflow analysis of any function. If this limit is exceeded
11860 with variable tracking at assignments enabled, analysis for that
11861 function is retried without it, after removing all debug insns from
11862 the function. If the limit is exceeded even without debug insns, var
11863 tracking analysis is completely disabled for the function. Setting
11864 the parameter to zero makes it unlimited.
11866 @item max-vartrack-expr-depth
11867 Sets a maximum number of recursion levels when attempting to map
11868 variable names or debug temporaries to value expressions. This trades
11869 compilation time for more complete debug information. If this is set too
11870 low, value expressions that are available and could be represented in
11871 debug information may end up not being used; setting this higher may
11872 enable the compiler to find more complex debug expressions, but compile
11873 time and memory use may grow.
11875 @item max-debug-marker-count
11876 Sets a threshold on the number of debug markers (e.g.@: begin stmt
11877 markers) to avoid complexity explosion at inlining or expanding to RTL.
11878 If a function has more such gimple stmts than the set limit, such stmts
11879 will be dropped from the inlined copy of a function, and from its RTL
11882 @item min-nondebug-insn-uid
11883 Use uids starting at this parameter for nondebug insns. The range below
11884 the parameter is reserved exclusively for debug insns created by
11885 @option{-fvar-tracking-assignments}, but debug insns may get
11886 (non-overlapping) uids above it if the reserved range is exhausted.
11888 @item ipa-sra-ptr-growth-factor
11889 IPA-SRA replaces a pointer to an aggregate with one or more new
11890 parameters only when their cumulative size is less or equal to
11891 @option{ipa-sra-ptr-growth-factor} times the size of the original
11894 @item ipa-sra-max-replacements
11895 Maximum pieces of an aggregate that IPA-SRA tracks. As a
11896 consequence, it is also the maximum number of replacements of a formal
11899 @item sra-max-scalarization-size-Ospeed
11900 @itemx sra-max-scalarization-size-Osize
11901 The two Scalar Reduction of Aggregates passes (SRA and IPA-SRA) aim to
11902 replace scalar parts of aggregates with uses of independent scalar
11903 variables. These parameters control the maximum size, in storage units,
11904 of aggregate which is considered for replacement when compiling for
11906 (@option{sra-max-scalarization-size-Ospeed}) or size
11907 (@option{sra-max-scalarization-size-Osize}) respectively.
11909 @item tm-max-aggregate-size
11910 When making copies of thread-local variables in a transaction, this
11911 parameter specifies the size in bytes after which variables are
11912 saved with the logging functions as opposed to save/restore code
11913 sequence pairs. This option only applies when using
11916 @item graphite-max-nb-scop-params
11917 To avoid exponential effects in the Graphite loop transforms, the
11918 number of parameters in a Static Control Part (SCoP) is bounded.
11919 A value of zero can be used to lift
11920 the bound. A variable whose value is unknown at compilation time and
11921 defined outside a SCoP is a parameter of the SCoP.
11923 @item loop-block-tile-size
11924 Loop blocking or strip mining transforms, enabled with
11925 @option{-floop-block} or @option{-floop-strip-mine}, strip mine each
11926 loop in the loop nest by a given number of iterations. The strip
11927 length can be changed using the @option{loop-block-tile-size}
11930 @item ipa-cp-value-list-size
11931 IPA-CP attempts to track all possible values and types passed to a function's
11932 parameter in order to propagate them and perform devirtualization.
11933 @option{ipa-cp-value-list-size} is the maximum number of values and types it
11934 stores per one formal parameter of a function.
11936 @item ipa-cp-eval-threshold
11937 IPA-CP calculates its own score of cloning profitability heuristics
11938 and performs those cloning opportunities with scores that exceed
11939 @option{ipa-cp-eval-threshold}.
11941 @item ipa-cp-recursion-penalty
11942 Percentage penalty the recursive functions will receive when they
11943 are evaluated for cloning.
11945 @item ipa-cp-single-call-penalty
11946 Percentage penalty functions containing a single call to another
11947 function will receive when they are evaluated for cloning.
11949 @item ipa-max-agg-items
11950 IPA-CP is also capable to propagate a number of scalar values passed
11951 in an aggregate. @option{ipa-max-agg-items} controls the maximum
11952 number of such values per one parameter.
11954 @item ipa-cp-loop-hint-bonus
11955 When IPA-CP determines that a cloning candidate would make the number
11956 of iterations of a loop known, it adds a bonus of
11957 @option{ipa-cp-loop-hint-bonus} to the profitability score of
11960 @item ipa-max-aa-steps
11961 During its analysis of function bodies, IPA-CP employs alias analysis
11962 in order to track values pointed to by function parameters. In order
11963 not spend too much time analyzing huge functions, it gives up and
11964 consider all memory clobbered after examining
11965 @option{ipa-max-aa-steps} statements modifying memory.
11967 @item ipa-max-switch-predicate-bounds
11968 Maximal number of boundary endpoints of case ranges of switch statement.
11969 For switch exceeding this limit, IPA-CP will not construct cloning cost
11970 predicate, which is used to estimate cloning benefit, for default case
11971 of the switch statement.
11973 @item lto-partitions
11974 Specify desired number of partitions produced during WHOPR compilation.
11975 The number of partitions should exceed the number of CPUs used for compilation.
11977 @item lto-min-partition
11978 Size of minimal partition for WHOPR (in estimated instructions).
11979 This prevents expenses of splitting very small programs into too many
11982 @item lto-max-partition
11983 Size of max partition for WHOPR (in estimated instructions).
11984 to provide an upper bound for individual size of partition.
11985 Meant to be used only with balanced partitioning.
11987 @item lto-max-streaming-parallelism
11988 Maximal number of parallel processes used for LTO streaming.
11990 @item cxx-max-namespaces-for-diagnostic-help
11991 The maximum number of namespaces to consult for suggestions when C++
11992 name lookup fails for an identifier.
11994 @item sink-frequency-threshold
11995 The maximum relative execution frequency (in percents) of the target block
11996 relative to a statement's original block to allow statement sinking of a
11997 statement. Larger numbers result in more aggressive statement sinking.
11998 A small positive adjustment is applied for
11999 statements with memory operands as those are even more profitable so sink.
12001 @item max-stores-to-sink
12002 The maximum number of conditional store pairs that can be sunk. Set to 0
12003 if either vectorization (@option{-ftree-vectorize}) or if-conversion
12004 (@option{-ftree-loop-if-convert}) is disabled.
12006 @item allow-store-data-races
12007 Allow optimizers to introduce new data races on stores.
12008 Set to 1 to allow, otherwise to 0.
12010 @item case-values-threshold
12011 The smallest number of different values for which it is best to use a
12012 jump-table instead of a tree of conditional branches. If the value is
12013 0, use the default for the machine.
12015 @item jump-table-max-growth-ratio-for-size
12016 The maximum code size growth ratio when expanding
12017 into a jump table (in percent). The parameter is used when
12018 optimizing for size.
12020 @item jump-table-max-growth-ratio-for-speed
12021 The maximum code size growth ratio when expanding
12022 into a jump table (in percent). The parameter is used when
12023 optimizing for speed.
12025 @item tree-reassoc-width
12026 Set the maximum number of instructions executed in parallel in
12027 reassociated tree. This parameter overrides target dependent
12028 heuristics used by default if has non zero value.
12030 @item sched-pressure-algorithm
12031 Choose between the two available implementations of
12032 @option{-fsched-pressure}. Algorithm 1 is the original implementation
12033 and is the more likely to prevent instructions from being reordered.
12034 Algorithm 2 was designed to be a compromise between the relatively
12035 conservative approach taken by algorithm 1 and the rather aggressive
12036 approach taken by the default scheduler. It relies more heavily on
12037 having a regular register file and accurate register pressure classes.
12038 See @file{haifa-sched.c} in the GCC sources for more details.
12040 The default choice depends on the target.
12042 @item max-slsr-cand-scan
12043 Set the maximum number of existing candidates that are considered when
12044 seeking a basis for a new straight-line strength reduction candidate.
12047 Enable buffer overflow detection for global objects. This kind
12048 of protection is enabled by default if you are using
12049 @option{-fsanitize=address} option.
12050 To disable global objects protection use @option{--param asan-globals=0}.
12053 Enable buffer overflow detection for stack objects. This kind of
12054 protection is enabled by default when using @option{-fsanitize=address}.
12055 To disable stack protection use @option{--param asan-stack=0} option.
12057 @item asan-instrument-reads
12058 Enable buffer overflow detection for memory reads. This kind of
12059 protection is enabled by default when using @option{-fsanitize=address}.
12060 To disable memory reads protection use
12061 @option{--param asan-instrument-reads=0}.
12063 @item asan-instrument-writes
12064 Enable buffer overflow detection for memory writes. This kind of
12065 protection is enabled by default when using @option{-fsanitize=address}.
12066 To disable memory writes protection use
12067 @option{--param asan-instrument-writes=0} option.
12069 @item asan-memintrin
12070 Enable detection for built-in functions. This kind of protection
12071 is enabled by default when using @option{-fsanitize=address}.
12072 To disable built-in functions protection use
12073 @option{--param asan-memintrin=0}.
12075 @item asan-use-after-return
12076 Enable detection of use-after-return. This kind of protection
12077 is enabled by default when using the @option{-fsanitize=address} option.
12078 To disable it use @option{--param asan-use-after-return=0}.
12080 Note: By default the check is disabled at run time. To enable it,
12081 add @code{detect_stack_use_after_return=1} to the environment variable
12082 @env{ASAN_OPTIONS}.
12084 @item asan-instrumentation-with-call-threshold
12085 If number of memory accesses in function being instrumented
12086 is greater or equal to this number, use callbacks instead of inline checks.
12087 E.g. to disable inline code use
12088 @option{--param asan-instrumentation-with-call-threshold=0}.
12090 @item use-after-scope-direct-emission-threshold
12091 If the size of a local variable in bytes is smaller or equal to this
12092 number, directly poison (or unpoison) shadow memory instead of using
12093 run-time callbacks.
12095 @item max-fsm-thread-path-insns
12096 Maximum number of instructions to copy when duplicating blocks on a
12097 finite state automaton jump thread path.
12099 @item max-fsm-thread-length
12100 Maximum number of basic blocks on a finite state automaton jump thread
12103 @item max-fsm-thread-paths
12104 Maximum number of new jump thread paths to create for a finite state
12107 @item parloops-chunk-size
12108 Chunk size of omp schedule for loops parallelized by parloops.
12110 @item parloops-schedule
12111 Schedule type of omp schedule for loops parallelized by parloops (static,
12112 dynamic, guided, auto, runtime).
12114 @item parloops-min-per-thread
12115 The minimum number of iterations per thread of an innermost parallelized
12116 loop for which the parallelized variant is preferred over the single threaded
12117 one. Note that for a parallelized loop nest the
12118 minimum number of iterations of the outermost loop per thread is two.
12120 @item max-ssa-name-query-depth
12121 Maximum depth of recursion when querying properties of SSA names in things
12122 like fold routines. One level of recursion corresponds to following a
12125 @item hsa-gen-debug-stores
12126 Enable emission of special debug stores within HSA kernels which are
12127 then read and reported by libgomp plugin. Generation of these stores
12128 is disabled by default, use @option{--param hsa-gen-debug-stores=1} to
12131 @item max-speculative-devirt-maydefs
12132 The maximum number of may-defs we analyze when looking for a must-def
12133 specifying the dynamic type of an object that invokes a virtual call
12134 we may be able to devirtualize speculatively.
12136 @item max-vrp-switch-assertions
12137 The maximum number of assertions to add along the default edge of a switch
12138 statement during VRP.
12140 @item unroll-jam-min-percent
12141 The minimum percentage of memory references that must be optimized
12142 away for the unroll-and-jam transformation to be considered profitable.
12144 @item unroll-jam-max-unroll
12145 The maximum number of times the outer loop should be unrolled by
12146 the unroll-and-jam transformation.
12148 @item max-rtl-if-conversion-unpredictable-cost
12149 Maximum permissible cost for the sequence that would be generated
12150 by the RTL if-conversion pass for a branch that is considered unpredictable.
12152 @item max-variable-expansions-in-unroller
12153 If @option{-fvariable-expansion-in-unroller} is used, the maximum number
12154 of times that an individual variable will be expanded during loop unrolling.
12156 @item tracer-min-branch-probability-feedback
12157 Stop forward growth if the probability of best edge is less than
12158 this threshold (in percent). Used when profile feedback is available.
12160 @item partial-inlining-entry-probability
12161 Maximum probability of the entry BB of split region
12162 (in percent relative to entry BB of the function)
12163 to make partial inlining happen.
12165 @item max-tracked-strlens
12166 Maximum number of strings for which strlen optimization pass will
12167 track string lengths.
12169 @item gcse-after-reload-partial-fraction
12170 The threshold ratio for performing partial redundancy
12171 elimination after reload.
12173 @item gcse-after-reload-critical-fraction
12174 The threshold ratio of critical edges execution count that
12175 permit performing redundancy elimination after reload.
12177 @item max-loop-header-insns
12178 The maximum number of insns in loop header duplicated
12179 by the copy loop headers pass.
12181 @item vect-epilogues-nomask
12182 Enable loop epilogue vectorization using smaller vector size.
12184 @item slp-max-insns-in-bb
12185 Maximum number of instructions in basic block to be
12186 considered for SLP vectorization.
12188 @item avoid-fma-max-bits
12189 Maximum number of bits for which we avoid creating FMAs.
12191 @item sms-loop-average-count-threshold
12192 A threshold on the average loop count considered by the swing modulo scheduler.
12194 @item sms-dfa-history
12195 The number of cycles the swing modulo scheduler considers when checking
12196 conflicts using DFA.
12198 @item max-inline-insns-recursive-auto
12199 The maximum number of instructions non-inline function
12200 can grow to via recursive inlining.
12202 @item graphite-allow-codegen-errors
12203 Whether codegen errors should be ICEs when @option{-fchecking}.
12205 @item sms-max-ii-factor
12206 A factor for tuning the upper bound that swing modulo scheduler
12207 uses for scheduling a loop.
12209 @item lra-max-considered-reload-pseudos
12210 The max number of reload pseudos which are considered during
12211 spilling a non-reload pseudo.
12213 @item max-pow-sqrt-depth
12214 Maximum depth of sqrt chains to use when synthesizing exponentiation
12215 by a real constant.
12217 @item max-dse-active-local-stores
12218 Maximum number of active local stores in RTL dead store elimination.
12220 @item asan-instrument-allocas
12221 Enable asan allocas/VLAs protection.
12223 @item max-iterations-computation-cost
12224 Bound on the cost of an expression to compute the number of iterations.
12226 @item max-isl-operations
12227 Maximum number of isl operations, 0 means unlimited.
12229 @item graphite-max-arrays-per-scop
12230 Maximum number of arrays per scop.
12232 @item max-vartrack-reverse-op-size
12233 Max. size of loc list for which reverse ops should be added.
12235 @item tracer-dynamic-coverage-feedback
12236 The percentage of function, weighted by execution frequency,
12237 that must be covered by trace formation.
12238 Used when profile feedback is available.
12240 @item max-inline-recursive-depth-auto
12241 The maximum depth of recursive inlining for non-inline functions.
12243 @item fsm-scale-path-stmts
12244 Scale factor to apply to the number of statements in a threading path
12245 when comparing to the number of (scaled) blocks.
12247 @item fsm-maximum-phi-arguments
12248 Maximum number of arguments a PHI may have before the FSM threader
12249 will not try to thread through its block.
12251 @item uninit-control-dep-attempts
12252 Maximum number of nested calls to search for control dependencies
12253 during uninitialized variable analysis.
12255 @item max-once-peeled-insns
12256 The maximum number of insns of a peeled loop that rolls only once.
12258 @item sra-max-scalarization-size-Osize
12259 Maximum size, in storage units, of an aggregate
12260 which should be considered for scalarization when compiling for size.
12262 @item fsm-scale-path-blocks
12263 Scale factor to apply to the number of blocks in a threading path
12264 when comparing to the number of (scaled) statements.
12266 @item sched-autopref-queue-depth
12267 Hardware autoprefetcher scheduler model control flag.
12268 Number of lookahead cycles the model looks into; at '
12269 ' only enable instruction sorting heuristic.
12271 @item loop-versioning-max-inner-insns
12272 The maximum number of instructions that an inner loop can have
12273 before the loop versioning pass considers it too big to copy.
12275 @item loop-versioning-max-outer-insns
12276 The maximum number of instructions that an outer loop can have
12277 before the loop versioning pass considers it too big to copy,
12278 discounting any instructions in inner loops that directly benefit
12281 @item ssa-name-def-chain-limit
12282 The maximum number of SSA_NAME assignments to follow in determining
12283 a property of a variable such as its value. This limits the number
12284 of iterations or recursive calls GCC performs when optimizing certain
12285 statements or when determining their validity prior to issuing
12291 @node Instrumentation Options
12292 @section Program Instrumentation Options
12293 @cindex instrumentation options
12294 @cindex program instrumentation options
12295 @cindex run-time error checking options
12296 @cindex profiling options
12297 @cindex options, program instrumentation
12298 @cindex options, run-time error checking
12299 @cindex options, profiling
12301 GCC supports a number of command-line options that control adding
12302 run-time instrumentation to the code it normally generates.
12303 For example, one purpose of instrumentation is collect profiling
12304 statistics for use in finding program hot spots, code coverage
12305 analysis, or profile-guided optimizations.
12306 Another class of program instrumentation is adding run-time checking
12307 to detect programming errors like invalid pointer
12308 dereferences or out-of-bounds array accesses, as well as deliberately
12309 hostile attacks such as stack smashing or C++ vtable hijacking.
12310 There is also a general hook which can be used to implement other
12311 forms of tracing or function-level instrumentation for debug or
12312 program analysis purposes.
12315 @cindex @command{prof}
12316 @cindex @command{gprof}
12321 Generate extra code to write profile information suitable for the
12322 analysis program @command{prof} (for @option{-p}) or @command{gprof}
12323 (for @option{-pg}). You must use this option when compiling
12324 the source files you want data about, and you must also use it when
12327 You can use the function attribute @code{no_instrument_function} to
12328 suppress profiling of individual functions when compiling with these options.
12329 @xref{Common Function Attributes}.
12331 @item -fprofile-arcs
12332 @opindex fprofile-arcs
12333 Add code so that program flow @dfn{arcs} are instrumented. During
12334 execution the program records how many times each branch and call is
12335 executed and how many times it is taken or returns. On targets that support
12336 constructors with priority support, profiling properly handles constructors,
12337 destructors and C++ constructors (and destructors) of classes which are used
12338 as a type of a global variable.
12341 program exits it saves this data to a file called
12342 @file{@var{auxname}.gcda} for each source file. The data may be used for
12343 profile-directed optimizations (@option{-fbranch-probabilities}), or for
12344 test coverage analysis (@option{-ftest-coverage}). Each object file's
12345 @var{auxname} is generated from the name of the output file, if
12346 explicitly specified and it is not the final executable, otherwise it is
12347 the basename of the source file. In both cases any suffix is removed
12348 (e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
12349 @file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
12350 @xref{Cross-profiling}.
12352 @cindex @command{gcov}
12356 This option is used to compile and link code instrumented for coverage
12357 analysis. The option is a synonym for @option{-fprofile-arcs}
12358 @option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
12359 linking). See the documentation for those options for more details.
12364 Compile the source files with @option{-fprofile-arcs} plus optimization
12365 and code generation options. For test coverage analysis, use the
12366 additional @option{-ftest-coverage} option. You do not need to profile
12367 every source file in a program.
12370 Compile the source files additionally with @option{-fprofile-abs-path}
12371 to create absolute path names in the @file{.gcno} files. This allows
12372 @command{gcov} to find the correct sources in projects where compilations
12373 occur with different working directories.
12376 Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
12377 (the latter implies the former).
12380 Run the program on a representative workload to generate the arc profile
12381 information. This may be repeated any number of times. You can run
12382 concurrent instances of your program, and provided that the file system
12383 supports locking, the data files will be correctly updated. Unless
12384 a strict ISO C dialect option is in effect, @code{fork} calls are
12385 detected and correctly handled without double counting.
12388 For profile-directed optimizations, compile the source files again with
12389 the same optimization and code generation options plus
12390 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
12391 Control Optimization}).
12394 For test coverage analysis, use @command{gcov} to produce human readable
12395 information from the @file{.gcno} and @file{.gcda} files. Refer to the
12396 @command{gcov} documentation for further information.
12400 With @option{-fprofile-arcs}, for each function of your program GCC
12401 creates a program flow graph, then finds a spanning tree for the graph.
12402 Only arcs that are not on the spanning tree have to be instrumented: the
12403 compiler adds code to count the number of times that these arcs are
12404 executed. When an arc is the only exit or only entrance to a block, the
12405 instrumentation code can be added to the block; otherwise, a new basic
12406 block must be created to hold the instrumentation code.
12409 @item -ftest-coverage
12410 @opindex ftest-coverage
12411 Produce a notes file that the @command{gcov} code-coverage utility
12412 (@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
12413 show program coverage. Each source file's note file is called
12414 @file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
12415 above for a description of @var{auxname} and instructions on how to
12416 generate test coverage data. Coverage data matches the source files
12417 more closely if you do not optimize.
12419 @item -fprofile-abs-path
12420 @opindex fprofile-abs-path
12421 Automatically convert relative source file names to absolute path names
12422 in the @file{.gcno} files. This allows @command{gcov} to find the correct
12423 sources in projects where compilations occur with different working
12426 @item -fprofile-dir=@var{path}
12427 @opindex fprofile-dir
12429 Set the directory to search for the profile data files in to @var{path}.
12430 This option affects only the profile data generated by
12431 @option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
12432 and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
12433 and its related options. Both absolute and relative paths can be used.
12434 By default, GCC uses the current directory as @var{path}, thus the
12435 profile data file appears in the same directory as the object file.
12436 In order to prevent the file name clashing, if the object file name is
12437 not an absolute path, we mangle the absolute path of the
12438 @file{@var{sourcename}.gcda} file and use it as the file name of a
12439 @file{.gcda} file. See similar option @option{-fprofile-note}.
12441 When an executable is run in a massive parallel environment, it is recommended
12442 to save profile to different folders. That can be done with variables
12443 in @var{path} that are exported during run-time:
12451 value of environment variable @var{VAR}
12455 @item -fprofile-generate
12456 @itemx -fprofile-generate=@var{path}
12457 @opindex fprofile-generate
12459 Enable options usually used for instrumenting application to produce
12460 profile useful for later recompilation with profile feedback based
12461 optimization. You must use @option{-fprofile-generate} both when
12462 compiling and when linking your program.
12464 The following options are enabled:
12465 @option{-fprofile-arcs}, @option{-fprofile-values},
12466 @option{-finline-functions}, and @option{-fipa-bit-cp}.
12468 If @var{path} is specified, GCC looks at the @var{path} to find
12469 the profile feedback data files. See @option{-fprofile-dir}.
12471 To optimize the program based on the collected profile information, use
12472 @option{-fprofile-use}. @xref{Optimize Options}, for more information.
12474 @item -fprofile-note=@var{path}
12475 @opindex fprofile-note
12477 If @var{path} is specified, GCC saves @file{.gcno} file into @var{path}
12478 location. If you combine the option with multiple source files,
12479 the @file{.gcno} file will be overwritten.
12481 @item -fprofile-update=@var{method}
12482 @opindex fprofile-update
12484 Alter the update method for an application instrumented for profile
12485 feedback based optimization. The @var{method} argument should be one of
12486 @samp{single}, @samp{atomic} or @samp{prefer-atomic}.
12487 The first one is useful for single-threaded applications,
12488 while the second one prevents profile corruption by emitting thread-safe code.
12490 @strong{Warning:} When an application does not properly join all threads
12491 (or creates an detached thread), a profile file can be still corrupted.
12493 Using @samp{prefer-atomic} would be transformed either to @samp{atomic},
12494 when supported by a target, or to @samp{single} otherwise. The GCC driver
12495 automatically selects @samp{prefer-atomic} when @option{-pthread}
12496 is present in the command line.
12498 @item -fprofile-filter-files=@var{regex}
12499 @opindex fprofile-filter-files
12501 Instrument only functions from files where names match
12502 any regular expression (separated by a semi-colon).
12504 For example, @option{-fprofile-filter-files=main.c;module.*.c} will instrument
12505 only @file{main.c} and all C files starting with 'module'.
12507 @item -fprofile-exclude-files=@var{regex}
12508 @opindex fprofile-exclude-files
12510 Instrument only functions from files where names do not match
12511 all the regular expressions (separated by a semi-colon).
12513 For example, @option{-fprofile-exclude-files=/usr/*} will prevent instrumentation
12514 of all files that are located in @file{/usr/} folder.
12516 @item -fsanitize=address
12517 @opindex fsanitize=address
12518 Enable AddressSanitizer, a fast memory error detector.
12519 Memory access instructions are instrumented to detect
12520 out-of-bounds and use-after-free bugs.
12521 The option enables @option{-fsanitize-address-use-after-scope}.
12522 See @uref{https://github.com/google/sanitizers/wiki/AddressSanitizer} for
12523 more details. The run-time behavior can be influenced using the
12524 @env{ASAN_OPTIONS} environment variable. When set to @code{help=1},
12525 the available options are shown at startup of the instrumented program. See
12526 @url{https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags}
12527 for a list of supported options.
12528 The option cannot be combined with @option{-fsanitize=thread}.
12530 @item -fsanitize=kernel-address
12531 @opindex fsanitize=kernel-address
12532 Enable AddressSanitizer for Linux kernel.
12533 See @uref{https://github.com/google/kasan/wiki} for more details.
12535 @item -fsanitize=pointer-compare
12536 @opindex fsanitize=pointer-compare
12537 Instrument comparison operation (<, <=, >, >=) with pointer operands.
12538 The option must be combined with either @option{-fsanitize=kernel-address} or
12539 @option{-fsanitize=address}
12540 The option cannot be combined with @option{-fsanitize=thread}.
12541 Note: By default the check is disabled at run time. To enable it,
12542 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12543 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12544 invalid operation only when both pointers are non-null.
12546 @item -fsanitize=pointer-subtract
12547 @opindex fsanitize=pointer-subtract
12548 Instrument subtraction with pointer operands.
12549 The option must be combined with either @option{-fsanitize=kernel-address} or
12550 @option{-fsanitize=address}
12551 The option cannot be combined with @option{-fsanitize=thread}.
12552 Note: By default the check is disabled at run time. To enable it,
12553 add @code{detect_invalid_pointer_pairs=2} to the environment variable
12554 @env{ASAN_OPTIONS}. Using @code{detect_invalid_pointer_pairs=1} detects
12555 invalid operation only when both pointers are non-null.
12557 @item -fsanitize=thread
12558 @opindex fsanitize=thread
12559 Enable ThreadSanitizer, a fast data race detector.
12560 Memory access instructions are instrumented to detect
12561 data race bugs. See @uref{https://github.com/google/sanitizers/wiki#threadsanitizer} for more
12562 details. The run-time behavior can be influenced using the @env{TSAN_OPTIONS}
12563 environment variable; see
12564 @url{https://github.com/google/sanitizers/wiki/ThreadSanitizerFlags} for a list of
12566 The option cannot be combined with @option{-fsanitize=address},
12567 @option{-fsanitize=leak}.
12569 Note that sanitized atomic builtins cannot throw exceptions when
12570 operating on invalid memory addresses with non-call exceptions
12571 (@option{-fnon-call-exceptions}).
12573 @item -fsanitize=leak
12574 @opindex fsanitize=leak
12575 Enable LeakSanitizer, a memory leak detector.
12576 This option only matters for linking of executables and
12577 the executable is linked against a library that overrides @code{malloc}
12578 and other allocator functions. See
12579 @uref{https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer} for more
12580 details. The run-time behavior can be influenced using the
12581 @env{LSAN_OPTIONS} environment variable.
12582 The option cannot be combined with @option{-fsanitize=thread}.
12584 @item -fsanitize=undefined
12585 @opindex fsanitize=undefined
12586 Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector.
12587 Various computations are instrumented to detect undefined behavior
12588 at runtime. Current suboptions are:
12592 @item -fsanitize=shift
12593 @opindex fsanitize=shift
12594 This option enables checking that the result of a shift operation is
12595 not undefined. Note that what exactly is considered undefined differs
12596 slightly between C and C++, as well as between ISO C90 and C99, etc.
12597 This option has two suboptions, @option{-fsanitize=shift-base} and
12598 @option{-fsanitize=shift-exponent}.
12600 @item -fsanitize=shift-exponent
12601 @opindex fsanitize=shift-exponent
12602 This option enables checking that the second argument of a shift operation
12603 is not negative and is smaller than the precision of the promoted first
12606 @item -fsanitize=shift-base
12607 @opindex fsanitize=shift-base
12608 If the second argument of a shift operation is within range, check that the
12609 result of a shift operation is not undefined. Note that what exactly is
12610 considered undefined differs slightly between C and C++, as well as between
12611 ISO C90 and C99, etc.
12613 @item -fsanitize=integer-divide-by-zero
12614 @opindex fsanitize=integer-divide-by-zero
12615 Detect integer division by zero as well as @code{INT_MIN / -1} division.
12617 @item -fsanitize=unreachable
12618 @opindex fsanitize=unreachable
12619 With this option, the compiler turns the @code{__builtin_unreachable}
12620 call into a diagnostics message call instead. When reaching the
12621 @code{__builtin_unreachable} call, the behavior is undefined.
12623 @item -fsanitize=vla-bound
12624 @opindex fsanitize=vla-bound
12625 This option instructs the compiler to check that the size of a variable
12626 length array is positive.
12628 @item -fsanitize=null
12629 @opindex fsanitize=null
12630 This option enables pointer checking. Particularly, the application
12631 built with this option turned on will issue an error message when it
12632 tries to dereference a NULL pointer, or if a reference (possibly an
12633 rvalue reference) is bound to a NULL pointer, or if a method is invoked
12634 on an object pointed by a NULL pointer.
12636 @item -fsanitize=return
12637 @opindex fsanitize=return
12638 This option enables return statement checking. Programs
12639 built with this option turned on will issue an error message
12640 when the end of a non-void function is reached without actually
12641 returning a value. This option works in C++ only.
12643 @item -fsanitize=signed-integer-overflow
12644 @opindex fsanitize=signed-integer-overflow
12645 This option enables signed integer overflow checking. We check that
12646 the result of @code{+}, @code{*}, and both unary and binary @code{-}
12647 does not overflow in the signed arithmetics. Note, integer promotion
12648 rules must be taken into account. That is, the following is not an
12651 signed char a = SCHAR_MAX;
12655 @item -fsanitize=bounds
12656 @opindex fsanitize=bounds
12657 This option enables instrumentation of array bounds. Various out of bounds
12658 accesses are detected. Flexible array members, flexible array member-like
12659 arrays, and initializers of variables with static storage are not instrumented.
12661 @item -fsanitize=bounds-strict
12662 @opindex fsanitize=bounds-strict
12663 This option enables strict instrumentation of array bounds. Most out of bounds
12664 accesses are detected, including flexible array members and flexible array
12665 member-like arrays. Initializers of variables with static storage are not
12668 @item -fsanitize=alignment
12669 @opindex fsanitize=alignment
12671 This option enables checking of alignment of pointers when they are
12672 dereferenced, or when a reference is bound to insufficiently aligned target,
12673 or when a method or constructor is invoked on insufficiently aligned object.
12675 @item -fsanitize=object-size
12676 @opindex fsanitize=object-size
12677 This option enables instrumentation of memory references using the
12678 @code{__builtin_object_size} function. Various out of bounds pointer
12679 accesses are detected.
12681 @item -fsanitize=float-divide-by-zero
12682 @opindex fsanitize=float-divide-by-zero
12683 Detect floating-point division by zero. Unlike other similar options,
12684 @option{-fsanitize=float-divide-by-zero} is not enabled by
12685 @option{-fsanitize=undefined}, since floating-point division by zero can
12686 be a legitimate way of obtaining infinities and NaNs.
12688 @item -fsanitize=float-cast-overflow
12689 @opindex fsanitize=float-cast-overflow
12690 This option enables floating-point type to integer conversion checking.
12691 We check that the result of the conversion does not overflow.
12692 Unlike other similar options, @option{-fsanitize=float-cast-overflow} is
12693 not enabled by @option{-fsanitize=undefined}.
12694 This option does not work well with @code{FE_INVALID} exceptions enabled.
12696 @item -fsanitize=nonnull-attribute
12697 @opindex fsanitize=nonnull-attribute
12699 This option enables instrumentation of calls, checking whether null values
12700 are not passed to arguments marked as requiring a non-null value by the
12701 @code{nonnull} function attribute.
12703 @item -fsanitize=returns-nonnull-attribute
12704 @opindex fsanitize=returns-nonnull-attribute
12706 This option enables instrumentation of return statements in functions
12707 marked with @code{returns_nonnull} function attribute, to detect returning
12708 of null values from such functions.
12710 @item -fsanitize=bool
12711 @opindex fsanitize=bool
12713 This option enables instrumentation of loads from bool. If a value other
12714 than 0/1 is loaded, a run-time error is issued.
12716 @item -fsanitize=enum
12717 @opindex fsanitize=enum
12719 This option enables instrumentation of loads from an enum type. If
12720 a value outside the range of values for the enum type is loaded,
12721 a run-time error is issued.
12723 @item -fsanitize=vptr
12724 @opindex fsanitize=vptr
12726 This option enables instrumentation of C++ member function calls, member
12727 accesses and some conversions between pointers to base and derived classes,
12728 to verify the referenced object has the correct dynamic type.
12730 @item -fsanitize=pointer-overflow
12731 @opindex fsanitize=pointer-overflow
12733 This option enables instrumentation of pointer arithmetics. If the pointer
12734 arithmetics overflows, a run-time error is issued.
12736 @item -fsanitize=builtin
12737 @opindex fsanitize=builtin
12739 This option enables instrumentation of arguments to selected builtin
12740 functions. If an invalid value is passed to such arguments, a run-time
12741 error is issued. E.g.@ passing 0 as the argument to @code{__builtin_ctz}
12742 or @code{__builtin_clz} invokes undefined behavior and is diagnosed
12747 While @option{-ftrapv} causes traps for signed overflows to be emitted,
12748 @option{-fsanitize=undefined} gives a diagnostic message.
12749 This currently works only for the C family of languages.
12751 @item -fno-sanitize=all
12752 @opindex fno-sanitize=all
12754 This option disables all previously enabled sanitizers.
12755 @option{-fsanitize=all} is not allowed, as some sanitizers cannot be used
12758 @item -fasan-shadow-offset=@var{number}
12759 @opindex fasan-shadow-offset
12760 This option forces GCC to use custom shadow offset in AddressSanitizer checks.
12761 It is useful for experimenting with different shadow memory layouts in
12762 Kernel AddressSanitizer.
12764 @item -fsanitize-sections=@var{s1},@var{s2},...
12765 @opindex fsanitize-sections
12766 Sanitize global variables in selected user-defined sections. @var{si} may
12769 @item -fsanitize-recover@r{[}=@var{opts}@r{]}
12770 @opindex fsanitize-recover
12771 @opindex fno-sanitize-recover
12772 @option{-fsanitize-recover=} controls error recovery mode for sanitizers
12773 mentioned in comma-separated list of @var{opts}. Enabling this option
12774 for a sanitizer component causes it to attempt to continue
12775 running the program as if no error happened. This means multiple
12776 runtime errors can be reported in a single program run, and the exit
12777 code of the program may indicate success even when errors
12778 have been reported. The @option{-fno-sanitize-recover=} option
12779 can be used to alter
12780 this behavior: only the first detected error is reported
12781 and program then exits with a non-zero exit code.
12783 Currently this feature only works for @option{-fsanitize=undefined} (and its suboptions
12784 except for @option{-fsanitize=unreachable} and @option{-fsanitize=return}),
12785 @option{-fsanitize=float-cast-overflow}, @option{-fsanitize=float-divide-by-zero},
12786 @option{-fsanitize=bounds-strict},
12787 @option{-fsanitize=kernel-address} and @option{-fsanitize=address}.
12788 For these sanitizers error recovery is turned on by default,
12789 except @option{-fsanitize=address}, for which this feature is experimental.
12790 @option{-fsanitize-recover=all} and @option{-fno-sanitize-recover=all} is also
12791 accepted, the former enables recovery for all sanitizers that support it,
12792 the latter disables recovery for all sanitizers that support it.
12794 Even if a recovery mode is turned on the compiler side, it needs to be also
12795 enabled on the runtime library side, otherwise the failures are still fatal.
12796 The runtime library defaults to @code{halt_on_error=0} for
12797 ThreadSanitizer and UndefinedBehaviorSanitizer, while default value for
12798 AddressSanitizer is @code{halt_on_error=1}. This can be overridden through
12799 setting the @code{halt_on_error} flag in the corresponding environment variable.
12801 Syntax without an explicit @var{opts} parameter is deprecated. It is
12802 equivalent to specifying an @var{opts} list of:
12805 undefined,float-cast-overflow,float-divide-by-zero,bounds-strict
12808 @item -fsanitize-address-use-after-scope
12809 @opindex fsanitize-address-use-after-scope
12810 Enable sanitization of local variables to detect use-after-scope bugs.
12811 The option sets @option{-fstack-reuse} to @samp{none}.
12813 @item -fsanitize-undefined-trap-on-error
12814 @opindex fsanitize-undefined-trap-on-error
12815 The @option{-fsanitize-undefined-trap-on-error} option instructs the compiler to
12816 report undefined behavior using @code{__builtin_trap} rather than
12817 a @code{libubsan} library routine. The advantage of this is that the
12818 @code{libubsan} library is not needed and is not linked in, so this
12819 is usable even in freestanding environments.
12821 @item -fsanitize-coverage=trace-pc
12822 @opindex fsanitize-coverage=trace-pc
12823 Enable coverage-guided fuzzing code instrumentation.
12824 Inserts a call to @code{__sanitizer_cov_trace_pc} into every basic block.
12826 @item -fsanitize-coverage=trace-cmp
12827 @opindex fsanitize-coverage=trace-cmp
12828 Enable dataflow guided fuzzing code instrumentation.
12829 Inserts a call to @code{__sanitizer_cov_trace_cmp1},
12830 @code{__sanitizer_cov_trace_cmp2}, @code{__sanitizer_cov_trace_cmp4} or
12831 @code{__sanitizer_cov_trace_cmp8} for integral comparison with both operands
12832 variable or @code{__sanitizer_cov_trace_const_cmp1},
12833 @code{__sanitizer_cov_trace_const_cmp2},
12834 @code{__sanitizer_cov_trace_const_cmp4} or
12835 @code{__sanitizer_cov_trace_const_cmp8} for integral comparison with one
12836 operand constant, @code{__sanitizer_cov_trace_cmpf} or
12837 @code{__sanitizer_cov_trace_cmpd} for float or double comparisons and
12838 @code{__sanitizer_cov_trace_switch} for switch statements.
12840 @item -fcf-protection=@r{[}full@r{|}branch@r{|}return@r{|}none@r{]}
12841 @opindex fcf-protection
12842 Enable code instrumentation of control-flow transfers to increase
12843 program security by checking that target addresses of control-flow
12844 transfer instructions (such as indirect function call, function return,
12845 indirect jump) are valid. This prevents diverting the flow of control
12846 to an unexpected target. This is intended to protect against such
12847 threats as Return-oriented Programming (ROP), and similarly
12848 call/jmp-oriented programming (COP/JOP).
12850 The value @code{branch} tells the compiler to implement checking of
12851 validity of control-flow transfer at the point of indirect branch
12852 instructions, i.e.@: call/jmp instructions. The value @code{return}
12853 implements checking of validity at the point of returning from a
12854 function. The value @code{full} is an alias for specifying both
12855 @code{branch} and @code{return}. The value @code{none} turns off
12858 The macro @code{__CET__} is defined when @option{-fcf-protection} is
12859 used. The first bit of @code{__CET__} is set to 1 for the value
12860 @code{branch} and the second bit of @code{__CET__} is set to 1 for
12863 You can also use the @code{nocf_check} attribute to identify
12864 which functions and calls should be skipped from instrumentation
12865 (@pxref{Function Attributes}).
12867 Currently the x86 GNU/Linux target provides an implementation based
12868 on Intel Control-flow Enforcement Technology (CET).
12870 @item -fstack-protector
12871 @opindex fstack-protector
12872 Emit extra code to check for buffer overflows, such as stack smashing
12873 attacks. This is done by adding a guard variable to functions with
12874 vulnerable objects. This includes functions that call @code{alloca}, and
12875 functions with buffers larger than 8 bytes. The guards are initialized
12876 when a function is entered and then checked when the function exits.
12877 If a guard check fails, an error message is printed and the program exits.
12879 @item -fstack-protector-all
12880 @opindex fstack-protector-all
12881 Like @option{-fstack-protector} except that all functions are protected.
12883 @item -fstack-protector-strong
12884 @opindex fstack-protector-strong
12885 Like @option{-fstack-protector} but includes additional functions to
12886 be protected --- those that have local array definitions, or have
12887 references to local frame addresses.
12889 @item -fstack-protector-explicit
12890 @opindex fstack-protector-explicit
12891 Like @option{-fstack-protector} but only protects those functions which
12892 have the @code{stack_protect} attribute.
12894 @item -fstack-check
12895 @opindex fstack-check
12896 Generate code to verify that you do not go beyond the boundary of the
12897 stack. You should specify this flag if you are running in an
12898 environment with multiple threads, but you only rarely need to specify it in
12899 a single-threaded environment since stack overflow is automatically
12900 detected on nearly all systems if there is only one stack.
12902 Note that this switch does not actually cause checking to be done; the
12903 operating system or the language runtime must do that. The switch causes
12904 generation of code to ensure that they see the stack being extended.
12906 You can additionally specify a string parameter: @samp{no} means no
12907 checking, @samp{generic} means force the use of old-style checking,
12908 @samp{specific} means use the best checking method and is equivalent
12909 to bare @option{-fstack-check}.
12911 Old-style checking is a generic mechanism that requires no specific
12912 target support in the compiler but comes with the following drawbacks:
12916 Modified allocation strategy for large objects: they are always
12917 allocated dynamically if their size exceeds a fixed threshold. Note this
12918 may change the semantics of some code.
12921 Fixed limit on the size of the static frame of functions: when it is
12922 topped by a particular function, stack checking is not reliable and
12923 a warning is issued by the compiler.
12926 Inefficiency: because of both the modified allocation strategy and the
12927 generic implementation, code performance is hampered.
12930 Note that old-style stack checking is also the fallback method for
12931 @samp{specific} if no target support has been added in the compiler.
12933 @samp{-fstack-check=} is designed for Ada's needs to detect infinite recursion
12934 and stack overflows. @samp{specific} is an excellent choice when compiling
12935 Ada code. It is not generally sufficient to protect against stack-clash
12936 attacks. To protect against those you want @samp{-fstack-clash-protection}.
12938 @item -fstack-clash-protection
12939 @opindex fstack-clash-protection
12940 Generate code to prevent stack clash style attacks. When this option is
12941 enabled, the compiler will only allocate one page of stack space at a time
12942 and each page is accessed immediately after allocation. Thus, it prevents
12943 allocations from jumping over any stack guard page provided by the
12946 Most targets do not fully support stack clash protection. However, on
12947 those targets @option{-fstack-clash-protection} will protect dynamic stack
12948 allocations. @option{-fstack-clash-protection} may also provide limited
12949 protection for static stack allocations if the target supports
12950 @option{-fstack-check=specific}.
12952 @item -fstack-limit-register=@var{reg}
12953 @itemx -fstack-limit-symbol=@var{sym}
12954 @itemx -fno-stack-limit
12955 @opindex fstack-limit-register
12956 @opindex fstack-limit-symbol
12957 @opindex fno-stack-limit
12958 Generate code to ensure that the stack does not grow beyond a certain value,
12959 either the value of a register or the address of a symbol. If a larger
12960 stack is required, a signal is raised at run time. For most targets,
12961 the signal is raised before the stack overruns the boundary, so
12962 it is possible to catch the signal without taking special precautions.
12964 For instance, if the stack starts at absolute address @samp{0x80000000}
12965 and grows downwards, you can use the flags
12966 @option{-fstack-limit-symbol=__stack_limit} and
12967 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
12968 of 128KB@. Note that this may only work with the GNU linker.
12970 You can locally override stack limit checking by using the
12971 @code{no_stack_limit} function attribute (@pxref{Function Attributes}).
12973 @item -fsplit-stack
12974 @opindex fsplit-stack
12975 Generate code to automatically split the stack before it overflows.
12976 The resulting program has a discontiguous stack which can only
12977 overflow if the program is unable to allocate any more memory. This
12978 is most useful when running threaded programs, as it is no longer
12979 necessary to calculate a good stack size to use for each thread. This
12980 is currently only implemented for the x86 targets running
12983 When code compiled with @option{-fsplit-stack} calls code compiled
12984 without @option{-fsplit-stack}, there may not be much stack space
12985 available for the latter code to run. If compiling all code,
12986 including library code, with @option{-fsplit-stack} is not an option,
12987 then the linker can fix up these calls so that the code compiled
12988 without @option{-fsplit-stack} always has a large stack. Support for
12989 this is implemented in the gold linker in GNU binutils release 2.21
12992 @item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
12993 @opindex fvtable-verify
12994 This option is only available when compiling C++ code.
12995 It turns on (or off, if using @option{-fvtable-verify=none}) the security
12996 feature that verifies at run time, for every virtual call, that
12997 the vtable pointer through which the call is made is valid for the type of
12998 the object, and has not been corrupted or overwritten. If an invalid vtable
12999 pointer is detected at run time, an error is reported and execution of the
13000 program is immediately halted.
13002 This option causes run-time data structures to be built at program startup,
13003 which are used for verifying the vtable pointers.
13004 The options @samp{std} and @samp{preinit}
13005 control the timing of when these data structures are built. In both cases the
13006 data structures are built before execution reaches @code{main}. Using
13007 @option{-fvtable-verify=std} causes the data structures to be built after
13008 shared libraries have been loaded and initialized.
13009 @option{-fvtable-verify=preinit} causes them to be built before shared
13010 libraries have been loaded and initialized.
13012 If this option appears multiple times in the command line with different
13013 values specified, @samp{none} takes highest priority over both @samp{std} and
13014 @samp{preinit}; @samp{preinit} takes priority over @samp{std}.
13017 @opindex fvtv-debug
13018 When used in conjunction with @option{-fvtable-verify=std} or
13019 @option{-fvtable-verify=preinit}, causes debug versions of the
13020 runtime functions for the vtable verification feature to be called.
13021 This flag also causes the compiler to log information about which
13022 vtable pointers it finds for each class.
13023 This information is written to a file named @file{vtv_set_ptr_data.log}
13024 in the directory named by the environment variable @env{VTV_LOGS_DIR}
13025 if that is defined or the current working directory otherwise.
13027 Note: This feature @emph{appends} data to the log file. If you want a fresh log
13028 file, be sure to delete any existing one.
13031 @opindex fvtv-counts
13032 This is a debugging flag. When used in conjunction with
13033 @option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
13034 causes the compiler to keep track of the total number of virtual calls
13035 it encounters and the number of verifications it inserts. It also
13036 counts the number of calls to certain run-time library functions
13037 that it inserts and logs this information for each compilation unit.
13038 The compiler writes this information to a file named
13039 @file{vtv_count_data.log} in the directory named by the environment
13040 variable @env{VTV_LOGS_DIR} if that is defined or the current working
13041 directory otherwise. It also counts the size of the vtable pointer sets
13042 for each class, and writes this information to @file{vtv_class_set_sizes.log}
13043 in the same directory.
13045 Note: This feature @emph{appends} data to the log files. To get fresh log
13046 files, be sure to delete any existing ones.
13048 @item -finstrument-functions
13049 @opindex finstrument-functions
13050 Generate instrumentation calls for entry and exit to functions. Just
13051 after function entry and just before function exit, the following
13052 profiling functions are called with the address of the current
13053 function and its call site. (On some platforms,
13054 @code{__builtin_return_address} does not work beyond the current
13055 function, so the call site information may not be available to the
13056 profiling functions otherwise.)
13059 void __cyg_profile_func_enter (void *this_fn,
13061 void __cyg_profile_func_exit (void *this_fn,
13065 The first argument is the address of the start of the current function,
13066 which may be looked up exactly in the symbol table.
13068 This instrumentation is also done for functions expanded inline in other
13069 functions. The profiling calls indicate where, conceptually, the
13070 inline function is entered and exited. This means that addressable
13071 versions of such functions must be available. If all your uses of a
13072 function are expanded inline, this may mean an additional expansion of
13073 code size. If you use @code{extern inline} in your C code, an
13074 addressable version of such functions must be provided. (This is
13075 normally the case anyway, but if you get lucky and the optimizer always
13076 expands the functions inline, you might have gotten away without
13077 providing static copies.)
13079 A function may be given the attribute @code{no_instrument_function}, in
13080 which case this instrumentation is not done. This can be used, for
13081 example, for the profiling functions listed above, high-priority
13082 interrupt routines, and any functions from which the profiling functions
13083 cannot safely be called (perhaps signal handlers, if the profiling
13084 routines generate output or allocate memory).
13085 @xref{Common Function Attributes}.
13087 @item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
13088 @opindex finstrument-functions-exclude-file-list
13090 Set the list of functions that are excluded from instrumentation (see
13091 the description of @option{-finstrument-functions}). If the file that
13092 contains a function definition matches with one of @var{file}, then
13093 that function is not instrumented. The match is done on substrings:
13094 if the @var{file} parameter is a substring of the file name, it is
13095 considered to be a match.
13100 -finstrument-functions-exclude-file-list=/bits/stl,include/sys
13104 excludes any inline function defined in files whose pathnames
13105 contain @file{/bits/stl} or @file{include/sys}.
13107 If, for some reason, you want to include letter @samp{,} in one of
13108 @var{sym}, write @samp{\,}. For example,
13109 @option{-finstrument-functions-exclude-file-list='\,\,tmp'}
13110 (note the single quote surrounding the option).
13112 @item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
13113 @opindex finstrument-functions-exclude-function-list
13115 This is similar to @option{-finstrument-functions-exclude-file-list},
13116 but this option sets the list of function names to be excluded from
13117 instrumentation. The function name to be matched is its user-visible
13118 name, such as @code{vector<int> blah(const vector<int> &)}, not the
13119 internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
13120 match is done on substrings: if the @var{sym} parameter is a substring
13121 of the function name, it is considered to be a match. For C99 and C++
13122 extended identifiers, the function name must be given in UTF-8, not
13123 using universal character names.
13125 @item -fpatchable-function-entry=@var{N}[,@var{M}]
13126 @opindex fpatchable-function-entry
13127 Generate @var{N} NOPs right at the beginning
13128 of each function, with the function entry point before the @var{M}th NOP.
13129 If @var{M} is omitted, it defaults to @code{0} so the
13130 function entry points to the address just at the first NOP.
13131 The NOP instructions reserve extra space which can be used to patch in
13132 any desired instrumentation at run time, provided that the code segment
13133 is writable. The amount of space is controllable indirectly via
13134 the number of NOPs; the NOP instruction used corresponds to the instruction
13135 emitted by the internal GCC back-end interface @code{gen_nop}. This behavior
13136 is target-specific and may also depend on the architecture variant and/or
13137 other compilation options.
13139 For run-time identification, the starting addresses of these areas,
13140 which correspond to their respective function entries minus @var{M},
13141 are additionally collected in the @code{__patchable_function_entries}
13142 section of the resulting binary.
13144 Note that the value of @code{__attribute__ ((patchable_function_entry
13145 (N,M)))} takes precedence over command-line option
13146 @option{-fpatchable-function-entry=N,M}. This can be used to increase
13147 the area size or to remove it completely on a single function.
13148 If @code{N=0}, no pad location is recorded.
13150 The NOP instructions are inserted at---and maybe before, depending on
13151 @var{M}---the function entry address, even before the prologue.
13156 @node Preprocessor Options
13157 @section Options Controlling the Preprocessor
13158 @cindex preprocessor options
13159 @cindex options, preprocessor
13161 These options control the C preprocessor, which is run on each C source
13162 file before actual compilation.
13164 If you use the @option{-E} option, nothing is done except preprocessing.
13165 Some of these options make sense only together with @option{-E} because
13166 they cause the preprocessor output to be unsuitable for actual
13169 In addition to the options listed here, there are a number of options
13170 to control search paths for include files documented in
13171 @ref{Directory Options}.
13172 Options to control preprocessor diagnostics are listed in
13173 @ref{Warning Options}.
13176 @include cppopts.texi
13178 @item -Wp,@var{option}
13180 You can use @option{-Wp,@var{option}} to bypass the compiler driver
13181 and pass @var{option} directly through to the preprocessor. If
13182 @var{option} contains commas, it is split into multiple options at the
13183 commas. However, many options are modified, translated or interpreted
13184 by the compiler driver before being passed to the preprocessor, and
13185 @option{-Wp} forcibly bypasses this phase. The preprocessor's direct
13186 interface is undocumented and subject to change, so whenever possible
13187 you should avoid using @option{-Wp} and let the driver handle the
13190 @item -Xpreprocessor @var{option}
13191 @opindex Xpreprocessor
13192 Pass @var{option} as an option to the preprocessor. You can use this to
13193 supply system-specific preprocessor options that GCC does not
13196 If you want to pass an option that takes an argument, you must use
13197 @option{-Xpreprocessor} twice, once for the option and once for the argument.
13199 @item -no-integrated-cpp
13200 @opindex no-integrated-cpp
13201 Perform preprocessing as a separate pass before compilation.
13202 By default, GCC performs preprocessing as an integrated part of
13203 input tokenization and parsing.
13204 If this option is provided, the appropriate language front end
13205 (@command{cc1}, @command{cc1plus}, or @command{cc1obj} for C, C++,
13206 and Objective-C, respectively) is instead invoked twice,
13207 once for preprocessing only and once for actual compilation
13208 of the preprocessed input.
13209 This option may be useful in conjunction with the @option{-B} or
13210 @option{-wrapper} options to specify an alternate preprocessor or
13211 perform additional processing of the program source between
13212 normal preprocessing and compilation.
13216 @node Assembler Options
13217 @section Passing Options to the Assembler
13219 @c prevent bad page break with this line
13220 You can pass options to the assembler.
13223 @item -Wa,@var{option}
13225 Pass @var{option} as an option to the assembler. If @var{option}
13226 contains commas, it is split into multiple options at the commas.
13228 @item -Xassembler @var{option}
13229 @opindex Xassembler
13230 Pass @var{option} as an option to the assembler. You can use this to
13231 supply system-specific assembler options that GCC does not
13234 If you want to pass an option that takes an argument, you must use
13235 @option{-Xassembler} twice, once for the option and once for the argument.
13240 @section Options for Linking
13241 @cindex link options
13242 @cindex options, linking
13244 These options come into play when the compiler links object files into
13245 an executable output file. They are meaningless if the compiler is
13246 not doing a link step.
13250 @item @var{object-file-name}
13251 A file name that does not end in a special recognized suffix is
13252 considered to name an object file or library. (Object files are
13253 distinguished from libraries by the linker according to the file
13254 contents.) If linking is done, these object files are used as input
13263 If any of these options is used, then the linker is not run, and
13264 object file names should not be used as arguments. @xref{Overall
13267 @item -flinker-output=@var{type}
13268 @opindex flinker-output
13269 This option controls code generation of the link-time optimizer. By
13270 default the linker output is automatically determined by the linker
13271 plugin. For debugging the compiler and if incremental linking with a
13272 non-LTO object file is desired, it may be useful to control the type
13275 If @var{type} is @samp{exec}, code generation produces a static
13276 binary. In this case @option{-fpic} and @option{-fpie} are both
13279 If @var{type} is @samp{dyn}, code generation produces a shared
13280 library. In this case @option{-fpic} or @option{-fPIC} is preserved,
13281 but not enabled automatically. This allows to build shared libraries
13282 without position-independent code on architectures where this is
13283 possible, i.e.@: on x86.
13285 If @var{type} is @samp{pie}, code generation produces an @option{-fpie}
13286 executable. This results in similar optimizations as @samp{exec}
13287 except that @option{-fpie} is not disabled if specified at compilation
13290 If @var{type} is @samp{rel}, the compiler assumes that incremental linking is
13291 done. The sections containing intermediate code for link-time optimization are
13292 merged, pre-optimized, and output to the resulting object file. In addition, if
13293 @option{-ffat-lto-objects} is specified, binary code is produced for future
13294 non-LTO linking. The object file produced by incremental linking is smaller
13295 than a static library produced from the same object files. At link time the
13296 result of incremental linking also loads faster than a static
13297 library assuming that the majority of objects in the library are used.
13299 Finally @samp{nolto-rel} configures the compiler for incremental linking where
13300 code generation is forced, a final binary is produced, and the intermediate
13301 code for later link-time optimization is stripped. When multiple object files
13302 are linked together the resulting code is better optimized than with
13303 link-time optimizations disabled (for example, cross-module inlining
13304 happens), but most of benefits of whole program optimizations are lost.
13306 During the incremental link (by @option{-r}) the linker plugin defaults to
13307 @option{rel}. With current interfaces to GNU Binutils it is however not
13308 possible to incrementally link LTO objects and non-LTO objects into a single
13309 mixed object file. If any of object files in incremental link cannot
13310 be used for link-time optimization, the linker plugin issues a warning and
13311 uses @samp{nolto-rel}. To maintain whole program optimization, it is
13312 recommended to link such objects into static library instead. Alternatively it
13313 is possible to use H.J. Lu's binutils with support for mixed objects.
13316 @opindex fuse-ld=bfd
13317 Use the @command{bfd} linker instead of the default linker.
13319 @item -fuse-ld=gold
13320 @opindex fuse-ld=gold
13321 Use the @command{gold} linker instead of the default linker.
13324 @opindex fuse-ld=lld
13325 Use the LLVM @command{lld} linker instead of the default linker.
13328 @item -l@var{library}
13329 @itemx -l @var{library}
13331 Search the library named @var{library} when linking. (The second
13332 alternative with the library as a separate argument is only for
13333 POSIX compliance and is not recommended.)
13335 The @option{-l} option is passed directly to the linker by GCC. Refer
13336 to your linker documentation for exact details. The general
13337 description below applies to the GNU linker.
13339 The linker searches a standard list of directories for the library.
13340 The directories searched include several standard system directories
13341 plus any that you specify with @option{-L}.
13343 Static libraries are archives of object files, and have file names
13344 like @file{lib@var{library}.a}. Some targets also support shared
13345 libraries, which typically have names like @file{lib@var{library}.so}.
13346 If both static and shared libraries are found, the linker gives
13347 preference to linking with the shared library unless the
13348 @option{-static} option is used.
13350 It makes a difference where in the command you write this option; the
13351 linker searches and processes libraries and object files in the order they
13352 are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
13353 after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
13354 to functions in @samp{z}, those functions may not be loaded.
13358 You need this special case of the @option{-l} option in order to
13359 link an Objective-C or Objective-C++ program.
13361 @item -nostartfiles
13362 @opindex nostartfiles
13363 Do not use the standard system startup files when linking.
13364 The standard system libraries are used normally, unless @option{-nostdlib},
13365 @option{-nolibc}, or @option{-nodefaultlibs} is used.
13367 @item -nodefaultlibs
13368 @opindex nodefaultlibs
13369 Do not use the standard system libraries when linking.
13370 Only the libraries you specify are passed to the linker, and options
13371 specifying linkage of the system libraries, such as @option{-static-libgcc}
13372 or @option{-shared-libgcc}, are ignored.
13373 The standard startup files are used normally, unless @option{-nostartfiles}
13376 The compiler may generate calls to @code{memcmp},
13377 @code{memset}, @code{memcpy} and @code{memmove}.
13378 These entries are usually resolved by entries in
13379 libc. These entry points should be supplied through some other
13380 mechanism when this option is specified.
13384 Do not use the C library or system libraries tightly coupled with it when
13385 linking. Still link with the startup files, @file{libgcc} or toolchain
13386 provided language support libraries such as @file{libgnat}, @file{libgfortran}
13387 or @file{libstdc++} unless options preventing their inclusion are used as
13388 well. This typically removes @option{-lc} from the link command line, as well
13389 as system libraries that normally go with it and become meaningless when
13390 absence of a C library is assumed, for example @option{-lpthread} or
13391 @option{-lm} in some configurations. This is intended for bare-board
13392 targets when there is indeed no C library available.
13396 Do not use the standard system startup files or libraries when linking.
13397 No startup files and only the libraries you specify are passed to
13398 the linker, and options specifying linkage of the system libraries, such as
13399 @option{-static-libgcc} or @option{-shared-libgcc}, are ignored.
13401 The compiler may generate calls to @code{memcmp}, @code{memset},
13402 @code{memcpy} and @code{memmove}.
13403 These entries are usually resolved by entries in
13404 libc. These entry points should be supplied through some other
13405 mechanism when this option is specified.
13407 @cindex @option{-lgcc}, use with @option{-nostdlib}
13408 @cindex @option{-nostdlib} and unresolved references
13409 @cindex unresolved references and @option{-nostdlib}
13410 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
13411 @cindex @option{-nodefaultlibs} and unresolved references
13412 @cindex unresolved references and @option{-nodefaultlibs}
13413 One of the standard libraries bypassed by @option{-nostdlib} and
13414 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
13415 which GCC uses to overcome shortcomings of particular machines, or special
13416 needs for some languages.
13417 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
13418 Collection (GCC) Internals},
13419 for more discussion of @file{libgcc.a}.)
13420 In most cases, you need @file{libgcc.a} even when you want to avoid
13421 other standard libraries. In other words, when you specify @option{-nostdlib}
13422 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
13423 This ensures that you have no unresolved references to internal GCC
13424 library subroutines.
13425 (An example of such an internal subroutine is @code{__main}, used to ensure C++
13426 constructors are called; @pxref{Collect2,,@code{collect2}, gccint,
13427 GNU Compiler Collection (GCC) Internals}.)
13429 @item -e @var{entry}
13430 @itemx --entry=@var{entry}
13434 Specify that the program entry point is @var{entry}. The argument is
13435 interpreted by the linker; the GNU linker accepts either a symbol name
13440 Produce a dynamically linked position independent executable on targets
13441 that support it. For predictable results, you must also specify the same
13442 set of options used for compilation (@option{-fpie}, @option{-fPIE},
13443 or model suboptions) when you specify this linker option.
13447 Don't produce a dynamically linked position independent executable.
13450 @opindex static-pie
13451 Produce a static position independent executable on targets that support
13452 it. A static position independent executable is similar to a static
13453 executable, but can be loaded at any address without a dynamic linker.
13454 For predictable results, you must also specify the same set of options
13455 used for compilation (@option{-fpie}, @option{-fPIE}, or model
13456 suboptions) when you specify this linker option.
13460 Link with the POSIX threads library. This option is supported on
13461 GNU/Linux targets, most other Unix derivatives, and also on
13462 x86 Cygwin and MinGW targets. On some targets this option also sets
13463 flags for the preprocessor, so it should be used consistently for both
13464 compilation and linking.
13468 Produce a relocatable object as output. This is also known as partial
13473 Pass the flag @option{-export-dynamic} to the ELF linker, on targets
13474 that support it. This instructs the linker to add all symbols, not
13475 only used ones, to the dynamic symbol table. This option is needed
13476 for some uses of @code{dlopen} or to allow obtaining backtraces
13477 from within a program.
13481 Remove all symbol table and relocation information from the executable.
13485 On systems that support dynamic linking, this overrides @option{-pie}
13486 and prevents linking with the shared libraries. On other systems, this
13487 option has no effect.
13491 Produce a shared object which can then be linked with other objects to
13492 form an executable. Not all systems support this option. For predictable
13493 results, you must also specify the same set of options used for compilation
13494 (@option{-fpic}, @option{-fPIC}, or model suboptions) when
13495 you specify this linker option.@footnote{On some systems, @samp{gcc -shared}
13496 needs to build supplementary stub code for constructors to work. On
13497 multi-libbed systems, @samp{gcc -shared} must select the correct support
13498 libraries to link against. Failing to supply the correct flags may lead
13499 to subtle defects. Supplying them in cases where they are not necessary
13502 @item -shared-libgcc
13503 @itemx -static-libgcc
13504 @opindex shared-libgcc
13505 @opindex static-libgcc
13506 On systems that provide @file{libgcc} as a shared library, these options
13507 force the use of either the shared or static version, respectively.
13508 If no shared version of @file{libgcc} was built when the compiler was
13509 configured, these options have no effect.
13511 There are several situations in which an application should use the
13512 shared @file{libgcc} instead of the static version. The most common
13513 of these is when the application wishes to throw and catch exceptions
13514 across different shared libraries. In that case, each of the libraries
13515 as well as the application itself should use the shared @file{libgcc}.
13517 Therefore, the G++ driver automatically adds @option{-shared-libgcc}
13518 whenever you build a shared library or a main executable, because C++
13519 programs typically use exceptions, so this is the right thing to do.
13521 If, instead, you use the GCC driver to create shared libraries, you may
13522 find that they are not always linked with the shared @file{libgcc}.
13523 If GCC finds, at its configuration time, that you have a non-GNU linker
13524 or a GNU linker that does not support option @option{--eh-frame-hdr},
13525 it links the shared version of @file{libgcc} into shared libraries
13526 by default. Otherwise, it takes advantage of the linker and optimizes
13527 away the linking with the shared version of @file{libgcc}, linking with
13528 the static version of libgcc by default. This allows exceptions to
13529 propagate through such shared libraries, without incurring relocation
13530 costs at library load time.
13532 However, if a library or main executable is supposed to throw or catch
13533 exceptions, you must link it using the G++ driver, or using the option
13534 @option{-shared-libgcc}, such that it is linked with the shared
13537 @item -static-libasan
13538 @opindex static-libasan
13539 When the @option{-fsanitize=address} option is used to link a program,
13540 the GCC driver automatically links against @option{libasan}. If
13541 @file{libasan} is available as a shared library, and the @option{-static}
13542 option is not used, then this links against the shared version of
13543 @file{libasan}. The @option{-static-libasan} option directs the GCC
13544 driver to link @file{libasan} statically, without necessarily linking
13545 other libraries statically.
13547 @item -static-libtsan
13548 @opindex static-libtsan
13549 When the @option{-fsanitize=thread} option is used to link a program,
13550 the GCC driver automatically links against @option{libtsan}. If
13551 @file{libtsan} is available as a shared library, and the @option{-static}
13552 option is not used, then this links against the shared version of
13553 @file{libtsan}. The @option{-static-libtsan} option directs the GCC
13554 driver to link @file{libtsan} statically, without necessarily linking
13555 other libraries statically.
13557 @item -static-liblsan
13558 @opindex static-liblsan
13559 When the @option{-fsanitize=leak} option is used to link a program,
13560 the GCC driver automatically links against @option{liblsan}. If
13561 @file{liblsan} is available as a shared library, and the @option{-static}
13562 option is not used, then this links against the shared version of
13563 @file{liblsan}. The @option{-static-liblsan} option directs the GCC
13564 driver to link @file{liblsan} statically, without necessarily linking
13565 other libraries statically.
13567 @item -static-libubsan
13568 @opindex static-libubsan
13569 When the @option{-fsanitize=undefined} option is used to link a program,
13570 the GCC driver automatically links against @option{libubsan}. If
13571 @file{libubsan} is available as a shared library, and the @option{-static}
13572 option is not used, then this links against the shared version of
13573 @file{libubsan}. The @option{-static-libubsan} option directs the GCC
13574 driver to link @file{libubsan} statically, without necessarily linking
13575 other libraries statically.
13577 @item -static-libstdc++
13578 @opindex static-libstdc++
13579 When the @command{g++} program is used to link a C++ program, it
13580 normally automatically links against @option{libstdc++}. If
13581 @file{libstdc++} is available as a shared library, and the
13582 @option{-static} option is not used, then this links against the
13583 shared version of @file{libstdc++}. That is normally fine. However, it
13584 is sometimes useful to freeze the version of @file{libstdc++} used by
13585 the program without going all the way to a fully static link. The
13586 @option{-static-libstdc++} option directs the @command{g++} driver to
13587 link @file{libstdc++} statically, without necessarily linking other
13588 libraries statically.
13592 Bind references to global symbols when building a shared object. Warn
13593 about any unresolved references (unless overridden by the link editor
13594 option @option{-Xlinker -z -Xlinker defs}). Only a few systems support
13597 @item -T @var{script}
13599 @cindex linker script
13600 Use @var{script} as the linker script. This option is supported by most
13601 systems using the GNU linker. On some targets, such as bare-board
13602 targets without an operating system, the @option{-T} option may be required
13603 when linking to avoid references to undefined symbols.
13605 @item -Xlinker @var{option}
13607 Pass @var{option} as an option to the linker. You can use this to
13608 supply system-specific linker options that GCC does not recognize.
13610 If you want to pass an option that takes a separate argument, you must use
13611 @option{-Xlinker} twice, once for the option and once for the argument.
13612 For example, to pass @option{-assert definitions}, you must write
13613 @option{-Xlinker -assert -Xlinker definitions}. It does not work to write
13614 @option{-Xlinker "-assert definitions"}, because this passes the entire
13615 string as a single argument, which is not what the linker expects.
13617 When using the GNU linker, it is usually more convenient to pass
13618 arguments to linker options using the @option{@var{option}=@var{value}}
13619 syntax than as separate arguments. For example, you can specify
13620 @option{-Xlinker -Map=output.map} rather than
13621 @option{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
13622 this syntax for command-line options.
13624 @item -Wl,@var{option}
13626 Pass @var{option} as an option to the linker. If @var{option} contains
13627 commas, it is split into multiple options at the commas. You can use this
13628 syntax to pass an argument to the option.
13629 For example, @option{-Wl,-Map,output.map} passes @option{-Map output.map} to the
13630 linker. When using the GNU linker, you can also get the same effect with
13631 @option{-Wl,-Map=output.map}.
13633 @item -u @var{symbol}
13635 Pretend the symbol @var{symbol} is undefined, to force linking of
13636 library modules to define it. You can use @option{-u} multiple times with
13637 different symbols to force loading of additional library modules.
13639 @item -z @var{keyword}
13641 @option{-z} is passed directly on to the linker along with the keyword
13642 @var{keyword}. See the section in the documentation of your linker for
13643 permitted values and their meanings.
13646 @node Directory Options
13647 @section Options for Directory Search
13648 @cindex directory options
13649 @cindex options, directory search
13650 @cindex search path
13652 These options specify directories to search for header files, for
13653 libraries and for parts of the compiler:
13656 @include cppdiropts.texi
13658 @item -iplugindir=@var{dir}
13659 @opindex iplugindir=
13660 Set the directory to search for plugins that are passed
13661 by @option{-fplugin=@var{name}} instead of
13662 @option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
13663 to be used by the user, but only passed by the driver.
13667 Add directory @var{dir} to the list of directories to be searched
13670 @item -B@var{prefix}
13672 This option specifies where to find the executables, libraries,
13673 include files, and data files of the compiler itself.
13675 The compiler driver program runs one or more of the subprograms
13676 @command{cpp}, @command{cc1}, @command{as} and @command{ld}. It tries
13677 @var{prefix} as a prefix for each program it tries to run, both with and
13678 without @samp{@var{machine}/@var{version}/} for the corresponding target
13679 machine and compiler version.
13681 For each subprogram to be run, the compiler driver first tries the
13682 @option{-B} prefix, if any. If that name is not found, or if @option{-B}
13683 is not specified, the driver tries two standard prefixes,
13684 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
13685 those results in a file name that is found, the unmodified program
13686 name is searched for using the directories specified in your
13687 @env{PATH} environment variable.
13689 The compiler checks to see if the path provided by @option{-B}
13690 refers to a directory, and if necessary it adds a directory
13691 separator character at the end of the path.
13693 @option{-B} prefixes that effectively specify directory names also apply
13694 to libraries in the linker, because the compiler translates these
13695 options into @option{-L} options for the linker. They also apply to
13696 include files in the preprocessor, because the compiler translates these
13697 options into @option{-isystem} options for the preprocessor. In this case,
13698 the compiler appends @samp{include} to the prefix.
13700 The runtime support file @file{libgcc.a} can also be searched for using
13701 the @option{-B} prefix, if needed. If it is not found there, the two
13702 standard prefixes above are tried, and that is all. The file is left
13703 out of the link if it is not found by those means.
13705 Another way to specify a prefix much like the @option{-B} prefix is to use
13706 the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
13709 As a special kludge, if the path provided by @option{-B} is
13710 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
13711 9, then it is replaced by @file{[dir/]include}. This is to help
13712 with boot-strapping the compiler.
13714 @item -no-canonical-prefixes
13715 @opindex no-canonical-prefixes
13716 Do not expand any symbolic links, resolve references to @samp{/../}
13717 or @samp{/./}, or make the path absolute when generating a relative
13720 @item --sysroot=@var{dir}
13722 Use @var{dir} as the logical root directory for headers and libraries.
13723 For example, if the compiler normally searches for headers in
13724 @file{/usr/include} and libraries in @file{/usr/lib}, it instead
13725 searches @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
13727 If you use both this option and the @option{-isysroot} option, then
13728 the @option{--sysroot} option applies to libraries, but the
13729 @option{-isysroot} option applies to header files.
13731 The GNU linker (beginning with version 2.16) has the necessary support
13732 for this option. If your linker does not support this option, the
13733 header file aspect of @option{--sysroot} still works, but the
13734 library aspect does not.
13736 @item --no-sysroot-suffix
13737 @opindex no-sysroot-suffix
13738 For some targets, a suffix is added to the root directory specified
13739 with @option{--sysroot}, depending on the other options used, so that
13740 headers may for example be found in
13741 @file{@var{dir}/@var{suffix}/usr/include} instead of
13742 @file{@var{dir}/usr/include}. This option disables the addition of
13747 @node Code Gen Options
13748 @section Options for Code Generation Conventions
13749 @cindex code generation conventions
13750 @cindex options, code generation
13751 @cindex run-time options
13753 These machine-independent options control the interface conventions
13754 used in code generation.
13756 Most of them have both positive and negative forms; the negative form
13757 of @option{-ffoo} is @option{-fno-foo}. In the table below, only
13758 one of the forms is listed---the one that is not the default. You
13759 can figure out the other form by either removing @samp{no-} or adding
13763 @item -fstack-reuse=@var{reuse-level}
13764 @opindex fstack_reuse
13765 This option controls stack space reuse for user declared local/auto variables
13766 and compiler generated temporaries. @var{reuse_level} can be @samp{all},
13767 @samp{named_vars}, or @samp{none}. @samp{all} enables stack reuse for all
13768 local variables and temporaries, @samp{named_vars} enables the reuse only for
13769 user defined local variables with names, and @samp{none} disables stack reuse
13770 completely. The default value is @samp{all}. The option is needed when the
13771 program extends the lifetime of a scoped local variable or a compiler generated
13772 temporary beyond the end point defined by the language. When a lifetime of
13773 a variable ends, and if the variable lives in memory, the optimizing compiler
13774 has the freedom to reuse its stack space with other temporaries or scoped
13775 local variables whose live range does not overlap with it. Legacy code extending
13776 local lifetime is likely to break with the stack reuse optimization.
13795 if (*p == 10) // out of scope use of local1
13806 A(int k) : i(k), j(k) @{ @}
13813 void foo(const A& ar)
13820 foo(A(10)); // temp object's lifetime ends when foo returns
13826 ap->i+= 10; // ap references out of scope temp whose space
13827 // is reused with a. What is the value of ap->i?
13832 The lifetime of a compiler generated temporary is well defined by the C++
13833 standard. When a lifetime of a temporary ends, and if the temporary lives
13834 in memory, the optimizing compiler has the freedom to reuse its stack
13835 space with other temporaries or scoped local variables whose live range
13836 does not overlap with it. However some of the legacy code relies on
13837 the behavior of older compilers in which temporaries' stack space is
13838 not reused, the aggressive stack reuse can lead to runtime errors. This
13839 option is used to control the temporary stack reuse optimization.
13843 This option generates traps for signed overflow on addition, subtraction,
13844 multiplication operations.
13845 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13846 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13847 @option{-fwrapv} being effective. Note that only active options override, so
13848 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13849 results in @option{-ftrapv} being effective.
13853 This option instructs the compiler to assume that signed arithmetic
13854 overflow of addition, subtraction and multiplication wraps around
13855 using twos-complement representation. This flag enables some optimizations
13856 and disables others.
13857 The options @option{-ftrapv} and @option{-fwrapv} override each other, so using
13858 @option{-ftrapv} @option{-fwrapv} on the command-line results in
13859 @option{-fwrapv} being effective. Note that only active options override, so
13860 using @option{-ftrapv} @option{-fwrapv} @option{-fno-wrapv} on the command-line
13861 results in @option{-ftrapv} being effective.
13863 @item -fwrapv-pointer
13864 @opindex fwrapv-pointer
13865 This option instructs the compiler to assume that pointer arithmetic
13866 overflow on addition and subtraction wraps around using twos-complement
13867 representation. This flag disables some optimizations which assume
13868 pointer overflow is invalid.
13870 @item -fstrict-overflow
13871 @opindex fstrict-overflow
13872 This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when
13873 negated implies @option{-fwrapv} @option{-fwrapv-pointer}.
13876 @opindex fexceptions
13877 Enable exception handling. Generates extra code needed to propagate
13878 exceptions. For some targets, this implies GCC generates frame
13879 unwind information for all functions, which can produce significant data
13880 size overhead, although it does not affect execution. If you do not
13881 specify this option, GCC enables it by default for languages like
13882 C++ that normally require exception handling, and disables it for
13883 languages like C that do not normally require it. However, you may need
13884 to enable this option when compiling C code that needs to interoperate
13885 properly with exception handlers written in C++. You may also wish to
13886 disable this option if you are compiling older C++ programs that don't
13887 use exception handling.
13889 @item -fnon-call-exceptions
13890 @opindex fnon-call-exceptions
13891 Generate code that allows trapping instructions to throw exceptions.
13892 Note that this requires platform-specific runtime support that does
13893 not exist everywhere. Moreover, it only allows @emph{trapping}
13894 instructions to throw exceptions, i.e.@: memory references or floating-point
13895 instructions. It does not allow exceptions to be thrown from
13896 arbitrary signal handlers such as @code{SIGALRM}.
13898 @item -fdelete-dead-exceptions
13899 @opindex fdelete-dead-exceptions
13900 Consider that instructions that may throw exceptions but don't otherwise
13901 contribute to the execution of the program can be optimized away.
13902 This option is enabled by default for the Ada front end, as permitted by
13903 the Ada language specification.
13904 Optimization passes that cause dead exceptions to be removed are enabled independently at different optimization levels.
13906 @item -funwind-tables
13907 @opindex funwind-tables
13908 Similar to @option{-fexceptions}, except that it just generates any needed
13909 static data, but does not affect the generated code in any other way.
13910 You normally do not need to enable this option; instead, a language processor
13911 that needs this handling enables it on your behalf.
13913 @item -fasynchronous-unwind-tables
13914 @opindex fasynchronous-unwind-tables
13915 Generate unwind table in DWARF format, if supported by target machine. The
13916 table is exact at each instruction boundary, so it can be used for stack
13917 unwinding from asynchronous events (such as debugger or garbage collector).
13919 @item -fno-gnu-unique
13920 @opindex fno-gnu-unique
13921 @opindex fgnu-unique
13922 On systems with recent GNU assembler and C library, the C++ compiler
13923 uses the @code{STB_GNU_UNIQUE} binding to make sure that definitions
13924 of template static data members and static local variables in inline
13925 functions are unique even in the presence of @code{RTLD_LOCAL}; this
13926 is necessary to avoid problems with a library used by two different
13927 @code{RTLD_LOCAL} plugins depending on a definition in one of them and
13928 therefore disagreeing with the other one about the binding of the
13929 symbol. But this causes @code{dlclose} to be ignored for affected
13930 DSOs; if your program relies on reinitialization of a DSO via
13931 @code{dlclose} and @code{dlopen}, you can use
13932 @option{-fno-gnu-unique}.
13934 @item -fpcc-struct-return
13935 @opindex fpcc-struct-return
13936 Return ``short'' @code{struct} and @code{union} values in memory like
13937 longer ones, rather than in registers. This convention is less
13938 efficient, but it has the advantage of allowing intercallability between
13939 GCC-compiled files and files compiled with other compilers, particularly
13940 the Portable C Compiler (pcc).
13942 The precise convention for returning structures in memory depends
13943 on the target configuration macros.
13945 Short structures and unions are those whose size and alignment match
13946 that of some integer type.
13948 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
13949 switch is not binary compatible with code compiled with the
13950 @option{-freg-struct-return} switch.
13951 Use it to conform to a non-default application binary interface.
13953 @item -freg-struct-return
13954 @opindex freg-struct-return
13955 Return @code{struct} and @code{union} values in registers when possible.
13956 This is more efficient for small structures than
13957 @option{-fpcc-struct-return}.
13959 If you specify neither @option{-fpcc-struct-return} nor
13960 @option{-freg-struct-return}, GCC defaults to whichever convention is
13961 standard for the target. If there is no standard convention, GCC
13962 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
13963 the principal compiler. In those cases, we can choose the standard, and
13964 we chose the more efficient register return alternative.
13966 @strong{Warning:} code compiled with the @option{-freg-struct-return}
13967 switch is not binary compatible with code compiled with the
13968 @option{-fpcc-struct-return} switch.
13969 Use it to conform to a non-default application binary interface.
13971 @item -fshort-enums
13972 @opindex fshort-enums
13973 Allocate to an @code{enum} type only as many bytes as it needs for the
13974 declared range of possible values. Specifically, the @code{enum} type
13975 is equivalent to the smallest integer type that has enough room.
13977 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
13978 code that is not binary compatible with code generated without that switch.
13979 Use it to conform to a non-default application binary interface.
13981 @item -fshort-wchar
13982 @opindex fshort-wchar
13983 Override the underlying type for @code{wchar_t} to be @code{short
13984 unsigned int} instead of the default for the target. This option is
13985 useful for building programs to run under WINE@.
13987 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
13988 code that is not binary compatible with code generated without that switch.
13989 Use it to conform to a non-default application binary interface.
13992 @opindex fno-common
13994 @cindex tentative definitions
13995 In C code, this option controls the placement of global variables
13996 defined without an initializer, known as @dfn{tentative definitions}
13997 in the C standard. Tentative definitions are distinct from declarations
13998 of a variable with the @code{extern} keyword, which do not allocate storage.
14000 Unix C compilers have traditionally allocated storage for
14001 uninitialized global variables in a common block. This allows the
14002 linker to resolve all tentative definitions of the same variable
14003 in different compilation units to the same object, or to a non-tentative
14005 This is the behavior specified by @option{-fcommon}, and is the default for
14006 GCC on most targets.
14007 On the other hand, this behavior is not required by ISO
14008 C, and on some targets may carry a speed or code size penalty on
14009 variable references.
14011 The @option{-fno-common} option specifies that the compiler should instead
14012 place uninitialized global variables in the BSS section of the object file.
14013 This inhibits the merging of tentative definitions by the linker so
14014 you get a multiple-definition error if the same
14015 variable is defined in more than one compilation unit.
14016 Compiling with @option{-fno-common} is useful on targets for which
14017 it provides better performance, or if you wish to verify that the
14018 program will work on other systems that always treat uninitialized
14019 variable definitions this way.
14024 Ignore the @code{#ident} directive.
14026 @item -finhibit-size-directive
14027 @opindex finhibit-size-directive
14028 Don't output a @code{.size} assembler directive, or anything else that
14029 would cause trouble if the function is split in the middle, and the
14030 two halves are placed at locations far apart in memory. This option is
14031 used when compiling @file{crtstuff.c}; you should not need to use it
14034 @item -fverbose-asm
14035 @opindex fverbose-asm
14036 Put extra commentary information in the generated assembly code to
14037 make it more readable. This option is generally only of use to those
14038 who actually need to read the generated assembly code (perhaps while
14039 debugging the compiler itself).
14041 @option{-fno-verbose-asm}, the default, causes the
14042 extra information to be omitted and is useful when comparing two assembler
14045 The added comments include:
14050 information on the compiler version and command-line options,
14053 the source code lines associated with the assembly instructions,
14054 in the form FILENAME:LINENUMBER:CONTENT OF LINE,
14057 hints on which high-level expressions correspond to
14058 the various assembly instruction operands.
14062 For example, given this C source file:
14070 for (i = 0; i < n; i++)
14077 compiling to (x86_64) assembly via @option{-S} and emitting the result
14078 direct to stdout via @option{-o} @option{-}
14081 gcc -S test.c -fverbose-asm -Os -o -
14084 gives output similar to this:
14088 # GNU C11 (GCC) version 7.0.0 20160809 (experimental) (x86_64-pc-linux-gnu)
14095 .type test, @@function
14099 # test.c:4: int total = 0;
14100 xorl %eax, %eax # <retval>
14101 # test.c:6: for (i = 0; i < n; i++)
14102 xorl %edx, %edx # i
14104 # test.c:6: for (i = 0; i < n; i++)
14105 cmpl %edi, %edx # n, i
14107 # test.c:7: total += i * i;
14108 movl %edx, %ecx # i, tmp92
14109 imull %edx, %ecx # i, tmp92
14110 # test.c:6: for (i = 0; i < n; i++)
14112 # test.c:7: total += i * i;
14113 addl %ecx, %eax # tmp92, <retval>
14121 .ident "GCC: (GNU) 7.0.0 20160809 (experimental)"
14122 .section .note.GNU-stack,"",@@progbits
14125 The comments are intended for humans rather than machines and hence the
14126 precise format of the comments is subject to change.
14128 @item -frecord-gcc-switches
14129 @opindex frecord-gcc-switches
14130 This switch causes the command line used to invoke the
14131 compiler to be recorded into the object file that is being created.
14132 This switch is only implemented on some targets and the exact format
14133 of the recording is target and binary file format dependent, but it
14134 usually takes the form of a section containing ASCII text. This
14135 switch is related to the @option{-fverbose-asm} switch, but that
14136 switch only records information in the assembler output file as
14137 comments, so it never reaches the object file.
14138 See also @option{-grecord-gcc-switches} for another
14139 way of storing compiler options into the object file.
14143 @cindex global offset table
14145 Generate position-independent code (PIC) suitable for use in a shared
14146 library, if supported for the target machine. Such code accesses all
14147 constant addresses through a global offset table (GOT)@. The dynamic
14148 loader resolves the GOT entries when the program starts (the dynamic
14149 loader is not part of GCC; it is part of the operating system). If
14150 the GOT size for the linked executable exceeds a machine-specific
14151 maximum size, you get an error message from the linker indicating that
14152 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
14153 instead. (These maximums are 8k on the SPARC, 28k on AArch64 and 32k
14154 on the m68k and RS/6000. The x86 has no such limit.)
14156 Position-independent code requires special support, and therefore works
14157 only on certain machines. For the x86, GCC supports PIC for System V
14158 but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14159 position-independent.
14161 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14166 If supported for the target machine, emit position-independent code,
14167 suitable for dynamic linking and avoiding any limit on the size of the
14168 global offset table. This option makes a difference on AArch64, m68k,
14169 PowerPC and SPARC@.
14171 Position-independent code requires special support, and therefore works
14172 only on certain machines.
14174 When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14181 These options are similar to @option{-fpic} and @option{-fPIC}, but the
14182 generated position-independent code can be only linked into executables.
14183 Usually these options are used to compile code that will be linked using
14184 the @option{-pie} GCC option.
14186 @option{-fpie} and @option{-fPIE} both define the macros
14187 @code{__pie__} and @code{__PIE__}. The macros have the value 1
14188 for @option{-fpie} and 2 for @option{-fPIE}.
14193 Do not use the PLT for external function calls in position-independent code.
14194 Instead, load the callee address at call sites from the GOT and branch to it.
14195 This leads to more efficient code by eliminating PLT stubs and exposing
14196 GOT loads to optimizations. On architectures such as 32-bit x86 where
14197 PLT stubs expect the GOT pointer in a specific register, this gives more
14198 register allocation freedom to the compiler.
14199 Lazy binding requires use of the PLT;
14200 with @option{-fno-plt} all external symbols are resolved at load time.
14202 Alternatively, the function attribute @code{noplt} can be used to avoid calls
14203 through the PLT for specific external functions.
14205 In position-dependent code, a few targets also convert calls to
14206 functions that are marked to not use the PLT to use the GOT instead.
14208 @item -fno-jump-tables
14209 @opindex fno-jump-tables
14210 @opindex fjump-tables
14211 Do not use jump tables for switch statements even where it would be
14212 more efficient than other code generation strategies. This option is
14213 of use in conjunction with @option{-fpic} or @option{-fPIC} for
14214 building code that forms part of a dynamic linker and cannot
14215 reference the address of a jump table. On some targets, jump tables
14216 do not require a GOT and this option is not needed.
14218 @item -ffixed-@var{reg}
14220 Treat the register named @var{reg} as a fixed register; generated code
14221 should never refer to it (except perhaps as a stack pointer, frame
14222 pointer or in some other fixed role).
14224 @var{reg} must be the name of a register. The register names accepted
14225 are machine-specific and are defined in the @code{REGISTER_NAMES}
14226 macro in the machine description macro file.
14228 This flag does not have a negative form, because it specifies a
14231 @item -fcall-used-@var{reg}
14232 @opindex fcall-used
14233 Treat the register named @var{reg} as an allocable register that is
14234 clobbered by function calls. It may be allocated for temporaries or
14235 variables that do not live across a call. Functions compiled this way
14236 do not save and restore the register @var{reg}.
14238 It is an error to use this flag with the frame pointer or stack pointer.
14239 Use of this flag for other registers that have fixed pervasive roles in
14240 the machine's execution model produces disastrous results.
14242 This flag does not have a negative form, because it specifies a
14245 @item -fcall-saved-@var{reg}
14246 @opindex fcall-saved
14247 Treat the register named @var{reg} as an allocable register saved by
14248 functions. It may be allocated even for temporaries or variables that
14249 live across a call. Functions compiled this way save and restore
14250 the register @var{reg} if they use it.
14252 It is an error to use this flag with the frame pointer or stack pointer.
14253 Use of this flag for other registers that have fixed pervasive roles in
14254 the machine's execution model produces disastrous results.
14256 A different sort of disaster results from the use of this flag for
14257 a register in which function values may be returned.
14259 This flag does not have a negative form, because it specifies a
14262 @item -fpack-struct[=@var{n}]
14263 @opindex fpack-struct
14264 Without a value specified, pack all structure members together without
14265 holes. When a value is specified (which must be a small power of two), pack
14266 structure members according to this value, representing the maximum
14267 alignment (that is, objects with default alignment requirements larger than
14268 this are output potentially unaligned at the next fitting location.
14270 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14271 code that is not binary compatible with code generated without that switch.
14272 Additionally, it makes the code suboptimal.
14273 Use it to conform to a non-default application binary interface.
14275 @item -fleading-underscore
14276 @opindex fleading-underscore
14277 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
14278 change the way C symbols are represented in the object file. One use
14279 is to help link with legacy assembly code.
14281 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14282 generate code that is not binary compatible with code generated without that
14283 switch. Use it to conform to a non-default application binary interface.
14284 Not all targets provide complete support for this switch.
14286 @item -ftls-model=@var{model}
14287 @opindex ftls-model
14288 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14289 The @var{model} argument should be one of @samp{global-dynamic},
14290 @samp{local-dynamic}, @samp{initial-exec} or @samp{local-exec}.
14291 Note that the choice is subject to optimization: the compiler may use
14292 a more efficient model for symbols not visible outside of the translation
14293 unit, or if @option{-fpic} is not given on the command line.
14295 The default without @option{-fpic} is @samp{initial-exec}; with
14296 @option{-fpic} the default is @samp{global-dynamic}.
14298 @item -ftrampolines
14299 @opindex ftrampolines
14300 For targets that normally need trampolines for nested functions, always
14301 generate them instead of using descriptors. Otherwise, for targets that
14302 do not need them, like for example HP-PA or IA-64, do nothing.
14304 A trampoline is a small piece of code that is created at run time on the
14305 stack when the address of a nested function is taken, and is used to call
14306 the nested function indirectly. Therefore, it requires the stack to be
14307 made executable in order for the program to work properly.
14309 @option{-fno-trampolines} is enabled by default on a language by language
14310 basis to let the compiler avoid generating them, if it computes that this
14311 is safe, and replace them with descriptors. Descriptors are made up of data
14312 only, but the generated code must be prepared to deal with them. As of this
14313 writing, @option{-fno-trampolines} is enabled by default only for Ada.
14315 Moreover, code compiled with @option{-ftrampolines} and code compiled with
14316 @option{-fno-trampolines} are not binary compatible if nested functions are
14317 present. This option must therefore be used on a program-wide basis and be
14318 manipulated with extreme care.
14320 @item -fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]}
14321 @opindex fvisibility
14322 Set the default ELF image symbol visibility to the specified option---all
14323 symbols are marked with this unless overridden within the code.
14324 Using this feature can very substantially improve linking and
14325 load times of shared object libraries, produce more optimized
14326 code, provide near-perfect API export and prevent symbol clashes.
14327 It is @strong{strongly} recommended that you use this in any shared objects
14330 Despite the nomenclature, @samp{default} always means public; i.e.,
14331 available to be linked against from outside the shared object.
14332 @samp{protected} and @samp{internal} are pretty useless in real-world
14333 usage so the only other commonly used option is @samp{hidden}.
14334 The default if @option{-fvisibility} isn't specified is
14335 @samp{default}, i.e., make every symbol public.
14337 A good explanation of the benefits offered by ensuring ELF
14338 symbols have the correct visibility is given by ``How To Write
14339 Shared Libraries'' by Ulrich Drepper (which can be found at
14340 @w{@uref{https://www.akkadia.org/drepper/}})---however a superior
14341 solution made possible by this option to marking things hidden when
14342 the default is public is to make the default hidden and mark things
14343 public. This is the norm with DLLs on Windows and with @option{-fvisibility=hidden}
14344 and @code{__attribute__ ((visibility("default")))} instead of
14345 @code{__declspec(dllexport)} you get almost identical semantics with
14346 identical syntax. This is a great boon to those working with
14347 cross-platform projects.
14349 For those adding visibility support to existing code, you may find
14350 @code{#pragma GCC visibility} of use. This works by you enclosing
14351 the declarations you wish to set visibility for with (for example)
14352 @code{#pragma GCC visibility push(hidden)} and
14353 @code{#pragma GCC visibility pop}.
14354 Bear in mind that symbol visibility should be viewed @strong{as
14355 part of the API interface contract} and thus all new code should
14356 always specify visibility when it is not the default; i.e., declarations
14357 only for use within the local DSO should @strong{always} be marked explicitly
14358 as hidden as so to avoid PLT indirection overheads---making this
14359 abundantly clear also aids readability and self-documentation of the code.
14360 Note that due to ISO C++ specification requirements, @code{operator new} and
14361 @code{operator delete} must always be of default visibility.
14363 Be aware that headers from outside your project, in particular system
14364 headers and headers from any other library you use, may not be
14365 expecting to be compiled with visibility other than the default. You
14366 may need to explicitly say @code{#pragma GCC visibility push(default)}
14367 before including any such headers.
14369 @code{extern} declarations are not affected by @option{-fvisibility}, so
14370 a lot of code can be recompiled with @option{-fvisibility=hidden} with
14371 no modifications. However, this means that calls to @code{extern}
14372 functions with no explicit visibility use the PLT, so it is more
14373 effective to use @code{__attribute ((visibility))} and/or
14374 @code{#pragma GCC visibility} to tell the compiler which @code{extern}
14375 declarations should be treated as hidden.
14377 Note that @option{-fvisibility} does affect C++ vague linkage
14378 entities. This means that, for instance, an exception class that is
14379 be thrown between DSOs must be explicitly marked with default
14380 visibility so that the @samp{type_info} nodes are unified between
14383 An overview of these techniques, their benefits and how to use them
14384 is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
14386 @item -fstrict-volatile-bitfields
14387 @opindex fstrict-volatile-bitfields
14388 This option should be used if accesses to volatile bit-fields (or other
14389 structure fields, although the compiler usually honors those types
14390 anyway) should use a single access of the width of the
14391 field's type, aligned to a natural alignment if possible. For
14392 example, targets with memory-mapped peripheral registers might require
14393 all such accesses to be 16 bits wide; with this flag you can
14394 declare all peripheral bit-fields as @code{unsigned short} (assuming short
14395 is 16 bits on these targets) to force GCC to use 16-bit accesses
14396 instead of, perhaps, a more efficient 32-bit access.
14398 If this option is disabled, the compiler uses the most efficient
14399 instruction. In the previous example, that might be a 32-bit load
14400 instruction, even though that accesses bytes that do not contain
14401 any portion of the bit-field, or memory-mapped registers unrelated to
14402 the one being updated.
14404 In some cases, such as when the @code{packed} attribute is applied to a
14405 structure field, it may not be possible to access the field with a single
14406 read or write that is correctly aligned for the target machine. In this
14407 case GCC falls back to generating multiple accesses rather than code that
14408 will fault or truncate the result at run time.
14410 Note: Due to restrictions of the C/C++11 memory model, write accesses are
14411 not allowed to touch non bit-field members. It is therefore recommended
14412 to define all bits of the field's type as bit-field members.
14414 The default value of this option is determined by the application binary
14415 interface for the target processor.
14417 @item -fsync-libcalls
14418 @opindex fsync-libcalls
14419 This option controls whether any out-of-line instance of the @code{__sync}
14420 family of functions may be used to implement the C++11 @code{__atomic}
14421 family of functions.
14423 The default value of this option is enabled, thus the only useful form
14424 of the option is @option{-fno-sync-libcalls}. This option is used in
14425 the implementation of the @file{libatomic} runtime library.
14429 @node Developer Options
14430 @section GCC Developer Options
14431 @cindex developer options
14432 @cindex debugging GCC
14433 @cindex debug dump options
14434 @cindex dump options
14435 @cindex compilation statistics
14437 This section describes command-line options that are primarily of
14438 interest to GCC developers, including options to support compiler
14439 testing and investigation of compiler bugs and compile-time
14440 performance problems. This includes options that produce debug dumps
14441 at various points in the compilation; that print statistics such as
14442 memory use and execution time; and that print information about GCC's
14443 configuration, such as where it searches for libraries. You should
14444 rarely need to use any of these options for ordinary compilation and
14447 Many developer options that cause GCC to dump output to a file take an
14448 optional @samp{=@var{filename}} suffix. You can specify @samp{stdout}
14449 or @samp{-} to dump to standard output, and @samp{stderr} for standard
14452 If @samp{=@var{filename}} is omitted, a default dump file name is
14453 constructed by concatenating the base dump file name, a pass number,
14454 phase letter, and pass name. The base dump file name is the name of
14455 output file produced by the compiler if explicitly specified and not
14456 an executable; otherwise it is the source file name.
14457 The pass number is determined by the order passes are registered with
14458 the compiler's pass manager.
14459 This is generally the same as the order of execution, but passes
14460 registered by plugins, target-specific passes, or passes that are
14461 otherwise registered late are numbered higher than the pass named
14462 @samp{final}, even if they are executed earlier. The phase letter is
14463 one of @samp{i} (inter-procedural analysis), @samp{l}
14464 (language-specific), @samp{r} (RTL), or @samp{t} (tree).
14465 The files are created in the directory of the output file.
14469 @item -d@var{letters}
14470 @itemx -fdump-rtl-@var{pass}
14471 @itemx -fdump-rtl-@var{pass}=@var{filename}
14473 @opindex fdump-rtl-@var{pass}
14474 Says to make debugging dumps during compilation at times specified by
14475 @var{letters}. This is used for debugging the RTL-based passes of the
14478 Some @option{-d@var{letters}} switches have different meaning when
14479 @option{-E} is used for preprocessing. @xref{Preprocessor Options},
14480 for information about preprocessor-specific dump options.
14482 Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
14483 @option{-d} option @var{letters}. Here are the possible
14484 letters for use in @var{pass} and @var{letters}, and their meanings:
14488 @item -fdump-rtl-alignments
14489 @opindex fdump-rtl-alignments
14490 Dump after branch alignments have been computed.
14492 @item -fdump-rtl-asmcons
14493 @opindex fdump-rtl-asmcons
14494 Dump after fixing rtl statements that have unsatisfied in/out constraints.
14496 @item -fdump-rtl-auto_inc_dec
14497 @opindex fdump-rtl-auto_inc_dec
14498 Dump after auto-inc-dec discovery. This pass is only run on
14499 architectures that have auto inc or auto dec instructions.
14501 @item -fdump-rtl-barriers
14502 @opindex fdump-rtl-barriers
14503 Dump after cleaning up the barrier instructions.
14505 @item -fdump-rtl-bbpart
14506 @opindex fdump-rtl-bbpart
14507 Dump after partitioning hot and cold basic blocks.
14509 @item -fdump-rtl-bbro
14510 @opindex fdump-rtl-bbro
14511 Dump after block reordering.
14513 @item -fdump-rtl-btl1
14514 @itemx -fdump-rtl-btl2
14515 @opindex fdump-rtl-btl2
14516 @opindex fdump-rtl-btl2
14517 @option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
14518 after the two branch
14519 target load optimization passes.
14521 @item -fdump-rtl-bypass
14522 @opindex fdump-rtl-bypass
14523 Dump after jump bypassing and control flow optimizations.
14525 @item -fdump-rtl-combine
14526 @opindex fdump-rtl-combine
14527 Dump after the RTL instruction combination pass.
14529 @item -fdump-rtl-compgotos
14530 @opindex fdump-rtl-compgotos
14531 Dump after duplicating the computed gotos.
14533 @item -fdump-rtl-ce1
14534 @itemx -fdump-rtl-ce2
14535 @itemx -fdump-rtl-ce3
14536 @opindex fdump-rtl-ce1
14537 @opindex fdump-rtl-ce2
14538 @opindex fdump-rtl-ce3
14539 @option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
14540 @option{-fdump-rtl-ce3} enable dumping after the three
14541 if conversion passes.
14543 @item -fdump-rtl-cprop_hardreg
14544 @opindex fdump-rtl-cprop_hardreg
14545 Dump after hard register copy propagation.
14547 @item -fdump-rtl-csa
14548 @opindex fdump-rtl-csa
14549 Dump after combining stack adjustments.
14551 @item -fdump-rtl-cse1
14552 @itemx -fdump-rtl-cse2
14553 @opindex fdump-rtl-cse1
14554 @opindex fdump-rtl-cse2
14555 @option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
14556 the two common subexpression elimination passes.
14558 @item -fdump-rtl-dce
14559 @opindex fdump-rtl-dce
14560 Dump after the standalone dead code elimination passes.
14562 @item -fdump-rtl-dbr
14563 @opindex fdump-rtl-dbr
14564 Dump after delayed branch scheduling.
14566 @item -fdump-rtl-dce1
14567 @itemx -fdump-rtl-dce2
14568 @opindex fdump-rtl-dce1
14569 @opindex fdump-rtl-dce2
14570 @option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
14571 the two dead store elimination passes.
14573 @item -fdump-rtl-eh
14574 @opindex fdump-rtl-eh
14575 Dump after finalization of EH handling code.
14577 @item -fdump-rtl-eh_ranges
14578 @opindex fdump-rtl-eh_ranges
14579 Dump after conversion of EH handling range regions.
14581 @item -fdump-rtl-expand
14582 @opindex fdump-rtl-expand
14583 Dump after RTL generation.
14585 @item -fdump-rtl-fwprop1
14586 @itemx -fdump-rtl-fwprop2
14587 @opindex fdump-rtl-fwprop1
14588 @opindex fdump-rtl-fwprop2
14589 @option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
14590 dumping after the two forward propagation passes.
14592 @item -fdump-rtl-gcse1
14593 @itemx -fdump-rtl-gcse2
14594 @opindex fdump-rtl-gcse1
14595 @opindex fdump-rtl-gcse2
14596 @option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
14597 after global common subexpression elimination.
14599 @item -fdump-rtl-init-regs
14600 @opindex fdump-rtl-init-regs
14601 Dump after the initialization of the registers.
14603 @item -fdump-rtl-initvals
14604 @opindex fdump-rtl-initvals
14605 Dump after the computation of the initial value sets.
14607 @item -fdump-rtl-into_cfglayout
14608 @opindex fdump-rtl-into_cfglayout
14609 Dump after converting to cfglayout mode.
14611 @item -fdump-rtl-ira
14612 @opindex fdump-rtl-ira
14613 Dump after iterated register allocation.
14615 @item -fdump-rtl-jump
14616 @opindex fdump-rtl-jump
14617 Dump after the second jump optimization.
14619 @item -fdump-rtl-loop2
14620 @opindex fdump-rtl-loop2
14621 @option{-fdump-rtl-loop2} enables dumping after the rtl
14622 loop optimization passes.
14624 @item -fdump-rtl-mach
14625 @opindex fdump-rtl-mach
14626 Dump after performing the machine dependent reorganization pass, if that
14629 @item -fdump-rtl-mode_sw
14630 @opindex fdump-rtl-mode_sw
14631 Dump after removing redundant mode switches.
14633 @item -fdump-rtl-rnreg
14634 @opindex fdump-rtl-rnreg
14635 Dump after register renumbering.
14637 @item -fdump-rtl-outof_cfglayout
14638 @opindex fdump-rtl-outof_cfglayout
14639 Dump after converting from cfglayout mode.
14641 @item -fdump-rtl-peephole2
14642 @opindex fdump-rtl-peephole2
14643 Dump after the peephole pass.
14645 @item -fdump-rtl-postreload
14646 @opindex fdump-rtl-postreload
14647 Dump after post-reload optimizations.
14649 @item -fdump-rtl-pro_and_epilogue
14650 @opindex fdump-rtl-pro_and_epilogue
14651 Dump after generating the function prologues and epilogues.
14653 @item -fdump-rtl-sched1
14654 @itemx -fdump-rtl-sched2
14655 @opindex fdump-rtl-sched1
14656 @opindex fdump-rtl-sched2
14657 @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
14658 after the basic block scheduling passes.
14660 @item -fdump-rtl-ree
14661 @opindex fdump-rtl-ree
14662 Dump after sign/zero extension elimination.
14664 @item -fdump-rtl-seqabstr
14665 @opindex fdump-rtl-seqabstr
14666 Dump after common sequence discovery.
14668 @item -fdump-rtl-shorten
14669 @opindex fdump-rtl-shorten
14670 Dump after shortening branches.
14672 @item -fdump-rtl-sibling
14673 @opindex fdump-rtl-sibling
14674 Dump after sibling call optimizations.
14676 @item -fdump-rtl-split1
14677 @itemx -fdump-rtl-split2
14678 @itemx -fdump-rtl-split3
14679 @itemx -fdump-rtl-split4
14680 @itemx -fdump-rtl-split5
14681 @opindex fdump-rtl-split1
14682 @opindex fdump-rtl-split2
14683 @opindex fdump-rtl-split3
14684 @opindex fdump-rtl-split4
14685 @opindex fdump-rtl-split5
14686 These options enable dumping after five rounds of
14687 instruction splitting.
14689 @item -fdump-rtl-sms
14690 @opindex fdump-rtl-sms
14691 Dump after modulo scheduling. This pass is only run on some
14694 @item -fdump-rtl-stack
14695 @opindex fdump-rtl-stack
14696 Dump after conversion from GCC's ``flat register file'' registers to the
14697 x87's stack-like registers. This pass is only run on x86 variants.
14699 @item -fdump-rtl-subreg1
14700 @itemx -fdump-rtl-subreg2
14701 @opindex fdump-rtl-subreg1
14702 @opindex fdump-rtl-subreg2
14703 @option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
14704 the two subreg expansion passes.
14706 @item -fdump-rtl-unshare
14707 @opindex fdump-rtl-unshare
14708 Dump after all rtl has been unshared.
14710 @item -fdump-rtl-vartrack
14711 @opindex fdump-rtl-vartrack
14712 Dump after variable tracking.
14714 @item -fdump-rtl-vregs
14715 @opindex fdump-rtl-vregs
14716 Dump after converting virtual registers to hard registers.
14718 @item -fdump-rtl-web
14719 @opindex fdump-rtl-web
14720 Dump after live range splitting.
14722 @item -fdump-rtl-regclass
14723 @itemx -fdump-rtl-subregs_of_mode_init
14724 @itemx -fdump-rtl-subregs_of_mode_finish
14725 @itemx -fdump-rtl-dfinit
14726 @itemx -fdump-rtl-dfinish
14727 @opindex fdump-rtl-regclass
14728 @opindex fdump-rtl-subregs_of_mode_init
14729 @opindex fdump-rtl-subregs_of_mode_finish
14730 @opindex fdump-rtl-dfinit
14731 @opindex fdump-rtl-dfinish
14732 These dumps are defined but always produce empty files.
14735 @itemx -fdump-rtl-all
14737 @opindex fdump-rtl-all
14738 Produce all the dumps listed above.
14742 Annotate the assembler output with miscellaneous debugging information.
14746 Dump all macro definitions, at the end of preprocessing, in addition to
14751 Produce a core dump whenever an error occurs.
14755 Annotate the assembler output with a comment indicating which
14756 pattern and alternative is used. The length and cost of each instruction are
14761 Dump the RTL in the assembler output as a comment before each instruction.
14762 Also turns on @option{-dp} annotation.
14766 Just generate RTL for a function instead of compiling it. Usually used
14767 with @option{-fdump-rtl-expand}.
14771 @opindex fdump-debug
14772 Dump debugging information generated during the debug
14775 @item -fdump-earlydebug
14776 @opindex fdump-earlydebug
14777 Dump debugging information generated during the early debug
14780 @item -fdump-noaddr
14781 @opindex fdump-noaddr
14782 When doing debugging dumps, suppress address output. This makes it more
14783 feasible to use diff on debugging dumps for compiler invocations with
14784 different compiler binaries and/or different
14785 text / bss / data / heap / stack / dso start locations.
14788 @opindex freport-bug
14789 Collect and dump debug information into a temporary file if an
14790 internal compiler error (ICE) occurs.
14792 @item -fdump-unnumbered
14793 @opindex fdump-unnumbered
14794 When doing debugging dumps, suppress instruction numbers and address output.
14795 This makes it more feasible to use diff on debugging dumps for compiler
14796 invocations with different options, in particular with and without
14799 @item -fdump-unnumbered-links
14800 @opindex fdump-unnumbered-links
14801 When doing debugging dumps (see @option{-d} option above), suppress
14802 instruction numbers for the links to the previous and next instructions
14805 @item -fdump-ipa-@var{switch}
14806 @itemx -fdump-ipa-@var{switch}-@var{options}
14808 Control the dumping at various stages of inter-procedural analysis
14809 language tree to a file. The file name is generated by appending a
14810 switch specific suffix to the source file name, and the file is created
14811 in the same directory as the output file. The following dumps are
14816 Enables all inter-procedural analysis dumps.
14819 Dumps information about call-graph optimization, unused function removal,
14820 and inlining decisions.
14823 Dump after function inlining.
14827 Additionally, the options @option{-optimized}, @option{-missed},
14828 @option{-note}, and @option{-all} can be provided, with the same meaning
14829 as for @option{-fopt-info}, defaulting to @option{-optimized}.
14831 For example, @option{-fdump-ipa-inline-optimized-missed} will emit
14832 information on callsites that were inlined, along with callsites
14833 that were not inlined.
14835 By default, the dump will contain messages about successful
14836 optimizations (equivalent to @option{-optimized}) together with
14837 low-level details about the analysis.
14839 @item -fdump-lang-all
14840 @itemx -fdump-lang-@var{switch}
14841 @itemx -fdump-lang-@var{switch}-@var{options}
14842 @itemx -fdump-lang-@var{switch}-@var{options}=@var{filename}
14843 @opindex fdump-lang-all
14844 @opindex fdump-lang
14845 Control the dumping of language-specific information. The @var{options}
14846 and @var{filename} portions behave as described in the
14847 @option{-fdump-tree} option. The following @var{switch} values are
14853 Enable all language-specific dumps.
14856 Dump class hierarchy information. Virtual table information is emitted
14857 unless '@option{slim}' is specified. This option is applicable to C++ only.
14860 Dump the raw internal tree data. This option is applicable to C++ only.
14864 @item -fdump-passes
14865 @opindex fdump-passes
14866 Print on @file{stderr} the list of optimization passes that are turned
14867 on and off by the current command-line options.
14869 @item -fdump-statistics-@var{option}
14870 @opindex fdump-statistics
14871 Enable and control dumping of pass statistics in a separate file. The
14872 file name is generated by appending a suffix ending in
14873 @samp{.statistics} to the source file name, and the file is created in
14874 the same directory as the output file. If the @samp{-@var{option}}
14875 form is used, @samp{-stats} causes counters to be summed over the
14876 whole compilation unit while @samp{-details} dumps every event as
14877 the passes generate them. The default with no option is to sum
14878 counters for each function compiled.
14880 @item -fdump-tree-all
14881 @itemx -fdump-tree-@var{switch}
14882 @itemx -fdump-tree-@var{switch}-@var{options}
14883 @itemx -fdump-tree-@var{switch}-@var{options}=@var{filename}
14884 @opindex fdump-tree-all
14885 @opindex fdump-tree
14886 Control the dumping at various stages of processing the intermediate
14887 language tree to a file. If the @samp{-@var{options}}
14888 form is used, @var{options} is a list of @samp{-} separated options
14889 which control the details of the dump. Not all options are applicable
14890 to all dumps; those that are not meaningful are ignored. The
14891 following options are available
14895 Print the address of each node. Usually this is not meaningful as it
14896 changes according to the environment and source file. Its primary use
14897 is for tying up a dump file with a debug environment.
14899 If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
14900 in the dump instead of @code{DECL_NAME}. Its primary use is ease of
14901 use working backward from mangled names in the assembly file.
14903 When dumping front-end intermediate representations, inhibit dumping
14904 of members of a scope or body of a function merely because that scope
14905 has been reached. Only dump such items when they are directly reachable
14906 by some other path.
14908 When dumping pretty-printed trees, this option inhibits dumping the
14909 bodies of control structures.
14911 When dumping RTL, print the RTL in slim (condensed) form instead of
14912 the default LISP-like representation.
14914 Print a raw representation of the tree. By default, trees are
14915 pretty-printed into a C-like representation.
14917 Enable more detailed dumps (not honored by every dump option). Also
14918 include information from the optimization passes.
14920 Enable dumping various statistics about the pass (not honored by every dump
14923 Enable showing basic block boundaries (disabled in raw dumps).
14925 For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
14926 dump a representation of the control flow graph suitable for viewing with
14927 GraphViz to @file{@var{file}.@var{passid}.@var{pass}.dot}. Each function in
14928 the file is pretty-printed as a subgraph, so that GraphViz can render them
14929 all in a single plot.
14931 This option currently only works for RTL dumps, and the RTL is always
14932 dumped in slim form.
14934 Enable showing virtual operands for every statement.
14936 Enable showing line numbers for statements.
14938 Enable showing the unique ID (@code{DECL_UID}) for each variable.
14940 Enable showing the tree dump for each statement.
14942 Enable showing the EH region number holding each statement.
14944 Enable showing scalar evolution analysis details.
14946 Enable showing optimization information (only available in certain
14949 Enable showing missed optimization information (only available in certain
14952 Enable other detailed optimization information (only available in
14955 Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
14956 and @option{lineno}.
14958 Turn on all optimization options, i.e., @option{optimized},
14959 @option{missed}, and @option{note}.
14962 To determine what tree dumps are available or find the dump for a pass
14963 of interest follow the steps below.
14967 Invoke GCC with @option{-fdump-passes} and in the @file{stderr} output
14968 look for a code that corresponds to the pass you are interested in.
14969 For example, the codes @code{tree-evrp}, @code{tree-vrp1}, and
14970 @code{tree-vrp2} correspond to the three Value Range Propagation passes.
14971 The number at the end distinguishes distinct invocations of the same pass.
14973 To enable the creation of the dump file, append the pass code to
14974 the @option{-fdump-} option prefix and invoke GCC with it. For example,
14975 to enable the dump from the Early Value Range Propagation pass, invoke
14976 GCC with the @option{-fdump-tree-evrp} option. Optionally, you may
14977 specify the name of the dump file. If you don't specify one, GCC
14978 creates as described below.
14980 Find the pass dump in a file whose name is composed of three components
14981 separated by a period: the name of the source file GCC was invoked to
14982 compile, a numeric suffix indicating the pass number followed by the
14983 letter @samp{t} for tree passes (and the letter @samp{r} for RTL passes),
14984 and finally the pass code. For example, the Early VRP pass dump might
14985 be in a file named @file{myfile.c.038t.evrp} in the current working
14986 directory. Note that the numeric codes are not stable and may change
14987 from one version of GCC to another.
14991 @itemx -fopt-info-@var{options}
14992 @itemx -fopt-info-@var{options}=@var{filename}
14994 Controls optimization dumps from various optimization passes. If the
14995 @samp{-@var{options}} form is used, @var{options} is a list of
14996 @samp{-} separated option keywords to select the dump details and
14999 The @var{options} can be divided into three groups:
15002 options describing what kinds of messages should be emitted,
15004 options describing the verbosity of the dump, and
15006 options describing which optimizations should be included.
15008 The options from each group can be freely mixed as they are
15009 non-overlapping. However, in case of any conflicts,
15010 the later options override the earlier options on the command
15013 The following options control which kinds of messages should be emitted:
15017 Print information when an optimization is successfully applied. It is
15018 up to a pass to decide which information is relevant. For example, the
15019 vectorizer passes print the source location of loops which are
15020 successfully vectorized.
15022 Print information about missed optimizations. Individual passes
15023 control which information to include in the output.
15025 Print verbose information about optimizations, such as certain
15026 transformations, more detailed messages about decisions etc.
15028 Print detailed optimization information. This includes
15029 @samp{optimized}, @samp{missed}, and @samp{note}.
15032 The following option controls the dump verbosity:
15036 By default, only ``high-level'' messages are emitted. This option enables
15037 additional, more detailed, messages, which are likely to only be of interest
15041 One or more of the following option keywords can be used to describe a
15042 group of optimizations:
15046 Enable dumps from all interprocedural optimizations.
15048 Enable dumps from all loop optimizations.
15050 Enable dumps from all inlining optimizations.
15052 Enable dumps from all OMP (Offloading and Multi Processing) optimizations.
15054 Enable dumps from all vectorization optimizations.
15056 Enable dumps from all optimizations. This is a superset of
15057 the optimization groups listed above.
15060 If @var{options} is
15061 omitted, it defaults to @samp{optimized-optall}, which means to dump messages
15062 about successful optimizations from all the passes, omitting messages
15063 that are treated as ``internals''.
15065 If the @var{filename} is provided, then the dumps from all the
15066 applicable optimizations are concatenated into the @var{filename}.
15067 Otherwise the dump is output onto @file{stderr}. Though multiple
15068 @option{-fopt-info} options are accepted, only one of them can include
15069 a @var{filename}. If other filenames are provided then all but the
15070 first such option are ignored.
15072 Note that the output @var{filename} is overwritten
15073 in case of multiple translation units. If a combined output from
15074 multiple translation units is desired, @file{stderr} should be used
15077 In the following example, the optimization info is output to
15086 gcc -O3 -fopt-info-missed=missed.all
15090 outputs missed optimization report from all the passes into
15091 @file{missed.all}, and this one:
15094 gcc -O2 -ftree-vectorize -fopt-info-vec-missed
15098 prints information about missed optimization opportunities from
15099 vectorization passes on @file{stderr}.
15100 Note that @option{-fopt-info-vec-missed} is equivalent to
15101 @option{-fopt-info-missed-vec}. The order of the optimization group
15102 names and message types listed after @option{-fopt-info} does not matter.
15104 As another example,
15106 gcc -O3 -fopt-info-inline-optimized-missed=inline.txt
15110 outputs information about missed optimizations as well as
15111 optimized locations from all the inlining passes into
15117 gcc -fopt-info-vec-missed=vec.miss -fopt-info-loop-optimized=loop.opt
15121 Here the two output filenames @file{vec.miss} and @file{loop.opt} are
15122 in conflict since only one output file is allowed. In this case, only
15123 the first option takes effect and the subsequent options are
15124 ignored. Thus only @file{vec.miss} is produced which contains
15125 dumps from the vectorizer about missed opportunities.
15127 @item -fsave-optimization-record
15128 @opindex fsave-optimization-record
15129 Write a SRCFILE.opt-record.json.gz file detailing what optimizations
15130 were performed, for those optimizations that support @option{-fopt-info}.
15132 This option is experimental and the format of the data within the
15133 compressed JSON file is subject to change.
15135 It is roughly equivalent to a machine-readable version of
15136 @option{-fopt-info-all}, as a collection of messages with source file,
15137 line number and column number, with the following additional data for
15143 the execution count of the code being optimized, along with metadata about
15144 whether this was from actual profile data, or just an estimate, allowing
15145 consumers to prioritize messages by code hotness,
15148 the function name of the code being optimized, where applicable,
15151 the ``inlining chain'' for the code being optimized, so that when
15152 a function is inlined into several different places (which might
15153 themselves be inlined), the reader can distinguish between the copies,
15156 objects identifying those parts of the message that refer to expressions,
15157 statements or symbol-table nodes, which of these categories they are, and,
15158 when available, their source code location,
15161 the GCC pass that emitted the message, and
15164 the location in GCC's own code from which the message was emitted
15168 Additionally, some messages are logically nested within other
15169 messages, reflecting implementation details of the optimization
15172 @item -fsched-verbose=@var{n}
15173 @opindex fsched-verbose
15174 On targets that use instruction scheduling, this option controls the
15175 amount of debugging output the scheduler prints to the dump files.
15177 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
15178 same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
15179 For @var{n} greater than one, it also output basic block probabilities,
15180 detailed ready list information and unit/insn info. For @var{n} greater
15181 than two, it includes RTL at abort point, control-flow and regions info.
15182 And for @var{n} over four, @option{-fsched-verbose} also includes
15187 @item -fenable-@var{kind}-@var{pass}
15188 @itemx -fdisable-@var{kind}-@var{pass}=@var{range-list}
15192 This is a set of options that are used to explicitly disable/enable
15193 optimization passes. These options are intended for use for debugging GCC.
15194 Compiler users should use regular options for enabling/disabling
15199 @item -fdisable-ipa-@var{pass}
15200 Disable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15201 statically invoked in the compiler multiple times, the pass name should be
15202 appended with a sequential number starting from 1.
15204 @item -fdisable-rtl-@var{pass}
15205 @itemx -fdisable-rtl-@var{pass}=@var{range-list}
15206 Disable RTL pass @var{pass}. @var{pass} is the pass name. If the same pass is
15207 statically invoked in the compiler multiple times, the pass name should be
15208 appended with a sequential number starting from 1. @var{range-list} is a
15209 comma-separated list of function ranges or assembler names. Each range is a number
15210 pair separated by a colon. The range is inclusive in both ends. If the range
15211 is trivial, the number pair can be simplified as a single number. If the
15212 function's call graph node's @var{uid} falls within one of the specified ranges,
15213 the @var{pass} is disabled for that function. The @var{uid} is shown in the
15214 function header of a dump file, and the pass names can be dumped by using
15215 option @option{-fdump-passes}.
15217 @item -fdisable-tree-@var{pass}
15218 @itemx -fdisable-tree-@var{pass}=@var{range-list}
15219 Disable tree pass @var{pass}. See @option{-fdisable-rtl} for the description of
15222 @item -fenable-ipa-@var{pass}
15223 Enable IPA pass @var{pass}. @var{pass} is the pass name. If the same pass is
15224 statically invoked in the compiler multiple times, the pass name should be
15225 appended with a sequential number starting from 1.
15227 @item -fenable-rtl-@var{pass}
15228 @itemx -fenable-rtl-@var{pass}=@var{range-list}
15229 Enable RTL pass @var{pass}. See @option{-fdisable-rtl} for option argument
15230 description and examples.
15232 @item -fenable-tree-@var{pass}
15233 @itemx -fenable-tree-@var{pass}=@var{range-list}
15234 Enable tree pass @var{pass}. See @option{-fdisable-rtl} for the description
15235 of option arguments.
15239 Here are some examples showing uses of these options.
15243 # disable ccp1 for all functions
15244 -fdisable-tree-ccp1
15245 # disable complete unroll for function whose cgraph node uid is 1
15246 -fenable-tree-cunroll=1
15247 # disable gcse2 for functions at the following ranges [1,1],
15248 # [300,400], and [400,1000]
15249 # disable gcse2 for functions foo and foo2
15250 -fdisable-rtl-gcse2=foo,foo2
15251 # disable early inlining
15252 -fdisable-tree-einline
15253 # disable ipa inlining
15254 -fdisable-ipa-inline
15255 # enable tree full unroll
15256 -fenable-tree-unroll
15261 @itemx -fchecking=@var{n}
15263 @opindex fno-checking
15264 Enable internal consistency checking. The default depends on
15265 the compiler configuration. @option{-fchecking=2} enables further
15266 internal consistency checking that might affect code generation.
15268 @item -frandom-seed=@var{string}
15269 @opindex frandom-seed
15270 This option provides a seed that GCC uses in place of
15271 random numbers in generating certain symbol names
15272 that have to be different in every compiled file. It is also used to
15273 place unique stamps in coverage data files and the object files that
15274 produce them. You can use the @option{-frandom-seed} option to produce
15275 reproducibly identical object files.
15277 The @var{string} can either be a number (decimal, octal or hex) or an
15278 arbitrary string (in which case it's converted to a number by
15281 The @var{string} should be different for every file you compile.
15284 @itemx -save-temps=cwd
15285 @opindex save-temps
15286 Store the usual ``temporary'' intermediate files permanently; place them
15287 in the current directory and name them based on the source file. Thus,
15288 compiling @file{foo.c} with @option{-c -save-temps} produces files
15289 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
15290 preprocessed @file{foo.i} output file even though the compiler now
15291 normally uses an integrated preprocessor.
15293 When used in combination with the @option{-x} command-line option,
15294 @option{-save-temps} is sensible enough to avoid over writing an
15295 input source file with the same extension as an intermediate file.
15296 The corresponding intermediate file may be obtained by renaming the
15297 source file before using @option{-save-temps}.
15299 If you invoke GCC in parallel, compiling several different source
15300 files that share a common base name in different subdirectories or the
15301 same source file compiled for multiple output destinations, it is
15302 likely that the different parallel compilers will interfere with each
15303 other, and overwrite the temporary files. For instance:
15306 gcc -save-temps -o outdir1/foo.o indir1/foo.c&
15307 gcc -save-temps -o outdir2/foo.o indir2/foo.c&
15310 may result in @file{foo.i} and @file{foo.o} being written to
15311 simultaneously by both compilers.
15313 @item -save-temps=obj
15314 @opindex save-temps=obj
15315 Store the usual ``temporary'' intermediate files permanently. If the
15316 @option{-o} option is used, the temporary files are based on the
15317 object file. If the @option{-o} option is not used, the
15318 @option{-save-temps=obj} switch behaves like @option{-save-temps}.
15323 gcc -save-temps=obj -c foo.c
15324 gcc -save-temps=obj -c bar.c -o dir/xbar.o
15325 gcc -save-temps=obj foobar.c -o dir2/yfoobar
15329 creates @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
15330 @file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
15331 @file{dir2/yfoobar.o}.
15333 @item -time@r{[}=@var{file}@r{]}
15335 Report the CPU time taken by each subprocess in the compilation
15336 sequence. For C source files, this is the compiler proper and assembler
15337 (plus the linker if linking is done).
15339 Without the specification of an output file, the output looks like this:
15346 The first number on each line is the ``user time'', that is time spent
15347 executing the program itself. The second number is ``system time'',
15348 time spent executing operating system routines on behalf of the program.
15349 Both numbers are in seconds.
15351 With the specification of an output file, the output is appended to the
15352 named file, and it looks like this:
15355 0.12 0.01 cc1 @var{options}
15356 0.00 0.01 as @var{options}
15359 The ``user time'' and the ``system time'' are moved before the program
15360 name, and the options passed to the program are displayed, so that one
15361 can later tell what file was being compiled, and with which options.
15363 @item -fdump-final-insns@r{[}=@var{file}@r{]}
15364 @opindex fdump-final-insns
15365 Dump the final internal representation (RTL) to @var{file}. If the
15366 optional argument is omitted (or if @var{file} is @code{.}), the name
15367 of the dump file is determined by appending @code{.gkd} to the
15368 compilation output file name.
15370 @item -fcompare-debug@r{[}=@var{opts}@r{]}
15371 @opindex fcompare-debug
15372 @opindex fno-compare-debug
15373 If no error occurs during compilation, run the compiler a second time,
15374 adding @var{opts} and @option{-fcompare-debug-second} to the arguments
15375 passed to the second compilation. Dump the final internal
15376 representation in both compilations, and print an error if they differ.
15378 If the equal sign is omitted, the default @option{-gtoggle} is used.
15380 The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
15381 and nonzero, implicitly enables @option{-fcompare-debug}. If
15382 @env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
15383 then it is used for @var{opts}, otherwise the default @option{-gtoggle}
15386 @option{-fcompare-debug=}, with the equal sign but without @var{opts},
15387 is equivalent to @option{-fno-compare-debug}, which disables the dumping
15388 of the final representation and the second compilation, preventing even
15389 @env{GCC_COMPARE_DEBUG} from taking effect.
15391 To verify full coverage during @option{-fcompare-debug} testing, set
15392 @env{GCC_COMPARE_DEBUG} to say @option{-fcompare-debug-not-overridden},
15393 which GCC rejects as an invalid option in any actual compilation
15394 (rather than preprocessing, assembly or linking). To get just a
15395 warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
15396 not overridden} will do.
15398 @item -fcompare-debug-second
15399 @opindex fcompare-debug-second
15400 This option is implicitly passed to the compiler for the second
15401 compilation requested by @option{-fcompare-debug}, along with options to
15402 silence warnings, and omitting other options that would cause the compiler
15403 to produce output to files or to standard output as a side effect. Dump
15404 files and preserved temporary files are renamed so as to contain the
15405 @code{.gk} additional extension during the second compilation, to avoid
15406 overwriting those generated by the first.
15408 When this option is passed to the compiler driver, it causes the
15409 @emph{first} compilation to be skipped, which makes it useful for little
15410 other than debugging the compiler proper.
15414 Turn off generation of debug info, if leaving out this option
15415 generates it, or turn it on at level 2 otherwise. The position of this
15416 argument in the command line does not matter; it takes effect after all
15417 other options are processed, and it does so only once, no matter how
15418 many times it is given. This is mainly intended to be used with
15419 @option{-fcompare-debug}.
15421 @item -fvar-tracking-assignments-toggle
15422 @opindex fvar-tracking-assignments-toggle
15423 @opindex fno-var-tracking-assignments-toggle
15424 Toggle @option{-fvar-tracking-assignments}, in the same way that
15425 @option{-gtoggle} toggles @option{-g}.
15429 Makes the compiler print out each function name as it is compiled, and
15430 print some statistics about each pass when it finishes.
15432 @item -ftime-report
15433 @opindex ftime-report
15434 Makes the compiler print some statistics about the time consumed by each
15435 pass when it finishes.
15437 @item -ftime-report-details
15438 @opindex ftime-report-details
15439 Record the time consumed by infrastructure parts separately for each pass.
15441 @item -fira-verbose=@var{n}
15442 @opindex fira-verbose
15443 Control the verbosity of the dump file for the integrated register allocator.
15444 The default value is 5. If the value @var{n} is greater or equal to 10,
15445 the dump output is sent to stderr using the same format as @var{n} minus 10.
15448 @opindex flto-report
15449 Prints a report with internal details on the workings of the link-time
15450 optimizer. The contents of this report vary from version to version.
15451 It is meant to be useful to GCC developers when processing object
15452 files in LTO mode (via @option{-flto}).
15454 Disabled by default.
15456 @item -flto-report-wpa
15457 @opindex flto-report-wpa
15458 Like @option{-flto-report}, but only print for the WPA phase of link-time
15462 @opindex fmem-report
15463 Makes the compiler print some statistics about permanent memory
15464 allocation when it finishes.
15466 @item -fmem-report-wpa
15467 @opindex fmem-report-wpa
15468 Makes the compiler print some statistics about permanent memory
15469 allocation for the WPA phase only.
15471 @item -fpre-ipa-mem-report
15472 @opindex fpre-ipa-mem-report
15473 @item -fpost-ipa-mem-report
15474 @opindex fpost-ipa-mem-report
15475 Makes the compiler print some statistics about permanent memory
15476 allocation before or after interprocedural optimization.
15478 @item -fprofile-report
15479 @opindex fprofile-report
15480 Makes the compiler print some statistics about consistency of the
15481 (estimated) profile and effect of individual passes.
15483 @item -fstack-usage
15484 @opindex fstack-usage
15485 Makes the compiler output stack usage information for the program, on a
15486 per-function basis. The filename for the dump is made by appending
15487 @file{.su} to the @var{auxname}. @var{auxname} is generated from the name of
15488 the output file, if explicitly specified and it is not an executable,
15489 otherwise it is the basename of the source file. An entry is made up
15494 The name of the function.
15498 One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
15501 The qualifier @code{static} means that the function manipulates the stack
15502 statically: a fixed number of bytes are allocated for the frame on function
15503 entry and released on function exit; no stack adjustments are otherwise made
15504 in the function. The second field is this fixed number of bytes.
15506 The qualifier @code{dynamic} means that the function manipulates the stack
15507 dynamically: in addition to the static allocation described above, stack
15508 adjustments are made in the body of the function, for example to push/pop
15509 arguments around function calls. If the qualifier @code{bounded} is also
15510 present, the amount of these adjustments is bounded at compile time and
15511 the second field is an upper bound of the total amount of stack used by
15512 the function. If it is not present, the amount of these adjustments is
15513 not bounded at compile time and the second field only represents the
15518 Emit statistics about front-end processing at the end of the compilation.
15519 This option is supported only by the C++ front end, and
15520 the information is generally only useful to the G++ development team.
15522 @item -fdbg-cnt-list
15523 @opindex fdbg-cnt-list
15524 Print the name and the counter upper bound for all debug counters.
15527 @item -fdbg-cnt=@var{counter-value-list}
15529 Set the internal debug counter lower and upper bound. @var{counter-value-list}
15530 is a comma-separated list of @var{name}:@var{lower_bound}:@var{upper_bound}
15531 tuples which sets the lower and the upper bound of each debug
15532 counter @var{name}. The @var{lower_bound} is optional and is zero
15533 initialized if not set.
15534 All debug counters have the initial upper bound of @code{UINT_MAX};
15535 thus @code{dbg_cnt} returns true always unless the upper bound
15536 is set by this option.
15537 For example, with @option{-fdbg-cnt=dce:2:4,tail_call:10},
15538 @code{dbg_cnt(dce)} returns true only for third and fourth invocation.
15539 For @code{dbg_cnt(tail_call)} true is returned for first 10 invocations.
15541 @item -print-file-name=@var{library}
15542 @opindex print-file-name
15543 Print the full absolute name of the library file @var{library} that
15544 would be used when linking---and don't do anything else. With this
15545 option, GCC does not compile or link anything; it just prints the
15548 @item -print-multi-directory
15549 @opindex print-multi-directory
15550 Print the directory name corresponding to the multilib selected by any
15551 other switches present in the command line. This directory is supposed
15552 to exist in @env{GCC_EXEC_PREFIX}.
15554 @item -print-multi-lib
15555 @opindex print-multi-lib
15556 Print the mapping from multilib directory names to compiler switches
15557 that enable them. The directory name is separated from the switches by
15558 @samp{;}, and each switch starts with an @samp{@@} instead of the
15559 @samp{-}, without spaces between multiple switches. This is supposed to
15560 ease shell processing.
15562 @item -print-multi-os-directory
15563 @opindex print-multi-os-directory
15564 Print the path to OS libraries for the selected
15565 multilib, relative to some @file{lib} subdirectory. If OS libraries are
15566 present in the @file{lib} subdirectory and no multilibs are used, this is
15567 usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
15568 sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
15569 @file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
15570 subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
15572 @item -print-multiarch
15573 @opindex print-multiarch
15574 Print the path to OS libraries for the selected multiarch,
15575 relative to some @file{lib} subdirectory.
15577 @item -print-prog-name=@var{program}
15578 @opindex print-prog-name
15579 Like @option{-print-file-name}, but searches for a program such as @command{cpp}.
15581 @item -print-libgcc-file-name
15582 @opindex print-libgcc-file-name
15583 Same as @option{-print-file-name=libgcc.a}.
15585 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
15586 but you do want to link with @file{libgcc.a}. You can do:
15589 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
15592 @item -print-search-dirs
15593 @opindex print-search-dirs
15594 Print the name of the configured installation directory and a list of
15595 program and library directories @command{gcc} searches---and don't do anything else.
15597 This is useful when @command{gcc} prints the error message
15598 @samp{installation problem, cannot exec cpp0: No such file or directory}.
15599 To resolve this you either need to put @file{cpp0} and the other compiler
15600 components where @command{gcc} expects to find them, or you can set the environment
15601 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
15602 Don't forget the trailing @samp{/}.
15603 @xref{Environment Variables}.
15605 @item -print-sysroot
15606 @opindex print-sysroot
15607 Print the target sysroot directory that is used during
15608 compilation. This is the target sysroot specified either at configure
15609 time or using the @option{--sysroot} option, possibly with an extra
15610 suffix that depends on compilation options. If no target sysroot is
15611 specified, the option prints nothing.
15613 @item -print-sysroot-headers-suffix
15614 @opindex print-sysroot-headers-suffix
15615 Print the suffix added to the target sysroot when searching for
15616 headers, or give an error if the compiler is not configured with such
15617 a suffix---and don't do anything else.
15620 @opindex dumpmachine
15621 Print the compiler's target machine (for example,
15622 @samp{i686-pc-linux-gnu})---and don't do anything else.
15625 @opindex dumpversion
15626 Print the compiler version (for example, @code{3.0}, @code{6.3.0} or @code{7})---and don't do
15627 anything else. This is the compiler version used in filesystem paths and
15628 specs. Depending on how the compiler has been configured it can be just
15629 a single number (major version), two numbers separated by a dot (major and
15630 minor version) or three numbers separated by dots (major, minor and patchlevel
15633 @item -dumpfullversion
15634 @opindex dumpfullversion
15635 Print the full compiler version---and don't do anything else. The output is
15636 always three numbers separated by dots, major, minor and patchlevel version.
15640 Print the compiler's built-in specs---and don't do anything else. (This
15641 is used when GCC itself is being built.) @xref{Spec Files}.
15644 @node Submodel Options
15645 @section Machine-Dependent Options
15646 @cindex submodel options
15647 @cindex specifying hardware config
15648 @cindex hardware models and configurations, specifying
15649 @cindex target-dependent options
15650 @cindex machine-dependent options
15652 Each target machine supported by GCC can have its own options---for
15653 example, to allow you to compile for a particular processor variant or
15654 ABI, or to control optimizations specific to that machine. By
15655 convention, the names of machine-specific options start with
15658 Some configurations of the compiler also support additional target-specific
15659 options, usually for compatibility with other compilers on the same
15662 @c This list is ordered alphanumerically by subsection name.
15663 @c It should be the same order and spelling as these options are listed
15664 @c in Machine Dependent Options
15667 * AArch64 Options::
15668 * Adapteva Epiphany Options::
15669 * AMD GCN Options::
15673 * Blackfin Options::
15679 * DEC Alpha Options::
15684 * GNU/Linux Options::
15694 * MicroBlaze Options::
15697 * MN10300 Options::
15701 * Nios II Options::
15702 * Nvidia PTX Options::
15703 * OpenRISC Options::
15705 * picoChip Options::
15706 * PowerPC Options::
15710 * RS/6000 and PowerPC Options::
15712 * S/390 and zSeries Options::
15715 * Solaris 2 Options::
15717 * System V Options::
15718 * TILE-Gx Options::
15719 * TILEPro Options::
15724 * VxWorks Options::
15726 * x86 Windows Options::
15727 * Xstormy16 Options::
15729 * zSeries Options::
15732 @node AArch64 Options
15733 @subsection AArch64 Options
15734 @cindex AArch64 Options
15736 These options are defined for AArch64 implementations:
15740 @item -mabi=@var{name}
15742 Generate code for the specified data model. Permissible values
15743 are @samp{ilp32} for SysV-like data model where int, long int and pointers
15744 are 32 bits, and @samp{lp64} for SysV-like data model where int is 32 bits,
15745 but long int and pointers are 64 bits.
15747 The default depends on the specific target configuration. Note that
15748 the LP64 and ILP32 ABIs are not link-compatible; you must compile your
15749 entire program with the same ABI, and link with a compatible set of libraries.
15752 @opindex mbig-endian
15753 Generate big-endian code. This is the default when GCC is configured for an
15754 @samp{aarch64_be-*-*} target.
15756 @item -mgeneral-regs-only
15757 @opindex mgeneral-regs-only
15758 Generate code which uses only the general-purpose registers. This will prevent
15759 the compiler from using floating-point and Advanced SIMD registers but will not
15760 impose any restrictions on the assembler.
15762 @item -mlittle-endian
15763 @opindex mlittle-endian
15764 Generate little-endian code. This is the default when GCC is configured for an
15765 @samp{aarch64-*-*} but not an @samp{aarch64_be-*-*} target.
15767 @item -mcmodel=tiny
15768 @opindex mcmodel=tiny
15769 Generate code for the tiny code model. The program and its statically defined
15770 symbols must be within 1MB of each other. Programs can be statically or
15771 dynamically linked.
15773 @item -mcmodel=small
15774 @opindex mcmodel=small
15775 Generate code for the small code model. The program and its statically defined
15776 symbols must be within 4GB of each other. Programs can be statically or
15777 dynamically linked. This is the default code model.
15779 @item -mcmodel=large
15780 @opindex mcmodel=large
15781 Generate code for the large code model. This makes no assumptions about
15782 addresses and sizes of sections. Programs can be statically linked only.
15784 @item -mstrict-align
15785 @itemx -mno-strict-align
15786 @opindex mstrict-align
15787 @opindex mno-strict-align
15788 Avoid or allow generating memory accesses that may not be aligned on a natural
15789 object boundary as described in the architecture specification.
15791 @item -momit-leaf-frame-pointer
15792 @itemx -mno-omit-leaf-frame-pointer
15793 @opindex momit-leaf-frame-pointer
15794 @opindex mno-omit-leaf-frame-pointer
15795 Omit or keep the frame pointer in leaf functions. The former behavior is the
15798 @item -mstack-protector-guard=@var{guard}
15799 @itemx -mstack-protector-guard-reg=@var{reg}
15800 @itemx -mstack-protector-guard-offset=@var{offset}
15801 @opindex mstack-protector-guard
15802 @opindex mstack-protector-guard-reg
15803 @opindex mstack-protector-guard-offset
15804 Generate stack protection code using canary at @var{guard}. Supported
15805 locations are @samp{global} for a global canary or @samp{sysreg} for a
15806 canary in an appropriate system register.
15808 With the latter choice the options
15809 @option{-mstack-protector-guard-reg=@var{reg}} and
15810 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15811 which system register to use as base register for reading the canary,
15812 and from what offset from that base register. There is no default
15813 register or offset as this is entirely for use within the Linux
15816 @item -mstack-protector-guard=@var{guard}
15817 @itemx -mstack-protector-guard-reg=@var{reg}
15818 @itemx -mstack-protector-guard-offset=@var{offset}
15819 @opindex mstack-protector-guard
15820 @opindex mstack-protector-guard-reg
15821 @opindex mstack-protector-guard-offset
15822 Generate stack protection code using canary at @var{guard}. Supported
15823 locations are @samp{global} for a global canary or @samp{sysreg} for a
15824 canary in an appropriate system register.
15826 With the latter choice the options
15827 @option{-mstack-protector-guard-reg=@var{reg}} and
15828 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
15829 which system register to use as base register for reading the canary,
15830 and from what offset from that base register. There is no default
15831 register or offset as this is entirely for use within the Linux
15834 @item -mtls-dialect=desc
15835 @opindex mtls-dialect=desc
15836 Use TLS descriptors as the thread-local storage mechanism for dynamic accesses
15837 of TLS variables. This is the default.
15839 @item -mtls-dialect=traditional
15840 @opindex mtls-dialect=traditional
15841 Use traditional TLS as the thread-local storage mechanism for dynamic accesses
15844 @item -mtls-size=@var{size}
15846 Specify bit size of immediate TLS offsets. Valid values are 12, 24, 32, 48.
15847 This option requires binutils 2.26 or newer.
15849 @item -mfix-cortex-a53-835769
15850 @itemx -mno-fix-cortex-a53-835769
15851 @opindex mfix-cortex-a53-835769
15852 @opindex mno-fix-cortex-a53-835769
15853 Enable or disable the workaround for the ARM Cortex-A53 erratum number 835769.
15854 This involves inserting a NOP instruction between memory instructions and
15855 64-bit integer multiply-accumulate instructions.
15857 @item -mfix-cortex-a53-843419
15858 @itemx -mno-fix-cortex-a53-843419
15859 @opindex mfix-cortex-a53-843419
15860 @opindex mno-fix-cortex-a53-843419
15861 Enable or disable the workaround for the ARM Cortex-A53 erratum number 843419.
15862 This erratum workaround is made at link time and this will only pass the
15863 corresponding flag to the linker.
15865 @item -mlow-precision-recip-sqrt
15866 @itemx -mno-low-precision-recip-sqrt
15867 @opindex mlow-precision-recip-sqrt
15868 @opindex mno-low-precision-recip-sqrt
15869 Enable or disable the reciprocal square root approximation.
15870 This option only has an effect if @option{-ffast-math} or
15871 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15872 precision of reciprocal square root results to about 16 bits for
15873 single precision and to 32 bits for double precision.
15875 @item -mlow-precision-sqrt
15876 @itemx -mno-low-precision-sqrt
15877 @opindex mlow-precision-sqrt
15878 @opindex mno-low-precision-sqrt
15879 Enable or disable the square root approximation.
15880 This option only has an effect if @option{-ffast-math} or
15881 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15882 precision of square root results to about 16 bits for
15883 single precision and to 32 bits for double precision.
15884 If enabled, it implies @option{-mlow-precision-recip-sqrt}.
15886 @item -mlow-precision-div
15887 @itemx -mno-low-precision-div
15888 @opindex mlow-precision-div
15889 @opindex mno-low-precision-div
15890 Enable or disable the division approximation.
15891 This option only has an effect if @option{-ffast-math} or
15892 @option{-funsafe-math-optimizations} is used as well. Enabling this reduces
15893 precision of division results to about 16 bits for
15894 single precision and to 32 bits for double precision.
15896 @item -mtrack-speculation
15897 @itemx -mno-track-speculation
15898 Enable or disable generation of additional code to track speculative
15899 execution through conditional branches. The tracking state can then
15900 be used by the compiler when expanding calls to
15901 @code{__builtin_speculation_safe_copy} to permit a more efficient code
15902 sequence to be generated.
15904 @item -moutline-atomics
15905 @itemx -mno-outline-atomics
15906 Enable or disable calls to out-of-line helpers to implement atomic operations.
15907 These helpers will, at runtime, determine if the LSE instructions from
15908 ARMv8.1-A can be used; if not, they will use the load/store-exclusive
15909 instructions that are present in the base ARMv8.0 ISA.
15911 This option is only applicable when compiling for the base ARMv8.0
15912 instruction set. If using a later revision, e.g. @option{-march=armv8.1-a}
15913 or @option{-march=armv8-a+lse}, the ARMv8.1-Atomics instructions will be
15914 used directly. The same applies when using @option{-mcpu=} when the
15915 selected cpu supports the @samp{lse} feature.
15917 @item -march=@var{name}
15919 Specify the name of the target architecture and, optionally, one or
15920 more feature modifiers. This option has the form
15921 @option{-march=@var{arch}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}.
15923 The permissible values for @var{arch} are @samp{armv8-a},
15924 @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a}, @samp{armv8.4-a},
15925 @samp{armv8.5-a} or @var{native}.
15927 The value @samp{armv8.5-a} implies @samp{armv8.4-a} and enables compiler
15928 support for the ARMv8.5-A architecture extensions.
15930 The value @samp{armv8.4-a} implies @samp{armv8.3-a} and enables compiler
15931 support for the ARMv8.4-A architecture extensions.
15933 The value @samp{armv8.3-a} implies @samp{armv8.2-a} and enables compiler
15934 support for the ARMv8.3-A architecture extensions.
15936 The value @samp{armv8.2-a} implies @samp{armv8.1-a} and enables compiler
15937 support for the ARMv8.2-A architecture extensions.
15939 The value @samp{armv8.1-a} implies @samp{armv8-a} and enables compiler
15940 support for the ARMv8.1-A architecture extension. In particular, it
15941 enables the @samp{+crc}, @samp{+lse}, and @samp{+rdma} features.
15943 The value @samp{native} is available on native AArch64 GNU/Linux and
15944 causes the compiler to pick the architecture of the host system. This
15945 option has no effect if the compiler is unable to recognize the
15946 architecture of the host system,
15948 The permissible values for @var{feature} are listed in the sub-section
15949 on @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
15950 Feature Modifiers}. Where conflicting feature modifiers are
15951 specified, the right-most feature is used.
15953 GCC uses @var{name} to determine what kind of instructions it can emit
15954 when generating assembly code. If @option{-march} is specified
15955 without either of @option{-mtune} or @option{-mcpu} also being
15956 specified, the code is tuned to perform well across a range of target
15957 processors implementing the target architecture.
15959 @item -mtune=@var{name}
15961 Specify the name of the target processor for which GCC should tune the
15962 performance of the code. Permissible values for this option are:
15963 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
15964 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
15965 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
15966 @samp{cortex-a65}, @samp{cortex-a65ae}, @samp{cortex-a34},
15967 @samp{ares}, @samp{exynos-m1}, @samp{emag}, @samp{falkor},
15968 @samp{neoverse-e1},@samp{neoverse-n1},@samp{qdf24xx}, @samp{saphira},
15969 @samp{phecda}, @samp{xgene1}, @samp{vulcan}, @samp{octeontx},
15970 @samp{octeontx81}, @samp{octeontx83}, @samp{thunderx}, @samp{thunderxt88},
15971 @samp{thunderxt88p1}, @samp{thunderxt81}, @samp{tsv110},
15972 @samp{thunderxt83}, @samp{thunderx2t99},
15973 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15974 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15975 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}
15978 The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
15979 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53},
15980 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55} specify that GCC
15981 should tune for a big.LITTLE system.
15983 Additionally on native AArch64 GNU/Linux systems the value
15984 @samp{native} tunes performance to the host system. This option has no effect
15985 if the compiler is unable to recognize the processor of the host system.
15987 Where none of @option{-mtune=}, @option{-mcpu=} or @option{-march=}
15988 are specified, the code is tuned to perform well across a range
15989 of target processors.
15991 This option cannot be suffixed by feature modifiers.
15993 @item -mcpu=@var{name}
15995 Specify the name of the target processor, optionally suffixed by one
15996 or more feature modifiers. This option has the form
15997 @option{-mcpu=@var{cpu}@r{@{}+@r{[}no@r{]}@var{feature}@r{@}*}}, where
15998 the permissible values for @var{cpu} are the same as those available
15999 for @option{-mtune}. The permissible values for @var{feature} are
16000 documented in the sub-section on
16001 @ref{aarch64-feature-modifiers,,@option{-march} and @option{-mcpu}
16002 Feature Modifiers}. Where conflicting feature modifiers are
16003 specified, the right-most feature is used.
16005 GCC uses @var{name} to determine what kind of instructions it can emit when
16006 generating assembly code (as if by @option{-march}) and to determine
16007 the target processor for which to tune for performance (as if
16008 by @option{-mtune}). Where this option is used in conjunction
16009 with @option{-march} or @option{-mtune}, those options take precedence
16010 over the appropriate part of this option.
16012 @item -moverride=@var{string}
16014 Override tuning decisions made by the back-end in response to a
16015 @option{-mtune=} switch. The syntax, semantics, and accepted values
16016 for @var{string} in this option are not guaranteed to be consistent
16019 This option is only intended to be useful when developing GCC.
16021 @item -mverbose-cost-dump
16022 @opindex mverbose-cost-dump
16023 Enable verbose cost model dumping in the debug dump files. This option is
16024 provided for use in debugging the compiler.
16026 @item -mpc-relative-literal-loads
16027 @itemx -mno-pc-relative-literal-loads
16028 @opindex mpc-relative-literal-loads
16029 @opindex mno-pc-relative-literal-loads
16030 Enable or disable PC-relative literal loads. With this option literal pools are
16031 accessed using a single instruction and emitted after each function. This
16032 limits the maximum size of functions to 1MB. This is enabled by default for
16033 @option{-mcmodel=tiny}.
16035 @item -msign-return-address=@var{scope}
16036 @opindex msign-return-address
16037 Select the function scope on which return address signing will be applied.
16038 Permissible values are @samp{none}, which disables return address signing,
16039 @samp{non-leaf}, which enables pointer signing for functions which are not leaf
16040 functions, and @samp{all}, which enables pointer signing for all functions. The
16041 default value is @samp{none}. This option has been deprecated by
16042 -mbranch-protection.
16044 @item -mbranch-protection=@var{none}|@var{standard}|@var{pac-ret}[+@var{leaf}+@var{b-key}]|@var{bti}
16045 @opindex mbranch-protection
16046 Select the branch protection features to use.
16047 @samp{none} is the default and turns off all types of branch protection.
16048 @samp{standard} turns on all types of branch protection features. If a feature
16049 has additional tuning options, then @samp{standard} sets it to its standard
16051 @samp{pac-ret[+@var{leaf}]} turns on return address signing to its standard
16052 level: signing functions that save the return address to memory (non-leaf
16053 functions will practically always do this) using the a-key. The optional
16054 argument @samp{leaf} can be used to extend the signing to include leaf
16055 functions. The optional argument @samp{b-key} can be used to sign the functions
16056 with the B-key instead of the A-key.
16057 @samp{bti} turns on branch target identification mechanism.
16059 @item -msve-vector-bits=@var{bits}
16060 @opindex msve-vector-bits
16061 Specify the number of bits in an SVE vector register. This option only has
16062 an effect when SVE is enabled.
16064 GCC supports two forms of SVE code generation: ``vector-length
16065 agnostic'' output that works with any size of vector register and
16066 ``vector-length specific'' output that allows GCC to make assumptions
16067 about the vector length when it is useful for optimization reasons.
16068 The possible values of @samp{bits} are: @samp{scalable}, @samp{128},
16069 @samp{256}, @samp{512}, @samp{1024} and @samp{2048}.
16070 Specifying @samp{scalable} selects vector-length agnostic
16071 output. At present @samp{-msve-vector-bits=128} also generates vector-length
16072 agnostic output. All other values generate vector-length specific code.
16073 The behavior of these values may change in future releases and no value except
16074 @samp{scalable} should be relied on for producing code that is portable across
16075 different hardware SVE vector lengths.
16077 The default is @samp{-msve-vector-bits=scalable}, which produces
16078 vector-length agnostic code.
16081 @subsubsection @option{-march} and @option{-mcpu} Feature Modifiers
16082 @anchor{aarch64-feature-modifiers}
16083 @cindex @option{-march} feature modifiers
16084 @cindex @option{-mcpu} feature modifiers
16085 Feature modifiers used with @option{-march} and @option{-mcpu} can be any of
16086 the following and their inverses @option{no@var{feature}}:
16090 Enable CRC extension. This is on by default for
16091 @option{-march=armv8.1-a}.
16093 Enable Crypto extension. This also enables Advanced SIMD and floating-point
16096 Enable floating-point instructions. This is on by default for all possible
16097 values for options @option{-march} and @option{-mcpu}.
16099 Enable Advanced SIMD instructions. This also enables floating-point
16100 instructions. This is on by default for all possible values for options
16101 @option{-march} and @option{-mcpu}.
16103 Enable Scalable Vector Extension instructions. This also enables Advanced
16104 SIMD and floating-point instructions.
16106 Enable Large System Extension instructions. This is on by default for
16107 @option{-march=armv8.1-a}.
16109 Enable Round Double Multiply Accumulate instructions. This is on by default
16110 for @option{-march=armv8.1-a}.
16112 Enable FP16 extension. This also enables floating-point instructions.
16114 Enable FP16 fmla extension. This also enables FP16 extensions and
16115 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.
16118 Enable the RcPc extension. This does not change code generation from GCC,
16119 but is passed on to the assembler, enabling inline asm statements to use
16120 instructions from the RcPc extension.
16122 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
16124 Enable the Armv8-a aes and pmull crypto extension. This also enables Advanced
16127 Enable the Armv8-a sha2 crypto extension. This also enables Advanced SIMD instructions.
16129 Enable the sha512 and sha3 crypto extension. This also enables Advanced SIMD
16130 instructions. Use of this option with architectures prior to Armv8.2-A is not supported.
16132 Enable the sm3 and sm4 crypto extension. This also enables Advanced SIMD instructions.
16133 Use of this option with architectures prior to Armv8.2-A is not supported.
16135 Enable the Statistical Profiling extension. This option is only to enable the
16136 extension at the assembler level and does not affect code generation.
16138 Enable the Armv8.5-a Random Number instructions. This option is only to
16139 enable the extension at the assembler level and does not affect code
16142 Enable the Armv8.5-a Memory Tagging Extensions. This option is only to
16143 enable the extension at the assembler level and does not affect code
16146 Enable the Armv8-a Speculation Barrier instruction. This option is only to
16147 enable the extension at the assembler level and does not affect code
16148 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16150 Enable the Armv8-a Speculative Store Bypass Safe instruction. This option
16151 is only to enable the extension at the assembler level and does not affect code
16152 generation. This option is enabled by default for @option{-march=armv8.5-a}.
16154 Enable the Armv8-a Execution and Data Prediction Restriction instructions.
16155 This option is only to enable the extension at the assembler level and does
16156 not affect code generation. This option is enabled by default for
16158 Enable the Armv8-a Scalable Vector Extension 2. This also enables SVE
16161 Enable SVE2 bitperm instructions. This also enables SVE2 instructions.
16163 Enable SVE2 sm4 instructions. This also enables SVE2 instructions.
16165 Enable SVE2 aes instructions. This also enables SVE2 instructions.
16167 Enable SVE2 sha3 instructions. This also enables SVE2 instructions.
16168 @option{-march=armv8.5-a}.
16170 Enable the Transactional Memory Extension.
16174 Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},
16175 which implies @option{fp}.
16176 Conversely, @option{nofp} implies @option{nosimd}, which implies
16177 @option{nocrypto}, @option{noaes} and @option{nosha2}.
16179 @node Adapteva Epiphany Options
16180 @subsection Adapteva Epiphany Options
16182 These @samp{-m} options are defined for Adapteva Epiphany:
16185 @item -mhalf-reg-file
16186 @opindex mhalf-reg-file
16187 Don't allocate any register in the range @code{r32}@dots{}@code{r63}.
16188 That allows code to run on hardware variants that lack these registers.
16190 @item -mprefer-short-insn-regs
16191 @opindex mprefer-short-insn-regs
16192 Preferentially allocate registers that allow short instruction generation.
16193 This can result in increased instruction count, so this may either reduce or
16194 increase overall code size.
16196 @item -mbranch-cost=@var{num}
16197 @opindex mbranch-cost
16198 Set the cost of branches to roughly @var{num} ``simple'' instructions.
16199 This cost is only a heuristic and is not guaranteed to produce
16200 consistent results across releases.
16204 Enable the generation of conditional moves.
16206 @item -mnops=@var{num}
16208 Emit @var{num} NOPs before every other generated instruction.
16210 @item -mno-soft-cmpsf
16211 @opindex mno-soft-cmpsf
16212 @opindex msoft-cmpsf
16213 For single-precision floating-point comparisons, emit an @code{fsub} instruction
16214 and test the flags. This is faster than a software comparison, but can
16215 get incorrect results in the presence of NaNs, or when two different small
16216 numbers are compared such that their difference is calculated as zero.
16217 The default is @option{-msoft-cmpsf}, which uses slower, but IEEE-compliant,
16218 software comparisons.
16220 @item -mstack-offset=@var{num}
16221 @opindex mstack-offset
16222 Set the offset between the top of the stack and the stack pointer.
16223 E.g., a value of 8 means that the eight bytes in the range @code{sp+0@dots{}sp+7}
16224 can be used by leaf functions without stack allocation.
16225 Values other than @samp{8} or @samp{16} are untested and unlikely to work.
16226 Note also that this option changes the ABI; compiling a program with a
16227 different stack offset than the libraries have been compiled with
16228 generally does not work.
16229 This option can be useful if you want to evaluate if a different stack
16230 offset would give you better code, but to actually use a different stack
16231 offset to build working programs, it is recommended to configure the
16232 toolchain with the appropriate @option{--with-stack-offset=@var{num}} option.
16234 @item -mno-round-nearest
16235 @opindex mno-round-nearest
16236 @opindex mround-nearest
16237 Make the scheduler assume that the rounding mode has been set to
16238 truncating. The default is @option{-mround-nearest}.
16241 @opindex mlong-calls
16242 If not otherwise specified by an attribute, assume all calls might be beyond
16243 the offset range of the @code{b} / @code{bl} instructions, and therefore load the
16244 function address into a register before performing a (otherwise direct) call.
16245 This is the default.
16247 @item -mshort-calls
16248 @opindex short-calls
16249 If not otherwise specified by an attribute, assume all direct calls are
16250 in the range of the @code{b} / @code{bl} instructions, so use these instructions
16251 for direct calls. The default is @option{-mlong-calls}.
16255 Assume addresses can be loaded as 16-bit unsigned values. This does not
16256 apply to function addresses for which @option{-mlong-calls} semantics
16259 @item -mfp-mode=@var{mode}
16261 Set the prevailing mode of the floating-point unit.
16262 This determines the floating-point mode that is provided and expected
16263 at function call and return time. Making this mode match the mode you
16264 predominantly need at function start can make your programs smaller and
16265 faster by avoiding unnecessary mode switches.
16267 @var{mode} can be set to one the following values:
16271 Any mode at function entry is valid, and retained or restored when
16272 the function returns, and when it calls other functions.
16273 This mode is useful for compiling libraries or other compilation units
16274 you might want to incorporate into different programs with different
16275 prevailing FPU modes, and the convenience of being able to use a single
16276 object file outweighs the size and speed overhead for any extra
16277 mode switching that might be needed, compared with what would be needed
16278 with a more specific choice of prevailing FPU mode.
16281 This is the mode used for floating-point calculations with
16282 truncating (i.e.@: round towards zero) rounding mode. That includes
16283 conversion from floating point to integer.
16285 @item round-nearest
16286 This is the mode used for floating-point calculations with
16287 round-to-nearest-or-even rounding mode.
16290 This is the mode used to perform integer calculations in the FPU, e.g.@:
16291 integer multiply, or integer multiply-and-accumulate.
16294 The default is @option{-mfp-mode=caller}
16296 @item -mno-split-lohi
16297 @itemx -mno-postinc
16298 @itemx -mno-postmodify
16299 @opindex mno-split-lohi
16300 @opindex msplit-lohi
16301 @opindex mno-postinc
16303 @opindex mno-postmodify
16304 @opindex mpostmodify
16305 Code generation tweaks that disable, respectively, splitting of 32-bit
16306 loads, generation of post-increment addresses, and generation of
16307 post-modify addresses. The defaults are @option{msplit-lohi},
16308 @option{-mpost-inc}, and @option{-mpost-modify}.
16310 @item -mnovect-double
16311 @opindex mno-vect-double
16312 @opindex mvect-double
16313 Change the preferred SIMD mode to SImode. The default is
16314 @option{-mvect-double}, which uses DImode as preferred SIMD mode.
16316 @item -max-vect-align=@var{num}
16317 @opindex max-vect-align
16318 The maximum alignment for SIMD vector mode types.
16319 @var{num} may be 4 or 8. The default is 8.
16320 Note that this is an ABI change, even though many library function
16321 interfaces are unaffected if they don't use SIMD vector modes
16322 in places that affect size and/or alignment of relevant types.
16324 @item -msplit-vecmove-early
16325 @opindex msplit-vecmove-early
16326 Split vector moves into single word moves before reload. In theory this
16327 can give better register allocation, but so far the reverse seems to be
16328 generally the case.
16330 @item -m1reg-@var{reg}
16332 Specify a register to hold the constant @minus{}1, which makes loading small negative
16333 constants and certain bitmasks faster.
16334 Allowable values for @var{reg} are @samp{r43} and @samp{r63},
16335 which specify use of that register as a fixed register,
16336 and @samp{none}, which means that no register is used for this
16337 purpose. The default is @option{-m1reg-none}.
16341 @node AMD GCN Options
16342 @subsection AMD GCN Options
16343 @cindex AMD GCN Options
16345 These options are defined specifically for the AMD GCN port.
16349 @item -march=@var{gpu}
16351 @itemx -mtune=@var{gpu}
16353 Set architecture type or tuning for @var{gpu}. Supported values for @var{gpu}
16359 Compile for GCN3 Fiji devices (gfx803).
16362 Compile for GCN5 Vega 10 devices (gfx900).
16365 Compile for GCN5 Vega 20 devices (gfx906).
16369 @item -mstack-size=@var{bytes}
16370 @opindex mstack-size
16371 Specify how many @var{bytes} of stack space will be requested for each GPU
16372 thread (wave-front). Beware that there may be many threads and limited memory
16373 available. The size of the stack allocation may also have an impact on
16374 run-time performance. The default is 32KB when using OpenACC or OpenMP, and
16380 @subsection ARC Options
16381 @cindex ARC options
16383 The following options control the architecture variant for which code
16386 @c architecture variants
16389 @item -mbarrel-shifter
16390 @opindex mbarrel-shifter
16391 Generate instructions supported by barrel shifter. This is the default
16392 unless @option{-mcpu=ARC601} or @samp{-mcpu=ARCEM} is in effect.
16395 @opindex mjli-alawys
16396 Force to call a function using jli_s instruction. This option is
16397 valid only for ARCv2 architecture.
16399 @item -mcpu=@var{cpu}
16401 Set architecture type, register usage, and instruction scheduling
16402 parameters for @var{cpu}. There are also shortcut alias options
16403 available for backward compatibility and convenience. Supported
16404 values for @var{cpu} are
16410 Compile for ARC600. Aliases: @option{-mA6}, @option{-mARC600}.
16414 Compile for ARC601. Alias: @option{-mARC601}.
16419 Compile for ARC700. Aliases: @option{-mA7}, @option{-mARC700}.
16420 This is the default when configured with @option{--with-cpu=arc700}@.
16423 Compile for ARC EM.
16426 Compile for ARC HS.
16429 Compile for ARC EM CPU with no hardware extensions.
16432 Compile for ARC EM4 CPU.
16435 Compile for ARC EM4 DMIPS CPU.
16438 Compile for ARC EM4 DMIPS CPU with the single-precision floating-point
16442 Compile for ARC EM4 DMIPS CPU with single-precision floating-point and
16443 double assist instructions.
16446 Compile for ARC HS CPU with no hardware extensions except the atomic
16450 Compile for ARC HS34 CPU.
16453 Compile for ARC HS38 CPU.
16456 Compile for ARC HS38 CPU with all hardware extensions on.
16459 Compile for ARC 600 CPU with @code{norm} instructions enabled.
16461 @item arc600_mul32x16
16462 Compile for ARC 600 CPU with @code{norm} and 32x16-bit multiply
16463 instructions enabled.
16466 Compile for ARC 600 CPU with @code{norm} and @code{mul64}-family
16467 instructions enabled.
16470 Compile for ARC 601 CPU with @code{norm} instructions enabled.
16472 @item arc601_mul32x16
16473 Compile for ARC 601 CPU with @code{norm} and 32x16-bit multiply
16474 instructions enabled.
16477 Compile for ARC 601 CPU with @code{norm} and @code{mul64}-family
16478 instructions enabled.
16481 Compile for ARC 700 on NPS400 chip.
16484 Compile for ARC EM minimalist configuration featuring reduced register
16491 @itemx -mdpfp-compact
16492 @opindex mdpfp-compact
16493 Generate double-precision FPX instructions, tuned for the compact
16497 @opindex mdpfp-fast
16498 Generate double-precision FPX instructions, tuned for the fast
16501 @item -mno-dpfp-lrsr
16502 @opindex mno-dpfp-lrsr
16503 Disable @code{lr} and @code{sr} instructions from using FPX extension
16508 Generate extended arithmetic instructions. Currently only
16509 @code{divaw}, @code{adds}, @code{subs}, and @code{sat16} are
16510 supported. This is always enabled for @option{-mcpu=ARC700}.
16515 Do not generate @code{mpy}-family instructions for ARC700. This option is
16520 Generate 32x16-bit multiply and multiply-accumulate instructions.
16524 Generate @code{mul64} and @code{mulu64} instructions.
16525 Only valid for @option{-mcpu=ARC600}.
16529 Generate @code{norm} instructions. This is the default if @option{-mcpu=ARC700}
16534 @itemx -mspfp-compact
16535 @opindex mspfp-compact
16536 Generate single-precision FPX instructions, tuned for the compact
16540 @opindex mspfp-fast
16541 Generate single-precision FPX instructions, tuned for the fast
16546 Enable generation of ARC SIMD instructions via target-specific
16547 builtins. Only valid for @option{-mcpu=ARC700}.
16550 @opindex msoft-float
16551 This option ignored; it is provided for compatibility purposes only.
16552 Software floating-point code is emitted by default, and this default
16553 can overridden by FPX options; @option{-mspfp}, @option{-mspfp-compact}, or
16554 @option{-mspfp-fast} for single precision, and @option{-mdpfp},
16555 @option{-mdpfp-compact}, or @option{-mdpfp-fast} for double precision.
16559 Generate @code{swap} instructions.
16563 This enables use of the locked load/store conditional extension to implement
16564 atomic memory built-in functions. Not available for ARC 6xx or ARC
16569 Enable @code{div} and @code{rem} instructions for ARCv2 cores.
16571 @item -mcode-density
16572 @opindex mcode-density
16573 Enable code density instructions for ARC EM.
16574 This option is on by default for ARC HS.
16578 Enable double load/store operations for ARC HS cores.
16580 @item -mtp-regno=@var{regno}
16582 Specify thread pointer register number.
16584 @item -mmpy-option=@var{multo}
16585 @opindex mmpy-option
16586 Compile ARCv2 code with a multiplier design option. You can specify
16587 the option using either a string or numeric value for @var{multo}.
16588 @samp{wlh1} is the default value. The recognized values are:
16593 No multiplier available.
16597 16x16 multiplier, fully pipelined.
16598 The following instructions are enabled: @code{mpyw} and @code{mpyuw}.
16602 32x32 multiplier, fully
16603 pipelined (1 stage). The following instructions are additionally
16604 enabled: @code{mpy}, @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16608 32x32 multiplier, fully pipelined
16609 (2 stages). The following instructions are additionally enabled: @code{mpy},
16610 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16614 Two 16x16 multipliers, blocking,
16615 sequential. The following instructions are additionally enabled: @code{mpy},
16616 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16620 One 16x16 multiplier, blocking,
16621 sequential. The following instructions are additionally enabled: @code{mpy},
16622 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16626 One 32x4 multiplier, blocking,
16627 sequential. The following instructions are additionally enabled: @code{mpy},
16628 @code{mpyu}, @code{mpym}, @code{mpymu}, and @code{mpy_s}.
16632 ARC HS SIMD support.
16636 ARC HS SIMD support.
16640 ARC HS SIMD support.
16644 This option is only available for ARCv2 cores@.
16646 @item -mfpu=@var{fpu}
16648 Enables support for specific floating-point hardware extensions for ARCv2
16649 cores. Supported values for @var{fpu} are:
16654 Enables support for single-precision floating-point hardware
16658 Enables support for double-precision floating-point hardware
16659 extensions. The single-precision floating-point extension is also
16660 enabled. Not available for ARC EM@.
16663 Enables support for double-precision floating-point hardware
16664 extensions using double-precision assist instructions. The single-precision
16665 floating-point extension is also enabled. This option is
16666 only available for ARC EM@.
16669 Enables support for double-precision floating-point hardware
16670 extensions using double-precision assist instructions.
16671 The single-precision floating-point, square-root, and divide
16672 extensions are also enabled. This option is
16673 only available for ARC EM@.
16676 Enables support for double-precision floating-point hardware
16677 extensions using double-precision assist instructions.
16678 The single-precision floating-point and fused multiply and add
16679 hardware extensions are also enabled. This option is
16680 only available for ARC EM@.
16683 Enables support for double-precision floating-point hardware
16684 extensions using double-precision assist instructions.
16685 All single-precision floating-point hardware extensions are also
16686 enabled. This option is only available for ARC EM@.
16689 Enables support for single-precision floating-point, square-root and divide
16690 hardware extensions@.
16693 Enables support for double-precision floating-point, square-root and divide
16694 hardware extensions. This option
16695 includes option @samp{fpus_div}. Not available for ARC EM@.
16698 Enables support for single-precision floating-point and
16699 fused multiply and add hardware extensions@.
16702 Enables support for double-precision floating-point and
16703 fused multiply and add hardware extensions. This option
16704 includes option @samp{fpus_fma}. Not available for ARC EM@.
16707 Enables support for all single-precision floating-point hardware
16711 Enables support for all single- and double-precision floating-point
16712 hardware extensions. Not available for ARC EM@.
16716 @item -mirq-ctrl-saved=@var{register-range}, @var{blink}, @var{lp_count}
16717 @opindex mirq-ctrl-saved
16718 Specifies general-purposes registers that the processor automatically
16719 saves/restores on interrupt entry and exit. @var{register-range} is
16720 specified as two registers separated by a dash. The register range
16721 always starts with @code{r0}, the upper limit is @code{fp} register.
16722 @var{blink} and @var{lp_count} are optional. This option is only
16723 valid for ARC EM and ARC HS cores.
16725 @item -mrgf-banked-regs=@var{number}
16726 @opindex mrgf-banked-regs
16727 Specifies the number of registers replicated in second register bank
16728 on entry to fast interrupt. Fast interrupts are interrupts with the
16729 highest priority level P0. These interrupts save only PC and STATUS32
16730 registers to avoid memory transactions during interrupt entry and exit
16731 sequences. Use this option when you are using fast interrupts in an
16732 ARC V2 family processor. Permitted values are 4, 8, 16, and 32.
16734 @item -mlpc-width=@var{width}
16735 @opindex mlpc-width
16736 Specify the width of the @code{lp_count} register. Valid values for
16737 @var{width} are 8, 16, 20, 24, 28 and 32 bits. The default width is
16738 fixed to 32 bits. If the width is less than 32, the compiler does not
16739 attempt to transform loops in your program to use the zero-delay loop
16740 mechanism unless it is known that the @code{lp_count} register can
16741 hold the required loop-counter value. Depending on the width
16742 specified, the compiler and run-time library might continue to use the
16743 loop mechanism for various needs. This option defines macro
16744 @code{__ARC_LPC_WIDTH__} with the value of @var{width}.
16748 This option instructs the compiler to generate code for a 16-entry
16749 register file. This option defines the @code{__ARC_RF16__}
16750 preprocessor macro.
16752 @item -mbranch-index
16753 @opindex mbranch-index
16754 Enable use of @code{bi} or @code{bih} instructions to implement jump
16759 The following options are passed through to the assembler, and also
16760 define preprocessor macro symbols.
16762 @c Flags used by the assembler, but for which we define preprocessor
16763 @c macro symbols as well.
16766 @opindex mdsp-packa
16767 Passed down to the assembler to enable the DSP Pack A extensions.
16768 Also sets the preprocessor symbol @code{__Xdsp_packa}. This option is
16773 Passed down to the assembler to enable the dual Viterbi butterfly
16774 extension. Also sets the preprocessor symbol @code{__Xdvbf}. This
16775 option is deprecated.
16777 @c ARC700 4.10 extension instruction
16780 Passed down to the assembler to enable the locked load/store
16781 conditional extension. Also sets the preprocessor symbol
16786 Passed down to the assembler. Also sets the preprocessor symbol
16787 @code{__Xxmac_d16}. This option is deprecated.
16791 Passed down to the assembler. Also sets the preprocessor symbol
16792 @code{__Xxmac_24}. This option is deprecated.
16794 @c ARC700 4.10 extension instruction
16797 Passed down to the assembler to enable the 64-bit time-stamp counter
16798 extension instruction. Also sets the preprocessor symbol
16799 @code{__Xrtsc}. This option is deprecated.
16801 @c ARC700 4.10 extension instruction
16804 Passed down to the assembler to enable the swap byte ordering
16805 extension instruction. Also sets the preprocessor symbol
16809 @opindex mtelephony
16810 Passed down to the assembler to enable dual- and single-operand
16811 instructions for telephony. Also sets the preprocessor symbol
16812 @code{__Xtelephony}. This option is deprecated.
16816 Passed down to the assembler to enable the XY memory extension. Also
16817 sets the preprocessor symbol @code{__Xxy}.
16821 The following options control how the assembly code is annotated:
16823 @c Assembly annotation options
16827 Annotate assembler instructions with estimated addresses.
16829 @item -mannotate-align
16830 @opindex mannotate-align
16831 Explain what alignment considerations lead to the decision to make an
16832 instruction short or long.
16836 The following options are passed through to the linker:
16838 @c options passed through to the linker
16842 Passed through to the linker, to specify use of the @code{arclinux} emulation.
16843 This option is enabled by default in tool chains built for
16844 @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets
16845 when profiling is not requested.
16847 @item -marclinux_prof
16848 @opindex marclinux_prof
16849 Passed through to the linker, to specify use of the
16850 @code{arclinux_prof} emulation. This option is enabled by default in
16851 tool chains built for @w{@code{arc-linux-uclibc}} and
16852 @w{@code{arceb-linux-uclibc}} targets when profiling is requested.
16856 The following options control the semantics of generated code:
16858 @c semantically relevant code generation options
16861 @opindex mlong-calls
16862 Generate calls as register indirect calls, thus providing access
16863 to the full 32-bit address range.
16865 @item -mmedium-calls
16866 @opindex mmedium-calls
16867 Don't use less than 25-bit addressing range for calls, which is the
16868 offset available for an unconditional branch-and-link
16869 instruction. Conditional execution of function calls is suppressed, to
16870 allow use of the 25-bit range, rather than the 21-bit range with
16871 conditional branch-and-link. This is the default for tool chains built
16872 for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}} targets.
16876 Put definitions of externally-visible data in a small data section if
16877 that data is no bigger than @var{num} bytes. The default value of
16878 @var{num} is 4 for any ARC configuration, or 8 when we have double
16879 load/store operations.
16884 Do not generate sdata references. This is the default for tool chains
16885 built for @w{@code{arc-linux-uclibc}} and @w{@code{arceb-linux-uclibc}}
16888 @item -mvolatile-cache
16889 @opindex mvolatile-cache
16890 Use ordinarily cached memory accesses for volatile references. This is the
16893 @item -mno-volatile-cache
16894 @opindex mno-volatile-cache
16895 @opindex mvolatile-cache
16896 Enable cache bypass for volatile references.
16900 The following options fine tune code generation:
16901 @c code generation tuning options
16904 @opindex malign-call
16905 Do alignment optimizations for call instructions.
16907 @item -mauto-modify-reg
16908 @opindex mauto-modify-reg
16909 Enable the use of pre/post modify with register displacement.
16911 @item -mbbit-peephole
16912 @opindex mbbit-peephole
16913 Enable bbit peephole2.
16917 This option disables a target-specific pass in @file{arc_reorg} to
16918 generate compare-and-branch (@code{br@var{cc}}) instructions.
16919 It has no effect on
16920 generation of these instructions driven by the combiner pass.
16922 @item -mcase-vector-pcrel
16923 @opindex mcase-vector-pcrel
16924 Use PC-relative switch case tables to enable case table shortening.
16925 This is the default for @option{-Os}.
16927 @item -mcompact-casesi
16928 @opindex mcompact-casesi
16929 Enable compact @code{casesi} pattern. This is the default for @option{-Os},
16930 and only available for ARCv1 cores. This option is deprecated.
16932 @item -mno-cond-exec
16933 @opindex mno-cond-exec
16934 Disable the ARCompact-specific pass to generate conditional
16935 execution instructions.
16937 Due to delay slot scheduling and interactions between operand numbers,
16938 literal sizes, instruction lengths, and the support for conditional execution,
16939 the target-independent pass to generate conditional execution is often lacking,
16940 so the ARC port has kept a special pass around that tries to find more
16941 conditional execution generation opportunities after register allocation,
16942 branch shortening, and delay slot scheduling have been done. This pass
16943 generally, but not always, improves performance and code size, at the cost of
16944 extra compilation time, which is why there is an option to switch it off.
16945 If you have a problem with call instructions exceeding their allowable
16946 offset range because they are conditionalized, you should consider using
16947 @option{-mmedium-calls} instead.
16949 @item -mearly-cbranchsi
16950 @opindex mearly-cbranchsi
16951 Enable pre-reload use of the @code{cbranchsi} pattern.
16953 @item -mexpand-adddi
16954 @opindex mexpand-adddi
16955 Expand @code{adddi3} and @code{subdi3} at RTL generation time into
16956 @code{add.f}, @code{adc} etc. This option is deprecated.
16958 @item -mindexed-loads
16959 @opindex mindexed-loads
16960 Enable the use of indexed loads. This can be problematic because some
16961 optimizers then assume that indexed stores exist, which is not
16966 Enable Local Register Allocation. This is still experimental for ARC,
16967 so by default the compiler uses standard reload
16968 (i.e.@: @option{-mno-lra}).
16970 @item -mlra-priority-none
16971 @opindex mlra-priority-none
16972 Don't indicate any priority for target registers.
16974 @item -mlra-priority-compact
16975 @opindex mlra-priority-compact
16976 Indicate target register priority for r0..r3 / r12..r15.
16978 @item -mlra-priority-noncompact
16979 @opindex mlra-priority-noncompact
16980 Reduce target register priority for r0..r3 / r12..r15.
16983 @opindex mmillicode
16984 When optimizing for size (using @option{-Os}), prologues and epilogues
16985 that have to save or restore a large number of registers are often
16986 shortened by using call to a special function in libgcc; this is
16987 referred to as a @emph{millicode} call. As these calls can pose
16988 performance issues, and/or cause linking issues when linking in a
16989 nonstandard way, this option is provided to turn on or off millicode
16992 @item -mcode-density-frame
16993 @opindex mcode-density-frame
16994 This option enable the compiler to emit @code{enter} and @code{leave}
16995 instructions. These instructions are only valid for CPUs with
16996 code-density feature.
16999 @opindex mmixed-code
17000 Tweak register allocation to help 16-bit instruction generation.
17001 This generally has the effect of decreasing the average instruction size
17002 while increasing the instruction count.
17006 Enable @samp{q} instruction alternatives.
17007 This is the default for @option{-Os}.
17011 Enable @samp{Rcq} constraint handling.
17012 Most short code generation depends on this.
17013 This is the default.
17017 Enable @samp{Rcw} constraint handling.
17018 Most ccfsm condexec mostly depends on this.
17019 This is the default.
17021 @item -msize-level=@var{level}
17022 @opindex msize-level
17023 Fine-tune size optimization with regards to instruction lengths and alignment.
17024 The recognized values for @var{level} are:
17027 No size optimization. This level is deprecated and treated like @samp{1}.
17030 Short instructions are used opportunistically.
17033 In addition, alignment of loops and of code after barriers are dropped.
17036 In addition, optional data alignment is dropped, and the option @option{Os} is enabled.
17040 This defaults to @samp{3} when @option{-Os} is in effect. Otherwise,
17041 the behavior when this is not set is equivalent to level @samp{1}.
17043 @item -mtune=@var{cpu}
17045 Set instruction scheduling parameters for @var{cpu}, overriding any implied
17046 by @option{-mcpu=}.
17048 Supported values for @var{cpu} are
17052 Tune for ARC600 CPU.
17055 Tune for ARC601 CPU.
17058 Tune for ARC700 CPU with standard multiplier block.
17061 Tune for ARC700 CPU with XMAC block.
17064 Tune for ARC725D CPU.
17067 Tune for ARC750D CPU.
17071 @item -mmultcost=@var{num}
17073 Cost to assume for a multiply instruction, with @samp{4} being equal to a
17074 normal instruction.
17076 @item -munalign-prob-threshold=@var{probability}
17077 @opindex munalign-prob-threshold
17078 Set probability threshold for unaligning branches.
17079 When tuning for @samp{ARC700} and optimizing for speed, branches without
17080 filled delay slot are preferably emitted unaligned and long, unless
17081 profiling indicates that the probability for the branch to be taken
17082 is below @var{probability}. @xref{Cross-profiling}.
17083 The default is (REG_BR_PROB_BASE/2), i.e.@: 5000.
17087 The following options are maintained for backward compatibility, but
17088 are now deprecated and will be removed in a future release:
17090 @c Deprecated options
17098 @opindex mbig-endian
17101 Compile code for big-endian targets. Use of these options is now
17102 deprecated. Big-endian code is supported by configuring GCC to build
17103 @w{@code{arceb-elf32}} and @w{@code{arceb-linux-uclibc}} targets,
17104 for which big endian is the default.
17106 @item -mlittle-endian
17107 @opindex mlittle-endian
17110 Compile code for little-endian targets. Use of these options is now
17111 deprecated. Little-endian code is supported by configuring GCC to build
17112 @w{@code{arc-elf32}} and @w{@code{arc-linux-uclibc}} targets,
17113 for which little endian is the default.
17115 @item -mbarrel_shifter
17116 @opindex mbarrel_shifter
17117 Replaced by @option{-mbarrel-shifter}.
17119 @item -mdpfp_compact
17120 @opindex mdpfp_compact
17121 Replaced by @option{-mdpfp-compact}.
17124 @opindex mdpfp_fast
17125 Replaced by @option{-mdpfp-fast}.
17128 @opindex mdsp_packa
17129 Replaced by @option{-mdsp-packa}.
17133 Replaced by @option{-mea}.
17137 Replaced by @option{-mmac-24}.
17141 Replaced by @option{-mmac-d16}.
17143 @item -mspfp_compact
17144 @opindex mspfp_compact
17145 Replaced by @option{-mspfp-compact}.
17148 @opindex mspfp_fast
17149 Replaced by @option{-mspfp-fast}.
17151 @item -mtune=@var{cpu}
17153 Values @samp{arc600}, @samp{arc601}, @samp{arc700} and
17154 @samp{arc700-xmac} for @var{cpu} are replaced by @samp{ARC600},
17155 @samp{ARC601}, @samp{ARC700} and @samp{ARC700-xmac} respectively.
17157 @item -multcost=@var{num}
17159 Replaced by @option{-mmultcost}.
17164 @subsection ARM Options
17165 @cindex ARM options
17167 These @samp{-m} options are defined for the ARM port:
17170 @item -mabi=@var{name}
17172 Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
17173 @samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
17176 @opindex mapcs-frame
17177 Generate a stack frame that is compliant with the ARM Procedure Call
17178 Standard for all functions, even if this is not strictly necessary for
17179 correct execution of the code. Specifying @option{-fomit-frame-pointer}
17180 with this option causes the stack frames not to be generated for
17181 leaf functions. The default is @option{-mno-apcs-frame}.
17182 This option is deprecated.
17186 This is a synonym for @option{-mapcs-frame} and is deprecated.
17189 @c not currently implemented
17190 @item -mapcs-stack-check
17191 @opindex mapcs-stack-check
17192 Generate code to check the amount of stack space available upon entry to
17193 every function (that actually uses some stack space). If there is
17194 insufficient space available then either the function
17195 @code{__rt_stkovf_split_small} or @code{__rt_stkovf_split_big} is
17196 called, depending upon the amount of stack space required. The runtime
17197 system is required to provide these functions. The default is
17198 @option{-mno-apcs-stack-check}, since this produces smaller code.
17200 @c not currently implemented
17201 @item -mapcs-reentrant
17202 @opindex mapcs-reentrant
17203 Generate reentrant, position-independent code. The default is
17204 @option{-mno-apcs-reentrant}.
17207 @item -mthumb-interwork
17208 @opindex mthumb-interwork
17209 Generate code that supports calling between the ARM and Thumb
17210 instruction sets. Without this option, on pre-v5 architectures, the
17211 two instruction sets cannot be reliably used inside one program. The
17212 default is @option{-mno-thumb-interwork}, since slightly larger code
17213 is generated when @option{-mthumb-interwork} is specified. In AAPCS
17214 configurations this option is meaningless.
17216 @item -mno-sched-prolog
17217 @opindex mno-sched-prolog
17218 @opindex msched-prolog
17219 Prevent the reordering of instructions in the function prologue, or the
17220 merging of those instruction with the instructions in the function's
17221 body. This means that all functions start with a recognizable set
17222 of instructions (or in fact one of a choice from a small set of
17223 different function prologues), and this information can be used to
17224 locate the start of functions inside an executable piece of code. The
17225 default is @option{-msched-prolog}.
17227 @item -mfloat-abi=@var{name}
17228 @opindex mfloat-abi
17229 Specifies which floating-point ABI to use. Permissible values
17230 are: @samp{soft}, @samp{softfp} and @samp{hard}.
17232 Specifying @samp{soft} causes GCC to generate output containing
17233 library calls for floating-point operations.
17234 @samp{softfp} allows the generation of code using hardware floating-point
17235 instructions, but still uses the soft-float calling conventions.
17236 @samp{hard} allows generation of floating-point instructions
17237 and uses FPU-specific calling conventions.
17239 The default depends on the specific target configuration. Note that
17240 the hard-float and soft-float ABIs are not link-compatible; you must
17241 compile your entire program with the same ABI, and link with a
17242 compatible set of libraries.
17244 @item -mgeneral-regs-only
17245 @opindex mgeneral-regs-only
17246 Generate code which uses only the general-purpose registers. This will prevent
17247 the compiler from using floating-point and Advanced SIMD registers but will not
17248 impose any restrictions on the assembler.
17250 @item -mlittle-endian
17251 @opindex mlittle-endian
17252 Generate code for a processor running in little-endian mode. This is
17253 the default for all standard configurations.
17256 @opindex mbig-endian
17257 Generate code for a processor running in big-endian mode; the default is
17258 to compile code for a little-endian processor.
17263 When linking a big-endian image select between BE8 and BE32 formats.
17264 The option has no effect for little-endian images and is ignored. The
17265 default is dependent on the selected target architecture. For ARMv6
17266 and later architectures the default is BE8, for older architectures
17267 the default is BE32. BE32 format has been deprecated by ARM.
17269 @item -march=@var{name}@r{[}+extension@dots{}@r{]}
17271 This specifies the name of the target ARM architecture. GCC uses this
17272 name to determine what kind of instructions it can emit when generating
17273 assembly code. This option can be used in conjunction with or instead
17274 of the @option{-mcpu=} option.
17276 Permissible names are:
17278 @samp{armv5t}, @samp{armv5te},
17279 @samp{armv6}, @samp{armv6j}, @samp{armv6k}, @samp{armv6kz}, @samp{armv6t2},
17280 @samp{armv6z}, @samp{armv6zk},
17281 @samp{armv7}, @samp{armv7-a}, @samp{armv7ve},
17282 @samp{armv8-a}, @samp{armv8.1-a}, @samp{armv8.2-a}, @samp{armv8.3-a},
17287 @samp{armv6-m}, @samp{armv6s-m},
17288 @samp{armv7-m}, @samp{armv7e-m},
17289 @samp{armv8-m.base}, @samp{armv8-m.main},
17290 @samp{iwmmxt} and @samp{iwmmxt2}.
17292 Additionally, the following architectures, which lack support for the
17293 Thumb execution state, are recognized but support is deprecated: @samp{armv4}.
17295 Many of the architectures support extensions. These can be added by
17296 appending @samp{+@var{extension}} to the architecture name. Extension
17297 options are processed in order and capabilities accumulate. An extension
17298 will also enable any necessary base extensions
17299 upon which it depends. For example, the @samp{+crypto} extension
17300 will always enable the @samp{+simd} extension. The exception to the
17301 additive construction is for extensions that are prefixed with
17302 @samp{+no@dots{}}: these extensions disable the specified option and
17303 any other extensions that may depend on the presence of that
17306 For example, @samp{-march=armv7-a+simd+nofp+vfpv4} is equivalent to
17307 writing @samp{-march=armv7-a+vfpv4} since the @samp{+simd} option is
17308 entirely disabled by the @samp{+nofp} option that follows it.
17310 Most extension names are generically named, but have an effect that is
17311 dependent upon the architecture to which it is applied. For example,
17312 the @samp{+simd} option can be applied to both @samp{armv7-a} and
17313 @samp{armv8-a} architectures, but will enable the original ARMv7-A
17314 Advanced SIMD (Neon) extensions for @samp{armv7-a} and the ARMv8-A
17315 variant for @samp{armv8-a}.
17317 The table below lists the supported extensions for each architecture.
17318 Architectures not mentioned do not support any extensions.
17331 The VFPv2 floating-point instructions. The extension @samp{+vfpv2} can be
17332 used as an alias for this extension.
17335 Disable the floating-point instructions.
17339 The common subset of the ARMv7-A, ARMv7-R and ARMv7-M architectures.
17342 The VFPv3 floating-point instructions, with 16 double-precision
17343 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17344 for this extension. Note that floating-point is not supported by the
17345 base ARMv7-M architecture, but is compatible with both the ARMv7-A and
17346 ARMv7-R architectures.
17349 Disable the floating-point instructions.
17355 The multiprocessing extension.
17358 The security extension.
17361 The VFPv3 floating-point instructions, with 16 double-precision
17362 registers. The extension @samp{+vfpv3-d16} can be used as an alias
17363 for this extension.
17366 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17367 The extensions @samp{+neon} and @samp{+neon-vfpv3} can be used as aliases
17368 for this extension.
17371 The VFPv3 floating-point instructions, with 32 double-precision
17374 @item +vfpv3-d16-fp16
17375 The VFPv3 floating-point instructions, with 16 double-precision
17376 registers and the half-precision floating-point conversion operations.
17379 The VFPv3 floating-point instructions, with 32 double-precision
17380 registers and the half-precision floating-point conversion operations.
17383 The VFPv4 floating-point instructions, with 16 double-precision
17387 The VFPv4 floating-point instructions, with 32 double-precision
17391 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17392 the half-precision floating-point conversion operations.
17395 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions.
17398 Disable the Advanced SIMD instructions (does not disable floating point).
17401 Disable the floating-point and Advanced SIMD instructions.
17405 The extended version of the ARMv7-A architecture with support for
17409 The VFPv4 floating-point instructions, with 16 double-precision registers.
17410 The extension @samp{+vfpv4-d16} can be used as an alias for this extension.
17413 The Advanced SIMD (Neon) v2 and the VFPv4 floating-point instructions. The
17414 extension @samp{+neon-vfpv4} can be used as an alias for this extension.
17417 The VFPv3 floating-point instructions, with 16 double-precision
17421 The VFPv3 floating-point instructions, with 32 double-precision
17424 @item +vfpv3-d16-fp16
17425 The VFPv3 floating-point instructions, with 16 double-precision
17426 registers and the half-precision floating-point conversion operations.
17429 The VFPv3 floating-point instructions, with 32 double-precision
17430 registers and the half-precision floating-point conversion operations.
17433 The VFPv4 floating-point instructions, with 16 double-precision
17437 The VFPv4 floating-point instructions, with 32 double-precision
17441 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions.
17442 The extension @samp{+neon-vfpv3} can be used as an alias for this extension.
17445 The Advanced SIMD (Neon) v1 and the VFPv3 floating-point instructions, with
17446 the half-precision floating-point conversion operations.
17449 Disable the Advanced SIMD instructions (does not disable floating point).
17452 Disable the floating-point and Advanced SIMD instructions.
17458 The Cyclic Redundancy Check (CRC) instructions.
17460 The ARMv8-A Advanced SIMD and floating-point instructions.
17462 The cryptographic instructions.
17464 Disable the cryptographic instructions.
17466 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17468 Speculation Barrier Instruction.
17470 Execution and Data Prediction Restriction Instructions.
17476 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17479 The cryptographic instructions. This also enables the Advanced SIMD and
17480 floating-point instructions.
17483 Disable the cryptographic instructions.
17486 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17489 Speculation Barrier Instruction.
17492 Execution and Data Prediction Restriction Instructions.
17499 The half-precision floating-point data processing instructions.
17500 This also enables the Advanced SIMD and floating-point instructions.
17503 The half-precision floating-point fmla extension. This also enables
17504 the half-precision floating-point extension and Advanced SIMD and
17505 floating-point instructions.
17508 The ARMv8.1-A Advanced SIMD and floating-point instructions.
17511 The cryptographic instructions. This also enables the Advanced SIMD and
17512 floating-point instructions.
17515 Enable the Dot Product extension. This also enables Advanced SIMD instructions.
17518 Disable the cryptographic extension.
17521 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17524 Speculation Barrier Instruction.
17527 Execution and Data Prediction Restriction Instructions.
17533 The half-precision floating-point data processing instructions.
17534 This also enables the Advanced SIMD and floating-point instructions as well
17535 as the Dot Product extension and the half-precision floating-point fmla
17539 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17540 Dot Product extension.
17543 The cryptographic instructions. This also enables the Advanced SIMD and
17544 floating-point instructions as well as the Dot Product extension.
17547 Disable the cryptographic extension.
17550 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17553 Speculation Barrier Instruction.
17556 Execution and Data Prediction Restriction Instructions.
17562 The half-precision floating-point data processing instructions.
17563 This also enables the Advanced SIMD and floating-point instructions as well
17564 as the Dot Product extension and the half-precision floating-point fmla
17568 The ARMv8.3-A Advanced SIMD and floating-point instructions as well as the
17569 Dot Product extension.
17572 The cryptographic instructions. This also enables the Advanced SIMD and
17573 floating-point instructions as well as the Dot Product extension.
17576 Disable the cryptographic extension.
17579 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17585 The single-precision VFPv3 floating-point instructions. The extension
17586 @samp{+vfpv3xd} can be used as an alias for this extension.
17589 The VFPv3 floating-point instructions with 16 double-precision registers.
17590 The extension +vfpv3-d16 can be used as an alias for this extension.
17592 @item +vfpv3xd-d16-fp16
17593 The single-precision VFPv3 floating-point instructions with 16 double-precision
17594 registers and the half-precision floating-point conversion operations.
17596 @item +vfpv3-d16-fp16
17597 The VFPv3 floating-point instructions with 16 double-precision
17598 registers and the half-precision floating-point conversion operations.
17601 Disable the floating-point extension.
17604 The ARM-state integer division instructions.
17607 Disable the ARM-state integer division extension.
17613 The single-precision VFPv4 floating-point instructions.
17616 The single-precision FPv5 floating-point instructions.
17619 The single- and double-precision FPv5 floating-point instructions.
17622 Disable the floating-point extensions.
17628 The DSP instructions.
17631 Disable the DSP extension.
17634 The single-precision floating-point instructions.
17637 The single- and double-precision floating-point instructions.
17640 Disable the floating-point extension.
17646 The Cyclic Redundancy Check (CRC) instructions.
17648 The single-precision FPv5 floating-point instructions.
17650 The ARMv8-A Advanced SIMD and floating-point instructions.
17652 The cryptographic instructions.
17654 Disable the cryptographic instructions.
17656 Disable the floating-point, Advanced SIMD and cryptographic instructions.
17661 @option{-march=native} causes the compiler to auto-detect the architecture
17662 of the build computer. At present, this feature is only supported on
17663 GNU/Linux, and not all architectures are recognized. If the auto-detect
17664 is unsuccessful the option has no effect.
17666 @item -mtune=@var{name}
17668 This option specifies the name of the target ARM processor for
17669 which GCC should tune the performance of the code.
17670 For some ARM implementations better performance can be obtained by using
17672 Permissible names are: @samp{arm7tdmi}, @samp{arm7tdmi-s}, @samp{arm710t},
17673 @samp{arm720t}, @samp{arm740t}, @samp{strongarm}, @samp{strongarm110},
17674 @samp{strongarm1100}, 0@samp{strongarm1110}, @samp{arm8}, @samp{arm810},
17675 @samp{arm9}, @samp{arm9e}, @samp{arm920}, @samp{arm920t}, @samp{arm922t},
17676 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm926ej-s},
17677 @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi}, @samp{arm1020t},
17678 @samp{arm1026ej-s}, @samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
17679 @samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
17680 @samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
17681 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}, @samp{cortex-a8},
17682 @samp{cortex-a9}, @samp{cortex-a12}, @samp{cortex-a15}, @samp{cortex-a17},
17683 @samp{cortex-a32}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
17684 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
17685 @samp{cortex-a76}, @samp{cortex-a76ae}, @samp{cortex-a77},
17686 @samp{ares}, @samp{cortex-r4}, @samp{cortex-r4f},
17687 @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52},
17688 @samp{cortex-m0}, @samp{cortex-m0plus}, @samp{cortex-m1}, @samp{cortex-m3},
17689 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m23}, @samp{cortex-m33},
17690 @samp{cortex-m35p},
17691 @samp{cortex-m1.small-multiply}, @samp{cortex-m0.small-multiply},
17692 @samp{cortex-m0plus.small-multiply}, @samp{exynos-m1}, @samp{marvell-pj4},
17693 @samp{neoverse-n1}, @samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2},
17694 @samp{ep9312}, @samp{fa526}, @samp{fa626}, @samp{fa606te}, @samp{fa626te},
17695 @samp{fmp626}, @samp{fa726te}, @samp{xgene1}.
17697 Additionally, this option can specify that GCC should tune the performance
17698 of the code for a big.LITTLE system. Permissible names are:
17699 @samp{cortex-a15.cortex-a7}, @samp{cortex-a17.cortex-a7},
17700 @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17701 @samp{cortex-a72.cortex-a35}, @samp{cortex-a73.cortex-a53},
17702 @samp{cortex-a75.cortex-a55}, @samp{cortex-a76.cortex-a55}.
17704 @option{-mtune=generic-@var{arch}} specifies that GCC should tune the
17705 performance for a blend of processors within architecture @var{arch}.
17706 The aim is to generate code that run well on the current most popular
17707 processors, balancing between optimizations that benefit some CPUs in the
17708 range, and avoiding performance pitfalls of other CPUs. The effects of
17709 this option may change in future GCC versions as CPU models come and go.
17711 @option{-mtune} permits the same extension options as @option{-mcpu}, but
17712 the extension options do not affect the tuning of the generated code.
17714 @option{-mtune=native} causes the compiler to auto-detect the CPU
17715 of the build computer. At present, this feature is only supported on
17716 GNU/Linux, and not all architectures are recognized. If the auto-detect is
17717 unsuccessful the option has no effect.
17719 @item -mcpu=@var{name}@r{[}+extension@dots{}@r{]}
17721 This specifies the name of the target ARM processor. GCC uses this name
17722 to derive the name of the target ARM architecture (as if specified
17723 by @option{-march}) and the ARM processor type for which to tune for
17724 performance (as if specified by @option{-mtune}). Where this option
17725 is used in conjunction with @option{-march} or @option{-mtune},
17726 those options take precedence over the appropriate part of this option.
17728 Many of the supported CPUs implement optional architectural
17729 extensions. Where this is so the architectural extensions are
17730 normally enabled by default. If implementations that lack the
17731 extension exist, then the extension syntax can be used to disable
17732 those extensions that have been omitted. For floating-point and
17733 Advanced SIMD (Neon) instructions, the settings of the options
17734 @option{-mfloat-abi} and @option{-mfpu} must also be considered:
17735 floating-point and Advanced SIMD instructions will only be used if
17736 @option{-mfloat-abi} is not set to @samp{soft}; and any setting of
17737 @option{-mfpu} other than @samp{auto} will override the available
17738 floating-point and SIMD extension instructions.
17740 For example, @samp{cortex-a9} can be found in three major
17741 configurations: integer only, with just a floating-point unit or with
17742 floating-point and Advanced SIMD. The default is to enable all the
17743 instructions, but the extensions @samp{+nosimd} and @samp{+nofp} can
17744 be used to disable just the SIMD or both the SIMD and floating-point
17745 instructions respectively.
17747 Permissible names for this option are the same as those for
17750 The following extension options are common to the listed CPUs:
17754 Disable the DSP instructions on @samp{cortex-m33}, @samp{cortex-m35p}.
17757 Disables the floating-point instructions on @samp{arm9e},
17758 @samp{arm946e-s}, @samp{arm966e-s}, @samp{arm968e-s}, @samp{arm10e},
17759 @samp{arm1020e}, @samp{arm1022e}, @samp{arm926ej-s},
17760 @samp{arm1026ej-s}, @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8},
17761 @samp{cortex-m4}, @samp{cortex-m7}, @samp{cortex-m33} and @samp{cortex-m35p}.
17762 Disables the floating-point and SIMD instructions on
17763 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7},
17764 @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a12},
17765 @samp{cortex-a15}, @samp{cortex-a17}, @samp{cortex-a15.cortex-a7},
17766 @samp{cortex-a17.cortex-a7}, @samp{cortex-a32}, @samp{cortex-a35},
17767 @samp{cortex-a53} and @samp{cortex-a55}.
17770 Disables the double-precision component of the floating-point instructions
17771 on @samp{cortex-r5}, @samp{cortex-r7}, @samp{cortex-r8}, @samp{cortex-r52} and
17775 Disables the SIMD (but not floating-point) instructions on
17776 @samp{generic-armv7-a}, @samp{cortex-a5}, @samp{cortex-a7}
17777 and @samp{cortex-a9}.
17780 Enables the cryptographic instructions on @samp{cortex-a32},
17781 @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55}, @samp{cortex-a57},
17782 @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75}, @samp{exynos-m1},
17783 @samp{xgene1}, @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
17784 @samp{cortex-a73.cortex-a35}, @samp{cortex-a73.cortex-a53} and
17785 @samp{cortex-a75.cortex-a55}.
17788 Additionally the @samp{generic-armv7-a} pseudo target defaults to
17789 VFPv3 with 16 double-precision registers. It supports the following
17790 extension options: @samp{mp}, @samp{sec}, @samp{vfpv3-d16},
17791 @samp{vfpv3}, @samp{vfpv3-d16-fp16}, @samp{vfpv3-fp16},
17792 @samp{vfpv4-d16}, @samp{vfpv4}, @samp{neon}, @samp{neon-vfpv3},
17793 @samp{neon-fp16}, @samp{neon-vfpv4}. The meanings are the same as for
17794 the extensions to @option{-march=armv7-a}.
17796 @option{-mcpu=generic-@var{arch}} is also permissible, and is
17797 equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
17798 See @option{-mtune} for more information.
17800 @option{-mcpu=native} causes the compiler to auto-detect the CPU
17801 of the build computer. At present, this feature is only supported on
17802 GNU/Linux, and not all architectures are recognized. If the auto-detect
17803 is unsuccessful the option has no effect.
17805 @item -mfpu=@var{name}
17807 This specifies what floating-point hardware (or hardware emulation) is
17808 available on the target. Permissible names are: @samp{auto}, @samp{vfpv2},
17810 @samp{vfpv3-fp16}, @samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd},
17811 @samp{vfpv3xd-fp16}, @samp{neon-vfpv3}, @samp{neon-fp16}, @samp{vfpv4},
17812 @samp{vfpv4-d16}, @samp{fpv4-sp-d16}, @samp{neon-vfpv4},
17813 @samp{fpv5-d16}, @samp{fpv5-sp-d16},
17814 @samp{fp-armv8}, @samp{neon-fp-armv8} and @samp{crypto-neon-fp-armv8}.
17815 Note that @samp{neon} is an alias for @samp{neon-vfpv3} and @samp{vfp}
17816 is an alias for @samp{vfpv2}.
17818 The setting @samp{auto} is the default and is special. It causes the
17819 compiler to select the floating-point and Advanced SIMD instructions
17820 based on the settings of @option{-mcpu} and @option{-march}.
17822 If the selected floating-point hardware includes the NEON extension
17823 (e.g.@: @option{-mfpu=neon}), note that floating-point
17824 operations are not generated by GCC's auto-vectorization pass unless
17825 @option{-funsafe-math-optimizations} is also specified. This is
17826 because NEON hardware does not fully implement the IEEE 754 standard for
17827 floating-point arithmetic (in particular denormal values are treated as
17828 zero), so the use of NEON instructions may lead to a loss of precision.
17830 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}).
17832 @item -mfp16-format=@var{name}
17833 @opindex mfp16-format
17834 Specify the format of the @code{__fp16} half-precision floating-point type.
17835 Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
17836 the default is @samp{none}, in which case the @code{__fp16} type is not
17837 defined. @xref{Half-Precision}, for more information.
17839 @item -mstructure-size-boundary=@var{n}
17840 @opindex mstructure-size-boundary
17841 The sizes of all structures and unions are rounded up to a multiple
17842 of the number of bits set by this option. Permissible values are 8, 32
17843 and 64. The default value varies for different toolchains. For the COFF
17844 targeted toolchain the default value is 8. A value of 64 is only allowed
17845 if the underlying ABI supports it.
17847 Specifying a larger number can produce faster, more efficient code, but
17848 can also increase the size of the program. Different values are potentially
17849 incompatible. Code compiled with one value cannot necessarily expect to
17850 work with code or libraries compiled with another value, if they exchange
17851 information using structures or unions.
17853 This option is deprecated.
17855 @item -mabort-on-noreturn
17856 @opindex mabort-on-noreturn
17857 Generate a call to the function @code{abort} at the end of a
17858 @code{noreturn} function. It is executed if the function tries to
17862 @itemx -mno-long-calls
17863 @opindex mlong-calls
17864 @opindex mno-long-calls
17865 Tells the compiler to perform function calls by first loading the
17866 address of the function into a register and then performing a subroutine
17867 call on this register. This switch is needed if the target function
17868 lies outside of the 64-megabyte addressing range of the offset-based
17869 version of subroutine call instruction.
17871 Even if this switch is enabled, not all function calls are turned
17872 into long calls. The heuristic is that static functions, functions
17873 that have the @code{short_call} attribute, functions that are inside
17874 the scope of a @code{#pragma no_long_calls} directive, and functions whose
17875 definitions have already been compiled within the current compilation
17876 unit are not turned into long calls. The exceptions to this rule are
17877 that weak function definitions, functions with the @code{long_call}
17878 attribute or the @code{section} attribute, and functions that are within
17879 the scope of a @code{#pragma long_calls} directive are always
17880 turned into long calls.
17882 This feature is not enabled by default. Specifying
17883 @option{-mno-long-calls} restores the default behavior, as does
17884 placing the function calls within the scope of a @code{#pragma
17885 long_calls_off} directive. Note these switches have no effect on how
17886 the compiler generates code to handle function calls via function
17889 @item -msingle-pic-base
17890 @opindex msingle-pic-base
17891 Treat the register used for PIC addressing as read-only, rather than
17892 loading it in the prologue for each function. The runtime system is
17893 responsible for initializing this register with an appropriate value
17894 before execution begins.
17896 @item -mpic-register=@var{reg}
17897 @opindex mpic-register
17898 Specify the register to be used for PIC addressing.
17899 For standard PIC base case, the default is any suitable register
17900 determined by compiler. For single PIC base case, the default is
17901 @samp{R9} if target is EABI based or stack-checking is enabled,
17902 otherwise the default is @samp{R10}.
17904 @item -mpic-data-is-text-relative
17905 @opindex mpic-data-is-text-relative
17906 Assume that the displacement between the text and data segments is fixed
17907 at static link time. This permits using PC-relative addressing
17908 operations to access data known to be in the data segment. For
17909 non-VxWorks RTP targets, this option is enabled by default. When
17910 disabled on such targets, it will enable @option{-msingle-pic-base} by
17913 @item -mpoke-function-name
17914 @opindex mpoke-function-name
17915 Write the name of each function into the text section, directly
17916 preceding the function prologue. The generated code is similar to this:
17920 .ascii "arm_poke_function_name", 0
17923 .word 0xff000000 + (t1 - t0)
17924 arm_poke_function_name
17926 stmfd sp!, @{fp, ip, lr, pc@}
17930 When performing a stack backtrace, code can inspect the value of
17931 @code{pc} stored at @code{fp + 0}. If the trace function then looks at
17932 location @code{pc - 12} and the top 8 bits are set, then we know that
17933 there is a function name embedded immediately preceding this location
17934 and has length @code{((pc[-3]) & 0xff000000)}.
17941 Select between generating code that executes in ARM and Thumb
17942 states. The default for most configurations is to generate code
17943 that executes in ARM state, but the default can be changed by
17944 configuring GCC with the @option{--with-mode=}@var{state}
17947 You can also override the ARM and Thumb mode for each function
17948 by using the @code{target("thumb")} and @code{target("arm")} function attributes
17949 (@pxref{ARM Function Attributes}) or pragmas (@pxref{Function Specific Option Pragmas}).
17952 @opindex mflip-thumb
17953 Switch ARM/Thumb modes on alternating functions.
17954 This option is provided for regression testing of mixed Thumb/ARM code
17955 generation, and is not intended for ordinary use in compiling code.
17958 @opindex mtpcs-frame
17959 Generate a stack frame that is compliant with the Thumb Procedure Call
17960 Standard for all non-leaf functions. (A leaf function is one that does
17961 not call any other functions.) The default is @option{-mno-tpcs-frame}.
17963 @item -mtpcs-leaf-frame
17964 @opindex mtpcs-leaf-frame
17965 Generate a stack frame that is compliant with the Thumb Procedure Call
17966 Standard for all leaf functions. (A leaf function is one that does
17967 not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
17969 @item -mcallee-super-interworking
17970 @opindex mcallee-super-interworking
17971 Gives all externally visible functions in the file being compiled an ARM
17972 instruction set header which switches to Thumb mode before executing the
17973 rest of the function. This allows these functions to be called from
17974 non-interworking code. This option is not valid in AAPCS configurations
17975 because interworking is enabled by default.
17977 @item -mcaller-super-interworking
17978 @opindex mcaller-super-interworking
17979 Allows calls via function pointers (including virtual functions) to
17980 execute correctly regardless of whether the target code has been
17981 compiled for interworking or not. There is a small overhead in the cost
17982 of executing a function pointer if this option is enabled. This option
17983 is not valid in AAPCS configurations because interworking is enabled
17986 @item -mtp=@var{name}
17988 Specify the access model for the thread local storage pointer. The valid
17989 models are @samp{soft}, which generates calls to @code{__aeabi_read_tp},
17990 @samp{cp15}, which fetches the thread pointer from @code{cp15} directly
17991 (supported in the arm6k architecture), and @samp{auto}, which uses the
17992 best available method for the selected processor. The default setting is
17995 @item -mtls-dialect=@var{dialect}
17996 @opindex mtls-dialect
17997 Specify the dialect to use for accessing thread local storage. Two
17998 @var{dialect}s are supported---@samp{gnu} and @samp{gnu2}. The
17999 @samp{gnu} dialect selects the original GNU scheme for supporting
18000 local and global dynamic TLS models. The @samp{gnu2} dialect
18001 selects the GNU descriptor scheme, which provides better performance
18002 for shared libraries. The GNU descriptor scheme is compatible with
18003 the original scheme, but does require new assembler, linker and
18004 library support. Initial and local exec TLS models are unaffected by
18005 this option and always use the original scheme.
18007 @item -mword-relocations
18008 @opindex mword-relocations
18009 Only generate absolute relocations on word-sized values (i.e.@: R_ARM_ABS32).
18010 This is enabled by default on targets (uClinux, SymbianOS) where the runtime
18011 loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
18012 is specified. This option conflicts with @option{-mslow-flash-data}.
18014 @item -mfix-cortex-m3-ldrd
18015 @opindex mfix-cortex-m3-ldrd
18016 Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
18017 with overlapping destination and base registers are used. This option avoids
18018 generating these instructions. This option is enabled by default when
18019 @option{-mcpu=cortex-m3} is specified.
18021 @item -munaligned-access
18022 @itemx -mno-unaligned-access
18023 @opindex munaligned-access
18024 @opindex mno-unaligned-access
18025 Enables (or disables) reading and writing of 16- and 32- bit values
18026 from addresses that are not 16- or 32- bit aligned. By default
18027 unaligned access is disabled for all pre-ARMv6, all ARMv6-M and for
18028 ARMv8-M Baseline architectures, and enabled for all other
18029 architectures. If unaligned access is not enabled then words in packed
18030 data structures are accessed a byte at a time.
18032 The ARM attribute @code{Tag_CPU_unaligned_access} is set in the
18033 generated object file to either true or false, depending upon the
18034 setting of this option. If unaligned access is enabled then the
18035 preprocessor symbol @code{__ARM_FEATURE_UNALIGNED} is also
18038 @item -mneon-for-64bits
18039 @opindex mneon-for-64bits
18040 This option is deprecated and has no effect.
18042 @item -mslow-flash-data
18043 @opindex mslow-flash-data
18044 Assume loading data from flash is slower than fetching instruction.
18045 Therefore literal load is minimized for better performance.
18046 This option is only supported when compiling for ARMv7 M-profile and
18047 off by default. It conflicts with @option{-mword-relocations}.
18049 @item -masm-syntax-unified
18050 @opindex masm-syntax-unified
18051 Assume inline assembler is using unified asm syntax. The default is
18052 currently off which implies divided syntax. This option has no impact
18053 on Thumb2. However, this may change in future releases of GCC.
18054 Divided syntax should be considered deprecated.
18056 @item -mrestrict-it
18057 @opindex mrestrict-it
18058 Restricts generation of IT blocks to conform to the rules of ARMv8-A.
18059 IT blocks can only contain a single 16-bit instruction from a select
18060 set of instructions. This option is on by default for ARMv8-A Thumb mode.
18062 @item -mprint-tune-info
18063 @opindex mprint-tune-info
18064 Print CPU tuning information as comment in assembler file. This is
18065 an option used only for regression testing of the compiler and not
18066 intended for ordinary use in compiling code. This option is disabled
18069 @item -mverbose-cost-dump
18070 @opindex mverbose-cost-dump
18071 Enable verbose cost model dumping in the debug dump files. This option is
18072 provided for use in debugging the compiler.
18075 @opindex mpure-code
18076 Do not allow constant data to be placed in code sections.
18077 Additionally, when compiling for ELF object format give all text sections the
18078 ELF processor-specific section attribute @code{SHF_ARM_PURECODE}. This option
18079 is only available when generating non-pic code for M-profile targets with the
18084 Generate secure code as per the "ARMv8-M Security Extensions: Requirements on
18085 Development Tools Engineering Specification", which can be found on
18086 @url{http://infocenter.arm.com/help/topic/com.arm.doc.ecm0359818/ECM0359818_armv8m_security_extensions_reqs_on_dev_tools_1_0.pdf}.
18092 Select the FDPIC ABI, which uses 64-bit function descriptors to
18093 represent pointers to functions. When the compiler is configured for
18094 @code{arm-*-uclinuxfdpiceabi} targets, this option is on by default
18095 and implies @option{-fPIE} if none of the PIC/PIE-related options is
18096 provided. On other targets, it only enables the FDPIC-specific code
18097 generation features, and the user should explicitly provide the
18098 PIC/PIE-related options as needed.
18100 Note that static linking is not supported because it would still
18101 involve the dynamic linker when the program self-relocates. If such
18102 behavior is acceptable, use -static and -Wl,-dynamic-linker options.
18104 The opposite @option{-mno-fdpic} option is useful (and required) to
18105 build the Linux kernel using the same (@code{arm-*-uclinuxfdpiceabi})
18106 toolchain as the one used to build the userland programs.
18111 @subsection AVR Options
18112 @cindex AVR Options
18114 These options are defined for AVR implementations:
18117 @item -mmcu=@var{mcu}
18119 Specify Atmel AVR instruction set architectures (ISA) or MCU type.
18121 The default for this option is@tie{}@samp{avr2}.
18123 GCC supports the following AVR devices and ISAs:
18125 @include avr-mmcu.texi
18130 Assume that all data in static storage can be accessed by LDS / STS
18131 instructions. This option has only an effect on reduced Tiny devices like
18132 ATtiny40. See also the @code{absdata}
18133 @ref{AVR Variable Attributes,variable attribute}.
18135 @item -maccumulate-args
18136 @opindex maccumulate-args
18137 Accumulate outgoing function arguments and acquire/release the needed
18138 stack space for outgoing function arguments once in function
18139 prologue/epilogue. Without this option, outgoing arguments are pushed
18140 before calling a function and popped afterwards.
18142 Popping the arguments after the function call can be expensive on
18143 AVR so that accumulating the stack space might lead to smaller
18144 executables because arguments need not be removed from the
18145 stack after such a function call.
18147 This option can lead to reduced code size for functions that perform
18148 several calls to functions that get their arguments on the stack like
18149 calls to printf-like functions.
18151 @item -mbranch-cost=@var{cost}
18152 @opindex mbranch-cost
18153 Set the branch costs for conditional branch instructions to
18154 @var{cost}. Reasonable values for @var{cost} are small, non-negative
18155 integers. The default branch cost is 0.
18157 @item -mcall-prologues
18158 @opindex mcall-prologues
18159 Functions prologues/epilogues are expanded as calls to appropriate
18160 subroutines. Code size is smaller.
18162 @item -mgas-isr-prologues
18163 @opindex mgas-isr-prologues
18164 Interrupt service routines (ISRs) may use the @code{__gcc_isr} pseudo
18165 instruction supported by GNU Binutils.
18166 If this option is on, the feature can still be disabled for individual
18167 ISRs by means of the @ref{AVR Function Attributes,,@code{no_gccisr}}
18168 function attribute. This feature is activated per default
18169 if optimization is on (but not with @option{-Og}, @pxref{Optimize Options}),
18170 and if GNU Binutils support @w{@uref{https://sourceware.org/PR21683,PR21683}}.
18174 Assume @code{int} to be 8-bit integer. This affects the sizes of all types: a
18175 @code{char} is 1 byte, an @code{int} is 1 byte, a @code{long} is 2 bytes,
18176 and @code{long long} is 4 bytes. Please note that this option does not
18177 conform to the C standards, but it results in smaller code
18180 @item -mmain-is-OS_task
18181 @opindex mmain-is-OS_task
18182 Do not save registers in @code{main}. The effect is the same like
18183 attaching attribute @ref{AVR Function Attributes,,@code{OS_task}}
18184 to @code{main}. It is activated per default if optimization is on.
18186 @item -mn-flash=@var{num}
18188 Assume that the flash memory has a size of
18189 @var{num} times 64@tie{}KiB.
18191 @item -mno-interrupts
18192 @opindex mno-interrupts
18193 Generated code is not compatible with hardware interrupts.
18194 Code size is smaller.
18198 Try to replace @code{CALL} resp.@: @code{JMP} instruction by the shorter
18199 @code{RCALL} resp.@: @code{RJMP} instruction if applicable.
18200 Setting @option{-mrelax} just adds the @option{--mlink-relax} option to
18201 the assembler's command line and the @option{--relax} option to the
18202 linker's command line.
18204 Jump relaxing is performed by the linker because jump offsets are not
18205 known before code is located. Therefore, the assembler code generated by the
18206 compiler is the same, but the instructions in the executable may
18207 differ from instructions in the assembler code.
18209 Relaxing must be turned on if linker stubs are needed, see the
18210 section on @code{EIND} and linker stubs below.
18214 Assume that the device supports the Read-Modify-Write
18215 instructions @code{XCH}, @code{LAC}, @code{LAS} and @code{LAT}.
18217 @item -mshort-calls
18218 @opindex mshort-calls
18220 Assume that @code{RJMP} and @code{RCALL} can target the whole
18223 This option is used internally for multilib selection. It is
18224 not an optimization option, and you don't need to set it by hand.
18228 Treat the stack pointer register as an 8-bit register,
18229 i.e.@: assume the high byte of the stack pointer is zero.
18230 In general, you don't need to set this option by hand.
18232 This option is used internally by the compiler to select and
18233 build multilibs for architectures @code{avr2} and @code{avr25}.
18234 These architectures mix devices with and without @code{SPH}.
18235 For any setting other than @option{-mmcu=avr2} or @option{-mmcu=avr25}
18236 the compiler driver adds or removes this option from the compiler
18237 proper's command line, because the compiler then knows if the device
18238 or architecture has an 8-bit stack pointer and thus no @code{SPH}
18243 Use address register @code{X} in a way proposed by the hardware. This means
18244 that @code{X} is only used in indirect, post-increment or
18245 pre-decrement addressing.
18247 Without this option, the @code{X} register may be used in the same way
18248 as @code{Y} or @code{Z} which then is emulated by additional
18250 For example, loading a value with @code{X+const} addressing with a
18251 small non-negative @code{const < 64} to a register @var{Rn} is
18255 adiw r26, const ; X += const
18256 ld @var{Rn}, X ; @var{Rn} = *X
18257 sbiw r26, const ; X -= const
18261 @opindex mtiny-stack
18262 Only change the lower 8@tie{}bits of the stack pointer.
18264 @item -mfract-convert-truncate
18265 @opindex mfract-convert-truncate
18266 Allow to use truncation instead of rounding towards zero for fractional fixed-point types.
18269 @opindex nodevicelib
18270 Don't link against AVR-LibC's device specific library @code{lib<mcu>.a}.
18272 @item -Waddr-space-convert
18273 @opindex Waddr-space-convert
18274 @opindex Wno-addr-space-convert
18275 Warn about conversions between address spaces in the case where the
18276 resulting address space is not contained in the incoming address space.
18278 @item -Wmisspelled-isr
18279 @opindex Wmisspelled-isr
18280 @opindex Wno-misspelled-isr
18281 Warn if the ISR is misspelled, i.e.@: without __vector prefix.
18282 Enabled by default.
18285 @subsubsection @code{EIND} and Devices with More Than 128 Ki Bytes of Flash
18286 @cindex @code{EIND}
18287 Pointers in the implementation are 16@tie{}bits wide.
18288 The address of a function or label is represented as word address so
18289 that indirect jumps and calls can target any code address in the
18290 range of 64@tie{}Ki words.
18292 In order to facilitate indirect jump on devices with more than 128@tie{}Ki
18293 bytes of program memory space, there is a special function register called
18294 @code{EIND} that serves as most significant part of the target address
18295 when @code{EICALL} or @code{EIJMP} instructions are used.
18297 Indirect jumps and calls on these devices are handled as follows by
18298 the compiler and are subject to some limitations:
18303 The compiler never sets @code{EIND}.
18306 The compiler uses @code{EIND} implicitly in @code{EICALL}/@code{EIJMP}
18307 instructions or might read @code{EIND} directly in order to emulate an
18308 indirect call/jump by means of a @code{RET} instruction.
18311 The compiler assumes that @code{EIND} never changes during the startup
18312 code or during the application. In particular, @code{EIND} is not
18313 saved/restored in function or interrupt service routine
18317 For indirect calls to functions and computed goto, the linker
18318 generates @emph{stubs}. Stubs are jump pads sometimes also called
18319 @emph{trampolines}. Thus, the indirect call/jump jumps to such a stub.
18320 The stub contains a direct jump to the desired address.
18323 Linker relaxation must be turned on so that the linker generates
18324 the stubs correctly in all situations. See the compiler option
18325 @option{-mrelax} and the linker option @option{--relax}.
18326 There are corner cases where the linker is supposed to generate stubs
18327 but aborts without relaxation and without a helpful error message.
18330 The default linker script is arranged for code with @code{EIND = 0}.
18331 If code is supposed to work for a setup with @code{EIND != 0}, a custom
18332 linker script has to be used in order to place the sections whose
18333 name start with @code{.trampolines} into the segment where @code{EIND}
18337 The startup code from libgcc never sets @code{EIND}.
18338 Notice that startup code is a blend of code from libgcc and AVR-LibC.
18339 For the impact of AVR-LibC on @code{EIND}, see the
18340 @w{@uref{http://nongnu.org/avr-libc/user-manual/,AVR-LibC user manual}}.
18343 It is legitimate for user-specific startup code to set up @code{EIND}
18344 early, for example by means of initialization code located in
18345 section @code{.init3}. Such code runs prior to general startup code
18346 that initializes RAM and calls constructors, but after the bit
18347 of startup code from AVR-LibC that sets @code{EIND} to the segment
18348 where the vector table is located.
18350 #include <avr/io.h>
18353 __attribute__((section(".init3"),naked,used,no_instrument_function))
18354 init3_set_eind (void)
18356 __asm volatile ("ldi r24,pm_hh8(__trampolines_start)\n\t"
18357 "out %i0,r24" :: "n" (&EIND) : "r24","memory");
18362 The @code{__trampolines_start} symbol is defined in the linker script.
18365 Stubs are generated automatically by the linker if
18366 the following two conditions are met:
18369 @item The address of a label is taken by means of the @code{gs} modifier
18370 (short for @emph{generate stubs}) like so:
18372 LDI r24, lo8(gs(@var{func}))
18373 LDI r25, hi8(gs(@var{func}))
18375 @item The final location of that label is in a code segment
18376 @emph{outside} the segment where the stubs are located.
18380 The compiler emits such @code{gs} modifiers for code labels in the
18381 following situations:
18383 @item Taking address of a function or code label.
18384 @item Computed goto.
18385 @item If prologue-save function is used, see @option{-mcall-prologues}
18386 command-line option.
18387 @item Switch/case dispatch tables. If you do not want such dispatch
18388 tables you can specify the @option{-fno-jump-tables} command-line option.
18389 @item C and C++ constructors/destructors called during startup/shutdown.
18390 @item If the tools hit a @code{gs()} modifier explained above.
18394 Jumping to non-symbolic addresses like so is @emph{not} supported:
18399 /* Call function at word address 0x2 */
18400 return ((int(*)(void)) 0x2)();
18404 Instead, a stub has to be set up, i.e.@: the function has to be called
18405 through a symbol (@code{func_4} in the example):
18410 extern int func_4 (void);
18412 /* Call function at byte address 0x4 */
18417 and the application be linked with @option{-Wl,--defsym,func_4=0x4}.
18418 Alternatively, @code{func_4} can be defined in the linker script.
18421 @subsubsection Handling of the @code{RAMPD}, @code{RAMPX}, @code{RAMPY} and @code{RAMPZ} Special Function Registers
18422 @cindex @code{RAMPD}
18423 @cindex @code{RAMPX}
18424 @cindex @code{RAMPY}
18425 @cindex @code{RAMPZ}
18426 Some AVR devices support memories larger than the 64@tie{}KiB range
18427 that can be accessed with 16-bit pointers. To access memory locations
18428 outside this 64@tie{}KiB range, the content of a @code{RAMP}
18429 register is used as high part of the address:
18430 The @code{X}, @code{Y}, @code{Z} address register is concatenated
18431 with the @code{RAMPX}, @code{RAMPY}, @code{RAMPZ} special function
18432 register, respectively, to get a wide address. Similarly,
18433 @code{RAMPD} is used together with direct addressing.
18437 The startup code initializes the @code{RAMP} special function
18438 registers with zero.
18441 If a @ref{AVR Named Address Spaces,named address space} other than
18442 generic or @code{__flash} is used, then @code{RAMPZ} is set
18443 as needed before the operation.
18446 If the device supports RAM larger than 64@tie{}KiB and the compiler
18447 needs to change @code{RAMPZ} to accomplish an operation, @code{RAMPZ}
18448 is reset to zero after the operation.
18451 If the device comes with a specific @code{RAMP} register, the ISR
18452 prologue/epilogue saves/restores that SFR and initializes it with
18453 zero in case the ISR code might (implicitly) use it.
18456 RAM larger than 64@tie{}KiB is not supported by GCC for AVR targets.
18457 If you use inline assembler to read from locations outside the
18458 16-bit address range and change one of the @code{RAMP} registers,
18459 you must reset it to zero after the access.
18463 @subsubsection AVR Built-in Macros
18465 GCC defines several built-in macros so that the user code can test
18466 for the presence or absence of features. Almost any of the following
18467 built-in macros are deduced from device capabilities and thus
18468 triggered by the @option{-mmcu=} command-line option.
18470 For even more AVR-specific built-in macros see
18471 @ref{AVR Named Address Spaces} and @ref{AVR Built-in Functions}.
18476 Build-in macro that resolves to a decimal number that identifies the
18477 architecture and depends on the @option{-mmcu=@var{mcu}} option.
18478 Possible values are:
18480 @code{2}, @code{25}, @code{3}, @code{31}, @code{35},
18481 @code{4}, @code{5}, @code{51}, @code{6}
18483 for @var{mcu}=@code{avr2}, @code{avr25}, @code{avr3}, @code{avr31},
18484 @code{avr35}, @code{avr4}, @code{avr5}, @code{avr51}, @code{avr6},
18489 @code{102}, @code{103}, @code{104},
18490 @code{105}, @code{106}, @code{107}
18492 for @var{mcu}=@code{avrtiny},
18493 @code{avrxmega2}, @code{avrxmega3}, @code{avrxmega4},
18494 @code{avrxmega5}, @code{avrxmega6}, @code{avrxmega7}, respectively.
18495 If @var{mcu} specifies a device, this built-in macro is set
18496 accordingly. For example, with @option{-mmcu=atmega8} the macro is
18497 defined to @code{4}.
18499 @item __AVR_@var{Device}__
18500 Setting @option{-mmcu=@var{device}} defines this built-in macro which reflects
18501 the device's name. For example, @option{-mmcu=atmega8} defines the
18502 built-in macro @code{__AVR_ATmega8__}, @option{-mmcu=attiny261a} defines
18503 @code{__AVR_ATtiny261A__}, etc.
18505 The built-in macros' names follow
18506 the scheme @code{__AVR_@var{Device}__} where @var{Device} is
18507 the device name as from the AVR user manual. The difference between
18508 @var{Device} in the built-in macro and @var{device} in
18509 @option{-mmcu=@var{device}} is that the latter is always lowercase.
18511 If @var{device} is not a device but only a core architecture like
18512 @samp{avr51}, this macro is not defined.
18514 @item __AVR_DEVICE_NAME__
18515 Setting @option{-mmcu=@var{device}} defines this built-in macro to
18516 the device's name. For example, with @option{-mmcu=atmega8} the macro
18517 is defined to @code{atmega8}.
18519 If @var{device} is not a device but only a core architecture like
18520 @samp{avr51}, this macro is not defined.
18522 @item __AVR_XMEGA__
18523 The device / architecture belongs to the XMEGA family of devices.
18525 @item __AVR_HAVE_ELPM__
18526 The device has the @code{ELPM} instruction.
18528 @item __AVR_HAVE_ELPMX__
18529 The device has the @code{ELPM R@var{n},Z} and @code{ELPM
18530 R@var{n},Z+} instructions.
18532 @item __AVR_HAVE_MOVW__
18533 The device has the @code{MOVW} instruction to perform 16-bit
18534 register-register moves.
18536 @item __AVR_HAVE_LPMX__
18537 The device has the @code{LPM R@var{n},Z} and
18538 @code{LPM R@var{n},Z+} instructions.
18540 @item __AVR_HAVE_MUL__
18541 The device has a hardware multiplier.
18543 @item __AVR_HAVE_JMP_CALL__
18544 The device has the @code{JMP} and @code{CALL} instructions.
18545 This is the case for devices with more than 8@tie{}KiB of program
18548 @item __AVR_HAVE_EIJMP_EICALL__
18549 @itemx __AVR_3_BYTE_PC__
18550 The device has the @code{EIJMP} and @code{EICALL} instructions.
18551 This is the case for devices with more than 128@tie{}KiB of program memory.
18552 This also means that the program counter
18553 (PC) is 3@tie{}bytes wide.
18555 @item __AVR_2_BYTE_PC__
18556 The program counter (PC) is 2@tie{}bytes wide. This is the case for devices
18557 with up to 128@tie{}KiB of program memory.
18559 @item __AVR_HAVE_8BIT_SP__
18560 @itemx __AVR_HAVE_16BIT_SP__
18561 The stack pointer (SP) register is treated as 8-bit respectively
18562 16-bit register by the compiler.
18563 The definition of these macros is affected by @option{-mtiny-stack}.
18565 @item __AVR_HAVE_SPH__
18567 The device has the SPH (high part of stack pointer) special function
18568 register or has an 8-bit stack pointer, respectively.
18569 The definition of these macros is affected by @option{-mmcu=} and
18570 in the cases of @option{-mmcu=avr2} and @option{-mmcu=avr25} also
18573 @item __AVR_HAVE_RAMPD__
18574 @itemx __AVR_HAVE_RAMPX__
18575 @itemx __AVR_HAVE_RAMPY__
18576 @itemx __AVR_HAVE_RAMPZ__
18577 The device has the @code{RAMPD}, @code{RAMPX}, @code{RAMPY},
18578 @code{RAMPZ} special function register, respectively.
18580 @item __NO_INTERRUPTS__
18581 This macro reflects the @option{-mno-interrupts} command-line option.
18583 @item __AVR_ERRATA_SKIP__
18584 @itemx __AVR_ERRATA_SKIP_JMP_CALL__
18585 Some AVR devices (AT90S8515, ATmega103) must not skip 32-bit
18586 instructions because of a hardware erratum. Skip instructions are
18587 @code{SBRS}, @code{SBRC}, @code{SBIS}, @code{SBIC} and @code{CPSE}.
18588 The second macro is only defined if @code{__AVR_HAVE_JMP_CALL__} is also
18591 @item __AVR_ISA_RMW__
18592 The device has Read-Modify-Write instructions (XCH, LAC, LAS and LAT).
18594 @item __AVR_SFR_OFFSET__=@var{offset}
18595 Instructions that can address I/O special function registers directly
18596 like @code{IN}, @code{OUT}, @code{SBI}, etc.@: may use a different
18597 address as if addressed by an instruction to access RAM like @code{LD}
18598 or @code{STS}. This offset depends on the device architecture and has
18599 to be subtracted from the RAM address in order to get the
18600 respective I/O@tie{}address.
18602 @item __AVR_SHORT_CALLS__
18603 The @option{-mshort-calls} command line option is set.
18605 @item __AVR_PM_BASE_ADDRESS__=@var{addr}
18606 Some devices support reading from flash memory by means of @code{LD*}
18607 instructions. The flash memory is seen in the data address space
18608 at an offset of @code{__AVR_PM_BASE_ADDRESS__}. If this macro
18609 is not defined, this feature is not available. If defined,
18610 the address space is linear and there is no need to put
18611 @code{.rodata} into RAM. This is handled by the default linker
18612 description file, and is currently available for
18613 @code{avrtiny} and @code{avrxmega3}. Even more convenient,
18614 there is no need to use address spaces like @code{__flash} or
18615 features like attribute @code{progmem} and @code{pgm_read_*}.
18617 @item __WITH_AVRLIBC__
18618 The compiler is configured to be used together with AVR-Libc.
18619 See the @option{--with-avrlibc} configure option.
18623 @node Blackfin Options
18624 @subsection Blackfin Options
18625 @cindex Blackfin Options
18628 @item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
18630 Specifies the name of the target Blackfin processor. Currently, @var{cpu}
18631 can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
18632 @samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
18633 @samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
18634 @samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
18635 @samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
18636 @samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
18637 @samp{bf561}, @samp{bf592}.
18639 The optional @var{sirevision} specifies the silicon revision of the target
18640 Blackfin processor. Any workarounds available for the targeted silicon revision
18641 are enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
18642 If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
18643 are enabled. The @code{__SILICON_REVISION__} macro is defined to two
18644 hexadecimal digits representing the major and minor numbers in the silicon
18645 revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
18646 is not defined. If @var{sirevision} is @samp{any}, the
18647 @code{__SILICON_REVISION__} is defined to be @code{0xffff}.
18648 If this optional @var{sirevision} is not used, GCC assumes the latest known
18649 silicon revision of the targeted Blackfin processor.
18651 GCC defines a preprocessor macro for the specified @var{cpu}.
18652 For the @samp{bfin-elf} toolchain, this option causes the hardware BSP
18653 provided by libgloss to be linked in if @option{-msim} is not given.
18655 Without this option, @samp{bf532} is used as the processor by default.
18657 Note that support for @samp{bf561} is incomplete. For @samp{bf561},
18658 only the preprocessor macro is defined.
18662 Specifies that the program will be run on the simulator. This causes
18663 the simulator BSP provided by libgloss to be linked in. This option
18664 has effect only for @samp{bfin-elf} toolchain.
18665 Certain other options, such as @option{-mid-shared-library} and
18666 @option{-mfdpic}, imply @option{-msim}.
18668 @item -momit-leaf-frame-pointer
18669 @opindex momit-leaf-frame-pointer
18670 Don't keep the frame pointer in a register for leaf functions. This
18671 avoids the instructions to save, set up and restore frame pointers and
18672 makes an extra register available in leaf functions.
18674 @item -mspecld-anomaly
18675 @opindex mspecld-anomaly
18676 When enabled, the compiler ensures that the generated code does not
18677 contain speculative loads after jump instructions. If this option is used,
18678 @code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
18680 @item -mno-specld-anomaly
18681 @opindex mno-specld-anomaly
18682 @opindex mspecld-anomaly
18683 Don't generate extra code to prevent speculative loads from occurring.
18685 @item -mcsync-anomaly
18686 @opindex mcsync-anomaly
18687 When enabled, the compiler ensures that the generated code does not
18688 contain CSYNC or SSYNC instructions too soon after conditional branches.
18689 If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
18691 @item -mno-csync-anomaly
18692 @opindex mno-csync-anomaly
18693 @opindex mcsync-anomaly
18694 Don't generate extra code to prevent CSYNC or SSYNC instructions from
18695 occurring too soon after a conditional branch.
18699 When enabled, the compiler is free to take advantage of the knowledge that
18700 the entire program fits into the low 64k of memory.
18703 @opindex mno-low64k
18704 Assume that the program is arbitrarily large. This is the default.
18706 @item -mstack-check-l1
18707 @opindex mstack-check-l1
18708 Do stack checking using information placed into L1 scratchpad memory by the
18711 @item -mid-shared-library
18712 @opindex mid-shared-library
18713 Generate code that supports shared libraries via the library ID method.
18714 This allows for execute in place and shared libraries in an environment
18715 without virtual memory management. This option implies @option{-fPIC}.
18716 With a @samp{bfin-elf} target, this option implies @option{-msim}.
18718 @item -mno-id-shared-library
18719 @opindex mno-id-shared-library
18720 @opindex mid-shared-library
18721 Generate code that doesn't assume ID-based shared libraries are being used.
18722 This is the default.
18724 @item -mleaf-id-shared-library
18725 @opindex mleaf-id-shared-library
18726 Generate code that supports shared libraries via the library ID method,
18727 but assumes that this library or executable won't link against any other
18728 ID shared libraries. That allows the compiler to use faster code for jumps
18731 @item -mno-leaf-id-shared-library
18732 @opindex mno-leaf-id-shared-library
18733 @opindex mleaf-id-shared-library
18734 Do not assume that the code being compiled won't link against any ID shared
18735 libraries. Slower code is generated for jump and call insns.
18737 @item -mshared-library-id=n
18738 @opindex mshared-library-id
18739 Specifies the identification number of the ID-based shared library being
18740 compiled. Specifying a value of 0 generates more compact code; specifying
18741 other values forces the allocation of that number to the current
18742 library but is no more space- or time-efficient than omitting this option.
18746 Generate code that allows the data segment to be located in a different
18747 area of memory from the text segment. This allows for execute in place in
18748 an environment without virtual memory management by eliminating relocations
18749 against the text section.
18751 @item -mno-sep-data
18752 @opindex mno-sep-data
18754 Generate code that assumes that the data segment follows the text segment.
18755 This is the default.
18758 @itemx -mno-long-calls
18759 @opindex mlong-calls
18760 @opindex mno-long-calls
18761 Tells the compiler to perform function calls by first loading the
18762 address of the function into a register and then performing a subroutine
18763 call on this register. This switch is needed if the target function
18764 lies outside of the 24-bit addressing range of the offset-based
18765 version of subroutine call instruction.
18767 This feature is not enabled by default. Specifying
18768 @option{-mno-long-calls} restores the default behavior. Note these
18769 switches have no effect on how the compiler generates code to handle
18770 function calls via function pointers.
18774 Link with the fast floating-point library. This library relaxes some of
18775 the IEEE floating-point standard's rules for checking inputs against
18776 Not-a-Number (NAN), in the interest of performance.
18779 @opindex minline-plt
18780 Enable inlining of PLT entries in function calls to functions that are
18781 not known to bind locally. It has no effect without @option{-mfdpic}.
18784 @opindex mmulticore
18785 Build a standalone application for multicore Blackfin processors.
18786 This option causes proper start files and link scripts supporting
18787 multicore to be used, and defines the macro @code{__BFIN_MULTICORE}.
18788 It can only be used with @option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}.
18790 This option can be used with @option{-mcorea} or @option{-mcoreb}, which
18791 selects the one-application-per-core programming model. Without
18792 @option{-mcorea} or @option{-mcoreb}, the single-application/dual-core
18793 programming model is used. In this model, the main function of Core B
18794 should be named as @code{coreb_main}.
18796 If this option is not used, the single-core application programming
18801 Build a standalone application for Core A of BF561 when using
18802 the one-application-per-core programming model. Proper start files
18803 and link scripts are used to support Core A, and the macro
18804 @code{__BFIN_COREA} is defined.
18805 This option can only be used in conjunction with @option{-mmulticore}.
18809 Build a standalone application for Core B of BF561 when using
18810 the one-application-per-core programming model. Proper start files
18811 and link scripts are used to support Core B, and the macro
18812 @code{__BFIN_COREB} is defined. When this option is used, @code{coreb_main}
18813 should be used instead of @code{main}.
18814 This option can only be used in conjunction with @option{-mmulticore}.
18818 Build a standalone application for SDRAM. Proper start files and
18819 link scripts are used to put the application into SDRAM, and the macro
18820 @code{__BFIN_SDRAM} is defined.
18821 The loader should initialize SDRAM before loading the application.
18825 Assume that ICPLBs are enabled at run time. This has an effect on certain
18826 anomaly workarounds. For Linux targets, the default is to assume ICPLBs
18827 are enabled; for standalone applications the default is off.
18831 @subsection C6X Options
18832 @cindex C6X Options
18835 @item -march=@var{name}
18837 This specifies the name of the target architecture. GCC uses this
18838 name to determine what kind of instructions it can emit when generating
18839 assembly code. Permissible names are: @samp{c62x},
18840 @samp{c64x}, @samp{c64x+}, @samp{c67x}, @samp{c67x+}, @samp{c674x}.
18843 @opindex mbig-endian
18844 Generate code for a big-endian target.
18846 @item -mlittle-endian
18847 @opindex mlittle-endian
18848 Generate code for a little-endian target. This is the default.
18852 Choose startup files and linker script suitable for the simulator.
18854 @item -msdata=default
18855 @opindex msdata=default
18856 Put small global and static data in the @code{.neardata} section,
18857 which is pointed to by register @code{B14}. Put small uninitialized
18858 global and static data in the @code{.bss} section, which is adjacent
18859 to the @code{.neardata} section. Put small read-only data into the
18860 @code{.rodata} section. The corresponding sections used for large
18861 pieces of data are @code{.fardata}, @code{.far} and @code{.const}.
18864 @opindex msdata=all
18865 Put all data, not just small objects, into the sections reserved for
18866 small data, and use addressing relative to the @code{B14} register to
18870 @opindex msdata=none
18871 Make no use of the sections reserved for small data, and use absolute
18872 addresses to access all data. Put all initialized global and static
18873 data in the @code{.fardata} section, and all uninitialized data in the
18874 @code{.far} section. Put all constant data into the @code{.const}
18879 @subsection CRIS Options
18880 @cindex CRIS Options
18882 These options are defined specifically for the CRIS ports.
18885 @item -march=@var{architecture-type}
18886 @itemx -mcpu=@var{architecture-type}
18889 Generate code for the specified architecture. The choices for
18890 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
18891 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
18892 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
18895 @item -mtune=@var{architecture-type}
18897 Tune to @var{architecture-type} everything applicable about the generated
18898 code, except for the ABI and the set of available instructions. The
18899 choices for @var{architecture-type} are the same as for
18900 @option{-march=@var{architecture-type}}.
18902 @item -mmax-stack-frame=@var{n}
18903 @opindex mmax-stack-frame
18904 Warn when the stack frame of a function exceeds @var{n} bytes.
18910 The options @option{-metrax4} and @option{-metrax100} are synonyms for
18911 @option{-march=v3} and @option{-march=v8} respectively.
18913 @item -mmul-bug-workaround
18914 @itemx -mno-mul-bug-workaround
18915 @opindex mmul-bug-workaround
18916 @opindex mno-mul-bug-workaround
18917 Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
18918 models where it applies. This option is active by default.
18922 Enable CRIS-specific verbose debug-related information in the assembly
18923 code. This option also has the effect of turning off the @samp{#NO_APP}
18924 formatted-code indicator to the assembler at the beginning of the
18929 Do not use condition-code results from previous instruction; always emit
18930 compare and test instructions before use of condition codes.
18932 @item -mno-side-effects
18933 @opindex mno-side-effects
18934 @opindex mside-effects
18935 Do not emit instructions with side effects in addressing modes other than
18938 @item -mstack-align
18939 @itemx -mno-stack-align
18940 @itemx -mdata-align
18941 @itemx -mno-data-align
18942 @itemx -mconst-align
18943 @itemx -mno-const-align
18944 @opindex mstack-align
18945 @opindex mno-stack-align
18946 @opindex mdata-align
18947 @opindex mno-data-align
18948 @opindex mconst-align
18949 @opindex mno-const-align
18950 These options (@samp{no-} options) arrange (eliminate arrangements) for the
18951 stack frame, individual data and constants to be aligned for the maximum
18952 single data access size for the chosen CPU model. The default is to
18953 arrange for 32-bit alignment. ABI details such as structure layout are
18954 not affected by these options.
18962 Similar to the stack- data- and const-align options above, these options
18963 arrange for stack frame, writable data and constants to all be 32-bit,
18964 16-bit or 8-bit aligned. The default is 32-bit alignment.
18966 @item -mno-prologue-epilogue
18967 @itemx -mprologue-epilogue
18968 @opindex mno-prologue-epilogue
18969 @opindex mprologue-epilogue
18970 With @option{-mno-prologue-epilogue}, the normal function prologue and
18971 epilogue which set up the stack frame are omitted and no return
18972 instructions or return sequences are generated in the code. Use this
18973 option only together with visual inspection of the compiled code: no
18974 warnings or errors are generated when call-saved registers must be saved,
18975 or storage for local variables needs to be allocated.
18979 @opindex mno-gotplt
18981 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
18982 instruction sequences that load addresses for functions from the PLT part
18983 of the GOT rather than (traditional on other architectures) calls to the
18984 PLT@. The default is @option{-mgotplt}.
18988 Legacy no-op option only recognized with the cris-axis-elf and
18989 cris-axis-linux-gnu targets.
18993 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
18997 This option, recognized for the cris-axis-elf, arranges
18998 to link with input-output functions from a simulator library. Code,
18999 initialized data and zero-initialized data are allocated consecutively.
19003 Like @option{-sim}, but pass linker options to locate initialized data at
19004 0x40000000 and zero-initialized data at 0x80000000.
19008 @subsection CR16 Options
19009 @cindex CR16 Options
19011 These options are defined specifically for the CR16 ports.
19017 Enable the use of multiply-accumulate instructions. Disabled by default.
19021 @opindex mcr16cplus
19023 Generate code for CR16C or CR16C+ architecture. CR16C+ architecture
19028 Links the library libsim.a which is in compatible with simulator. Applicable
19029 to ELF compiler only.
19033 Choose integer type as 32-bit wide.
19037 Generates @code{sbit}/@code{cbit} instructions for bit manipulations.
19039 @item -mdata-model=@var{model}
19040 @opindex mdata-model
19041 Choose a data model. The choices for @var{model} are @samp{near},
19042 @samp{far} or @samp{medium}. @samp{medium} is default.
19043 However, @samp{far} is not valid with @option{-mcr16c}, as the
19044 CR16C architecture does not support the far data model.
19047 @node C-SKY Options
19048 @subsection C-SKY Options
19049 @cindex C-SKY Options
19051 GCC supports these options when compiling for C-SKY V2 processors.
19055 @item -march=@var{arch}
19057 Specify the C-SKY target architecture. Valid values for @var{arch} are:
19058 @samp{ck801}, @samp{ck802}, @samp{ck803}, @samp{ck807}, and @samp{ck810}.
19059 The default is @samp{ck810}.
19061 @item -mcpu=@var{cpu}
19063 Specify the C-SKY target processor. Valid values for @var{cpu} are:
19064 @samp{ck801}, @samp{ck801t},
19065 @samp{ck802}, @samp{ck802t}, @samp{ck802j},
19066 @samp{ck803}, @samp{ck803h}, @samp{ck803t}, @samp{ck803ht},
19067 @samp{ck803f}, @samp{ck803fh}, @samp{ck803e}, @samp{ck803eh},
19068 @samp{ck803et}, @samp{ck803eht}, @samp{ck803ef}, @samp{ck803efh},
19069 @samp{ck803ft}, @samp{ck803eft}, @samp{ck803efht}, @samp{ck803r1},
19070 @samp{ck803hr1}, @samp{ck803tr1}, @samp{ck803htr1}, @samp{ck803fr1},
19071 @samp{ck803fhr1}, @samp{ck803er1}, @samp{ck803ehr1}, @samp{ck803etr1},
19072 @samp{ck803ehtr1}, @samp{ck803efr1}, @samp{ck803efhr1}, @samp{ck803ftr1},
19073 @samp{ck803eftr1}, @samp{ck803efhtr1},
19074 @samp{ck803s}, @samp{ck803st}, @samp{ck803se}, @samp{ck803sf},
19075 @samp{ck803sef}, @samp{ck803seft},
19076 @samp{ck807e}, @samp{ck807ef}, @samp{ck807}, @samp{ck807f},
19077 @samp{ck810e}, @samp{ck810et}, @samp{ck810ef}, @samp{ck810eft},
19078 @samp{ck810}, @samp{ck810v}, @samp{ck810f}, @samp{ck810t}, @samp{ck810fv},
19079 @samp{ck810tv}, @samp{ck810ft}, and @samp{ck810ftv}.
19082 @opindex mbig-endian
19085 @itemx -mlittle-endian
19086 @opindex mlittle-endian
19090 Select big- or little-endian code. The default is little-endian.
19093 @opindex mhard-float
19094 @itemx -msoft-float
19095 @opindex msoft-float
19097 Select hardware or software floating-point implementations.
19098 The default is soft float.
19100 @item -mdouble-float
19101 @itemx -mno-double-float
19102 @opindex mdouble-float
19103 When @option{-mhard-float} is in effect, enable generation of
19104 double-precision float instructions. This is the default except
19105 when compiling for CK803.
19110 When @option{-mhard-float} is in effect, enable generation of
19111 @code{frecipd}, @code{fsqrtd}, and @code{fdivd} instructions.
19112 This is the default except when compiling for CK803.
19114 @item -mfpu=@var{fpu}
19116 Select the floating-point processor. This option can only be used with
19117 @option{-mhard-float}.
19118 Values for @var{fpu} are
19119 @samp{fpv2_sf} (equivalent to @samp{-mno-double-float -mno-fdivdu}),
19120 @samp{fpv2} (@samp{-mdouble-float -mno-divdu}), and
19121 @samp{fpv2_divd} (@samp{-mdouble-float -mdivdu}).
19126 Enable the extended @code{lrw} instruction. This option defaults to on
19127 for CK801 and off otherwise.
19132 Enable interrupt stack instructions; the default is off.
19134 The @option{-mistack} option is required to handle the
19135 @code{interrupt} and @code{isr} function attributes
19136 (@pxref{C-SKY Function Attributes}).
19140 Enable multiprocessor instructions; the default is off.
19144 Enable coprocessor instructions; the default is off.
19148 Enable coprocessor instructions; the default is off.
19152 Enable C-SKY security instructions; the default is off.
19156 Enable C-SKY trust instructions; the default is off.
19164 Enable C-SKY DSP, Enhanced DSP, or Vector DSP instructions, respectively.
19165 All of these options default to off.
19170 Generate divide instructions. Default is off.
19175 Generate code for Smart Mode, using only registers numbered 0-7 to allow
19176 use of 16-bit instructions. This option is ignored for CK801 where this
19177 is the required behavior, and it defaults to on for CK802.
19178 For other targets, the default is off.
19180 @item -mhigh-registers
19181 @itemx -mno-high-registers
19182 @opindex mhigh-registers
19183 Generate code using the high registers numbered 16-31. This option
19184 is not supported on CK801, CK802, or CK803, and is enabled by default
19185 for other processors.
19190 Generate code using global anchor symbol addresses.
19193 @itemx -mno-pushpop
19195 Generate code using @code{push} and @code{pop} instructions. This option
19198 @item -mmultiple-stld
19200 @itemx -mno-multiple-stld
19202 @opindex mmultiple-stld
19203 Generate code using @code{stm} and @code{ldm} instructions. This option
19204 isn't supported on CK801 but is enabled by default on other processors.
19207 @itemx -mno-constpool
19208 @opindex mconstpool
19209 Create constant pools in the compiler instead of deferring it to the
19210 assembler. This option is the default and required for correct code
19211 generation on CK801 and CK802, and is optional on other processors.
19214 @item -mno-stack-size
19215 @opindex mstack-size
19216 Emit @code{.stack_size} directives for each function in the assembly
19217 output. This option defaults to off.
19222 Generate code for the C-SKY compiler runtime instead of libgcc. This
19223 option defaults to off.
19225 @item -mbranch-cost=@var{n}
19226 @opindex mbranch-cost=
19227 Set the branch costs to roughly @code{n} instructions. The default is 1.
19229 @item -msched-prolog
19230 @itemx -mno-sched-prolog
19231 @opindex msched-prolog
19232 Permit scheduling of function prologue and epilogue sequences. Using
19233 this option can result in code that is not compliant with the C-SKY V2 ABI
19234 prologue requirements and that cannot be debugged or backtraced.
19235 It is disabled by default.
19239 @node Darwin Options
19240 @subsection Darwin Options
19241 @cindex Darwin options
19243 These options are defined for all architectures running the Darwin operating
19246 FSF GCC on Darwin does not create ``fat'' object files; it creates
19247 an object file for the single architecture that GCC was built to
19248 target. Apple's GCC on Darwin does create ``fat'' files if multiple
19249 @option{-arch} options are used; it does so by running the compiler or
19250 linker multiple times and joining the results together with
19253 The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
19254 @samp{i686}) is determined by the flags that specify the ISA
19255 that GCC is targeting, like @option{-mcpu} or @option{-march}. The
19256 @option{-force_cpusubtype_ALL} option can be used to override this.
19258 The Darwin tools vary in their behavior when presented with an ISA
19259 mismatch. The assembler, @file{as}, only permits instructions to
19260 be used that are valid for the subtype of the file it is generating,
19261 so you cannot put 64-bit instructions in a @samp{ppc750} object file.
19262 The linker for shared libraries, @file{/usr/bin/libtool}, fails
19263 and prints an error if asked to create a shared library with a less
19264 restrictive subtype than its input files (for instance, trying to put
19265 a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
19266 for executables, @command{ld}, quietly gives the executable the most
19267 restrictive subtype of any of its input files.
19272 Add the framework directory @var{dir} to the head of the list of
19273 directories to be searched for header files. These directories are
19274 interleaved with those specified by @option{-I} options and are
19275 scanned in a left-to-right order.
19277 A framework directory is a directory with frameworks in it. A
19278 framework is a directory with a @file{Headers} and/or
19279 @file{PrivateHeaders} directory contained directly in it that ends
19280 in @file{.framework}. The name of a framework is the name of this
19281 directory excluding the @file{.framework}. Headers associated with
19282 the framework are found in one of those two directories, with
19283 @file{Headers} being searched first. A subframework is a framework
19284 directory that is in a framework's @file{Frameworks} directory.
19285 Includes of subframework headers can only appear in a header of a
19286 framework that contains the subframework, or in a sibling subframework
19287 header. Two subframeworks are siblings if they occur in the same
19288 framework. A subframework should not have the same name as a
19289 framework; a warning is issued if this is violated. Currently a
19290 subframework cannot have subframeworks; in the future, the mechanism
19291 may be extended to support this. The standard frameworks can be found
19292 in @file{/System/Library/Frameworks} and
19293 @file{/Library/Frameworks}. An example include looks like
19294 @code{#include <Framework/header.h>}, where @file{Framework} denotes
19295 the name of the framework and @file{header.h} is found in the
19296 @file{PrivateHeaders} or @file{Headers} directory.
19298 @item -iframework@var{dir}
19299 @opindex iframework
19300 Like @option{-F} except the directory is a treated as a system
19301 directory. The main difference between this @option{-iframework} and
19302 @option{-F} is that with @option{-iframework} the compiler does not
19303 warn about constructs contained within header files found via
19304 @var{dir}. This option is valid only for the C family of languages.
19308 Emit debugging information for symbols that are used. For stabs
19309 debugging format, this enables @option{-feliminate-unused-debug-symbols}.
19310 This is by default ON@.
19314 Emit debugging information for all symbols and types.
19316 @item -mmacosx-version-min=@var{version}
19317 The earliest version of MacOS X that this executable will run on
19318 is @var{version}. Typical values of @var{version} include @code{10.1},
19319 @code{10.2}, and @code{10.3.9}.
19321 If the compiler was built to use the system's headers by default,
19322 then the default for this option is the system version on which the
19323 compiler is running, otherwise the default is to make choices that
19324 are compatible with as many systems and code bases as possible.
19328 Enable kernel development mode. The @option{-mkernel} option sets
19329 @option{-static}, @option{-fno-common}, @option{-fno-use-cxa-atexit},
19330 @option{-fno-exceptions}, @option{-fno-non-call-exceptions},
19331 @option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
19332 applicable. This mode also sets @option{-mno-altivec},
19333 @option{-msoft-float}, @option{-fno-builtin} and
19334 @option{-mlong-branch} for PowerPC targets.
19336 @item -mone-byte-bool
19337 @opindex mone-byte-bool
19338 Override the defaults for @code{bool} so that @code{sizeof(bool)==1}.
19339 By default @code{sizeof(bool)} is @code{4} when compiling for
19340 Darwin/PowerPC and @code{1} when compiling for Darwin/x86, so this
19341 option has no effect on x86.
19343 @strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
19344 to generate code that is not binary compatible with code generated
19345 without that switch. Using this switch may require recompiling all
19346 other modules in a program, including system libraries. Use this
19347 switch to conform to a non-default data model.
19349 @item -mfix-and-continue
19350 @itemx -ffix-and-continue
19351 @itemx -findirect-data
19352 @opindex mfix-and-continue
19353 @opindex ffix-and-continue
19354 @opindex findirect-data
19355 Generate code suitable for fast turnaround development, such as to
19356 allow GDB to dynamically load @file{.o} files into already-running
19357 programs. @option{-findirect-data} and @option{-ffix-and-continue}
19358 are provided for backwards compatibility.
19362 Loads all members of static archive libraries.
19363 See man ld(1) for more information.
19365 @item -arch_errors_fatal
19366 @opindex arch_errors_fatal
19367 Cause the errors having to do with files that have the wrong architecture
19370 @item -bind_at_load
19371 @opindex bind_at_load
19372 Causes the output file to be marked such that the dynamic linker will
19373 bind all undefined references when the file is loaded or launched.
19377 Produce a Mach-o bundle format file.
19378 See man ld(1) for more information.
19380 @item -bundle_loader @var{executable}
19381 @opindex bundle_loader
19382 This option specifies the @var{executable} that will load the build
19383 output file being linked. See man ld(1) for more information.
19386 @opindex dynamiclib
19387 When passed this option, GCC produces a dynamic library instead of
19388 an executable when linking, using the Darwin @file{libtool} command.
19390 @item -force_cpusubtype_ALL
19391 @opindex force_cpusubtype_ALL
19392 This causes GCC's output file to have the @samp{ALL} subtype, instead of
19393 one controlled by the @option{-mcpu} or @option{-march} option.
19395 @item -allowable_client @var{client_name}
19396 @itemx -client_name
19397 @itemx -compatibility_version
19398 @itemx -current_version
19400 @itemx -dependency-file
19402 @itemx -dylinker_install_name
19404 @itemx -exported_symbols_list
19407 @itemx -flat_namespace
19408 @itemx -force_flat_namespace
19409 @itemx -headerpad_max_install_names
19412 @itemx -install_name
19413 @itemx -keep_private_externs
19414 @itemx -multi_module
19415 @itemx -multiply_defined
19416 @itemx -multiply_defined_unused
19419 @itemx -no_dead_strip_inits_and_terms
19420 @itemx -nofixprebinding
19421 @itemx -nomultidefs
19423 @itemx -noseglinkedit
19424 @itemx -pagezero_size
19426 @itemx -prebind_all_twolevel_modules
19427 @itemx -private_bundle
19429 @itemx -read_only_relocs
19431 @itemx -sectobjectsymbols
19435 @itemx -sectobjectsymbols
19438 @itemx -segs_read_only_addr
19440 @itemx -segs_read_write_addr
19441 @itemx -seg_addr_table
19442 @itemx -seg_addr_table_filename
19443 @itemx -seglinkedit
19445 @itemx -segs_read_only_addr
19446 @itemx -segs_read_write_addr
19447 @itemx -single_module
19449 @itemx -sub_library
19451 @itemx -sub_umbrella
19452 @itemx -twolevel_namespace
19455 @itemx -unexported_symbols_list
19456 @itemx -weak_reference_mismatches
19457 @itemx -whatsloaded
19458 @opindex allowable_client
19459 @opindex client_name
19460 @opindex compatibility_version
19461 @opindex current_version
19462 @opindex dead_strip
19463 @opindex dependency-file
19464 @opindex dylib_file
19465 @opindex dylinker_install_name
19467 @opindex exported_symbols_list
19469 @opindex flat_namespace
19470 @opindex force_flat_namespace
19471 @opindex headerpad_max_install_names
19472 @opindex image_base
19474 @opindex install_name
19475 @opindex keep_private_externs
19476 @opindex multi_module
19477 @opindex multiply_defined
19478 @opindex multiply_defined_unused
19479 @opindex noall_load
19480 @opindex no_dead_strip_inits_and_terms
19481 @opindex nofixprebinding
19482 @opindex nomultidefs
19484 @opindex noseglinkedit
19485 @opindex pagezero_size
19487 @opindex prebind_all_twolevel_modules
19488 @opindex private_bundle
19489 @opindex read_only_relocs
19491 @opindex sectobjectsymbols
19494 @opindex sectcreate
19495 @opindex sectobjectsymbols
19498 @opindex segs_read_only_addr
19499 @opindex segs_read_write_addr
19500 @opindex seg_addr_table
19501 @opindex seg_addr_table_filename
19502 @opindex seglinkedit
19504 @opindex segs_read_only_addr
19505 @opindex segs_read_write_addr
19506 @opindex single_module
19508 @opindex sub_library
19509 @opindex sub_umbrella
19510 @opindex twolevel_namespace
19513 @opindex unexported_symbols_list
19514 @opindex weak_reference_mismatches
19515 @opindex whatsloaded
19516 These options are passed to the Darwin linker. The Darwin linker man page
19517 describes them in detail.
19520 @node DEC Alpha Options
19521 @subsection DEC Alpha Options
19523 These @samp{-m} options are defined for the DEC Alpha implementations:
19526 @item -mno-soft-float
19527 @itemx -msoft-float
19528 @opindex mno-soft-float
19529 @opindex msoft-float
19530 Use (do not use) the hardware floating-point instructions for
19531 floating-point operations. When @option{-msoft-float} is specified,
19532 functions in @file{libgcc.a} are used to perform floating-point
19533 operations. Unless they are replaced by routines that emulate the
19534 floating-point operations, or compiled in such a way as to call such
19535 emulations routines, these routines issue floating-point
19536 operations. If you are compiling for an Alpha without floating-point
19537 operations, you must ensure that the library is built so as not to call
19540 Note that Alpha implementations without floating-point operations are
19541 required to have floating-point registers.
19544 @itemx -mno-fp-regs
19546 @opindex mno-fp-regs
19547 Generate code that uses (does not use) the floating-point register set.
19548 @option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
19549 register set is not used, floating-point operands are passed in integer
19550 registers as if they were integers and floating-point results are passed
19551 in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
19552 so any function with a floating-point argument or return value called by code
19553 compiled with @option{-mno-fp-regs} must also be compiled with that
19556 A typical use of this option is building a kernel that does not use,
19557 and hence need not save and restore, any floating-point registers.
19561 The Alpha architecture implements floating-point hardware optimized for
19562 maximum performance. It is mostly compliant with the IEEE floating-point
19563 standard. However, for full compliance, software assistance is
19564 required. This option generates code fully IEEE-compliant code
19565 @emph{except} that the @var{inexact-flag} is not maintained (see below).
19566 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
19567 defined during compilation. The resulting code is less efficient but is
19568 able to correctly support denormalized numbers and exceptional IEEE
19569 values such as not-a-number and plus/minus infinity. Other Alpha
19570 compilers call this option @option{-ieee_with_no_inexact}.
19572 @item -mieee-with-inexact
19573 @opindex mieee-with-inexact
19574 This is like @option{-mieee} except the generated code also maintains
19575 the IEEE @var{inexact-flag}. Turning on this option causes the
19576 generated code to implement fully-compliant IEEE math. In addition to
19577 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
19578 macro. On some Alpha implementations the resulting code may execute
19579 significantly slower than the code generated by default. Since there is
19580 very little code that depends on the @var{inexact-flag}, you should
19581 normally not specify this option. Other Alpha compilers call this
19582 option @option{-ieee_with_inexact}.
19584 @item -mfp-trap-mode=@var{trap-mode}
19585 @opindex mfp-trap-mode
19586 This option controls what floating-point related traps are enabled.
19587 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
19588 The trap mode can be set to one of four values:
19592 This is the default (normal) setting. The only traps that are enabled
19593 are the ones that cannot be disabled in software (e.g., division by zero
19597 In addition to the traps enabled by @samp{n}, underflow traps are enabled
19601 Like @samp{u}, but the instructions are marked to be safe for software
19602 completion (see Alpha architecture manual for details).
19605 Like @samp{su}, but inexact traps are enabled as well.
19608 @item -mfp-rounding-mode=@var{rounding-mode}
19609 @opindex mfp-rounding-mode
19610 Selects the IEEE rounding mode. Other Alpha compilers call this option
19611 @option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
19616 Normal IEEE rounding mode. Floating-point numbers are rounded towards
19617 the nearest machine number or towards the even machine number in case
19621 Round towards minus infinity.
19624 Chopped rounding mode. Floating-point numbers are rounded towards zero.
19627 Dynamic rounding mode. A field in the floating-point control register
19628 (@var{fpcr}, see Alpha architecture reference manual) controls the
19629 rounding mode in effect. The C library initializes this register for
19630 rounding towards plus infinity. Thus, unless your program modifies the
19631 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
19634 @item -mtrap-precision=@var{trap-precision}
19635 @opindex mtrap-precision
19636 In the Alpha architecture, floating-point traps are imprecise. This
19637 means without software assistance it is impossible to recover from a
19638 floating trap and program execution normally needs to be terminated.
19639 GCC can generate code that can assist operating system trap handlers
19640 in determining the exact location that caused a floating-point trap.
19641 Depending on the requirements of an application, different levels of
19642 precisions can be selected:
19646 Program precision. This option is the default and means a trap handler
19647 can only identify which program caused a floating-point exception.
19650 Function precision. The trap handler can determine the function that
19651 caused a floating-point exception.
19654 Instruction precision. The trap handler can determine the exact
19655 instruction that caused a floating-point exception.
19658 Other Alpha compilers provide the equivalent options called
19659 @option{-scope_safe} and @option{-resumption_safe}.
19661 @item -mieee-conformant
19662 @opindex mieee-conformant
19663 This option marks the generated code as IEEE conformant. You must not
19664 use this option unless you also specify @option{-mtrap-precision=i} and either
19665 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
19666 is to emit the line @samp{.eflag 48} in the function prologue of the
19667 generated assembly file.
19669 @item -mbuild-constants
19670 @opindex mbuild-constants
19671 Normally GCC examines a 32- or 64-bit integer constant to
19672 see if it can construct it from smaller constants in two or three
19673 instructions. If it cannot, it outputs the constant as a literal and
19674 generates code to load it from the data segment at run time.
19676 Use this option to require GCC to construct @emph{all} integer constants
19677 using code, even if it takes more instructions (the maximum is six).
19679 You typically use this option to build a shared library dynamic
19680 loader. Itself a shared library, it must relocate itself in memory
19681 before it can find the variables and constants in its own data segment.
19699 Indicate whether GCC should generate code to use the optional BWX,
19700 CIX, FIX and MAX instruction sets. The default is to use the instruction
19701 sets supported by the CPU type specified via @option{-mcpu=} option or that
19702 of the CPU on which GCC was built if none is specified.
19705 @itemx -mfloat-ieee
19706 @opindex mfloat-vax
19707 @opindex mfloat-ieee
19708 Generate code that uses (does not use) VAX F and G floating-point
19709 arithmetic instead of IEEE single and double precision.
19711 @item -mexplicit-relocs
19712 @itemx -mno-explicit-relocs
19713 @opindex mexplicit-relocs
19714 @opindex mno-explicit-relocs
19715 Older Alpha assemblers provided no way to generate symbol relocations
19716 except via assembler macros. Use of these macros does not allow
19717 optimal instruction scheduling. GNU binutils as of version 2.12
19718 supports a new syntax that allows the compiler to explicitly mark
19719 which relocations should apply to which instructions. This option
19720 is mostly useful for debugging, as GCC detects the capabilities of
19721 the assembler when it is built and sets the default accordingly.
19724 @itemx -mlarge-data
19725 @opindex msmall-data
19726 @opindex mlarge-data
19727 When @option{-mexplicit-relocs} is in effect, static data is
19728 accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
19729 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
19730 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
19731 16-bit relocations off of the @code{$gp} register. This limits the
19732 size of the small data area to 64KB, but allows the variables to be
19733 directly accessed via a single instruction.
19735 The default is @option{-mlarge-data}. With this option the data area
19736 is limited to just below 2GB@. Programs that require more than 2GB of
19737 data must use @code{malloc} or @code{mmap} to allocate the data in the
19738 heap instead of in the program's data segment.
19740 When generating code for shared libraries, @option{-fpic} implies
19741 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
19744 @itemx -mlarge-text
19745 @opindex msmall-text
19746 @opindex mlarge-text
19747 When @option{-msmall-text} is used, the compiler assumes that the
19748 code of the entire program (or shared library) fits in 4MB, and is
19749 thus reachable with a branch instruction. When @option{-msmall-data}
19750 is used, the compiler can assume that all local symbols share the
19751 same @code{$gp} value, and thus reduce the number of instructions
19752 required for a function call from 4 to 1.
19754 The default is @option{-mlarge-text}.
19756 @item -mcpu=@var{cpu_type}
19758 Set the instruction set and instruction scheduling parameters for
19759 machine type @var{cpu_type}. You can specify either the @samp{EV}
19760 style name or the corresponding chip number. GCC supports scheduling
19761 parameters for the EV4, EV5 and EV6 family of processors and
19762 chooses the default values for the instruction set from the processor
19763 you specify. If you do not specify a processor type, GCC defaults
19764 to the processor on which the compiler was built.
19766 Supported values for @var{cpu_type} are
19772 Schedules as an EV4 and has no instruction set extensions.
19776 Schedules as an EV5 and has no instruction set extensions.
19780 Schedules as an EV5 and supports the BWX extension.
19785 Schedules as an EV5 and supports the BWX and MAX extensions.
19789 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
19793 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
19796 Native toolchains also support the value @samp{native},
19797 which selects the best architecture option for the host processor.
19798 @option{-mcpu=native} has no effect if GCC does not recognize
19801 @item -mtune=@var{cpu_type}
19803 Set only the instruction scheduling parameters for machine type
19804 @var{cpu_type}. The instruction set is not changed.
19806 Native toolchains also support the value @samp{native},
19807 which selects the best architecture option for the host processor.
19808 @option{-mtune=native} has no effect if GCC does not recognize
19811 @item -mmemory-latency=@var{time}
19812 @opindex mmemory-latency
19813 Sets the latency the scheduler should assume for typical memory
19814 references as seen by the application. This number is highly
19815 dependent on the memory access patterns used by the application
19816 and the size of the external cache on the machine.
19818 Valid options for @var{time} are
19822 A decimal number representing clock cycles.
19828 The compiler contains estimates of the number of clock cycles for
19829 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
19830 (also called Dcache, Scache, and Bcache), as well as to main memory.
19831 Note that L3 is only valid for EV5.
19837 @subsection eBPF Options
19838 @cindex eBPF Options
19841 @item -mframe-limit=@var{bytes}
19842 This specifies the hard limit for frame sizes, in bytes. Currently,
19843 the value that can be specified should be less than or equal to
19844 @samp{32767}. Defaults to whatever limit is imposed by the version of
19845 the Linux kernel targeted.
19847 @item -mkernel=@var{version}
19849 This specifies the minimum version of the kernel that will run the
19850 compiled program. GCC uses this version to determine which
19851 instructions to use, what kernel helpers to allow, etc. Currently,
19852 @var{version} can be one of @samp{4.0}, @samp{4.1}, @samp{4.2},
19853 @samp{4.3}, @samp{4.4}, @samp{4.5}, @samp{4.6}, @samp{4.7},
19854 @samp{4.8}, @samp{4.9}, @samp{4.10}, @samp{4.11}, @samp{4.12},
19855 @samp{4.13}, @samp{4.14}, @samp{4.15}, @samp{4.16}, @samp{4.17},
19856 @samp{4.18}, @samp{4.19}, @samp{4.20}, @samp{5.0}, @samp{5.1},
19857 @samp{5.2}, @samp{latest} and @samp{native}.
19860 @opindex mbig-endian
19861 Generate code for a big-endian target.
19863 @item -mlittle-endian
19864 @opindex mlittle-endian
19865 Generate code for a little-endian target. This is the default.
19869 @subsection FR30 Options
19870 @cindex FR30 Options
19872 These options are defined specifically for the FR30 port.
19876 @item -msmall-model
19877 @opindex msmall-model
19878 Use the small address space model. This can produce smaller code, but
19879 it does assume that all symbolic values and addresses fit into a
19884 Assume that runtime support has been provided and so there is no need
19885 to include the simulator library (@file{libsim.a}) on the linker
19891 @subsection FT32 Options
19892 @cindex FT32 Options
19894 These options are defined specifically for the FT32 port.
19900 Specifies that the program will be run on the simulator. This causes
19901 an alternate runtime startup and library to be linked.
19902 You must not use this option when generating programs that will run on
19903 real hardware; you must provide your own runtime library for whatever
19904 I/O functions are needed.
19908 Enable Local Register Allocation. This is still experimental for FT32,
19909 so by default the compiler uses standard reload.
19913 Do not use div and mod instructions.
19917 Enable use of the extended instructions of the FT32B processor.
19921 Compress all code using the Ft32B code compression scheme.
19925 Do not generate code that reads program memory.
19930 @subsection FRV Options
19931 @cindex FRV Options
19937 Only use the first 32 general-purpose registers.
19942 Use all 64 general-purpose registers.
19947 Use only the first 32 floating-point registers.
19952 Use all 64 floating-point registers.
19955 @opindex mhard-float
19957 Use hardware instructions for floating-point operations.
19960 @opindex msoft-float
19962 Use library routines for floating-point operations.
19967 Dynamically allocate condition code registers.
19972 Do not try to dynamically allocate condition code registers, only
19973 use @code{icc0} and @code{fcc0}.
19978 Change ABI to use double word insns.
19984 Do not use double word instructions.
19989 Use floating-point double instructions.
19992 @opindex mno-double
19994 Do not use floating-point double instructions.
19999 Use media instructions.
20004 Do not use media instructions.
20009 Use multiply and add/subtract instructions.
20012 @opindex mno-muladd
20014 Do not use multiply and add/subtract instructions.
20019 Select the FDPIC ABI, which uses function descriptors to represent
20020 pointers to functions. Without any PIC/PIE-related options, it
20021 implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
20022 assumes GOT entries and small data are within a 12-bit range from the
20023 GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
20024 are computed with 32 bits.
20025 With a @samp{bfin-elf} target, this option implies @option{-msim}.
20028 @opindex minline-plt
20030 Enable inlining of PLT entries in function calls to functions that are
20031 not known to bind locally. It has no effect without @option{-mfdpic}.
20032 It's enabled by default if optimizing for speed and compiling for
20033 shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
20034 optimization option such as @option{-O3} or above is present in the
20040 Assume a large TLS segment when generating thread-local code.
20045 Do not assume a large TLS segment when generating thread-local code.
20050 Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
20051 that is known to be in read-only sections. It's enabled by default,
20052 except for @option{-fpic} or @option{-fpie}: even though it may help
20053 make the global offset table smaller, it trades 1 instruction for 4.
20054 With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
20055 one of which may be shared by multiple symbols, and it avoids the need
20056 for a GOT entry for the referenced symbol, so it's more likely to be a
20057 win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
20059 @item -multilib-library-pic
20060 @opindex multilib-library-pic
20062 Link with the (library, not FD) pic libraries. It's implied by
20063 @option{-mlibrary-pic}, as well as by @option{-fPIC} and
20064 @option{-fpic} without @option{-mfdpic}. You should never have to use
20068 @opindex mlinked-fp
20070 Follow the EABI requirement of always creating a frame pointer whenever
20071 a stack frame is allocated. This option is enabled by default and can
20072 be disabled with @option{-mno-linked-fp}.
20075 @opindex mlong-calls
20077 Use indirect addressing to call functions outside the current
20078 compilation unit. This allows the functions to be placed anywhere
20079 within the 32-bit address space.
20081 @item -malign-labels
20082 @opindex malign-labels
20084 Try to align labels to an 8-byte boundary by inserting NOPs into the
20085 previous packet. This option only has an effect when VLIW packing
20086 is enabled. It doesn't create new packets; it merely adds NOPs to
20089 @item -mlibrary-pic
20090 @opindex mlibrary-pic
20092 Generate position-independent EABI code.
20097 Use only the first four media accumulator registers.
20102 Use all eight media accumulator registers.
20107 Pack VLIW instructions.
20112 Do not pack VLIW instructions.
20115 @opindex mno-eflags
20117 Do not mark ABI switches in e_flags.
20120 @opindex mcond-move
20122 Enable the use of conditional-move instructions (default).
20124 This switch is mainly for debugging the compiler and will likely be removed
20125 in a future version.
20127 @item -mno-cond-move
20128 @opindex mno-cond-move
20130 Disable the use of conditional-move instructions.
20132 This switch is mainly for debugging the compiler and will likely be removed
20133 in a future version.
20138 Enable the use of conditional set instructions (default).
20140 This switch is mainly for debugging the compiler and will likely be removed
20141 in a future version.
20146 Disable the use of conditional set instructions.
20148 This switch is mainly for debugging the compiler and will likely be removed
20149 in a future version.
20152 @opindex mcond-exec
20154 Enable the use of conditional execution (default).
20156 This switch is mainly for debugging the compiler and will likely be removed
20157 in a future version.
20159 @item -mno-cond-exec
20160 @opindex mno-cond-exec
20162 Disable the use of conditional execution.
20164 This switch is mainly for debugging the compiler and will likely be removed
20165 in a future version.
20167 @item -mvliw-branch
20168 @opindex mvliw-branch
20170 Run a pass to pack branches into VLIW instructions (default).
20172 This switch is mainly for debugging the compiler and will likely be removed
20173 in a future version.
20175 @item -mno-vliw-branch
20176 @opindex mno-vliw-branch
20178 Do not run a pass to pack branches into VLIW instructions.
20180 This switch is mainly for debugging the compiler and will likely be removed
20181 in a future version.
20183 @item -mmulti-cond-exec
20184 @opindex mmulti-cond-exec
20186 Enable optimization of @code{&&} and @code{||} in conditional execution
20189 This switch is mainly for debugging the compiler and will likely be removed
20190 in a future version.
20192 @item -mno-multi-cond-exec
20193 @opindex mno-multi-cond-exec
20195 Disable optimization of @code{&&} and @code{||} in conditional execution.
20197 This switch is mainly for debugging the compiler and will likely be removed
20198 in a future version.
20200 @item -mnested-cond-exec
20201 @opindex mnested-cond-exec
20203 Enable nested conditional execution optimizations (default).
20205 This switch is mainly for debugging the compiler and will likely be removed
20206 in a future version.
20208 @item -mno-nested-cond-exec
20209 @opindex mno-nested-cond-exec
20211 Disable nested conditional execution optimizations.
20213 This switch is mainly for debugging the compiler and will likely be removed
20214 in a future version.
20216 @item -moptimize-membar
20217 @opindex moptimize-membar
20219 This switch removes redundant @code{membar} instructions from the
20220 compiler-generated code. It is enabled by default.
20222 @item -mno-optimize-membar
20223 @opindex mno-optimize-membar
20224 @opindex moptimize-membar
20226 This switch disables the automatic removal of redundant @code{membar}
20227 instructions from the generated code.
20229 @item -mtomcat-stats
20230 @opindex mtomcat-stats
20232 Cause gas to print out tomcat statistics.
20234 @item -mcpu=@var{cpu}
20237 Select the processor type for which to generate code. Possible values are
20238 @samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
20239 @samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
20243 @node GNU/Linux Options
20244 @subsection GNU/Linux Options
20246 These @samp{-m} options are defined for GNU/Linux targets:
20251 Use the GNU C library. This is the default except
20252 on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
20253 @samp{*-*-linux-*android*} targets.
20257 Use uClibc C library. This is the default on
20258 @samp{*-*-linux-*uclibc*} targets.
20262 Use the musl C library. This is the default on
20263 @samp{*-*-linux-*musl*} targets.
20267 Use Bionic C library. This is the default on
20268 @samp{*-*-linux-*android*} targets.
20272 Compile code compatible with Android platform. This is the default on
20273 @samp{*-*-linux-*android*} targets.
20275 When compiling, this option enables @option{-mbionic}, @option{-fPIC},
20276 @option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
20277 this option makes the GCC driver pass Android-specific options to the linker.
20278 Finally, this option causes the preprocessor macro @code{__ANDROID__}
20281 @item -tno-android-cc
20282 @opindex tno-android-cc
20283 Disable compilation effects of @option{-mandroid}, i.e., do not enable
20284 @option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
20285 @option{-fno-rtti} by default.
20287 @item -tno-android-ld
20288 @opindex tno-android-ld
20289 Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
20290 linking options to the linker.
20294 @node H8/300 Options
20295 @subsection H8/300 Options
20297 These @samp{-m} options are defined for the H8/300 implementations:
20302 Shorten some address references at link time, when possible; uses the
20303 linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
20304 ld, Using ld}, for a fuller description.
20308 Generate code for the H8/300H@.
20312 Generate code for the H8S@.
20316 Generate code for the H8S and H8/300H in the normal mode. This switch
20317 must be used either with @option{-mh} or @option{-ms}.
20321 Generate code for the H8S/2600. This switch must be used with @option{-ms}.
20325 Extended registers are stored on stack before execution of function
20326 with monitor attribute. Default option is @option{-mexr}.
20327 This option is valid only for H8S targets.
20332 Extended registers are not stored on stack before execution of function
20333 with monitor attribute. Default option is @option{-mno-exr}.
20334 This option is valid only for H8S targets.
20338 Make @code{int} data 32 bits by default.
20341 @opindex malign-300
20342 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
20343 The default for the H8/300H and H8S is to align longs and floats on
20345 @option{-malign-300} causes them to be aligned on 2-byte boundaries.
20346 This option has no effect on the H8/300.
20350 @subsection HPPA Options
20351 @cindex HPPA Options
20353 These @samp{-m} options are defined for the HPPA family of computers:
20356 @item -march=@var{architecture-type}
20358 Generate code for the specified architecture. The choices for
20359 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
20360 1.1, and @samp{2.0} for PA 2.0 processors. Refer to
20361 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
20362 architecture option for your machine. Code compiled for lower numbered
20363 architectures runs on higher numbered architectures, but not the
20366 @item -mpa-risc-1-0
20367 @itemx -mpa-risc-1-1
20368 @itemx -mpa-risc-2-0
20369 @opindex mpa-risc-1-0
20370 @opindex mpa-risc-1-1
20371 @opindex mpa-risc-2-0
20372 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
20374 @item -mcaller-copies
20375 @opindex mcaller-copies
20376 The caller copies function arguments passed by hidden reference. This
20377 option should be used with care as it is not compatible with the default
20378 32-bit runtime. However, only aggregates larger than eight bytes are
20379 passed by hidden reference and the option provides better compatibility
20382 @item -mjump-in-delay
20383 @opindex mjump-in-delay
20384 This option is ignored and provided for compatibility purposes only.
20386 @item -mdisable-fpregs
20387 @opindex mdisable-fpregs
20388 Prevent floating-point registers from being used in any manner. This is
20389 necessary for compiling kernels that perform lazy context switching of
20390 floating-point registers. If you use this option and attempt to perform
20391 floating-point operations, the compiler aborts.
20393 @item -mdisable-indexing
20394 @opindex mdisable-indexing
20395 Prevent the compiler from using indexing address modes. This avoids some
20396 rather obscure problems when compiling MIG generated code under MACH@.
20398 @item -mno-space-regs
20399 @opindex mno-space-regs
20400 @opindex mspace-regs
20401 Generate code that assumes the target has no space registers. This allows
20402 GCC to generate faster indirect calls and use unscaled index address modes.
20404 Such code is suitable for level 0 PA systems and kernels.
20406 @item -mfast-indirect-calls
20407 @opindex mfast-indirect-calls
20408 Generate code that assumes calls never cross space boundaries. This
20409 allows GCC to emit code that performs faster indirect calls.
20411 This option does not work in the presence of shared libraries or nested
20414 @item -mfixed-range=@var{register-range}
20415 @opindex mfixed-range
20416 Generate code treating the given register range as fixed registers.
20417 A fixed register is one that the register allocator cannot use. This is
20418 useful when compiling kernel code. A register range is specified as
20419 two registers separated by a dash. Multiple register ranges can be
20420 specified separated by a comma.
20422 @item -mlong-load-store
20423 @opindex mlong-load-store
20424 Generate 3-instruction load and store sequences as sometimes required by
20425 the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
20428 @item -mportable-runtime
20429 @opindex mportable-runtime
20430 Use the portable calling conventions proposed by HP for ELF systems.
20434 Enable the use of assembler directives only GAS understands.
20436 @item -mschedule=@var{cpu-type}
20438 Schedule code according to the constraints for the machine type
20439 @var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
20440 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
20441 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
20442 proper scheduling option for your machine. The default scheduling is
20446 @opindex mlinker-opt
20447 Enable the optimization pass in the HP-UX linker. Note this makes symbolic
20448 debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
20449 linkers in which they give bogus error messages when linking some programs.
20452 @opindex msoft-float
20453 Generate output containing library calls for floating point.
20454 @strong{Warning:} the requisite libraries are not available for all HPPA
20455 targets. Normally the facilities of the machine's usual C compiler are
20456 used, but this cannot be done directly in cross-compilation. You must make
20457 your own arrangements to provide suitable library functions for
20460 @option{-msoft-float} changes the calling convention in the output file;
20461 therefore, it is only useful if you compile @emph{all} of a program with
20462 this option. In particular, you need to compile @file{libgcc.a}, the
20463 library that comes with GCC, with @option{-msoft-float} in order for
20468 Generate the predefine, @code{_SIO}, for server IO@. The default is
20469 @option{-mwsio}. This generates the predefines, @code{__hp9000s700},
20470 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
20471 options are available under HP-UX and HI-UX@.
20475 Use options specific to GNU @command{ld}.
20476 This passes @option{-shared} to @command{ld} when
20477 building a shared library. It is the default when GCC is configured,
20478 explicitly or implicitly, with the GNU linker. This option does not
20479 affect which @command{ld} is called; it only changes what parameters
20480 are passed to that @command{ld}.
20481 The @command{ld} that is called is determined by the
20482 @option{--with-ld} configure option, GCC's program search path, and
20483 finally by the user's @env{PATH}. The linker used by GCC can be printed
20484 using @samp{which `gcc -print-prog-name=ld`}. This option is only available
20485 on the 64-bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20489 Use options specific to HP @command{ld}.
20490 This passes @option{-b} to @command{ld} when building
20491 a shared library and passes @option{+Accept TypeMismatch} to @command{ld} on all
20492 links. It is the default when GCC is configured, explicitly or
20493 implicitly, with the HP linker. This option does not affect
20494 which @command{ld} is called; it only changes what parameters are passed to that
20496 The @command{ld} that is called is determined by the @option{--with-ld}
20497 configure option, GCC's program search path, and finally by the user's
20498 @env{PATH}. The linker used by GCC can be printed using @samp{which
20499 `gcc -print-prog-name=ld`}. This option is only available on the 64-bit
20500 HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
20503 @opindex mno-long-calls
20504 @opindex mlong-calls
20505 Generate code that uses long call sequences. This ensures that a call
20506 is always able to reach linker generated stubs. The default is to generate
20507 long calls only when the distance from the call site to the beginning
20508 of the function or translation unit, as the case may be, exceeds a
20509 predefined limit set by the branch type being used. The limits for
20510 normal calls are 7,600,000 and 240,000 bytes, respectively for the
20511 PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
20514 Distances are measured from the beginning of functions when using the
20515 @option{-ffunction-sections} option, or when using the @option{-mgas}
20516 and @option{-mno-portable-runtime} options together under HP-UX with
20519 It is normally not desirable to use this option as it degrades
20520 performance. However, it may be useful in large applications,
20521 particularly when partial linking is used to build the application.
20523 The types of long calls used depends on the capabilities of the
20524 assembler and linker, and the type of code being generated. The
20525 impact on systems that support long absolute calls, and long pic
20526 symbol-difference or pc-relative calls should be relatively small.
20527 However, an indirect call is used on 32-bit ELF systems in pic code
20528 and it is quite long.
20530 @item -munix=@var{unix-std}
20532 Generate compiler predefines and select a startfile for the specified
20533 UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
20534 and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
20535 is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
20536 11.11 and later. The default values are @samp{93} for HP-UX 10.00,
20537 @samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
20540 @option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
20541 @option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
20542 and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
20543 @option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
20544 @code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
20545 @code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
20547 It is @emph{important} to note that this option changes the interfaces
20548 for various library routines. It also affects the operational behavior
20549 of the C library. Thus, @emph{extreme} care is needed in using this
20552 Library code that is intended to operate with more than one UNIX
20553 standard must test, set and restore the variable @code{__xpg4_extended_mask}
20554 as appropriate. Most GNU software doesn't provide this capability.
20558 Suppress the generation of link options to search libdld.sl when the
20559 @option{-static} option is specified on HP-UX 10 and later.
20563 The HP-UX implementation of setlocale in libc has a dependency on
20564 libdld.sl. There isn't an archive version of libdld.sl. Thus,
20565 when the @option{-static} option is specified, special link options
20566 are needed to resolve this dependency.
20568 On HP-UX 10 and later, the GCC driver adds the necessary options to
20569 link with libdld.sl when the @option{-static} option is specified.
20570 This causes the resulting binary to be dynamic. On the 64-bit port,
20571 the linkers generate dynamic binaries by default in any case. The
20572 @option{-nolibdld} option can be used to prevent the GCC driver from
20573 adding these link options.
20577 Add support for multithreading with the @dfn{dce thread} library
20578 under HP-UX@. This option sets flags for both the preprocessor and
20582 @node IA-64 Options
20583 @subsection IA-64 Options
20584 @cindex IA-64 Options
20586 These are the @samp{-m} options defined for the Intel IA-64 architecture.
20590 @opindex mbig-endian
20591 Generate code for a big-endian target. This is the default for HP-UX@.
20593 @item -mlittle-endian
20594 @opindex mlittle-endian
20595 Generate code for a little-endian target. This is the default for AIX5
20601 @opindex mno-gnu-as
20602 Generate (or don't) code for the GNU assembler. This is the default.
20603 @c Also, this is the default if the configure option @option{--with-gnu-as}
20609 @opindex mno-gnu-ld
20610 Generate (or don't) code for the GNU linker. This is the default.
20611 @c Also, this is the default if the configure option @option{--with-gnu-ld}
20616 Generate code that does not use a global pointer register. The result
20617 is not position independent code, and violates the IA-64 ABI@.
20619 @item -mvolatile-asm-stop
20620 @itemx -mno-volatile-asm-stop
20621 @opindex mvolatile-asm-stop
20622 @opindex mno-volatile-asm-stop
20623 Generate (or don't) a stop bit immediately before and after volatile asm
20626 @item -mregister-names
20627 @itemx -mno-register-names
20628 @opindex mregister-names
20629 @opindex mno-register-names
20630 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
20631 the stacked registers. This may make assembler output more readable.
20637 Disable (or enable) optimizations that use the small data section. This may
20638 be useful for working around optimizer bugs.
20640 @item -mconstant-gp
20641 @opindex mconstant-gp
20642 Generate code that uses a single constant global pointer value. This is
20643 useful when compiling kernel code.
20647 Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
20648 This is useful when compiling firmware code.
20650 @item -minline-float-divide-min-latency
20651 @opindex minline-float-divide-min-latency
20652 Generate code for inline divides of floating-point values
20653 using the minimum latency algorithm.
20655 @item -minline-float-divide-max-throughput
20656 @opindex minline-float-divide-max-throughput
20657 Generate code for inline divides of floating-point values
20658 using the maximum throughput algorithm.
20660 @item -mno-inline-float-divide
20661 @opindex mno-inline-float-divide
20662 Do not generate inline code for divides of floating-point values.
20664 @item -minline-int-divide-min-latency
20665 @opindex minline-int-divide-min-latency
20666 Generate code for inline divides of integer values
20667 using the minimum latency algorithm.
20669 @item -minline-int-divide-max-throughput
20670 @opindex minline-int-divide-max-throughput
20671 Generate code for inline divides of integer values
20672 using the maximum throughput algorithm.
20674 @item -mno-inline-int-divide
20675 @opindex mno-inline-int-divide
20676 @opindex minline-int-divide
20677 Do not generate inline code for divides of integer values.
20679 @item -minline-sqrt-min-latency
20680 @opindex minline-sqrt-min-latency
20681 Generate code for inline square roots
20682 using the minimum latency algorithm.
20684 @item -minline-sqrt-max-throughput
20685 @opindex minline-sqrt-max-throughput
20686 Generate code for inline square roots
20687 using the maximum throughput algorithm.
20689 @item -mno-inline-sqrt
20690 @opindex mno-inline-sqrt
20691 Do not generate inline code for @code{sqrt}.
20694 @itemx -mno-fused-madd
20695 @opindex mfused-madd
20696 @opindex mno-fused-madd
20697 Do (don't) generate code that uses the fused multiply/add or multiply/subtract
20698 instructions. The default is to use these instructions.
20700 @item -mno-dwarf2-asm
20701 @itemx -mdwarf2-asm
20702 @opindex mno-dwarf2-asm
20703 @opindex mdwarf2-asm
20704 Don't (or do) generate assembler code for the DWARF line number debugging
20705 info. This may be useful when not using the GNU assembler.
20707 @item -mearly-stop-bits
20708 @itemx -mno-early-stop-bits
20709 @opindex mearly-stop-bits
20710 @opindex mno-early-stop-bits
20711 Allow stop bits to be placed earlier than immediately preceding the
20712 instruction that triggered the stop bit. This can improve instruction
20713 scheduling, but does not always do so.
20715 @item -mfixed-range=@var{register-range}
20716 @opindex mfixed-range
20717 Generate code treating the given register range as fixed registers.
20718 A fixed register is one that the register allocator cannot use. This is
20719 useful when compiling kernel code. A register range is specified as
20720 two registers separated by a dash. Multiple register ranges can be
20721 specified separated by a comma.
20723 @item -mtls-size=@var{tls-size}
20725 Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
20728 @item -mtune=@var{cpu-type}
20730 Tune the instruction scheduling for a particular CPU, Valid values are
20731 @samp{itanium}, @samp{itanium1}, @samp{merced}, @samp{itanium2},
20732 and @samp{mckinley}.
20738 Generate code for a 32-bit or 64-bit environment.
20739 The 32-bit environment sets int, long and pointer to 32 bits.
20740 The 64-bit environment sets int to 32 bits and long and pointer
20741 to 64 bits. These are HP-UX specific flags.
20743 @item -mno-sched-br-data-spec
20744 @itemx -msched-br-data-spec
20745 @opindex mno-sched-br-data-spec
20746 @opindex msched-br-data-spec
20747 (Dis/En)able data speculative scheduling before reload.
20748 This results in generation of @code{ld.a} instructions and
20749 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20750 The default setting is disabled.
20752 @item -msched-ar-data-spec
20753 @itemx -mno-sched-ar-data-spec
20754 @opindex msched-ar-data-spec
20755 @opindex mno-sched-ar-data-spec
20756 (En/Dis)able data speculative scheduling after reload.
20757 This results in generation of @code{ld.a} instructions and
20758 the corresponding check instructions (@code{ld.c} / @code{chk.a}).
20759 The default setting is enabled.
20761 @item -mno-sched-control-spec
20762 @itemx -msched-control-spec
20763 @opindex mno-sched-control-spec
20764 @opindex msched-control-spec
20765 (Dis/En)able control speculative scheduling. This feature is
20766 available only during region scheduling (i.e.@: before reload).
20767 This results in generation of the @code{ld.s} instructions and
20768 the corresponding check instructions @code{chk.s}.
20769 The default setting is disabled.
20771 @item -msched-br-in-data-spec
20772 @itemx -mno-sched-br-in-data-spec
20773 @opindex msched-br-in-data-spec
20774 @opindex mno-sched-br-in-data-spec
20775 (En/Dis)able speculative scheduling of the instructions that
20776 are dependent on the data speculative loads before reload.
20777 This is effective only with @option{-msched-br-data-spec} enabled.
20778 The default setting is enabled.
20780 @item -msched-ar-in-data-spec
20781 @itemx -mno-sched-ar-in-data-spec
20782 @opindex msched-ar-in-data-spec
20783 @opindex mno-sched-ar-in-data-spec
20784 (En/Dis)able speculative scheduling of the instructions that
20785 are dependent on the data speculative loads after reload.
20786 This is effective only with @option{-msched-ar-data-spec} enabled.
20787 The default setting is enabled.
20789 @item -msched-in-control-spec
20790 @itemx -mno-sched-in-control-spec
20791 @opindex msched-in-control-spec
20792 @opindex mno-sched-in-control-spec
20793 (En/Dis)able speculative scheduling of the instructions that
20794 are dependent on the control speculative loads.
20795 This is effective only with @option{-msched-control-spec} enabled.
20796 The default setting is enabled.
20798 @item -mno-sched-prefer-non-data-spec-insns
20799 @itemx -msched-prefer-non-data-spec-insns
20800 @opindex mno-sched-prefer-non-data-spec-insns
20801 @opindex msched-prefer-non-data-spec-insns
20802 If enabled, data-speculative instructions are chosen for schedule
20803 only if there are no other choices at the moment. This makes
20804 the use of the data speculation much more conservative.
20805 The default setting is disabled.
20807 @item -mno-sched-prefer-non-control-spec-insns
20808 @itemx -msched-prefer-non-control-spec-insns
20809 @opindex mno-sched-prefer-non-control-spec-insns
20810 @opindex msched-prefer-non-control-spec-insns
20811 If enabled, control-speculative instructions are chosen for schedule
20812 only if there are no other choices at the moment. This makes
20813 the use of the control speculation much more conservative.
20814 The default setting is disabled.
20816 @item -mno-sched-count-spec-in-critical-path
20817 @itemx -msched-count-spec-in-critical-path
20818 @opindex mno-sched-count-spec-in-critical-path
20819 @opindex msched-count-spec-in-critical-path
20820 If enabled, speculative dependencies are considered during
20821 computation of the instructions priorities. This makes the use of the
20822 speculation a bit more conservative.
20823 The default setting is disabled.
20825 @item -msched-spec-ldc
20826 @opindex msched-spec-ldc
20827 Use a simple data speculation check. This option is on by default.
20829 @item -msched-control-spec-ldc
20830 @opindex msched-spec-ldc
20831 Use a simple check for control speculation. This option is on by default.
20833 @item -msched-stop-bits-after-every-cycle
20834 @opindex msched-stop-bits-after-every-cycle
20835 Place a stop bit after every cycle when scheduling. This option is on
20838 @item -msched-fp-mem-deps-zero-cost
20839 @opindex msched-fp-mem-deps-zero-cost
20840 Assume that floating-point stores and loads are not likely to cause a conflict
20841 when placed into the same instruction group. This option is disabled by
20844 @item -msel-sched-dont-check-control-spec
20845 @opindex msel-sched-dont-check-control-spec
20846 Generate checks for control speculation in selective scheduling.
20847 This flag is disabled by default.
20849 @item -msched-max-memory-insns=@var{max-insns}
20850 @opindex msched-max-memory-insns
20851 Limit on the number of memory insns per instruction group, giving lower
20852 priority to subsequent memory insns attempting to schedule in the same
20853 instruction group. Frequently useful to prevent cache bank conflicts.
20854 The default value is 1.
20856 @item -msched-max-memory-insns-hard-limit
20857 @opindex msched-max-memory-insns-hard-limit
20858 Makes the limit specified by @option{msched-max-memory-insns} a hard limit,
20859 disallowing more than that number in an instruction group.
20860 Otherwise, the limit is ``soft'', meaning that non-memory operations
20861 are preferred when the limit is reached, but memory operations may still
20867 @subsection LM32 Options
20868 @cindex LM32 options
20870 These @option{-m} options are defined for the LatticeMico32 architecture:
20873 @item -mbarrel-shift-enabled
20874 @opindex mbarrel-shift-enabled
20875 Enable barrel-shift instructions.
20877 @item -mdivide-enabled
20878 @opindex mdivide-enabled
20879 Enable divide and modulus instructions.
20881 @item -mmultiply-enabled
20882 @opindex multiply-enabled
20883 Enable multiply instructions.
20885 @item -msign-extend-enabled
20886 @opindex msign-extend-enabled
20887 Enable sign extend instructions.
20889 @item -muser-enabled
20890 @opindex muser-enabled
20891 Enable user-defined instructions.
20896 @subsection M32C Options
20897 @cindex M32C options
20900 @item -mcpu=@var{name}
20902 Select the CPU for which code is generated. @var{name} may be one of
20903 @samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
20904 /60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
20905 the M32C/80 series.
20909 Specifies that the program will be run on the simulator. This causes
20910 an alternate runtime library to be linked in which supports, for
20911 example, file I/O@. You must not use this option when generating
20912 programs that will run on real hardware; you must provide your own
20913 runtime library for whatever I/O functions are needed.
20915 @item -memregs=@var{number}
20917 Specifies the number of memory-based pseudo-registers GCC uses
20918 during code generation. These pseudo-registers are used like real
20919 registers, so there is a tradeoff between GCC's ability to fit the
20920 code into available registers, and the performance penalty of using
20921 memory instead of registers. Note that all modules in a program must
20922 be compiled with the same value for this option. Because of that, you
20923 must not use this option with GCC's default runtime libraries.
20927 @node M32R/D Options
20928 @subsection M32R/D Options
20929 @cindex M32R/D options
20931 These @option{-m} options are defined for Renesas M32R/D architectures:
20936 Generate code for the M32R/2@.
20940 Generate code for the M32R/X@.
20944 Generate code for the M32R@. This is the default.
20946 @item -mmodel=small
20947 @opindex mmodel=small
20948 Assume all objects live in the lower 16MB of memory (so that their addresses
20949 can be loaded with the @code{ld24} instruction), and assume all subroutines
20950 are reachable with the @code{bl} instruction.
20951 This is the default.
20953 The addressability of a particular object can be set with the
20954 @code{model} attribute.
20956 @item -mmodel=medium
20957 @opindex mmodel=medium
20958 Assume objects may be anywhere in the 32-bit address space (the compiler
20959 generates @code{seth/add3} instructions to load their addresses), and
20960 assume all subroutines are reachable with the @code{bl} instruction.
20962 @item -mmodel=large
20963 @opindex mmodel=large
20964 Assume objects may be anywhere in the 32-bit address space (the compiler
20965 generates @code{seth/add3} instructions to load their addresses), and
20966 assume subroutines may not be reachable with the @code{bl} instruction
20967 (the compiler generates the much slower @code{seth/add3/jl}
20968 instruction sequence).
20971 @opindex msdata=none
20972 Disable use of the small data area. Variables are put into
20973 one of @code{.data}, @code{.bss}, or @code{.rodata} (unless the
20974 @code{section} attribute has been specified).
20975 This is the default.
20977 The small data area consists of sections @code{.sdata} and @code{.sbss}.
20978 Objects may be explicitly put in the small data area with the
20979 @code{section} attribute using one of these sections.
20981 @item -msdata=sdata
20982 @opindex msdata=sdata
20983 Put small global and static data in the small data area, but do not
20984 generate special code to reference them.
20987 @opindex msdata=use
20988 Put small global and static data in the small data area, and generate
20989 special instructions to reference them.
20993 @cindex smaller data references
20994 Put global and static objects less than or equal to @var{num} bytes
20995 into the small data or BSS sections instead of the normal data or BSS
20996 sections. The default value of @var{num} is 8.
20997 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
20998 for this option to have any effect.
21000 All modules should be compiled with the same @option{-G @var{num}} value.
21001 Compiling with different values of @var{num} may or may not work; if it
21002 doesn't the linker gives an error message---incorrect code is not
21007 Makes the M32R-specific code in the compiler display some statistics
21008 that might help in debugging programs.
21010 @item -malign-loops
21011 @opindex malign-loops
21012 Align all loops to a 32-byte boundary.
21014 @item -mno-align-loops
21015 @opindex mno-align-loops
21016 Do not enforce a 32-byte alignment for loops. This is the default.
21018 @item -missue-rate=@var{number}
21019 @opindex missue-rate=@var{number}
21020 Issue @var{number} instructions per cycle. @var{number} can only be 1
21023 @item -mbranch-cost=@var{number}
21024 @opindex mbranch-cost=@var{number}
21025 @var{number} can only be 1 or 2. If it is 1 then branches are
21026 preferred over conditional code, if it is 2, then the opposite applies.
21028 @item -mflush-trap=@var{number}
21029 @opindex mflush-trap=@var{number}
21030 Specifies the trap number to use to flush the cache. The default is
21031 12. Valid numbers are between 0 and 15 inclusive.
21033 @item -mno-flush-trap
21034 @opindex mno-flush-trap
21035 Specifies that the cache cannot be flushed by using a trap.
21037 @item -mflush-func=@var{name}
21038 @opindex mflush-func=@var{name}
21039 Specifies the name of the operating system function to call to flush
21040 the cache. The default is @samp{_flush_cache}, but a function call
21041 is only used if a trap is not available.
21043 @item -mno-flush-func
21044 @opindex mno-flush-func
21045 Indicates that there is no OS function for flushing the cache.
21049 @node M680x0 Options
21050 @subsection M680x0 Options
21051 @cindex M680x0 options
21053 These are the @samp{-m} options defined for M680x0 and ColdFire processors.
21054 The default settings depend on which architecture was selected when
21055 the compiler was configured; the defaults for the most common choices
21059 @item -march=@var{arch}
21061 Generate code for a specific M680x0 or ColdFire instruction set
21062 architecture. Permissible values of @var{arch} for M680x0
21063 architectures are: @samp{68000}, @samp{68010}, @samp{68020},
21064 @samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
21065 architectures are selected according to Freescale's ISA classification
21066 and the permissible values are: @samp{isaa}, @samp{isaaplus},
21067 @samp{isab} and @samp{isac}.
21069 GCC defines a macro @code{__mcf@var{arch}__} whenever it is generating
21070 code for a ColdFire target. The @var{arch} in this macro is one of the
21071 @option{-march} arguments given above.
21073 When used together, @option{-march} and @option{-mtune} select code
21074 that runs on a family of similar processors but that is optimized
21075 for a particular microarchitecture.
21077 @item -mcpu=@var{cpu}
21079 Generate code for a specific M680x0 or ColdFire processor.
21080 The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
21081 @samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
21082 and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
21083 below, which also classifies the CPUs into families:
21085 @multitable @columnfractions 0.20 0.80
21086 @item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
21087 @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}
21088 @item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
21089 @item @samp{5206e} @tab @samp{5206e}
21090 @item @samp{5208} @tab @samp{5207} @samp{5208}
21091 @item @samp{5211a} @tab @samp{5210a} @samp{5211a}
21092 @item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
21093 @item @samp{5216} @tab @samp{5214} @samp{5216}
21094 @item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
21095 @item @samp{5225} @tab @samp{5224} @samp{5225}
21096 @item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
21097 @item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
21098 @item @samp{5249} @tab @samp{5249}
21099 @item @samp{5250} @tab @samp{5250}
21100 @item @samp{5271} @tab @samp{5270} @samp{5271}
21101 @item @samp{5272} @tab @samp{5272}
21102 @item @samp{5275} @tab @samp{5274} @samp{5275}
21103 @item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
21104 @item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
21105 @item @samp{5307} @tab @samp{5307}
21106 @item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
21107 @item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
21108 @item @samp{5407} @tab @samp{5407}
21109 @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}
21112 @option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
21113 @var{arch} is compatible with @var{cpu}. Other combinations of
21114 @option{-mcpu} and @option{-march} are rejected.
21116 GCC defines the macro @code{__mcf_cpu_@var{cpu}} when ColdFire target
21117 @var{cpu} is selected. It also defines @code{__mcf_family_@var{family}},
21118 where the value of @var{family} is given by the table above.
21120 @item -mtune=@var{tune}
21122 Tune the code for a particular microarchitecture within the
21123 constraints set by @option{-march} and @option{-mcpu}.
21124 The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
21125 @samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
21126 and @samp{cpu32}. The ColdFire microarchitectures
21127 are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
21129 You can also use @option{-mtune=68020-40} for code that needs
21130 to run relatively well on 68020, 68030 and 68040 targets.
21131 @option{-mtune=68020-60} is similar but includes 68060 targets
21132 as well. These two options select the same tuning decisions as
21133 @option{-m68020-40} and @option{-m68020-60} respectively.
21135 GCC defines the macros @code{__mc@var{arch}} and @code{__mc@var{arch}__}
21136 when tuning for 680x0 architecture @var{arch}. It also defines
21137 @code{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
21138 option is used. If GCC is tuning for a range of architectures,
21139 as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
21140 it defines the macros for every architecture in the range.
21142 GCC also defines the macro @code{__m@var{uarch}__} when tuning for
21143 ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
21144 of the arguments given above.
21150 Generate output for a 68000. This is the default
21151 when the compiler is configured for 68000-based systems.
21152 It is equivalent to @option{-march=68000}.
21154 Use this option for microcontrollers with a 68000 or EC000 core,
21155 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
21159 Generate output for a 68010. This is the default
21160 when the compiler is configured for 68010-based systems.
21161 It is equivalent to @option{-march=68010}.
21167 Generate output for a 68020. This is the default
21168 when the compiler is configured for 68020-based systems.
21169 It is equivalent to @option{-march=68020}.
21173 Generate output for a 68030. This is the default when the compiler is
21174 configured for 68030-based systems. It is equivalent to
21175 @option{-march=68030}.
21179 Generate output for a 68040. This is the default when the compiler is
21180 configured for 68040-based systems. It is equivalent to
21181 @option{-march=68040}.
21183 This option inhibits the use of 68881/68882 instructions that have to be
21184 emulated by software on the 68040. Use this option if your 68040 does not
21185 have code to emulate those instructions.
21189 Generate output for a 68060. This is the default when the compiler is
21190 configured for 68060-based systems. It is equivalent to
21191 @option{-march=68060}.
21193 This option inhibits the use of 68020 and 68881/68882 instructions that
21194 have to be emulated by software on the 68060. Use this option if your 68060
21195 does not have code to emulate those instructions.
21199 Generate output for a CPU32. This is the default
21200 when the compiler is configured for CPU32-based systems.
21201 It is equivalent to @option{-march=cpu32}.
21203 Use this option for microcontrollers with a
21204 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
21205 68336, 68340, 68341, 68349 and 68360.
21209 Generate output for a 520X ColdFire CPU@. This is the default
21210 when the compiler is configured for 520X-based systems.
21211 It is equivalent to @option{-mcpu=5206}, and is now deprecated
21212 in favor of that option.
21214 Use this option for microcontroller with a 5200 core, including
21215 the MCF5202, MCF5203, MCF5204 and MCF5206.
21219 Generate output for a 5206e ColdFire CPU@. The option is now
21220 deprecated in favor of the equivalent @option{-mcpu=5206e}.
21224 Generate output for a member of the ColdFire 528X family.
21225 The option is now deprecated in favor of the equivalent
21226 @option{-mcpu=528x}.
21230 Generate output for a ColdFire 5307 CPU@. The option is now deprecated
21231 in favor of the equivalent @option{-mcpu=5307}.
21235 Generate output for a ColdFire 5407 CPU@. The option is now deprecated
21236 in favor of the equivalent @option{-mcpu=5407}.
21240 Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
21241 This includes use of hardware floating-point instructions.
21242 The option is equivalent to @option{-mcpu=547x}, and is now
21243 deprecated in favor of that option.
21247 Generate output for a 68040, without using any of the new instructions.
21248 This results in code that can run relatively efficiently on either a
21249 68020/68881 or a 68030 or a 68040. The generated code does use the
21250 68881 instructions that are emulated on the 68040.
21252 The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
21256 Generate output for a 68060, without using any of the new instructions.
21257 This results in code that can run relatively efficiently on either a
21258 68020/68881 or a 68030 or a 68040. The generated code does use the
21259 68881 instructions that are emulated on the 68060.
21261 The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
21265 @opindex mhard-float
21267 Generate floating-point instructions. This is the default for 68020
21268 and above, and for ColdFire devices that have an FPU@. It defines the
21269 macro @code{__HAVE_68881__} on M680x0 targets and @code{__mcffpu__}
21270 on ColdFire targets.
21273 @opindex msoft-float
21274 Do not generate floating-point instructions; use library calls instead.
21275 This is the default for 68000, 68010, and 68832 targets. It is also
21276 the default for ColdFire devices that have no FPU.
21282 Generate (do not generate) ColdFire hardware divide and remainder
21283 instructions. If @option{-march} is used without @option{-mcpu},
21284 the default is ``on'' for ColdFire architectures and ``off'' for M680x0
21285 architectures. Otherwise, the default is taken from the target CPU
21286 (either the default CPU, or the one specified by @option{-mcpu}). For
21287 example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
21288 @option{-mcpu=5206e}.
21290 GCC defines the macro @code{__mcfhwdiv__} when this option is enabled.
21294 Consider type @code{int} to be 16 bits wide, like @code{short int}.
21295 Additionally, parameters passed on the stack are also aligned to a
21296 16-bit boundary even on targets whose API mandates promotion to 32-bit.
21300 Do not consider type @code{int} to be 16 bits wide. This is the default.
21303 @itemx -mno-bitfield
21304 @opindex mnobitfield
21305 @opindex mno-bitfield
21306 Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
21307 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
21311 Do use the bit-field instructions. The @option{-m68020} option implies
21312 @option{-mbitfield}. This is the default if you use a configuration
21313 designed for a 68020.
21317 Use a different function-calling convention, in which functions
21318 that take a fixed number of arguments return with the @code{rtd}
21319 instruction, which pops their arguments while returning. This
21320 saves one instruction in the caller since there is no need to pop
21321 the arguments there.
21323 This calling convention is incompatible with the one normally
21324 used on Unix, so you cannot use it if you need to call libraries
21325 compiled with the Unix compiler.
21327 Also, you must provide function prototypes for all functions that
21328 take variable numbers of arguments (including @code{printf});
21329 otherwise incorrect code is generated for calls to those
21332 In addition, seriously incorrect code results if you call a
21333 function with too many arguments. (Normally, extra arguments are
21334 harmlessly ignored.)
21336 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
21337 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
21339 The default is @option{-mno-rtd}.
21342 @itemx -mno-align-int
21343 @opindex malign-int
21344 @opindex mno-align-int
21345 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
21346 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
21347 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
21348 Aligning variables on 32-bit boundaries produces code that runs somewhat
21349 faster on processors with 32-bit busses at the expense of more memory.
21351 @strong{Warning:} if you use the @option{-malign-int} switch, GCC
21352 aligns structures containing the above types differently than
21353 most published application binary interface specifications for the m68k.
21357 Use the pc-relative addressing mode of the 68000 directly, instead of
21358 using a global offset table. At present, this option implies @option{-fpic},
21359 allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
21360 not presently supported with @option{-mpcrel}, though this could be supported for
21361 68020 and higher processors.
21363 @item -mno-strict-align
21364 @itemx -mstrict-align
21365 @opindex mno-strict-align
21366 @opindex mstrict-align
21367 Do not (do) assume that unaligned memory references are handled by
21371 Generate code that allows the data segment to be located in a different
21372 area of memory from the text segment. This allows for execute-in-place in
21373 an environment without virtual memory management. This option implies
21376 @item -mno-sep-data
21377 Generate code that assumes that the data segment follows the text segment.
21378 This is the default.
21380 @item -mid-shared-library
21381 Generate code that supports shared libraries via the library ID method.
21382 This allows for execute-in-place and shared libraries in an environment
21383 without virtual memory management. This option implies @option{-fPIC}.
21385 @item -mno-id-shared-library
21386 Generate code that doesn't assume ID-based shared libraries are being used.
21387 This is the default.
21389 @item -mshared-library-id=n
21390 Specifies the identification number of the ID-based shared library being
21391 compiled. Specifying a value of 0 generates more compact code; specifying
21392 other values forces the allocation of that number to the current
21393 library, but is no more space- or time-efficient than omitting this option.
21399 When generating position-independent code for ColdFire, generate code
21400 that works if the GOT has more than 8192 entries. This code is
21401 larger and slower than code generated without this option. On M680x0
21402 processors, this option is not needed; @option{-fPIC} suffices.
21404 GCC normally uses a single instruction to load values from the GOT@.
21405 While this is relatively efficient, it only works if the GOT
21406 is smaller than about 64k. Anything larger causes the linker
21407 to report an error such as:
21409 @cindex relocation truncated to fit (ColdFire)
21411 relocation truncated to fit: R_68K_GOT16O foobar
21414 If this happens, you should recompile your code with @option{-mxgot}.
21415 It should then work with very large GOTs. However, code generated with
21416 @option{-mxgot} is less efficient, since it takes 4 instructions to fetch
21417 the value of a global symbol.
21419 Note that some linkers, including newer versions of the GNU linker,
21420 can create multiple GOTs and sort GOT entries. If you have such a linker,
21421 you should only need to use @option{-mxgot} when compiling a single
21422 object file that accesses more than 8192 GOT entries. Very few do.
21424 These options have no effect unless GCC is generating
21425 position-independent code.
21427 @item -mlong-jump-table-offsets
21428 @opindex mlong-jump-table-offsets
21429 Use 32-bit offsets in @code{switch} tables. The default is to use
21434 @node MCore Options
21435 @subsection MCore Options
21436 @cindex MCore options
21438 These are the @samp{-m} options defined for the Motorola M*Core
21444 @itemx -mno-hardlit
21446 @opindex mno-hardlit
21447 Inline constants into the code stream if it can be done in two
21448 instructions or less.
21454 Use the divide instruction. (Enabled by default).
21456 @item -mrelax-immediate
21457 @itemx -mno-relax-immediate
21458 @opindex mrelax-immediate
21459 @opindex mno-relax-immediate
21460 Allow arbitrary-sized immediates in bit operations.
21462 @item -mwide-bitfields
21463 @itemx -mno-wide-bitfields
21464 @opindex mwide-bitfields
21465 @opindex mno-wide-bitfields
21466 Always treat bit-fields as @code{int}-sized.
21468 @item -m4byte-functions
21469 @itemx -mno-4byte-functions
21470 @opindex m4byte-functions
21471 @opindex mno-4byte-functions
21472 Force all functions to be aligned to a 4-byte boundary.
21474 @item -mcallgraph-data
21475 @itemx -mno-callgraph-data
21476 @opindex mcallgraph-data
21477 @opindex mno-callgraph-data
21478 Emit callgraph information.
21481 @itemx -mno-slow-bytes
21482 @opindex mslow-bytes
21483 @opindex mno-slow-bytes
21484 Prefer word access when reading byte quantities.
21486 @item -mlittle-endian
21487 @itemx -mbig-endian
21488 @opindex mlittle-endian
21489 @opindex mbig-endian
21490 Generate code for a little-endian target.
21496 Generate code for the 210 processor.
21500 Assume that runtime support has been provided and so omit the
21501 simulator library (@file{libsim.a)} from the linker command line.
21503 @item -mstack-increment=@var{size}
21504 @opindex mstack-increment
21505 Set the maximum amount for a single stack increment operation. Large
21506 values can increase the speed of programs that contain functions
21507 that need a large amount of stack space, but they can also trigger a
21508 segmentation fault if the stack is extended too much. The default
21514 @subsection MeP Options
21515 @cindex MeP options
21521 Enables the @code{abs} instruction, which is the absolute difference
21522 between two registers.
21526 Enables all the optional instructions---average, multiply, divide, bit
21527 operations, leading zero, absolute difference, min/max, clip, and
21533 Enables the @code{ave} instruction, which computes the average of two
21536 @item -mbased=@var{n}
21538 Variables of size @var{n} bytes or smaller are placed in the
21539 @code{.based} section by default. Based variables use the @code{$tp}
21540 register as a base register, and there is a 128-byte limit to the
21541 @code{.based} section.
21545 Enables the bit operation instructions---bit test (@code{btstm}), set
21546 (@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
21547 test-and-set (@code{tas}).
21549 @item -mc=@var{name}
21551 Selects which section constant data is placed in. @var{name} may
21552 be @samp{tiny}, @samp{near}, or @samp{far}.
21556 Enables the @code{clip} instruction. Note that @option{-mclip} is not
21557 useful unless you also provide @option{-mminmax}.
21559 @item -mconfig=@var{name}
21561 Selects one of the built-in core configurations. Each MeP chip has
21562 one or more modules in it; each module has a core CPU and a variety of
21563 coprocessors, optional instructions, and peripherals. The
21564 @code{MeP-Integrator} tool, not part of GCC, provides these
21565 configurations through this option; using this option is the same as
21566 using all the corresponding command-line options. The default
21567 configuration is @samp{default}.
21571 Enables the coprocessor instructions. By default, this is a 32-bit
21572 coprocessor. Note that the coprocessor is normally enabled via the
21573 @option{-mconfig=} option.
21577 Enables the 32-bit coprocessor's instructions.
21581 Enables the 64-bit coprocessor's instructions.
21585 Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
21589 Causes constant variables to be placed in the @code{.near} section.
21593 Enables the @code{div} and @code{divu} instructions.
21597 Generate big-endian code.
21601 Generate little-endian code.
21603 @item -mio-volatile
21604 @opindex mio-volatile
21605 Tells the compiler that any variable marked with the @code{io}
21606 attribute is to be considered volatile.
21610 Causes variables to be assigned to the @code{.far} section by default.
21614 Enables the @code{leadz} (leading zero) instruction.
21618 Causes variables to be assigned to the @code{.near} section by default.
21622 Enables the @code{min} and @code{max} instructions.
21626 Enables the multiplication and multiply-accumulate instructions.
21630 Disables all the optional instructions enabled by @option{-mall-opts}.
21634 Enables the @code{repeat} and @code{erepeat} instructions, used for
21635 low-overhead looping.
21639 Causes all variables to default to the @code{.tiny} section. Note
21640 that there is a 65536-byte limit to this section. Accesses to these
21641 variables use the @code{%gp} base register.
21645 Enables the saturation instructions. Note that the compiler does not
21646 currently generate these itself, but this option is included for
21647 compatibility with other tools, like @code{as}.
21651 Link the SDRAM-based runtime instead of the default ROM-based runtime.
21655 Link the simulator run-time libraries.
21659 Link the simulator runtime libraries, excluding built-in support
21660 for reset and exception vectors and tables.
21664 Causes all functions to default to the @code{.far} section. Without
21665 this option, functions default to the @code{.near} section.
21667 @item -mtiny=@var{n}
21669 Variables that are @var{n} bytes or smaller are allocated to the
21670 @code{.tiny} section. These variables use the @code{$gp} base
21671 register. The default for this option is 4, but note that there's a
21672 65536-byte limit to the @code{.tiny} section.
21676 @node MicroBlaze Options
21677 @subsection MicroBlaze Options
21678 @cindex MicroBlaze Options
21683 @opindex msoft-float
21684 Use software emulation for floating point (default).
21687 @opindex mhard-float
21688 Use hardware floating-point instructions.
21692 Do not optimize block moves, use @code{memcpy}.
21694 @item -mno-clearbss
21695 @opindex mno-clearbss
21696 This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
21698 @item -mcpu=@var{cpu-type}
21700 Use features of, and schedule code for, the given CPU.
21701 Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
21702 where @var{X} is a major version, @var{YY} is the minor version, and
21703 @var{Z} is compatibility code. Example values are @samp{v3.00.a},
21704 @samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v6.00.a}.
21706 @item -mxl-soft-mul
21707 @opindex mxl-soft-mul
21708 Use software multiply emulation (default).
21710 @item -mxl-soft-div
21711 @opindex mxl-soft-div
21712 Use software emulation for divides (default).
21714 @item -mxl-barrel-shift
21715 @opindex mxl-barrel-shift
21716 Use the hardware barrel shifter.
21718 @item -mxl-pattern-compare
21719 @opindex mxl-pattern-compare
21720 Use pattern compare instructions.
21722 @item -msmall-divides
21723 @opindex msmall-divides
21724 Use table lookup optimization for small signed integer divisions.
21726 @item -mxl-stack-check
21727 @opindex mxl-stack-check
21728 This option is deprecated. Use @option{-fstack-check} instead.
21731 @opindex mxl-gp-opt
21732 Use GP-relative @code{.sdata}/@code{.sbss} sections.
21734 @item -mxl-multiply-high
21735 @opindex mxl-multiply-high
21736 Use multiply high instructions for high part of 32x32 multiply.
21738 @item -mxl-float-convert
21739 @opindex mxl-float-convert
21740 Use hardware floating-point conversion instructions.
21742 @item -mxl-float-sqrt
21743 @opindex mxl-float-sqrt
21744 Use hardware floating-point square root instruction.
21747 @opindex mbig-endian
21748 Generate code for a big-endian target.
21750 @item -mlittle-endian
21751 @opindex mlittle-endian
21752 Generate code for a little-endian target.
21755 @opindex mxl-reorder
21756 Use reorder instructions (swap and byte reversed load/store).
21758 @item -mxl-mode-@var{app-model}
21759 Select application model @var{app-model}. Valid models are
21762 normal executable (default), uses startup code @file{crt0.o}.
21764 @item -mpic-data-is-text-relative
21765 @opindex mpic-data-is-text-relative
21766 Assume that the displacement between the text and data segments is fixed
21767 at static link time. This allows data to be referenced by offset from start of
21768 text address instead of GOT since PC-relative addressing is not supported.
21771 for use with Xilinx Microprocessor Debugger (XMD) based
21772 software intrusive debug agent called xmdstub. This uses startup file
21773 @file{crt1.o} and sets the start address of the program to 0x800.
21776 for applications that are loaded using a bootloader.
21777 This model uses startup file @file{crt2.o} which does not contain a processor
21778 reset vector handler. This is suitable for transferring control on a
21779 processor reset to the bootloader rather than the application.
21782 for applications that do not require any of the
21783 MicroBlaze vectors. This option may be useful for applications running
21784 within a monitoring application. This model uses @file{crt3.o} as a startup file.
21787 Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
21788 @option{-mxl-mode-@var{app-model}}.
21793 @subsection MIPS Options
21794 @cindex MIPS options
21800 Generate big-endian code.
21804 Generate little-endian code. This is the default for @samp{mips*el-*-*}
21807 @item -march=@var{arch}
21809 Generate code that runs on @var{arch}, which can be the name of a
21810 generic MIPS ISA, or the name of a particular processor.
21812 @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
21813 @samp{mips32}, @samp{mips32r2}, @samp{mips32r3}, @samp{mips32r5},
21814 @samp{mips32r6}, @samp{mips64}, @samp{mips64r2}, @samp{mips64r3},
21815 @samp{mips64r5} and @samp{mips64r6}.
21816 The processor names are:
21817 @samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
21818 @samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
21819 @samp{5kc}, @samp{5kf},
21821 @samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
21822 @samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
21823 @samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1}, @samp{34kn},
21824 @samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
21825 @samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
21826 @samp{i6400}, @samp{i6500},
21828 @samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a}, @samp{gs464},
21829 @samp{gs464e}, @samp{gs264e},
21831 @samp{m14k}, @samp{m14kc}, @samp{m14ke}, @samp{m14kec},
21832 @samp{m5100}, @samp{m5101},
21833 @samp{octeon}, @samp{octeon+}, @samp{octeon2}, @samp{octeon3},
21835 @samp{p5600}, @samp{p6600},
21836 @samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
21837 @samp{r4600}, @samp{r4650}, @samp{r4700}, @samp{r5900},
21838 @samp{r6000}, @samp{r8000},
21839 @samp{rm7000}, @samp{rm9000},
21840 @samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
21843 @samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
21844 @samp{vr5000}, @samp{vr5400}, @samp{vr5500},
21845 @samp{xlr} and @samp{xlp}.
21846 The special value @samp{from-abi} selects the
21847 most compatible architecture for the selected ABI (that is,
21848 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
21850 The native Linux/GNU toolchain also supports the value @samp{native},
21851 which selects the best architecture option for the host processor.
21852 @option{-march=native} has no effect if GCC does not recognize
21855 In processor names, a final @samp{000} can be abbreviated as @samp{k}
21856 (for example, @option{-march=r2k}). Prefixes are optional, and
21857 @samp{vr} may be written @samp{r}.
21859 Names of the form @samp{@var{n}f2_1} refer to processors with
21860 FPUs clocked at half the rate of the core, names of the form
21861 @samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
21862 rate as the core, and names of the form @samp{@var{n}f3_2} refer to
21863 processors with FPUs clocked a ratio of 3:2 with respect to the core.
21864 For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
21865 for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
21866 accepted as synonyms for @samp{@var{n}f1_1}.
21868 GCC defines two macros based on the value of this option. The first
21869 is @code{_MIPS_ARCH}, which gives the name of target architecture, as
21870 a string. The second has the form @code{_MIPS_ARCH_@var{foo}},
21871 where @var{foo} is the capitalized value of @code{_MIPS_ARCH}@.
21872 For example, @option{-march=r2000} sets @code{_MIPS_ARCH}
21873 to @code{"r2000"} and defines the macro @code{_MIPS_ARCH_R2000}.
21875 Note that the @code{_MIPS_ARCH} macro uses the processor names given
21876 above. In other words, it has the full prefix and does not
21877 abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
21878 the macro names the resolved architecture (either @code{"mips1"} or
21879 @code{"mips3"}). It names the default architecture when no
21880 @option{-march} option is given.
21882 @item -mtune=@var{arch}
21884 Optimize for @var{arch}. Among other things, this option controls
21885 the way instructions are scheduled, and the perceived cost of arithmetic
21886 operations. The list of @var{arch} values is the same as for
21889 When this option is not used, GCC optimizes for the processor
21890 specified by @option{-march}. By using @option{-march} and
21891 @option{-mtune} together, it is possible to generate code that
21892 runs on a family of processors, but optimize the code for one
21893 particular member of that family.
21895 @option{-mtune} defines the macros @code{_MIPS_TUNE} and
21896 @code{_MIPS_TUNE_@var{foo}}, which work in the same way as the
21897 @option{-march} ones described above.
21901 Equivalent to @option{-march=mips1}.
21905 Equivalent to @option{-march=mips2}.
21909 Equivalent to @option{-march=mips3}.
21913 Equivalent to @option{-march=mips4}.
21917 Equivalent to @option{-march=mips32}.
21921 Equivalent to @option{-march=mips32r3}.
21925 Equivalent to @option{-march=mips32r5}.
21929 Equivalent to @option{-march=mips32r6}.
21933 Equivalent to @option{-march=mips64}.
21937 Equivalent to @option{-march=mips64r2}.
21941 Equivalent to @option{-march=mips64r3}.
21945 Equivalent to @option{-march=mips64r5}.
21949 Equivalent to @option{-march=mips64r6}.
21954 @opindex mno-mips16
21955 Generate (do not generate) MIPS16 code. If GCC is targeting a
21956 MIPS32 or MIPS64 architecture, it makes use of the MIPS16e ASE@.
21958 MIPS16 code generation can also be controlled on a per-function basis
21959 by means of @code{mips16} and @code{nomips16} attributes.
21960 @xref{Function Attributes}, for more information.
21962 @item -mflip-mips16
21963 @opindex mflip-mips16
21964 Generate MIPS16 code on alternating functions. This option is provided
21965 for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
21966 not intended for ordinary use in compiling user code.
21968 @item -minterlink-compressed
21969 @itemx -mno-interlink-compressed
21970 @opindex minterlink-compressed
21971 @opindex mno-interlink-compressed
21972 Require (do not require) that code using the standard (uncompressed) MIPS ISA
21973 be link-compatible with MIPS16 and microMIPS code, and vice versa.
21975 For example, code using the standard ISA encoding cannot jump directly
21976 to MIPS16 or microMIPS code; it must either use a call or an indirect jump.
21977 @option{-minterlink-compressed} therefore disables direct jumps unless GCC
21978 knows that the target of the jump is not compressed.
21980 @item -minterlink-mips16
21981 @itemx -mno-interlink-mips16
21982 @opindex minterlink-mips16
21983 @opindex mno-interlink-mips16
21984 Aliases of @option{-minterlink-compressed} and
21985 @option{-mno-interlink-compressed}. These options predate the microMIPS ASE
21986 and are retained for backwards compatibility.
21998 Generate code for the given ABI@.
22000 Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
22001 generates 64-bit code when you select a 64-bit architecture, but you
22002 can use @option{-mgp32} to get 32-bit code instead.
22004 For information about the O64 ABI, see
22005 @uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
22007 GCC supports a variant of the o32 ABI in which floating-point registers
22008 are 64 rather than 32 bits wide. You can select this combination with
22009 @option{-mabi=32} @option{-mfp64}. This ABI relies on the @code{mthc1}
22010 and @code{mfhc1} instructions and is therefore only supported for
22011 MIPS32R2, MIPS32R3 and MIPS32R5 processors.
22013 The register assignments for arguments and return values remain the
22014 same, but each scalar value is passed in a single 64-bit register
22015 rather than a pair of 32-bit registers. For example, scalar
22016 floating-point values are returned in @samp{$f0} only, not a
22017 @samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
22018 remains the same in that the even-numbered double-precision registers
22021 Two additional variants of the o32 ABI are supported to enable
22022 a transition from 32-bit to 64-bit registers. These are FPXX
22023 (@option{-mfpxx}) and FP64A (@option{-mfp64} @option{-mno-odd-spreg}).
22024 The FPXX extension mandates that all code must execute correctly
22025 when run using 32-bit or 64-bit registers. The code can be interlinked
22026 with either FP32 or FP64, but not both.
22027 The FP64A extension is similar to the FP64 extension but forbids the
22028 use of odd-numbered single-precision registers. This can be used
22029 in conjunction with the @code{FRE} mode of FPUs in MIPS32R5
22030 processors and allows both FP32 and FP64A code to interlink and
22031 run in the same process without changing FPU modes.
22034 @itemx -mno-abicalls
22036 @opindex mno-abicalls
22037 Generate (do not generate) code that is suitable for SVR4-style
22038 dynamic objects. @option{-mabicalls} is the default for SVR4-based
22043 Generate (do not generate) code that is fully position-independent,
22044 and that can therefore be linked into shared libraries. This option
22045 only affects @option{-mabicalls}.
22047 All @option{-mabicalls} code has traditionally been position-independent,
22048 regardless of options like @option{-fPIC} and @option{-fpic}. However,
22049 as an extension, the GNU toolchain allows executables to use absolute
22050 accesses for locally-binding symbols. It can also use shorter GP
22051 initialization sequences and generate direct calls to locally-defined
22052 functions. This mode is selected by @option{-mno-shared}.
22054 @option{-mno-shared} depends on binutils 2.16 or higher and generates
22055 objects that can only be linked by the GNU linker. However, the option
22056 does not affect the ABI of the final executable; it only affects the ABI
22057 of relocatable objects. Using @option{-mno-shared} generally makes
22058 executables both smaller and quicker.
22060 @option{-mshared} is the default.
22066 Assume (do not assume) that the static and dynamic linkers
22067 support PLTs and copy relocations. This option only affects
22068 @option{-mno-shared -mabicalls}. For the n64 ABI, this option
22069 has no effect without @option{-msym32}.
22071 You can make @option{-mplt} the default by configuring
22072 GCC with @option{--with-mips-plt}. The default is
22073 @option{-mno-plt} otherwise.
22079 Lift (do not lift) the usual restrictions on the size of the global
22082 GCC normally uses a single instruction to load values from the GOT@.
22083 While this is relatively efficient, it only works if the GOT
22084 is smaller than about 64k. Anything larger causes the linker
22085 to report an error such as:
22087 @cindex relocation truncated to fit (MIPS)
22089 relocation truncated to fit: R_MIPS_GOT16 foobar
22092 If this happens, you should recompile your code with @option{-mxgot}.
22093 This works with very large GOTs, although the code is also
22094 less efficient, since it takes three instructions to fetch the
22095 value of a global symbol.
22097 Note that some linkers can create multiple GOTs. If you have such a
22098 linker, you should only need to use @option{-mxgot} when a single object
22099 file accesses more than 64k's worth of GOT entries. Very few do.
22101 These options have no effect unless GCC is generating position
22106 Assume that general-purpose registers are 32 bits wide.
22110 Assume that general-purpose registers are 64 bits wide.
22114 Assume that floating-point registers are 32 bits wide.
22118 Assume that floating-point registers are 64 bits wide.
22122 Do not assume the width of floating-point registers.
22125 @opindex mhard-float
22126 Use floating-point coprocessor instructions.
22129 @opindex msoft-float
22130 Do not use floating-point coprocessor instructions. Implement
22131 floating-point calculations using library calls instead.
22135 Equivalent to @option{-msoft-float}, but additionally asserts that the
22136 program being compiled does not perform any floating-point operations.
22137 This option is presently supported only by some bare-metal MIPS
22138 configurations, where it may select a special set of libraries
22139 that lack all floating-point support (including, for example, the
22140 floating-point @code{printf} formats).
22141 If code compiled with @option{-mno-float} accidentally contains
22142 floating-point operations, it is likely to suffer a link-time
22143 or run-time failure.
22145 @item -msingle-float
22146 @opindex msingle-float
22147 Assume that the floating-point coprocessor only supports single-precision
22150 @item -mdouble-float
22151 @opindex mdouble-float
22152 Assume that the floating-point coprocessor supports double-precision
22153 operations. This is the default.
22156 @itemx -mno-odd-spreg
22157 @opindex modd-spreg
22158 @opindex mno-odd-spreg
22159 Enable the use of odd-numbered single-precision floating-point registers
22160 for the o32 ABI. This is the default for processors that are known to
22161 support these registers. When using the o32 FPXX ABI, @option{-mno-odd-spreg}
22165 @itemx -mabs=legacy
22167 @opindex mabs=legacy
22168 These options control the treatment of the special not-a-number (NaN)
22169 IEEE 754 floating-point data with the @code{abs.@i{fmt}} and
22170 @code{neg.@i{fmt}} machine instructions.
22172 By default or when @option{-mabs=legacy} is used the legacy
22173 treatment is selected. In this case these instructions are considered
22174 arithmetic and avoided where correct operation is required and the
22175 input operand might be a NaN. A longer sequence of instructions that
22176 manipulate the sign bit of floating-point datum manually is used
22177 instead unless the @option{-ffinite-math-only} option has also been
22180 The @option{-mabs=2008} option selects the IEEE 754-2008 treatment. In
22181 this case these instructions are considered non-arithmetic and therefore
22182 operating correctly in all cases, including in particular where the
22183 input operand is a NaN. These instructions are therefore always used
22184 for the respective operations.
22187 @itemx -mnan=legacy
22189 @opindex mnan=legacy
22190 These options control the encoding of the special not-a-number (NaN)
22191 IEEE 754 floating-point data.
22193 The @option{-mnan=legacy} option selects the legacy encoding. In this
22194 case quiet NaNs (qNaNs) are denoted by the first bit of their trailing
22195 significand field being 0, whereas signaling NaNs (sNaNs) are denoted
22196 by the first bit of their trailing significand field being 1.
22198 The @option{-mnan=2008} option selects the IEEE 754-2008 encoding. In
22199 this case qNaNs are denoted by the first bit of their trailing
22200 significand field being 1, whereas sNaNs are denoted by the first bit of
22201 their trailing significand field being 0.
22203 The default is @option{-mnan=legacy} unless GCC has been configured with
22204 @option{--with-nan=2008}.
22210 Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
22211 implement atomic memory built-in functions. When neither option is
22212 specified, GCC uses the instructions if the target architecture
22215 @option{-mllsc} is useful if the runtime environment can emulate the
22216 instructions and @option{-mno-llsc} can be useful when compiling for
22217 nonstandard ISAs. You can make either option the default by
22218 configuring GCC with @option{--with-llsc} and @option{--without-llsc}
22219 respectively. @option{--with-llsc} is the default for some
22220 configurations; see the installation documentation for details.
22226 Use (do not use) revision 1 of the MIPS DSP ASE@.
22227 @xref{MIPS DSP Built-in Functions}. This option defines the
22228 preprocessor macro @code{__mips_dsp}. It also defines
22229 @code{__mips_dsp_rev} to 1.
22235 Use (do not use) revision 2 of the MIPS DSP ASE@.
22236 @xref{MIPS DSP Built-in Functions}. This option defines the
22237 preprocessor macros @code{__mips_dsp} and @code{__mips_dspr2}.
22238 It also defines @code{__mips_dsp_rev} to 2.
22241 @itemx -mno-smartmips
22242 @opindex msmartmips
22243 @opindex mno-smartmips
22244 Use (do not use) the MIPS SmartMIPS ASE.
22246 @item -mpaired-single
22247 @itemx -mno-paired-single
22248 @opindex mpaired-single
22249 @opindex mno-paired-single
22250 Use (do not use) paired-single floating-point instructions.
22251 @xref{MIPS Paired-Single Support}. This option requires
22252 hardware floating-point support to be enabled.
22258 Use (do not use) MIPS Digital Media Extension instructions.
22259 This option can only be used when generating 64-bit code and requires
22260 hardware floating-point support to be enabled.
22265 @opindex mno-mips3d
22266 Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
22267 The option @option{-mips3d} implies @option{-mpaired-single}.
22270 @itemx -mno-micromips
22271 @opindex mmicromips
22272 @opindex mno-mmicromips
22273 Generate (do not generate) microMIPS code.
22275 MicroMIPS code generation can also be controlled on a per-function basis
22276 by means of @code{micromips} and @code{nomicromips} attributes.
22277 @xref{Function Attributes}, for more information.
22283 Use (do not use) MT Multithreading instructions.
22289 Use (do not use) the MIPS MCU ASE instructions.
22295 Use (do not use) the MIPS Enhanced Virtual Addressing instructions.
22301 Use (do not use) the MIPS Virtualization (VZ) instructions.
22307 Use (do not use) the MIPS eXtended Physical Address (XPA) instructions.
22313 Use (do not use) the MIPS Cyclic Redundancy Check (CRC) instructions.
22319 Use (do not use) the MIPS Global INValidate (GINV) instructions.
22321 @item -mloongson-mmi
22322 @itemx -mno-loongson-mmi
22323 @opindex mloongson-mmi
22324 @opindex mno-loongson-mmi
22325 Use (do not use) the MIPS Loongson MultiMedia extensions Instructions (MMI).
22327 @item -mloongson-ext
22328 @itemx -mno-loongson-ext
22329 @opindex mloongson-ext
22330 @opindex mno-loongson-ext
22331 Use (do not use) the MIPS Loongson EXTensions (EXT) instructions.
22333 @item -mloongson-ext2
22334 @itemx -mno-loongson-ext2
22335 @opindex mloongson-ext2
22336 @opindex mno-loongson-ext2
22337 Use (do not use) the MIPS Loongson EXTensions r2 (EXT2) instructions.
22341 Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
22342 an explanation of the default and the way that the pointer size is
22347 Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
22349 The default size of @code{int}s, @code{long}s and pointers depends on
22350 the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
22351 uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
22352 32-bit @code{long}s. Pointers are the same size as @code{long}s,
22353 or the same size as integer registers, whichever is smaller.
22359 Assume (do not assume) that all symbols have 32-bit values, regardless
22360 of the selected ABI@. This option is useful in combination with
22361 @option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
22362 to generate shorter and faster references to symbolic addresses.
22366 Put definitions of externally-visible data in a small data section
22367 if that data is no bigger than @var{num} bytes. GCC can then generate
22368 more efficient accesses to the data; see @option{-mgpopt} for details.
22370 The default @option{-G} option depends on the configuration.
22372 @item -mlocal-sdata
22373 @itemx -mno-local-sdata
22374 @opindex mlocal-sdata
22375 @opindex mno-local-sdata
22376 Extend (do not extend) the @option{-G} behavior to local data too,
22377 such as to static variables in C@. @option{-mlocal-sdata} is the
22378 default for all configurations.
22380 If the linker complains that an application is using too much small data,
22381 you might want to try rebuilding the less performance-critical parts with
22382 @option{-mno-local-sdata}. You might also want to build large
22383 libraries with @option{-mno-local-sdata}, so that the libraries leave
22384 more room for the main program.
22386 @item -mextern-sdata
22387 @itemx -mno-extern-sdata
22388 @opindex mextern-sdata
22389 @opindex mno-extern-sdata
22390 Assume (do not assume) that externally-defined data is in
22391 a small data section if the size of that data is within the @option{-G} limit.
22392 @option{-mextern-sdata} is the default for all configurations.
22394 If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
22395 @var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
22396 that is no bigger than @var{num} bytes, you must make sure that @var{Var}
22397 is placed in a small data section. If @var{Var} is defined by another
22398 module, you must either compile that module with a high-enough
22399 @option{-G} setting or attach a @code{section} attribute to @var{Var}'s
22400 definition. If @var{Var} is common, you must link the application
22401 with a high-enough @option{-G} setting.
22403 The easiest way of satisfying these restrictions is to compile
22404 and link every module with the same @option{-G} option. However,
22405 you may wish to build a library that supports several different
22406 small data limits. You can do this by compiling the library with
22407 the highest supported @option{-G} setting and additionally using
22408 @option{-mno-extern-sdata} to stop the library from making assumptions
22409 about externally-defined data.
22415 Use (do not use) GP-relative accesses for symbols that are known to be
22416 in a small data section; see @option{-G}, @option{-mlocal-sdata} and
22417 @option{-mextern-sdata}. @option{-mgpopt} is the default for all
22420 @option{-mno-gpopt} is useful for cases where the @code{$gp} register
22421 might not hold the value of @code{_gp}. For example, if the code is
22422 part of a library that might be used in a boot monitor, programs that
22423 call boot monitor routines pass an unknown value in @code{$gp}.
22424 (In such situations, the boot monitor itself is usually compiled
22425 with @option{-G0}.)
22427 @option{-mno-gpopt} implies @option{-mno-local-sdata} and
22428 @option{-mno-extern-sdata}.
22430 @item -membedded-data
22431 @itemx -mno-embedded-data
22432 @opindex membedded-data
22433 @opindex mno-embedded-data
22434 Allocate variables to the read-only data section first if possible, then
22435 next in the small data section if possible, otherwise in data. This gives
22436 slightly slower code than the default, but reduces the amount of RAM required
22437 when executing, and thus may be preferred for some embedded systems.
22439 @item -muninit-const-in-rodata
22440 @itemx -mno-uninit-const-in-rodata
22441 @opindex muninit-const-in-rodata
22442 @opindex mno-uninit-const-in-rodata
22443 Put uninitialized @code{const} variables in the read-only data section.
22444 This option is only meaningful in conjunction with @option{-membedded-data}.
22446 @item -mcode-readable=@var{setting}
22447 @opindex mcode-readable
22448 Specify whether GCC may generate code that reads from executable sections.
22449 There are three possible settings:
22452 @item -mcode-readable=yes
22453 Instructions may freely access executable sections. This is the
22456 @item -mcode-readable=pcrel
22457 MIPS16 PC-relative load instructions can access executable sections,
22458 but other instructions must not do so. This option is useful on 4KSc
22459 and 4KSd processors when the code TLBs have the Read Inhibit bit set.
22460 It is also useful on processors that can be configured to have a dual
22461 instruction/data SRAM interface and that, like the M4K, automatically
22462 redirect PC-relative loads to the instruction RAM.
22464 @item -mcode-readable=no
22465 Instructions must not access executable sections. This option can be
22466 useful on targets that are configured to have a dual instruction/data
22467 SRAM interface but that (unlike the M4K) do not automatically redirect
22468 PC-relative loads to the instruction RAM.
22471 @item -msplit-addresses
22472 @itemx -mno-split-addresses
22473 @opindex msplit-addresses
22474 @opindex mno-split-addresses
22475 Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
22476 relocation operators. This option has been superseded by
22477 @option{-mexplicit-relocs} but is retained for backwards compatibility.
22479 @item -mexplicit-relocs
22480 @itemx -mno-explicit-relocs
22481 @opindex mexplicit-relocs
22482 @opindex mno-explicit-relocs
22483 Use (do not use) assembler relocation operators when dealing with symbolic
22484 addresses. The alternative, selected by @option{-mno-explicit-relocs},
22485 is to use assembler macros instead.
22487 @option{-mexplicit-relocs} is the default if GCC was configured
22488 to use an assembler that supports relocation operators.
22490 @item -mcheck-zero-division
22491 @itemx -mno-check-zero-division
22492 @opindex mcheck-zero-division
22493 @opindex mno-check-zero-division
22494 Trap (do not trap) on integer division by zero.
22496 The default is @option{-mcheck-zero-division}.
22498 @item -mdivide-traps
22499 @itemx -mdivide-breaks
22500 @opindex mdivide-traps
22501 @opindex mdivide-breaks
22502 MIPS systems check for division by zero by generating either a
22503 conditional trap or a break instruction. Using traps results in
22504 smaller code, but is only supported on MIPS II and later. Also, some
22505 versions of the Linux kernel have a bug that prevents trap from
22506 generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
22507 allow conditional traps on architectures that support them and
22508 @option{-mdivide-breaks} to force the use of breaks.
22510 The default is usually @option{-mdivide-traps}, but this can be
22511 overridden at configure time using @option{--with-divide=breaks}.
22512 Divide-by-zero checks can be completely disabled using
22513 @option{-mno-check-zero-division}.
22515 @item -mload-store-pairs
22516 @itemx -mno-load-store-pairs
22517 @opindex mload-store-pairs
22518 @opindex mno-load-store-pairs
22519 Enable (disable) an optimization that pairs consecutive load or store
22520 instructions to enable load/store bonding. This option is enabled by
22521 default but only takes effect when the selected architecture is known
22522 to support bonding.
22527 @opindex mno-memcpy
22528 Force (do not force) the use of @code{memcpy} for non-trivial block
22529 moves. The default is @option{-mno-memcpy}, which allows GCC to inline
22530 most constant-sized copies.
22533 @itemx -mno-long-calls
22534 @opindex mlong-calls
22535 @opindex mno-long-calls
22536 Disable (do not disable) use of the @code{jal} instruction. Calling
22537 functions using @code{jal} is more efficient but requires the caller
22538 and callee to be in the same 256 megabyte segment.
22540 This option has no effect on abicalls code. The default is
22541 @option{-mno-long-calls}.
22547 Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
22548 instructions, as provided by the R4650 ISA@.
22554 Enable (disable) use of the @code{madd} and @code{msub} integer
22555 instructions. The default is @option{-mimadd} on architectures
22556 that support @code{madd} and @code{msub} except for the 74k
22557 architecture where it was found to generate slower code.
22560 @itemx -mno-fused-madd
22561 @opindex mfused-madd
22562 @opindex mno-fused-madd
22563 Enable (disable) use of the floating-point multiply-accumulate
22564 instructions, when they are available. The default is
22565 @option{-mfused-madd}.
22567 On the R8000 CPU when multiply-accumulate instructions are used,
22568 the intermediate product is calculated to infinite precision
22569 and is not subject to the FCSR Flush to Zero bit. This may be
22570 undesirable in some circumstances. On other processors the result
22571 is numerically identical to the equivalent computation using
22572 separate multiply, add, subtract and negate instructions.
22576 Tell the MIPS assembler to not run its preprocessor over user
22577 assembler files (with a @samp{.s} suffix) when assembling them.
22580 @itemx -mno-fix-24k
22582 @opindex mno-fix-24k
22583 Work around the 24K E48 (lost data on stores during refill) errata.
22584 The workarounds are implemented by the assembler rather than by GCC@.
22587 @itemx -mno-fix-r4000
22588 @opindex mfix-r4000
22589 @opindex mno-fix-r4000
22590 Work around certain R4000 CPU errata:
22593 A double-word or a variable shift may give an incorrect result if executed
22594 immediately after starting an integer division.
22596 A double-word or a variable shift may give an incorrect result if executed
22597 while an integer multiplication is in progress.
22599 An integer division may give an incorrect result if started in a delay slot
22600 of a taken branch or a jump.
22604 @itemx -mno-fix-r4400
22605 @opindex mfix-r4400
22606 @opindex mno-fix-r4400
22607 Work around certain R4400 CPU errata:
22610 A double-word or a variable shift may give an incorrect result if executed
22611 immediately after starting an integer division.
22615 @itemx -mno-fix-r10000
22616 @opindex mfix-r10000
22617 @opindex mno-fix-r10000
22618 Work around certain R10000 errata:
22621 @code{ll}/@code{sc} sequences may not behave atomically on revisions
22622 prior to 3.0. They may deadlock on revisions 2.6 and earlier.
22625 This option can only be used if the target architecture supports
22626 branch-likely instructions. @option{-mfix-r10000} is the default when
22627 @option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
22631 @itemx -mno-fix-r5900
22632 @opindex mfix-r5900
22633 Do not attempt to schedule the preceding instruction into the delay slot
22634 of a branch instruction placed at the end of a short loop of six
22635 instructions or fewer and always schedule a @code{nop} instruction there
22636 instead. The short loop bug under certain conditions causes loops to
22637 execute only once or twice, due to a hardware bug in the R5900 chip. The
22638 workaround is implemented by the assembler rather than by GCC@.
22641 @itemx -mno-fix-rm7000
22642 @opindex mfix-rm7000
22643 Work around the RM7000 @code{dmult}/@code{dmultu} errata. The
22644 workarounds are implemented by the assembler rather than by GCC@.
22647 @itemx -mno-fix-vr4120
22648 @opindex mfix-vr4120
22649 Work around certain VR4120 errata:
22652 @code{dmultu} does not always produce the correct result.
22654 @code{div} and @code{ddiv} do not always produce the correct result if one
22655 of the operands is negative.
22657 The workarounds for the division errata rely on special functions in
22658 @file{libgcc.a}. At present, these functions are only provided by
22659 the @code{mips64vr*-elf} configurations.
22661 Other VR4120 errata require a NOP to be inserted between certain pairs of
22662 instructions. These errata are handled by the assembler, not by GCC itself.
22665 @opindex mfix-vr4130
22666 Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
22667 workarounds are implemented by the assembler rather than by GCC,
22668 although GCC avoids using @code{mflo} and @code{mfhi} if the
22669 VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
22670 instructions are available instead.
22673 @itemx -mno-fix-sb1
22675 Work around certain SB-1 CPU core errata.
22676 (This flag currently works around the SB-1 revision 2
22677 ``F1'' and ``F2'' floating-point errata.)
22679 @item -mr10k-cache-barrier=@var{setting}
22680 @opindex mr10k-cache-barrier
22681 Specify whether GCC should insert cache barriers to avoid the
22682 side effects of speculation on R10K processors.
22684 In common with many processors, the R10K tries to predict the outcome
22685 of a conditional branch and speculatively executes instructions from
22686 the ``taken'' branch. It later aborts these instructions if the
22687 predicted outcome is wrong. However, on the R10K, even aborted
22688 instructions can have side effects.
22690 This problem only affects kernel stores and, depending on the system,
22691 kernel loads. As an example, a speculatively-executed store may load
22692 the target memory into cache and mark the cache line as dirty, even if
22693 the store itself is later aborted. If a DMA operation writes to the
22694 same area of memory before the ``dirty'' line is flushed, the cached
22695 data overwrites the DMA-ed data. See the R10K processor manual
22696 for a full description, including other potential problems.
22698 One workaround is to insert cache barrier instructions before every memory
22699 access that might be speculatively executed and that might have side
22700 effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
22701 controls GCC's implementation of this workaround. It assumes that
22702 aborted accesses to any byte in the following regions does not have
22707 the memory occupied by the current function's stack frame;
22710 the memory occupied by an incoming stack argument;
22713 the memory occupied by an object with a link-time-constant address.
22716 It is the kernel's responsibility to ensure that speculative
22717 accesses to these regions are indeed safe.
22719 If the input program contains a function declaration such as:
22725 then the implementation of @code{foo} must allow @code{j foo} and
22726 @code{jal foo} to be executed speculatively. GCC honors this
22727 restriction for functions it compiles itself. It expects non-GCC
22728 functions (such as hand-written assembly code) to do the same.
22730 The option has three forms:
22733 @item -mr10k-cache-barrier=load-store
22734 Insert a cache barrier before a load or store that might be
22735 speculatively executed and that might have side effects even
22738 @item -mr10k-cache-barrier=store
22739 Insert a cache barrier before a store that might be speculatively
22740 executed and that might have side effects even if aborted.
22742 @item -mr10k-cache-barrier=none
22743 Disable the insertion of cache barriers. This is the default setting.
22746 @item -mflush-func=@var{func}
22747 @itemx -mno-flush-func
22748 @opindex mflush-func
22749 Specifies the function to call to flush the I and D caches, or to not
22750 call any such function. If called, the function must take the same
22751 arguments as the common @code{_flush_func}, that is, the address of the
22752 memory range for which the cache is being flushed, the size of the
22753 memory range, and the number 3 (to flush both caches). The default
22754 depends on the target GCC was configured for, but commonly is either
22755 @code{_flush_func} or @code{__cpu_flush}.
22757 @item mbranch-cost=@var{num}
22758 @opindex mbranch-cost
22759 Set the cost of branches to roughly @var{num} ``simple'' instructions.
22760 This cost is only a heuristic and is not guaranteed to produce
22761 consistent results across releases. A zero cost redundantly selects
22762 the default, which is based on the @option{-mtune} setting.
22764 @item -mbranch-likely
22765 @itemx -mno-branch-likely
22766 @opindex mbranch-likely
22767 @opindex mno-branch-likely
22768 Enable or disable use of Branch Likely instructions, regardless of the
22769 default for the selected architecture. By default, Branch Likely
22770 instructions may be generated if they are supported by the selected
22771 architecture. An exception is for the MIPS32 and MIPS64 architectures
22772 and processors that implement those architectures; for those, Branch
22773 Likely instructions are not be generated by default because the MIPS32
22774 and MIPS64 architectures specifically deprecate their use.
22776 @item -mcompact-branches=never
22777 @itemx -mcompact-branches=optimal
22778 @itemx -mcompact-branches=always
22779 @opindex mcompact-branches=never
22780 @opindex mcompact-branches=optimal
22781 @opindex mcompact-branches=always
22782 These options control which form of branches will be generated. The
22783 default is @option{-mcompact-branches=optimal}.
22785 The @option{-mcompact-branches=never} option ensures that compact branch
22786 instructions will never be generated.
22788 The @option{-mcompact-branches=always} option ensures that a compact
22789 branch instruction will be generated if available. If a compact branch
22790 instruction is not available, a delay slot form of the branch will be
22793 This option is supported from MIPS Release 6 onwards.
22795 The @option{-mcompact-branches=optimal} option will cause a delay slot
22796 branch to be used if one is available in the current ISA and the delay
22797 slot is successfully filled. If the delay slot is not filled, a compact
22798 branch will be chosen if one is available.
22800 @item -mfp-exceptions
22801 @itemx -mno-fp-exceptions
22802 @opindex mfp-exceptions
22803 Specifies whether FP exceptions are enabled. This affects how
22804 FP instructions are scheduled for some processors.
22805 The default is that FP exceptions are
22808 For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
22809 64-bit code, then we can use both FP pipes. Otherwise, we can only use one
22812 @item -mvr4130-align
22813 @itemx -mno-vr4130-align
22814 @opindex mvr4130-align
22815 The VR4130 pipeline is two-way superscalar, but can only issue two
22816 instructions together if the first one is 8-byte aligned. When this
22817 option is enabled, GCC aligns pairs of instructions that it
22818 thinks should execute in parallel.
22820 This option only has an effect when optimizing for the VR4130.
22821 It normally makes code faster, but at the expense of making it bigger.
22822 It is enabled by default at optimization level @option{-O3}.
22827 Enable (disable) generation of @code{synci} instructions on
22828 architectures that support it. The @code{synci} instructions (if
22829 enabled) are generated when @code{__builtin___clear_cache} is
22832 This option defaults to @option{-mno-synci}, but the default can be
22833 overridden by configuring GCC with @option{--with-synci}.
22835 When compiling code for single processor systems, it is generally safe
22836 to use @code{synci}. However, on many multi-core (SMP) systems, it
22837 does not invalidate the instruction caches on all cores and may lead
22838 to undefined behavior.
22840 @item -mrelax-pic-calls
22841 @itemx -mno-relax-pic-calls
22842 @opindex mrelax-pic-calls
22843 Try to turn PIC calls that are normally dispatched via register
22844 @code{$25} into direct calls. This is only possible if the linker can
22845 resolve the destination at link time and if the destination is within
22846 range for a direct call.
22848 @option{-mrelax-pic-calls} is the default if GCC was configured to use
22849 an assembler and a linker that support the @code{.reloc} assembly
22850 directive and @option{-mexplicit-relocs} is in effect. With
22851 @option{-mno-explicit-relocs}, this optimization can be performed by the
22852 assembler and the linker alone without help from the compiler.
22854 @item -mmcount-ra-address
22855 @itemx -mno-mcount-ra-address
22856 @opindex mmcount-ra-address
22857 @opindex mno-mcount-ra-address
22858 Emit (do not emit) code that allows @code{_mcount} to modify the
22859 calling function's return address. When enabled, this option extends
22860 the usual @code{_mcount} interface with a new @var{ra-address}
22861 parameter, which has type @code{intptr_t *} and is passed in register
22862 @code{$12}. @code{_mcount} can then modify the return address by
22863 doing both of the following:
22866 Returning the new address in register @code{$31}.
22868 Storing the new address in @code{*@var{ra-address}},
22869 if @var{ra-address} is nonnull.
22872 The default is @option{-mno-mcount-ra-address}.
22874 @item -mframe-header-opt
22875 @itemx -mno-frame-header-opt
22876 @opindex mframe-header-opt
22877 Enable (disable) frame header optimization in the o32 ABI. When using the
22878 o32 ABI, calling functions will allocate 16 bytes on the stack for the called
22879 function to write out register arguments. When enabled, this optimization
22880 will suppress the allocation of the frame header if it can be determined that
22883 This optimization is off by default at all optimization levels.
22886 @itemx -mno-lxc1-sxc1
22887 @opindex mlxc1-sxc1
22888 When applicable, enable (disable) the generation of @code{lwxc1},
22889 @code{swxc1}, @code{ldxc1}, @code{sdxc1} instructions. Enabled by default.
22894 When applicable, enable (disable) the generation of 4-operand @code{madd.s},
22895 @code{madd.d} and related instructions. Enabled by default.
22900 @subsection MMIX Options
22901 @cindex MMIX Options
22903 These options are defined for the MMIX:
22907 @itemx -mno-libfuncs
22909 @opindex mno-libfuncs
22910 Specify that intrinsic library functions are being compiled, passing all
22911 values in registers, no matter the size.
22914 @itemx -mno-epsilon
22916 @opindex mno-epsilon
22917 Generate floating-point comparison instructions that compare with respect
22918 to the @code{rE} epsilon register.
22920 @item -mabi=mmixware
22922 @opindex mabi=mmixware
22924 Generate code that passes function parameters and return values that (in
22925 the called function) are seen as registers @code{$0} and up, as opposed to
22926 the GNU ABI which uses global registers @code{$231} and up.
22928 @item -mzero-extend
22929 @itemx -mno-zero-extend
22930 @opindex mzero-extend
22931 @opindex mno-zero-extend
22932 When reading data from memory in sizes shorter than 64 bits, use (do not
22933 use) zero-extending load instructions by default, rather than
22934 sign-extending ones.
22937 @itemx -mno-knuthdiv
22939 @opindex mno-knuthdiv
22940 Make the result of a division yielding a remainder have the same sign as
22941 the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
22942 remainder follows the sign of the dividend. Both methods are
22943 arithmetically valid, the latter being almost exclusively used.
22945 @item -mtoplevel-symbols
22946 @itemx -mno-toplevel-symbols
22947 @opindex mtoplevel-symbols
22948 @opindex mno-toplevel-symbols
22949 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
22950 code can be used with the @code{PREFIX} assembly directive.
22954 Generate an executable in the ELF format, rather than the default
22955 @samp{mmo} format used by the @command{mmix} simulator.
22957 @item -mbranch-predict
22958 @itemx -mno-branch-predict
22959 @opindex mbranch-predict
22960 @opindex mno-branch-predict
22961 Use (do not use) the probable-branch instructions, when static branch
22962 prediction indicates a probable branch.
22964 @item -mbase-addresses
22965 @itemx -mno-base-addresses
22966 @opindex mbase-addresses
22967 @opindex mno-base-addresses
22968 Generate (do not generate) code that uses @emph{base addresses}. Using a
22969 base address automatically generates a request (handled by the assembler
22970 and the linker) for a constant to be set up in a global register. The
22971 register is used for one or more base address requests within the range 0
22972 to 255 from the value held in the register. The generally leads to short
22973 and fast code, but the number of different data items that can be
22974 addressed is limited. This means that a program that uses lots of static
22975 data may require @option{-mno-base-addresses}.
22977 @item -msingle-exit
22978 @itemx -mno-single-exit
22979 @opindex msingle-exit
22980 @opindex mno-single-exit
22981 Force (do not force) generated code to have a single exit point in each
22985 @node MN10300 Options
22986 @subsection MN10300 Options
22987 @cindex MN10300 options
22989 These @option{-m} options are defined for Matsushita MN10300 architectures:
22994 Generate code to avoid bugs in the multiply instructions for the MN10300
22995 processors. This is the default.
22997 @item -mno-mult-bug
22998 @opindex mno-mult-bug
22999 Do not generate code to avoid bugs in the multiply instructions for the
23000 MN10300 processors.
23004 Generate code using features specific to the AM33 processor.
23008 Do not generate code using features specific to the AM33 processor. This
23013 Generate code using features specific to the AM33/2.0 processor.
23017 Generate code using features specific to the AM34 processor.
23019 @item -mtune=@var{cpu-type}
23021 Use the timing characteristics of the indicated CPU type when
23022 scheduling instructions. This does not change the targeted processor
23023 type. The CPU type must be one of @samp{mn10300}, @samp{am33},
23024 @samp{am33-2} or @samp{am34}.
23026 @item -mreturn-pointer-on-d0
23027 @opindex mreturn-pointer-on-d0
23028 When generating a function that returns a pointer, return the pointer
23029 in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
23030 only in @code{a0}, and attempts to call such functions without a prototype
23031 result in errors. Note that this option is on by default; use
23032 @option{-mno-return-pointer-on-d0} to disable it.
23036 Do not link in the C run-time initialization object file.
23040 Indicate to the linker that it should perform a relaxation optimization pass
23041 to shorten branches, calls and absolute memory addresses. This option only
23042 has an effect when used on the command line for the final link step.
23044 This option makes symbolic debugging impossible.
23048 Allow the compiler to generate @emph{Long Instruction Word}
23049 instructions if the target is the @samp{AM33} or later. This is the
23050 default. This option defines the preprocessor macro @code{__LIW__}.
23054 Do not allow the compiler to generate @emph{Long Instruction Word}
23055 instructions. This option defines the preprocessor macro
23060 Allow the compiler to generate the @emph{SETLB} and @emph{Lcc}
23061 instructions if the target is the @samp{AM33} or later. This is the
23062 default. This option defines the preprocessor macro @code{__SETLB__}.
23066 Do not allow the compiler to generate @emph{SETLB} or @emph{Lcc}
23067 instructions. This option defines the preprocessor macro
23068 @code{__NO_SETLB__}.
23072 @node Moxie Options
23073 @subsection Moxie Options
23074 @cindex Moxie Options
23080 Generate big-endian code. This is the default for @samp{moxie-*-*}
23085 Generate little-endian code.
23089 Generate mul.x and umul.x instructions. This is the default for
23090 @samp{moxiebox-*-*} configurations.
23094 Do not link in the C run-time initialization object file.
23098 @node MSP430 Options
23099 @subsection MSP430 Options
23100 @cindex MSP430 Options
23102 These options are defined for the MSP430:
23108 Force assembly output to always use hex constants. Normally such
23109 constants are signed decimals, but this option is available for
23110 testsuite and/or aesthetic purposes.
23114 Select the MCU to target. This is used to create a C preprocessor
23115 symbol based upon the MCU name, converted to upper case and pre- and
23116 post-fixed with @samp{__}. This in turn is used by the
23117 @file{msp430.h} header file to select an MCU-specific supplementary
23120 The option also sets the ISA to use. If the MCU name is one that is
23121 known to only support the 430 ISA then that is selected, otherwise the
23122 430X ISA is selected. A generic MCU name of @samp{msp430} can also be
23123 used to select the 430 ISA. Similarly the generic @samp{msp430x} MCU
23124 name selects the 430X ISA.
23126 In addition an MCU-specific linker script is added to the linker
23127 command line. The script's name is the name of the MCU with
23128 @file{.ld} appended. Thus specifying @option{-mmcu=xxx} on the @command{gcc}
23129 command line defines the C preprocessor symbol @code{__XXX__} and
23130 cause the linker to search for a script called @file{xxx.ld}.
23132 The ISA and hardware multiply supported for the different MCUs is hard-coded
23133 into GCC. However, an external @samp{devices.csv} file can be used to
23134 extend device support beyond those that have been hard-coded.
23136 GCC searches for the @samp{devices.csv} file on the paths specified
23137 with the @code{-I} and @code{-L} options.
23140 @itemx -mno-warn-mcu
23142 @opindex mno-warn-mcu
23143 This option enables or disables warnings about conflicts between the
23144 MCU name specified by the @option{-mmcu} option and the ISA set by the
23145 @option{-mcpu} option and/or the hardware multiply support set by the
23146 @option{-mhwmult} option. It also toggles warnings about unrecognized
23147 MCU names. This option is on by default.
23151 Specifies the ISA to use. Accepted values are @samp{msp430},
23152 @samp{msp430x} and @samp{msp430xv2}. This option is deprecated. The
23153 @option{-mmcu=} option should be used to select the ISA.
23157 Link to the simulator runtime libraries and linker script. Overrides
23158 any scripts that would be selected by the @option{-mmcu=} option.
23162 Use large-model addressing (20-bit pointers, 32-bit @code{size_t}).
23166 Use small-model addressing (16-bit pointers, 16-bit @code{size_t}).
23170 This option is passed to the assembler and linker, and allows the
23171 linker to perform certain optimizations that cannot be done until
23176 Describes the type of hardware multiply supported by the target.
23177 Accepted values are @samp{none} for no hardware multiply, @samp{16bit}
23178 for the original 16-bit-only multiply supported by early MCUs.
23179 @samp{32bit} for the 16/32-bit multiply supported by later MCUs and
23180 @samp{f5series} for the 16/32-bit multiply supported by F5-series MCUs.
23181 A value of @samp{auto} can also be given. This tells GCC to deduce
23182 the hardware multiply support based upon the MCU name provided by the
23183 @option{-mmcu} option. If no @option{-mmcu} option is specified or if
23184 the MCU name is not recognized then no hardware multiply support is
23185 assumed. @code{auto} is the default setting.
23187 Hardware multiplies are normally performed by calling a library
23188 routine. This saves space in the generated code. When compiling at
23189 @option{-O3} or higher however the hardware multiplier is invoked
23190 inline. This makes for bigger, but faster code.
23192 The hardware multiply routines disable interrupts whilst running and
23193 restore the previous interrupt state when they finish. This makes
23194 them safe to use inside interrupt handlers as well as in normal code.
23198 Enable the use of a minimum runtime environment - no static
23199 initializers or constructors. This is intended for memory-constrained
23200 devices. The compiler includes special symbols in some objects
23201 that tell the linker and runtime which code fragments are required.
23203 @item -mcode-region=
23204 @itemx -mdata-region=
23205 @opindex mcode-region
23206 @opindex mdata-region
23207 These options tell the compiler where to place functions and data that
23208 do not have one of the @code{lower}, @code{upper}, @code{either} or
23209 @code{section} attributes. Possible values are @code{lower},
23210 @code{upper}, @code{either} or @code{any}. The first three behave
23211 like the corresponding attribute. The fourth possible value -
23212 @code{any} - is the default. It leaves placement entirely up to the
23213 linker script and how it assigns the standard sections
23214 (@code{.text}, @code{.data}, etc) to the memory regions.
23216 @item -msilicon-errata=
23217 @opindex msilicon-errata
23218 This option passes on a request to assembler to enable the fixes for
23219 the named silicon errata.
23221 @item -msilicon-errata-warn=
23222 @opindex msilicon-errata-warn
23223 This option passes on a request to the assembler to enable warning
23224 messages when a silicon errata might need to be applied.
23226 @item -mwarn-devices-csv
23227 @itemx -mno-warn-devices-csv
23228 @opindex mwarn-devices-csv
23229 @opindex mno-warn-devices-csv
23230 Warn if @samp{devices.csv} is not found or there are problem parsing it
23235 @node NDS32 Options
23236 @subsection NDS32 Options
23237 @cindex NDS32 Options
23239 These options are defined for NDS32 implementations:
23244 @opindex mbig-endian
23245 Generate code in big-endian mode.
23247 @item -mlittle-endian
23248 @opindex mlittle-endian
23249 Generate code in little-endian mode.
23251 @item -mreduced-regs
23252 @opindex mreduced-regs
23253 Use reduced-set registers for register allocation.
23256 @opindex mfull-regs
23257 Use full-set registers for register allocation.
23261 Generate conditional move instructions.
23265 Do not generate conditional move instructions.
23269 Generate performance extension instructions.
23271 @item -mno-ext-perf
23272 @opindex mno-ext-perf
23273 Do not generate performance extension instructions.
23276 @opindex mext-perf2
23277 Generate performance extension 2 instructions.
23279 @item -mno-ext-perf2
23280 @opindex mno-ext-perf2
23281 Do not generate performance extension 2 instructions.
23284 @opindex mext-string
23285 Generate string extension instructions.
23287 @item -mno-ext-string
23288 @opindex mno-ext-string
23289 Do not generate string extension instructions.
23293 Generate v3 push25/pop25 instructions.
23296 @opindex mno-v3push
23297 Do not generate v3 push25/pop25 instructions.
23301 Generate 16-bit instructions.
23304 @opindex mno-16-bit
23305 Do not generate 16-bit instructions.
23307 @item -misr-vector-size=@var{num}
23308 @opindex misr-vector-size
23309 Specify the size of each interrupt vector, which must be 4 or 16.
23311 @item -mcache-block-size=@var{num}
23312 @opindex mcache-block-size
23313 Specify the size of each cache block,
23314 which must be a power of 2 between 4 and 512.
23316 @item -march=@var{arch}
23318 Specify the name of the target architecture.
23320 @item -mcmodel=@var{code-model}
23322 Set the code model to one of
23325 All the data and read-only data segments must be within 512KB addressing space.
23326 The text segment must be within 16MB addressing space.
23327 @item @samp{medium}
23328 The data segment must be within 512KB while the read-only data segment can be
23329 within 4GB addressing space. The text segment should be still within 16MB
23332 All the text and data segments can be within 4GB addressing space.
23336 @opindex mctor-dtor
23337 Enable constructor/destructor feature.
23341 Guide linker to relax instructions.
23345 @node Nios II Options
23346 @subsection Nios II Options
23347 @cindex Nios II options
23348 @cindex Altera Nios II options
23350 These are the options defined for the Altera Nios II processor.
23356 @cindex smaller data references
23357 Put global and static objects less than or equal to @var{num} bytes
23358 into the small data or BSS sections instead of the normal data or BSS
23359 sections. The default value of @var{num} is 8.
23361 @item -mgpopt=@var{option}
23366 Generate (do not generate) GP-relative accesses. The following
23367 @var{option} names are recognized:
23372 Do not generate GP-relative accesses.
23375 Generate GP-relative accesses for small data objects that are not
23376 external, weak, or uninitialized common symbols.
23377 Also use GP-relative addressing for objects that
23378 have been explicitly placed in a small data section via a @code{section}
23382 As for @samp{local}, but also generate GP-relative accesses for
23383 small data objects that are external, weak, or common. If you use this option,
23384 you must ensure that all parts of your program (including libraries) are
23385 compiled with the same @option{-G} setting.
23388 Generate GP-relative accesses for all data objects in the program. If you
23389 use this option, the entire data and BSS segments
23390 of your program must fit in 64K of memory and you must use an appropriate
23391 linker script to allocate them within the addressable range of the
23395 Generate GP-relative addresses for function pointers as well as data
23396 pointers. If you use this option, the entire text, data, and BSS segments
23397 of your program must fit in 64K of memory and you must use an appropriate
23398 linker script to allocate them within the addressable range of the
23403 @option{-mgpopt} is equivalent to @option{-mgpopt=local}, and
23404 @option{-mno-gpopt} is equivalent to @option{-mgpopt=none}.
23406 The default is @option{-mgpopt} except when @option{-fpic} or
23407 @option{-fPIC} is specified to generate position-independent code.
23408 Note that the Nios II ABI does not permit GP-relative accesses from
23411 You may need to specify @option{-mno-gpopt} explicitly when building
23412 programs that include large amounts of small data, including large
23413 GOT data sections. In this case, the 16-bit offset for GP-relative
23414 addressing may not be large enough to allow access to the entire
23415 small data section.
23417 @item -mgprel-sec=@var{regexp}
23418 @opindex mgprel-sec
23419 This option specifies additional section names that can be accessed via
23420 GP-relative addressing. It is most useful in conjunction with
23421 @code{section} attributes on variable declarations
23422 (@pxref{Common Variable Attributes}) and a custom linker script.
23423 The @var{regexp} is a POSIX Extended Regular Expression.
23425 This option does not affect the behavior of the @option{-G} option, and
23426 the specified sections are in addition to the standard @code{.sdata}
23427 and @code{.sbss} small-data sections that are recognized by @option{-mgpopt}.
23429 @item -mr0rel-sec=@var{regexp}
23430 @opindex mr0rel-sec
23431 This option specifies names of sections that can be accessed via a
23432 16-bit offset from @code{r0}; that is, in the low 32K or high 32K
23433 of the 32-bit address space. It is most useful in conjunction with
23434 @code{section} attributes on variable declarations
23435 (@pxref{Common Variable Attributes}) and a custom linker script.
23436 The @var{regexp} is a POSIX Extended Regular Expression.
23438 In contrast to the use of GP-relative addressing for small data,
23439 zero-based addressing is never generated by default and there are no
23440 conventional section names used in standard linker scripts for sections
23441 in the low or high areas of memory.
23447 Generate little-endian (default) or big-endian (experimental) code,
23450 @item -march=@var{arch}
23452 This specifies the name of the target Nios II architecture. GCC uses this
23453 name to determine what kind of instructions it can emit when generating
23454 assembly code. Permissible names are: @samp{r1}, @samp{r2}.
23456 The preprocessor macro @code{__nios2_arch__} is available to programs,
23457 with value 1 or 2, indicating the targeted ISA level.
23459 @item -mbypass-cache
23460 @itemx -mno-bypass-cache
23461 @opindex mno-bypass-cache
23462 @opindex mbypass-cache
23463 Force all load and store instructions to always bypass cache by
23464 using I/O variants of the instructions. The default is not to
23467 @item -mno-cache-volatile
23468 @itemx -mcache-volatile
23469 @opindex mcache-volatile
23470 @opindex mno-cache-volatile
23471 Volatile memory access bypass the cache using the I/O variants of
23472 the load and store instructions. The default is not to bypass the cache.
23474 @item -mno-fast-sw-div
23475 @itemx -mfast-sw-div
23476 @opindex mno-fast-sw-div
23477 @opindex mfast-sw-div
23478 Do not use table-based fast divide for small numbers. The default
23479 is to use the fast divide at @option{-O3} and above.
23483 @itemx -mno-hw-mulx
23487 @opindex mno-hw-mul
23489 @opindex mno-hw-mulx
23491 @opindex mno-hw-div
23493 Enable or disable emitting @code{mul}, @code{mulx} and @code{div} family of
23494 instructions by the compiler. The default is to emit @code{mul}
23495 and not emit @code{div} and @code{mulx}.
23501 Enable or disable generation of Nios II R2 BMX (bit manipulation) and
23502 CDX (code density) instructions. Enabling these instructions also
23503 requires @option{-march=r2}. Since these instructions are optional
23504 extensions to the R2 architecture, the default is not to emit them.
23506 @item -mcustom-@var{insn}=@var{N}
23507 @itemx -mno-custom-@var{insn}
23508 @opindex mcustom-@var{insn}
23509 @opindex mno-custom-@var{insn}
23510 Each @option{-mcustom-@var{insn}=@var{N}} option enables use of a
23511 custom instruction with encoding @var{N} when generating code that uses
23512 @var{insn}. For example, @option{-mcustom-fadds=253} generates custom
23513 instruction 253 for single-precision floating-point add operations instead
23514 of the default behavior of using a library call.
23516 The following values of @var{insn} are supported. Except as otherwise
23517 noted, floating-point operations are expected to be implemented with
23518 normal IEEE 754 semantics and correspond directly to the C operators or the
23519 equivalent GCC built-in functions (@pxref{Other Builtins}).
23521 Single-precision floating point:
23524 @item @samp{fadds}, @samp{fsubs}, @samp{fdivs}, @samp{fmuls}
23525 Binary arithmetic operations.
23531 Unary absolute value.
23533 @item @samp{fcmpeqs}, @samp{fcmpges}, @samp{fcmpgts}, @samp{fcmples}, @samp{fcmplts}, @samp{fcmpnes}
23534 Comparison operations.
23536 @item @samp{fmins}, @samp{fmaxs}
23537 Floating-point minimum and maximum. These instructions are only
23538 generated if @option{-ffinite-math-only} is specified.
23540 @item @samp{fsqrts}
23541 Unary square root operation.
23543 @item @samp{fcoss}, @samp{fsins}, @samp{ftans}, @samp{fatans}, @samp{fexps}, @samp{flogs}
23544 Floating-point trigonometric and exponential functions. These instructions
23545 are only generated if @option{-funsafe-math-optimizations} is also specified.
23549 Double-precision floating point:
23552 @item @samp{faddd}, @samp{fsubd}, @samp{fdivd}, @samp{fmuld}
23553 Binary arithmetic operations.
23559 Unary absolute value.
23561 @item @samp{fcmpeqd}, @samp{fcmpged}, @samp{fcmpgtd}, @samp{fcmpled}, @samp{fcmpltd}, @samp{fcmpned}
23562 Comparison operations.
23564 @item @samp{fmind}, @samp{fmaxd}
23565 Double-precision minimum and maximum. These instructions are only
23566 generated if @option{-ffinite-math-only} is specified.
23568 @item @samp{fsqrtd}
23569 Unary square root operation.
23571 @item @samp{fcosd}, @samp{fsind}, @samp{ftand}, @samp{fatand}, @samp{fexpd}, @samp{flogd}
23572 Double-precision trigonometric and exponential functions. These instructions
23573 are only generated if @option{-funsafe-math-optimizations} is also specified.
23579 @item @samp{fextsd}
23580 Conversion from single precision to double precision.
23582 @item @samp{ftruncds}
23583 Conversion from double precision to single precision.
23585 @item @samp{fixsi}, @samp{fixsu}, @samp{fixdi}, @samp{fixdu}
23586 Conversion from floating point to signed or unsigned integer types, with
23587 truncation towards zero.
23590 Conversion from single-precision floating point to signed integer,
23591 rounding to the nearest integer and ties away from zero.
23592 This corresponds to the @code{__builtin_lroundf} function when
23593 @option{-fno-math-errno} is used.
23595 @item @samp{floatis}, @samp{floatus}, @samp{floatid}, @samp{floatud}
23596 Conversion from signed or unsigned integer types to floating-point types.
23600 In addition, all of the following transfer instructions for internal
23601 registers X and Y must be provided to use any of the double-precision
23602 floating-point instructions. Custom instructions taking two
23603 double-precision source operands expect the first operand in the
23604 64-bit register X. The other operand (or only operand of a unary
23605 operation) is given to the custom arithmetic instruction with the
23606 least significant half in source register @var{src1} and the most
23607 significant half in @var{src2}. A custom instruction that returns a
23608 double-precision result returns the most significant 32 bits in the
23609 destination register and the other half in 32-bit register Y.
23610 GCC automatically generates the necessary code sequences to write
23611 register X and/or read register Y when double-precision floating-point
23612 instructions are used.
23617 Write @var{src1} into the least significant half of X and @var{src2} into
23618 the most significant half of X.
23621 Write @var{src1} into Y.
23623 @item @samp{frdxhi}, @samp{frdxlo}
23624 Read the most or least (respectively) significant half of X and store it in
23628 Read the value of Y and store it into @var{dest}.
23631 Note that you can gain more local control over generation of Nios II custom
23632 instructions by using the @code{target("custom-@var{insn}=@var{N}")}
23633 and @code{target("no-custom-@var{insn}")} function attributes
23634 (@pxref{Function Attributes})
23635 or pragmas (@pxref{Function Specific Option Pragmas}).
23637 @item -mcustom-fpu-cfg=@var{name}
23638 @opindex mcustom-fpu-cfg
23640 This option enables a predefined, named set of custom instruction encodings
23641 (see @option{-mcustom-@var{insn}} above).
23642 Currently, the following sets are defined:
23644 @option{-mcustom-fpu-cfg=60-1} is equivalent to:
23645 @gccoptlist{-mcustom-fmuls=252 @gol
23646 -mcustom-fadds=253 @gol
23647 -mcustom-fsubs=254 @gol
23648 -fsingle-precision-constant}
23650 @option{-mcustom-fpu-cfg=60-2} is equivalent to:
23651 @gccoptlist{-mcustom-fmuls=252 @gol
23652 -mcustom-fadds=253 @gol
23653 -mcustom-fsubs=254 @gol
23654 -mcustom-fdivs=255 @gol
23655 -fsingle-precision-constant}
23657 @option{-mcustom-fpu-cfg=72-3} is equivalent to:
23658 @gccoptlist{-mcustom-floatus=243 @gol
23659 -mcustom-fixsi=244 @gol
23660 -mcustom-floatis=245 @gol
23661 -mcustom-fcmpgts=246 @gol
23662 -mcustom-fcmples=249 @gol
23663 -mcustom-fcmpeqs=250 @gol
23664 -mcustom-fcmpnes=251 @gol
23665 -mcustom-fmuls=252 @gol
23666 -mcustom-fadds=253 @gol
23667 -mcustom-fsubs=254 @gol
23668 -mcustom-fdivs=255 @gol
23669 -fsingle-precision-constant}
23671 Custom instruction assignments given by individual
23672 @option{-mcustom-@var{insn}=} options override those given by
23673 @option{-mcustom-fpu-cfg=}, regardless of the
23674 order of the options on the command line.
23676 Note that you can gain more local control over selection of a FPU
23677 configuration by using the @code{target("custom-fpu-cfg=@var{name}")}
23678 function attribute (@pxref{Function Attributes})
23679 or pragma (@pxref{Function Specific Option Pragmas}).
23683 These additional @samp{-m} options are available for the Altera Nios II
23684 ELF (bare-metal) target:
23690 Link with HAL BSP. This suppresses linking with the GCC-provided C runtime
23691 startup and termination code, and is typically used in conjunction with
23692 @option{-msys-crt0=} to specify the location of the alternate startup code
23693 provided by the HAL BSP.
23697 Link with a limited version of the C library, @option{-lsmallc}, rather than
23700 @item -msys-crt0=@var{startfile}
23702 @var{startfile} is the file name of the startfile (crt0) to use
23703 when linking. This option is only useful in conjunction with @option{-mhal}.
23705 @item -msys-lib=@var{systemlib}
23707 @var{systemlib} is the library name of the library that provides
23708 low-level system calls required by the C library,
23709 e.g.@: @code{read} and @code{write}.
23710 This option is typically used to link with a library provided by a HAL BSP.
23714 @node Nvidia PTX Options
23715 @subsection Nvidia PTX Options
23716 @cindex Nvidia PTX options
23717 @cindex nvptx options
23719 These options are defined for Nvidia PTX:
23727 Generate code for 32-bit or 64-bit ABI.
23729 @item -misa=@var{ISA-string}
23731 Generate code for given the specified PTX ISA (e.g.@: @samp{sm_35}). ISA
23732 strings must be lower-case. Valid ISA strings include @samp{sm_30} and
23733 @samp{sm_35}. The default ISA is sm_30.
23736 @opindex mmainkernel
23737 Link in code for a __main kernel. This is for stand-alone instead of
23738 offloading execution.
23742 Apply partitioned execution optimizations. This is the default when any
23743 level of optimization is selected.
23746 @opindex msoft-stack
23747 Generate code that does not use @code{.local} memory
23748 directly for stack storage. Instead, a per-warp stack pointer is
23749 maintained explicitly. This enables variable-length stack allocation (with
23750 variable-length arrays or @code{alloca}), and when global memory is used for
23751 underlying storage, makes it possible to access automatic variables from other
23752 threads, or with atomic instructions. This code generation variant is used
23753 for OpenMP offloading, but the option is exposed on its own for the purpose
23754 of testing the compiler; to generate code suitable for linking into programs
23755 using OpenMP offloading, use option @option{-mgomp}.
23757 @item -muniform-simt
23758 @opindex muniform-simt
23759 Switch to code generation variant that allows to execute all threads in each
23760 warp, while maintaining memory state and side effects as if only one thread
23761 in each warp was active outside of OpenMP SIMD regions. All atomic operations
23762 and calls to runtime (malloc, free, vprintf) are conditionally executed (iff
23763 current lane index equals the master lane index), and the register being
23764 assigned is copied via a shuffle instruction from the master lane. Outside of
23765 SIMD regions lane 0 is the master; inside, each thread sees itself as the
23766 master. Shared memory array @code{int __nvptx_uni[]} stores all-zeros or
23767 all-ones bitmasks for each warp, indicating current mode (0 outside of SIMD
23768 regions). Each thread can bitwise-and the bitmask at position @code{tid.y}
23769 with current lane index to compute the master lane index.
23773 Generate code for use in OpenMP offloading: enables @option{-msoft-stack} and
23774 @option{-muniform-simt} options, and selects corresponding multilib variant.
23778 @node OpenRISC Options
23779 @subsection OpenRISC Options
23780 @cindex OpenRISC Options
23782 These options are defined for OpenRISC:
23786 @item -mboard=@var{name}
23788 Configure a board specific runtime. This will be passed to the linker for
23789 newlib board library linking. The default is @code{or1ksim}.
23793 This option is ignored; it is for compatibility purposes only. This used to
23794 select linker and preprocessor options for use with newlib.
23800 Select software or hardware divide (@code{l.div}, @code{l.divu}) instructions.
23801 This default is hardware divide.
23807 Select software or hardware multiply (@code{l.mul}, @code{l.muli}) instructions.
23808 This default is hardware multiply.
23811 @itemx -mhard-float
23812 @opindex msoft-float
23813 @opindex mhard-float
23814 Select software or hardware for floating point operations.
23815 The default is software.
23817 @item -mdouble-float
23818 @opindex mdouble-float
23819 When @option{-mhard-float} is selected, enables generation of double-precision
23820 floating point instructions. By default functions from @file{libgcc} are used
23821 to perform double-precision floating point operations.
23823 @item -munordered-float
23824 @opindex munordered-float
23825 When @option{-mhard-float} is selected, enables generation of unordered
23826 floating point compare and set flag (@code{lf.sfun*}) instructions. By default
23827 functions from @file{libgcc} are used to perform unordered floating point
23828 compare and set flag operations.
23832 Enable generation of conditional move (@code{l.cmov}) instructions. By
23833 default the equivalent will be generated using using set and branch.
23837 Enable generation of rotate right (@code{l.ror}) instructions. By default
23838 functions from @file{libgcc} are used to perform rotate right operations.
23842 Enable generation of rotate right with immediate (@code{l.rori}) instructions.
23843 By default functions from @file{libgcc} are used to perform rotate right with
23844 immediate operations.
23848 Enable generation of sign extension (@code{l.ext*}) instructions. By default
23849 memory loads are used to perform sign extension.
23853 Enable generation of compare and set flag with immediate (@code{l.sf*i})
23854 instructions. By default extra instructions will be generated to store the
23855 immediate to a register first.
23859 Enable generation of shift with immediate (@code{l.srai}, @code{l.srli},
23860 @code{l.slli}) instructions. By default extra instructions will be generated
23861 to store the immediate to a register first.
23866 @node PDP-11 Options
23867 @subsection PDP-11 Options
23868 @cindex PDP-11 Options
23870 These options are defined for the PDP-11:
23875 Use hardware FPP floating point. This is the default. (FIS floating
23876 point on the PDP-11/40 is not supported.) Implies -m45.
23879 @opindex msoft-float
23880 Do not use hardware floating point.
23884 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
23888 Return floating-point results in memory. This is the default.
23892 Generate code for a PDP-11/40. Implies -msoft-float -mno-split.
23896 Generate code for a PDP-11/45. This is the default.
23900 Generate code for a PDP-11/10. Implies -msoft-float -mno-split.
23906 Use 16-bit @code{int}. This is the default.
23912 Use 32-bit @code{int}.
23916 Target has split instruction and data space. Implies -m45.
23920 Use Unix assembler syntax.
23924 Use DEC assembler syntax.
23928 Use GNU assembler syntax. This is the default.
23932 Use the new LRA register allocator. By default, the old ``reload''
23936 @node picoChip Options
23937 @subsection picoChip Options
23938 @cindex picoChip options
23940 These @samp{-m} options are defined for picoChip implementations:
23944 @item -mae=@var{ae_type}
23946 Set the instruction set, register set, and instruction scheduling
23947 parameters for array element type @var{ae_type}. Supported values
23948 for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
23950 @option{-mae=ANY} selects a completely generic AE type. Code
23951 generated with this option runs on any of the other AE types. The
23952 code is not as efficient as it would be if compiled for a specific
23953 AE type, and some types of operation (e.g., multiplication) do not
23954 work properly on all types of AE.
23956 @option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
23957 for compiled code, and is the default.
23959 @option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
23960 option may suffer from poor performance of byte (char) manipulation,
23961 since the DSP AE does not provide hardware support for byte load/stores.
23963 @item -msymbol-as-address
23964 Enable the compiler to directly use a symbol name as an address in a
23965 load/store instruction, without first loading it into a
23966 register. Typically, the use of this option generates larger
23967 programs, which run faster than when the option isn't used. However, the
23968 results vary from program to program, so it is left as a user option,
23969 rather than being permanently enabled.
23971 @item -mno-inefficient-warnings
23972 Disables warnings about the generation of inefficient code. These
23973 warnings can be generated, for example, when compiling code that
23974 performs byte-level memory operations on the MAC AE type. The MAC AE has
23975 no hardware support for byte-level memory operations, so all byte
23976 load/stores must be synthesized from word load/store operations. This is
23977 inefficient and a warning is generated to indicate
23978 that you should rewrite the code to avoid byte operations, or to target
23979 an AE type that has the necessary hardware support. This option disables
23984 @node PowerPC Options
23985 @subsection PowerPC Options
23986 @cindex PowerPC options
23988 These are listed under @xref{RS/6000 and PowerPC Options}.
23991 @subsection PRU Options
23992 @cindex PRU Options
23994 These command-line options are defined for PRU target:
23999 Link with a minimum runtime environment, with no support for static
24000 initializers and constructors. Using this option can significantly reduce
24001 the size of the final ELF binary. Beware that the compiler could still
24002 generate code with static initializers and constructors. It is up to the
24003 programmer to ensure that the source program will not use those features.
24005 @item -mmcu=@var{mcu}
24007 Specify the PRU MCU variant to use. Check Newlib for the exact list of
24012 Make GCC pass the @option{--no-relax} command-line option to the linker
24013 instead of the @option{--relax} option.
24017 Allow (or do not allow) GCC to use the LOOP instruction.
24019 @item -mabi=@var{variant}
24021 Specify the ABI variant to output code for. @option{-mabi=ti} selects the
24022 unmodified TI ABI while @option{-mabi=gnu} selects a GNU variant that copes
24023 more naturally with certain GCC assumptions. These are the differences:
24026 @item Function Pointer Size
24027 TI ABI specifies that function (code) pointers are 16-bit, whereas GNU
24028 supports only 32-bit data and code pointers.
24030 @item Optional Return Value Pointer
24031 Function return values larger than 64 bits are passed by using a hidden
24032 pointer as the first argument of the function. TI ABI, though, mandates that
24033 the pointer can be NULL in case the caller is not using the returned value.
24034 GNU always passes and expects a valid return value pointer.
24038 The current @option{-mabi=ti} implementation simply raises a compile error
24039 when any of the above code constructs is detected. As a consequence
24040 the standard C library cannot be built and it is omitted when linking with
24043 Relaxation is a GNU feature and for safety reasons is disabled when using
24044 @option{-mabi=ti}. The TI toolchain does not emit relocations for QBBx
24045 instructions, so the GNU linker cannot adjust them when shortening adjacent
24046 LDI32 pseudo instructions.
24050 @node RISC-V Options
24051 @subsection RISC-V Options
24052 @cindex RISC-V Options
24054 These command-line options are defined for RISC-V targets:
24057 @item -mbranch-cost=@var{n}
24058 @opindex mbranch-cost
24059 Set the cost of branches to roughly @var{n} instructions.
24064 When generating PIC code, do or don't allow the use of PLTs. Ignored for
24065 non-PIC. The default is @option{-mplt}.
24067 @item -mabi=@var{ABI-string}
24069 Specify integer and floating-point calling convention. @var{ABI-string}
24070 contains two parts: the size of integer types and the registers used for
24071 floating-point types. For example @samp{-march=rv64ifd -mabi=lp64d} means that
24072 @samp{long} and pointers are 64-bit (implicitly defining @samp{int} to be
24073 32-bit), and that floating-point values up to 64 bits wide are passed in F
24074 registers. Contrast this with @samp{-march=rv64ifd -mabi=lp64f}, which still
24075 allows the compiler to generate code that uses the F and D extensions but only
24076 allows floating-point values up to 32 bits long to be passed in registers; or
24077 @samp{-march=rv64ifd -mabi=lp64}, in which no floating-point arguments will be
24078 passed in registers.
24080 The default for this argument is system dependent, users who want a specific
24081 calling convention should specify one explicitly. The valid calling
24082 conventions are: @samp{ilp32}, @samp{ilp32f}, @samp{ilp32d}, @samp{lp64},
24083 @samp{lp64f}, and @samp{lp64d}. Some calling conventions are impossible to
24084 implement on some ISAs: for example, @samp{-march=rv32if -mabi=ilp32d} is
24085 invalid because the ABI requires 64-bit values be passed in F registers, but F
24086 registers are only 32 bits wide. There is also the @samp{ilp32e} ABI that can
24087 only be used with the @samp{rv32e} architecture. This ABI is not well
24088 specified at present, and is subject to change.
24093 Do or don't use hardware floating-point divide and square root instructions.
24094 This requires the F or D extensions for floating-point registers. The default
24095 is to use them if the specified architecture has these instructions.
24100 Do or don't use hardware instructions for integer division. This requires the
24101 M extension. The default is to use them if the specified architecture has
24102 these instructions.
24104 @item -march=@var{ISA-string}
24106 Generate code for given RISC-V ISA (e.g.@: @samp{rv64im}). ISA strings must be
24107 lower-case. Examples include @samp{rv64i}, @samp{rv32g}, @samp{rv32e}, and
24110 @item -mtune=@var{processor-string}
24112 Optimize the output for the given processor, specified by microarchitecture
24113 name. Permissible values for this option are: @samp{rocket},
24114 @samp{sifive-3-series}, @samp{sifive-5-series}, @samp{sifive-7-series},
24117 When @option{-mtune=} is not specified, the default is @samp{rocket}.
24119 The @samp{size} choice is not intended for use by end-users. This is used
24120 when @option{-Os} is specified. It overrides the instruction cost info
24121 provided by @option{-mtune=}, but does not override the pipeline info. This
24122 helps reduce code size while still giving good performance.
24124 @item -mpreferred-stack-boundary=@var{num}
24125 @opindex mpreferred-stack-boundary
24126 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
24127 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
24128 the default is 4 (16 bytes or 128-bits).
24130 @strong{Warning:} If you use this switch, then you must build all modules with
24131 the same value, including any libraries. This includes the system libraries
24132 and startup modules.
24134 @item -msmall-data-limit=@var{n}
24135 @opindex msmall-data-limit
24136 Put global and static data smaller than @var{n} bytes into a special section
24139 @item -msave-restore
24140 @itemx -mno-save-restore
24141 @opindex msave-restore
24142 Do or don't use smaller but slower prologue and epilogue code that uses
24143 library function calls. The default is to use fast inline prologues and
24146 @item -mstrict-align
24147 @itemx -mno-strict-align
24148 @opindex mstrict-align
24149 Do not or do generate unaligned memory accesses. The default is set depending
24150 on whether the processor we are optimizing for supports fast unaligned access
24153 @item -mcmodel=medlow
24154 @opindex mcmodel=medlow
24155 Generate code for the medium-low code model. The program and its statically
24156 defined symbols must lie within a single 2 GiB address range and must lie
24157 between absolute addresses @minus{}2 GiB and +2 GiB. Programs can be
24158 statically or dynamically linked. This is the default code model.
24160 @item -mcmodel=medany
24161 @opindex mcmodel=medany
24162 Generate code for the medium-any code model. The program and its statically
24163 defined symbols must be within any single 2 GiB address range. Programs can be
24164 statically or dynamically linked.
24166 @item -mexplicit-relocs
24167 @itemx -mno-exlicit-relocs
24168 Use or do not use assembler relocation operators when dealing with symbolic
24169 addresses. The alternative is to use assembler macros instead, which may
24170 limit optimization.
24174 Take advantage of linker relaxations to reduce the number of instructions
24175 required to materialize symbol addresses. The default is to take advantage of
24176 linker relaxations.
24178 @item -memit-attribute
24179 @itemx -mno-emit-attribute
24180 Emit (do not emit) RISC-V attribute to record extra information into ELF
24181 objects. This feature requires at least binutils 2.32.
24183 @item -malign-data=@var{type}
24184 @opindex malign-data
24185 Control how GCC aligns variables and constants of array, structure, or union
24186 types. Supported values for @var{type} are @samp{xlen} which uses x register
24187 width as the alignment value, and @samp{natural} which uses natural alignment.
24188 @samp{xlen} is the default.
24192 @subsection RL78 Options
24193 @cindex RL78 Options
24199 Links in additional target libraries to support operation within a
24208 Specifies the type of hardware multiplication and division support to
24209 be used. The simplest is @code{none}, which uses software for both
24210 multiplication and division. This is the default. The @code{g13}
24211 value is for the hardware multiply/divide peripheral found on the
24212 RL78/G13 (S2 core) targets. The @code{g14} value selects the use of
24213 the multiplication and division instructions supported by the RL78/G14
24214 (S3 core) parts. The value @code{rl78} is an alias for @code{g14} and
24215 the value @code{mg10} is an alias for @code{none}.
24217 In addition a C preprocessor macro is defined, based upon the setting
24218 of this option. Possible values are: @code{__RL78_MUL_NONE__},
24219 @code{__RL78_MUL_G13__} or @code{__RL78_MUL_G14__}.
24226 Specifies the RL78 core to target. The default is the G14 core, also
24227 known as an S3 core or just RL78. The G13 or S2 core does not have
24228 multiply or divide instructions, instead it uses a hardware peripheral
24229 for these operations. The G10 or S1 core does not have register
24230 banks, so it uses a different calling convention.
24232 If this option is set it also selects the type of hardware multiply
24233 support to use, unless this is overridden by an explicit
24234 @option{-mmul=none} option on the command line. Thus specifying
24235 @option{-mcpu=g13} enables the use of the G13 hardware multiply
24236 peripheral and specifying @option{-mcpu=g10} disables the use of
24237 hardware multiplications altogether.
24239 Note, although the RL78/G14 core is the default target, specifying
24240 @option{-mcpu=g14} or @option{-mcpu=rl78} on the command line does
24241 change the behavior of the toolchain since it also enables G14
24242 hardware multiply support. If these options are not specified on the
24243 command line then software multiplication routines will be used even
24244 though the code targets the RL78 core. This is for backwards
24245 compatibility with older toolchains which did not have hardware
24246 multiply and divide support.
24248 In addition a C preprocessor macro is defined, based upon the setting
24249 of this option. Possible values are: @code{__RL78_G10__},
24250 @code{__RL78_G13__} or @code{__RL78_G14__}.
24260 These are aliases for the corresponding @option{-mcpu=} option. They
24261 are provided for backwards compatibility.
24265 Allow the compiler to use all of the available registers. By default
24266 registers @code{r24..r31} are reserved for use in interrupt handlers.
24267 With this option enabled these registers can be used in ordinary
24270 @item -m64bit-doubles
24271 @itemx -m32bit-doubles
24272 @opindex m64bit-doubles
24273 @opindex m32bit-doubles
24274 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
24275 or 32 bits (@option{-m32bit-doubles}) in size. The default is
24276 @option{-m32bit-doubles}.
24278 @item -msave-mduc-in-interrupts
24279 @itemx -mno-save-mduc-in-interrupts
24280 @opindex msave-mduc-in-interrupts
24281 @opindex mno-save-mduc-in-interrupts
24282 Specifies that interrupt handler functions should preserve the
24283 MDUC registers. This is only necessary if normal code might use
24284 the MDUC registers, for example because it performs multiplication
24285 and division operations. The default is to ignore the MDUC registers
24286 as this makes the interrupt handlers faster. The target option -mg13
24287 needs to be passed for this to work as this feature is only available
24288 on the G13 target (S2 core). The MDUC registers will only be saved
24289 if the interrupt handler performs a multiplication or division
24290 operation or it calls another function.
24294 @node RS/6000 and PowerPC Options
24295 @subsection IBM RS/6000 and PowerPC Options
24296 @cindex RS/6000 and PowerPC Options
24297 @cindex IBM RS/6000 and PowerPC Options
24299 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
24301 @item -mpowerpc-gpopt
24302 @itemx -mno-powerpc-gpopt
24303 @itemx -mpowerpc-gfxopt
24304 @itemx -mno-powerpc-gfxopt
24307 @itemx -mno-powerpc64
24311 @itemx -mno-popcntb
24313 @itemx -mno-popcntd
24320 @itemx -mno-hard-dfp
24321 @opindex mpowerpc-gpopt
24322 @opindex mno-powerpc-gpopt
24323 @opindex mpowerpc-gfxopt
24324 @opindex mno-powerpc-gfxopt
24325 @opindex mpowerpc64
24326 @opindex mno-powerpc64
24330 @opindex mno-popcntb
24332 @opindex mno-popcntd
24338 @opindex mno-hard-dfp
24339 You use these options to specify which instructions are available on the
24340 processor you are using. The default value of these options is
24341 determined when configuring GCC@. Specifying the
24342 @option{-mcpu=@var{cpu_type}} overrides the specification of these
24343 options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
24344 rather than the options listed above.
24346 Specifying @option{-mpowerpc-gpopt} allows
24347 GCC to use the optional PowerPC architecture instructions in the
24348 General Purpose group, including floating-point square root. Specifying
24349 @option{-mpowerpc-gfxopt} allows GCC to
24350 use the optional PowerPC architecture instructions in the Graphics
24351 group, including floating-point select.
24353 The @option{-mmfcrf} option allows GCC to generate the move from
24354 condition register field instruction implemented on the POWER4
24355 processor and other processors that support the PowerPC V2.01
24357 The @option{-mpopcntb} option allows GCC to generate the popcount and
24358 double-precision FP reciprocal estimate instruction implemented on the
24359 POWER5 processor and other processors that support the PowerPC V2.02
24361 The @option{-mpopcntd} option allows GCC to generate the popcount
24362 instruction implemented on the POWER7 processor and other processors
24363 that support the PowerPC V2.06 architecture.
24364 The @option{-mfprnd} option allows GCC to generate the FP round to
24365 integer instructions implemented on the POWER5+ processor and other
24366 processors that support the PowerPC V2.03 architecture.
24367 The @option{-mcmpb} option allows GCC to generate the compare bytes
24368 instruction implemented on the POWER6 processor and other processors
24369 that support the PowerPC V2.05 architecture.
24370 The @option{-mhard-dfp} option allows GCC to generate the decimal
24371 floating-point instructions implemented on some POWER processors.
24373 The @option{-mpowerpc64} option allows GCC to generate the additional
24374 64-bit instructions that are found in the full PowerPC64 architecture
24375 and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
24376 @option{-mno-powerpc64}.
24378 @item -mcpu=@var{cpu_type}
24380 Set architecture type, register usage, and
24381 instruction scheduling parameters for machine type @var{cpu_type}.
24382 Supported values for @var{cpu_type} are @samp{401}, @samp{403},
24383 @samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
24384 @samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
24385 @samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
24386 @samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
24387 @samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
24388 @samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{e5500},
24389 @samp{e6500}, @samp{ec603e}, @samp{G3}, @samp{G4}, @samp{G5},
24390 @samp{titan}, @samp{power3}, @samp{power4}, @samp{power5}, @samp{power5+},
24391 @samp{power6}, @samp{power6x}, @samp{power7}, @samp{power8},
24392 @samp{power9}, @samp{future}, @samp{powerpc}, @samp{powerpc64},
24393 @samp{powerpc64le}, @samp{rs64}, and @samp{native}.
24395 @option{-mcpu=powerpc}, @option{-mcpu=powerpc64}, and
24396 @option{-mcpu=powerpc64le} specify pure 32-bit PowerPC (either
24397 endian), 64-bit big endian PowerPC and 64-bit little endian PowerPC
24398 architecture machine types, with an appropriate, generic processor
24399 model assumed for scheduling purposes.
24401 Specifying @samp{native} as cpu type detects and selects the
24402 architecture option that corresponds to the host processor of the
24403 system performing the compilation.
24404 @option{-mcpu=native} has no effect if GCC does not recognize the
24407 The other options specify a specific processor. Code generated under
24408 those options runs best on that processor, and may not run at all on
24411 The @option{-mcpu} options automatically enable or disable the
24414 @gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
24415 -mpopcntb -mpopcntd -mpowerpc64 @gol
24416 -mpowerpc-gpopt -mpowerpc-gfxopt @gol
24417 -mmulhw -mdlmzb -mmfpgpr -mvsx @gol
24418 -mcrypto -mhtm -mpower8-fusion -mpower8-vector @gol
24419 -mquad-memory -mquad-memory-atomic -mfloat128 -mfloat128-hardware}
24421 The particular options set for any particular CPU varies between
24422 compiler versions, depending on what setting seems to produce optimal
24423 code for that CPU; it doesn't necessarily reflect the actual hardware's
24424 capabilities. If you wish to set an individual option to a particular
24425 value, you may specify it after the @option{-mcpu} option, like
24426 @option{-mcpu=970 -mno-altivec}.
24428 On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
24429 not enabled or disabled by the @option{-mcpu} option at present because
24430 AIX does not have full support for these options. You may still
24431 enable or disable them individually if you're sure it'll work in your
24434 @item -mtune=@var{cpu_type}
24436 Set the instruction scheduling parameters for machine type
24437 @var{cpu_type}, but do not set the architecture type or register usage,
24438 as @option{-mcpu=@var{cpu_type}} does. The same
24439 values for @var{cpu_type} are used for @option{-mtune} as for
24440 @option{-mcpu}. If both are specified, the code generated uses the
24441 architecture and registers set by @option{-mcpu}, but the
24442 scheduling parameters set by @option{-mtune}.
24444 @item -mcmodel=small
24445 @opindex mcmodel=small
24446 Generate PowerPC64 code for the small model: The TOC is limited to
24449 @item -mcmodel=medium
24450 @opindex mcmodel=medium
24451 Generate PowerPC64 code for the medium model: The TOC and other static
24452 data may be up to a total of 4G in size. This is the default for 64-bit
24455 @item -mcmodel=large
24456 @opindex mcmodel=large
24457 Generate PowerPC64 code for the large model: The TOC may be up to 4G
24458 in size. Other data and code is only limited by the 64-bit address
24462 @itemx -mno-altivec
24464 @opindex mno-altivec
24465 Generate code that uses (does not use) AltiVec instructions, and also
24466 enable the use of built-in functions that allow more direct access to
24467 the AltiVec instruction set. You may also need to set
24468 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
24471 When @option{-maltivec} is used, the element order for AltiVec intrinsics
24472 such as @code{vec_splat}, @code{vec_extract}, and @code{vec_insert}
24473 match array element order corresponding to the endianness of the
24474 target. That is, element zero identifies the leftmost element in a
24475 vector register when targeting a big-endian platform, and identifies
24476 the rightmost element in a vector register when targeting a
24477 little-endian platform.
24482 @opindex mno-vrsave
24483 Generate VRSAVE instructions when generating AltiVec code.
24486 @opindex msecure-plt
24487 Generate code that allows @command{ld} and @command{ld.so}
24488 to build executables and shared
24489 libraries with non-executable @code{.plt} and @code{.got} sections.
24491 32-bit SYSV ABI option.
24495 Generate code that uses a BSS @code{.plt} section that @command{ld.so}
24497 requires @code{.plt} and @code{.got}
24498 sections that are both writable and executable.
24499 This is a PowerPC 32-bit SYSV ABI option.
24505 This switch enables or disables the generation of ISEL instructions.
24511 Generate code that uses (does not use) vector/scalar (VSX)
24512 instructions, and also enable the use of built-in functions that allow
24513 more direct access to the VSX instruction set.
24518 @opindex mno-crypto
24519 Enable the use (disable) of the built-in functions that allow direct
24520 access to the cryptographic instructions that were added in version
24521 2.07 of the PowerPC ISA.
24527 Enable (disable) the use of the built-in functions that allow direct
24528 access to the Hardware Transactional Memory (HTM) instructions that
24529 were added in version 2.07 of the PowerPC ISA.
24531 @item -mpower8-fusion
24532 @itemx -mno-power8-fusion
24533 @opindex mpower8-fusion
24534 @opindex mno-power8-fusion
24535 Generate code that keeps (does not keeps) some integer operations
24536 adjacent so that the instructions can be fused together on power8 and
24539 @item -mpower8-vector
24540 @itemx -mno-power8-vector
24541 @opindex mpower8-vector
24542 @opindex mno-power8-vector
24543 Generate code that uses (does not use) the vector and scalar
24544 instructions that were added in version 2.07 of the PowerPC ISA. Also
24545 enable the use of built-in functions that allow more direct access to
24546 the vector instructions.
24548 @item -mquad-memory
24549 @itemx -mno-quad-memory
24550 @opindex mquad-memory
24551 @opindex mno-quad-memory
24552 Generate code that uses (does not use) the non-atomic quad word memory
24553 instructions. The @option{-mquad-memory} option requires use of
24556 @item -mquad-memory-atomic
24557 @itemx -mno-quad-memory-atomic
24558 @opindex mquad-memory-atomic
24559 @opindex mno-quad-memory-atomic
24560 Generate code that uses (does not use) the atomic quad word memory
24561 instructions. The @option{-mquad-memory-atomic} option requires use of
24565 @itemx -mno-float128
24567 @opindex mno-float128
24568 Enable/disable the @var{__float128} keyword for IEEE 128-bit floating point
24569 and use either software emulation for IEEE 128-bit floating point or
24570 hardware instructions.
24572 The VSX instruction set (@option{-mvsx}, @option{-mcpu=power7},
24573 @option{-mcpu=power8}), or @option{-mcpu=power9} must be enabled to
24574 use the IEEE 128-bit floating point support. The IEEE 128-bit
24575 floating point support only works on PowerPC Linux systems.
24577 The default for @option{-mfloat128} is enabled on PowerPC Linux
24578 systems using the VSX instruction set, and disabled on other systems.
24580 If you use the ISA 3.0 instruction set (@option{-mpower9-vector} or
24581 @option{-mcpu=power9}) on a 64-bit system, the IEEE 128-bit floating
24582 point support will also enable the generation of ISA 3.0 IEEE 128-bit
24583 floating point instructions. Otherwise, if you do not specify to
24584 generate ISA 3.0 instructions or you are targeting a 32-bit big endian
24585 system, IEEE 128-bit floating point will be done with software
24588 @item -mfloat128-hardware
24589 @itemx -mno-float128-hardware
24590 @opindex mfloat128-hardware
24591 @opindex mno-float128-hardware
24592 Enable/disable using ISA 3.0 hardware instructions to support the
24593 @var{__float128} data type.
24595 The default for @option{-mfloat128-hardware} is enabled on PowerPC
24596 Linux systems using the ISA 3.0 instruction set, and disabled on other
24603 Generate code for 32-bit or 64-bit environments of Darwin and SVR4
24604 targets (including GNU/Linux). The 32-bit environment sets int, long
24605 and pointer to 32 bits and generates code that runs on any PowerPC
24606 variant. The 64-bit environment sets int to 32 bits and long and
24607 pointer to 64 bits, and generates code for PowerPC64, as for
24608 @option{-mpowerpc64}.
24611 @itemx -mno-fp-in-toc
24612 @itemx -mno-sum-in-toc
24613 @itemx -mminimal-toc
24615 @opindex mno-fp-in-toc
24616 @opindex mno-sum-in-toc
24617 @opindex mminimal-toc
24618 Modify generation of the TOC (Table Of Contents), which is created for
24619 every executable file. The @option{-mfull-toc} option is selected by
24620 default. In that case, GCC allocates at least one TOC entry for
24621 each unique non-automatic variable reference in your program. GCC
24622 also places floating-point constants in the TOC@. However, only
24623 16,384 entries are available in the TOC@.
24625 If you receive a linker error message that saying you have overflowed
24626 the available TOC space, you can reduce the amount of TOC space used
24627 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
24628 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
24629 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
24630 generate code to calculate the sum of an address and a constant at
24631 run time instead of putting that sum into the TOC@. You may specify one
24632 or both of these options. Each causes GCC to produce very slightly
24633 slower and larger code at the expense of conserving TOC space.
24635 If you still run out of space in the TOC even when you specify both of
24636 these options, specify @option{-mminimal-toc} instead. This option causes
24637 GCC to make only one TOC entry for every file. When you specify this
24638 option, GCC produces code that is slower and larger but which
24639 uses extremely little TOC space. You may wish to use this option
24640 only on files that contain less frequently-executed code.
24646 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
24647 @code{long} type, and the infrastructure needed to support them.
24648 Specifying @option{-maix64} implies @option{-mpowerpc64},
24649 while @option{-maix32} disables the 64-bit ABI and
24650 implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
24653 @itemx -mno-xl-compat
24654 @opindex mxl-compat
24655 @opindex mno-xl-compat
24656 Produce code that conforms more closely to IBM XL compiler semantics
24657 when using AIX-compatible ABI@. Pass floating-point arguments to
24658 prototyped functions beyond the register save area (RSA) on the stack
24659 in addition to argument FPRs. Do not assume that most significant
24660 double in 128-bit long double value is properly rounded when comparing
24661 values and converting to double. Use XL symbol names for long double
24664 The AIX calling convention was extended but not initially documented to
24665 handle an obscure K&R C case of calling a function that takes the
24666 address of its arguments with fewer arguments than declared. IBM XL
24667 compilers access floating-point arguments that do not fit in the
24668 RSA from the stack when a subroutine is compiled without
24669 optimization. Because always storing floating-point arguments on the
24670 stack is inefficient and rarely needed, this option is not enabled by
24671 default and only is necessary when calling subroutines compiled by IBM
24672 XL compilers without optimization.
24676 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
24677 application written to use message passing with special startup code to
24678 enable the application to run. The system must have PE installed in the
24679 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
24680 must be overridden with the @option{-specs=} option to specify the
24681 appropriate directory location. The Parallel Environment does not
24682 support threads, so the @option{-mpe} option and the @option{-pthread}
24683 option are incompatible.
24685 @item -malign-natural
24686 @itemx -malign-power
24687 @opindex malign-natural
24688 @opindex malign-power
24689 On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
24690 @option{-malign-natural} overrides the ABI-defined alignment of larger
24691 types, such as floating-point doubles, on their natural size-based boundary.
24692 The option @option{-malign-power} instructs GCC to follow the ABI-specified
24693 alignment rules. GCC defaults to the standard alignment defined in the ABI@.
24695 On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
24699 @itemx -mhard-float
24700 @opindex msoft-float
24701 @opindex mhard-float
24702 Generate code that does not use (uses) the floating-point register set.
24703 Software floating-point emulation is provided if you use the
24704 @option{-msoft-float} option, and pass the option to GCC when linking.
24707 @itemx -mno-multiple
24709 @opindex mno-multiple
24710 Generate code that uses (does not use) the load multiple word
24711 instructions and the store multiple word instructions. These
24712 instructions are generated by default on POWER systems, and not
24713 generated on PowerPC systems. Do not use @option{-mmultiple} on little-endian
24714 PowerPC systems, since those instructions do not work when the
24715 processor is in little-endian mode. The exceptions are PPC740 and
24716 PPC750 which permit these instructions in little-endian mode.
24721 @opindex mno-update
24722 Generate code that uses (does not use) the load or store instructions
24723 that update the base register to the address of the calculated memory
24724 location. These instructions are generated by default. If you use
24725 @option{-mno-update}, there is a small window between the time that the
24726 stack pointer is updated and the address of the previous frame is
24727 stored, which means code that walks the stack frame across interrupts or
24728 signals may get corrupted data.
24730 @item -mavoid-indexed-addresses
24731 @itemx -mno-avoid-indexed-addresses
24732 @opindex mavoid-indexed-addresses
24733 @opindex mno-avoid-indexed-addresses
24734 Generate code that tries to avoid (not avoid) the use of indexed load
24735 or store instructions. These instructions can incur a performance
24736 penalty on Power6 processors in certain situations, such as when
24737 stepping through large arrays that cross a 16M boundary. This option
24738 is enabled by default when targeting Power6 and disabled otherwise.
24741 @itemx -mno-fused-madd
24742 @opindex mfused-madd
24743 @opindex mno-fused-madd
24744 Generate code that uses (does not use) the floating-point multiply and
24745 accumulate instructions. These instructions are generated by default
24746 if hardware floating point is used. The machine-dependent
24747 @option{-mfused-madd} option is now mapped to the machine-independent
24748 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
24749 mapped to @option{-ffp-contract=off}.
24755 Generate code that uses (does not use) the half-word multiply and
24756 multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
24757 These instructions are generated by default when targeting those
24764 Generate code that uses (does not use) the string-search @samp{dlmzb}
24765 instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
24766 generated by default when targeting those processors.
24768 @item -mno-bit-align
24770 @opindex mno-bit-align
24771 @opindex mbit-align
24772 On System V.4 and embedded PowerPC systems do not (do) force structures
24773 and unions that contain bit-fields to be aligned to the base type of the
24776 For example, by default a structure containing nothing but 8
24777 @code{unsigned} bit-fields of length 1 is aligned to a 4-byte
24778 boundary and has a size of 4 bytes. By using @option{-mno-bit-align},
24779 the structure is aligned to a 1-byte boundary and is 1 byte in
24782 @item -mno-strict-align
24783 @itemx -mstrict-align
24784 @opindex mno-strict-align
24785 @opindex mstrict-align
24786 On System V.4 and embedded PowerPC systems do not (do) assume that
24787 unaligned memory references are handled by the system.
24789 @item -mrelocatable
24790 @itemx -mno-relocatable
24791 @opindex mrelocatable
24792 @opindex mno-relocatable
24793 Generate code that allows (does not allow) a static executable to be
24794 relocated to a different address at run time. A simple embedded
24795 PowerPC system loader should relocate the entire contents of
24796 @code{.got2} and 4-byte locations listed in the @code{.fixup} section,
24797 a table of 32-bit addresses generated by this option. For this to
24798 work, all objects linked together must be compiled with
24799 @option{-mrelocatable} or @option{-mrelocatable-lib}.
24800 @option{-mrelocatable} code aligns the stack to an 8-byte boundary.
24802 @item -mrelocatable-lib
24803 @itemx -mno-relocatable-lib
24804 @opindex mrelocatable-lib
24805 @opindex mno-relocatable-lib
24806 Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
24807 @code{.fixup} section to allow static executables to be relocated at
24808 run time, but @option{-mrelocatable-lib} does not use the smaller stack
24809 alignment of @option{-mrelocatable}. Objects compiled with
24810 @option{-mrelocatable-lib} may be linked with objects compiled with
24811 any combination of the @option{-mrelocatable} options.
24817 On System V.4 and embedded PowerPC systems do not (do) assume that
24818 register 2 contains a pointer to a global area pointing to the addresses
24819 used in the program.
24822 @itemx -mlittle-endian
24824 @opindex mlittle-endian
24825 On System V.4 and embedded PowerPC systems compile code for the
24826 processor in little-endian mode. The @option{-mlittle-endian} option is
24827 the same as @option{-mlittle}.
24830 @itemx -mbig-endian
24832 @opindex mbig-endian
24833 On System V.4 and embedded PowerPC systems compile code for the
24834 processor in big-endian mode. The @option{-mbig-endian} option is
24835 the same as @option{-mbig}.
24837 @item -mdynamic-no-pic
24838 @opindex mdynamic-no-pic
24839 On Darwin and Mac OS X systems, compile code so that it is not
24840 relocatable, but that its external references are relocatable. The
24841 resulting code is suitable for applications, but not shared
24844 @item -msingle-pic-base
24845 @opindex msingle-pic-base
24846 Treat the register used for PIC addressing as read-only, rather than
24847 loading it in the prologue for each function. The runtime system is
24848 responsible for initializing this register with an appropriate value
24849 before execution begins.
24851 @item -mprioritize-restricted-insns=@var{priority}
24852 @opindex mprioritize-restricted-insns
24853 This option controls the priority that is assigned to
24854 dispatch-slot restricted instructions during the second scheduling
24855 pass. The argument @var{priority} takes the value @samp{0}, @samp{1},
24856 or @samp{2} to assign no, highest, or second-highest (respectively)
24857 priority to dispatch-slot restricted
24860 @item -msched-costly-dep=@var{dependence_type}
24861 @opindex msched-costly-dep
24862 This option controls which dependences are considered costly
24863 by the target during instruction scheduling. The argument
24864 @var{dependence_type} takes one of the following values:
24868 No dependence is costly.
24871 All dependences are costly.
24873 @item @samp{true_store_to_load}
24874 A true dependence from store to load is costly.
24876 @item @samp{store_to_load}
24877 Any dependence from store to load is costly.
24880 Any dependence for which the latency is greater than or equal to
24881 @var{number} is costly.
24884 @item -minsert-sched-nops=@var{scheme}
24885 @opindex minsert-sched-nops
24886 This option controls which NOP insertion scheme is used during
24887 the second scheduling pass. The argument @var{scheme} takes one of the
24895 Pad with NOPs any dispatch group that has vacant issue slots,
24896 according to the scheduler's grouping.
24898 @item @samp{regroup_exact}
24899 Insert NOPs to force costly dependent insns into
24900 separate groups. Insert exactly as many NOPs as needed to force an insn
24901 to a new group, according to the estimated processor grouping.
24904 Insert NOPs to force costly dependent insns into
24905 separate groups. Insert @var{number} NOPs to force an insn to a new group.
24909 @opindex mcall-sysv
24910 On System V.4 and embedded PowerPC systems compile code using calling
24911 conventions that adhere to the March 1995 draft of the System V
24912 Application Binary Interface, PowerPC processor supplement. This is the
24913 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
24915 @item -mcall-sysv-eabi
24917 @opindex mcall-sysv-eabi
24918 @opindex mcall-eabi
24919 Specify both @option{-mcall-sysv} and @option{-meabi} options.
24921 @item -mcall-sysv-noeabi
24922 @opindex mcall-sysv-noeabi
24923 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
24925 @item -mcall-aixdesc
24927 On System V.4 and embedded PowerPC systems compile code for the AIX
24931 @opindex mcall-linux
24932 On System V.4 and embedded PowerPC systems compile code for the
24933 Linux-based GNU system.
24935 @item -mcall-freebsd
24936 @opindex mcall-freebsd
24937 On System V.4 and embedded PowerPC systems compile code for the
24938 FreeBSD operating system.
24940 @item -mcall-netbsd
24941 @opindex mcall-netbsd
24942 On System V.4 and embedded PowerPC systems compile code for the
24943 NetBSD operating system.
24945 @item -mcall-openbsd
24946 @opindex mcall-netbsd
24947 On System V.4 and embedded PowerPC systems compile code for the
24948 OpenBSD operating system.
24950 @item -mtraceback=@var{traceback_type}
24951 @opindex mtraceback
24952 Select the type of traceback table. Valid values for @var{traceback_type}
24953 are @samp{full}, @samp{part}, and @samp{no}.
24955 @item -maix-struct-return
24956 @opindex maix-struct-return
24957 Return all structures in memory (as specified by the AIX ABI)@.
24959 @item -msvr4-struct-return
24960 @opindex msvr4-struct-return
24961 Return structures smaller than 8 bytes in registers (as specified by the
24964 @item -mabi=@var{abi-type}
24966 Extend the current ABI with a particular extension, or remove such extension.
24967 Valid values are @samp{altivec}, @samp{no-altivec},
24968 @samp{ibmlongdouble}, @samp{ieeelongdouble},
24969 @samp{elfv1}, @samp{elfv2}@.
24971 @item -mabi=ibmlongdouble
24972 @opindex mabi=ibmlongdouble
24973 Change the current ABI to use IBM extended-precision long double.
24974 This is not likely to work if your system defaults to using IEEE
24975 extended-precision long double. If you change the long double type
24976 from IEEE extended-precision, the compiler will issue a warning unless
24977 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24980 @item -mabi=ieeelongdouble
24981 @opindex mabi=ieeelongdouble
24982 Change the current ABI to use IEEE extended-precision long double.
24983 This is not likely to work if your system defaults to using IBM
24984 extended-precision long double. If you change the long double type
24985 from IBM extended-precision, the compiler will issue a warning unless
24986 you use the @option{-Wno-psabi} option. Requires @option{-mlong-double-128}
24990 @opindex mabi=elfv1
24991 Change the current ABI to use the ELFv1 ABI.
24992 This is the default ABI for big-endian PowerPC 64-bit Linux.
24993 Overriding the default ABI requires special system support and is
24994 likely to fail in spectacular ways.
24997 @opindex mabi=elfv2
24998 Change the current ABI to use the ELFv2 ABI.
24999 This is the default ABI for little-endian PowerPC 64-bit Linux.
25000 Overriding the default ABI requires special system support and is
25001 likely to fail in spectacular ways.
25003 @item -mgnu-attribute
25004 @itemx -mno-gnu-attribute
25005 @opindex mgnu-attribute
25006 @opindex mno-gnu-attribute
25007 Emit .gnu_attribute assembly directives to set tag/value pairs in a
25008 .gnu.attributes section that specify ABI variations in function
25009 parameters or return values.
25012 @itemx -mno-prototype
25013 @opindex mprototype
25014 @opindex mno-prototype
25015 On System V.4 and embedded PowerPC systems assume that all calls to
25016 variable argument functions are properly prototyped. Otherwise, the
25017 compiler must insert an instruction before every non-prototyped call to
25018 set or clear bit 6 of the condition code register (@code{CR}) to
25019 indicate whether floating-point values are passed in the floating-point
25020 registers in case the function takes variable arguments. With
25021 @option{-mprototype}, only calls to prototyped variable argument functions
25022 set or clear the bit.
25026 On embedded PowerPC systems, assume that the startup module is called
25027 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
25028 @file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
25033 On embedded PowerPC systems, assume that the startup module is called
25034 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
25039 On embedded PowerPC systems, assume that the startup module is called
25040 @file{crt0.o} and the standard C libraries are @file{libads.a} and
25043 @item -myellowknife
25044 @opindex myellowknife
25045 On embedded PowerPC systems, assume that the startup module is called
25046 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
25051 On System V.4 and embedded PowerPC systems, specify that you are
25052 compiling for a VxWorks system.
25056 On embedded PowerPC systems, set the @code{PPC_EMB} bit in the ELF flags
25057 header to indicate that @samp{eabi} extended relocations are used.
25063 On System V.4 and embedded PowerPC systems do (do not) adhere to the
25064 Embedded Applications Binary Interface (EABI), which is a set of
25065 modifications to the System V.4 specifications. Selecting @option{-meabi}
25066 means that the stack is aligned to an 8-byte boundary, a function
25067 @code{__eabi} is called from @code{main} to set up the EABI
25068 environment, and the @option{-msdata} option can use both @code{r2} and
25069 @code{r13} to point to two separate small data areas. Selecting
25070 @option{-mno-eabi} means that the stack is aligned to a 16-byte boundary,
25071 no EABI initialization function is called from @code{main}, and the
25072 @option{-msdata} option only uses @code{r13} to point to a single
25073 small data area. The @option{-meabi} option is on by default if you
25074 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
25077 @opindex msdata=eabi
25078 On System V.4 and embedded PowerPC systems, put small initialized
25079 @code{const} global and static data in the @code{.sdata2} section, which
25080 is pointed to by register @code{r2}. Put small initialized
25081 non-@code{const} global and static data in the @code{.sdata} section,
25082 which is pointed to by register @code{r13}. Put small uninitialized
25083 global and static data in the @code{.sbss} section, which is adjacent to
25084 the @code{.sdata} section. The @option{-msdata=eabi} option is
25085 incompatible with the @option{-mrelocatable} option. The
25086 @option{-msdata=eabi} option also sets the @option{-memb} option.
25089 @opindex msdata=sysv
25090 On System V.4 and embedded PowerPC systems, put small global and static
25091 data in the @code{.sdata} section, which is pointed to by register
25092 @code{r13}. Put small uninitialized global and static data in the
25093 @code{.sbss} section, which is adjacent to the @code{.sdata} section.
25094 The @option{-msdata=sysv} option is incompatible with the
25095 @option{-mrelocatable} option.
25097 @item -msdata=default
25099 @opindex msdata=default
25101 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
25102 compile code the same as @option{-msdata=eabi}, otherwise compile code the
25103 same as @option{-msdata=sysv}.
25106 @opindex msdata=data
25107 On System V.4 and embedded PowerPC systems, put small global
25108 data in the @code{.sdata} section. Put small uninitialized global
25109 data in the @code{.sbss} section. Do not use register @code{r13}
25110 to address small data however. This is the default behavior unless
25111 other @option{-msdata} options are used.
25115 @opindex msdata=none
25117 On embedded PowerPC systems, put all initialized global and static data
25118 in the @code{.data} section, and all uninitialized data in the
25119 @code{.bss} section.
25121 @item -mreadonly-in-sdata
25122 @opindex mreadonly-in-sdata
25123 @opindex mno-readonly-in-sdata
25124 Put read-only objects in the @code{.sdata} section as well. This is the
25127 @item -mblock-move-inline-limit=@var{num}
25128 @opindex mblock-move-inline-limit
25129 Inline all block moves (such as calls to @code{memcpy} or structure
25130 copies) less than or equal to @var{num} bytes. The minimum value for
25131 @var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
25132 targets. The default value is target-specific.
25134 @item -mblock-compare-inline-limit=@var{num}
25135 @opindex mblock-compare-inline-limit
25136 Generate non-looping inline code for all block compares (such as calls
25137 to @code{memcmp} or structure compares) less than or equal to @var{num}
25138 bytes. If @var{num} is 0, all inline expansion (non-loop and loop) of
25139 block compare is disabled. The default value is target-specific.
25141 @item -mblock-compare-inline-loop-limit=@var{num}
25142 @opindex mblock-compare-inline-loop-limit
25143 Generate an inline expansion using loop code for all block compares that
25144 are less than or equal to @var{num} bytes, but greater than the limit
25145 for non-loop inline block compare expansion. If the block length is not
25146 constant, at most @var{num} bytes will be compared before @code{memcmp}
25147 is called to compare the remainder of the block. The default value is
25150 @item -mstring-compare-inline-limit=@var{num}
25151 @opindex mstring-compare-inline-limit
25152 Compare at most @var{num} string bytes with inline code.
25153 If the difference or end of string is not found at the
25154 end of the inline compare a call to @code{strcmp} or @code{strncmp} will
25155 take care of the rest of the comparison. The default is 64 bytes.
25159 @cindex smaller data references (PowerPC)
25160 @cindex .sdata/.sdata2 references (PowerPC)
25161 On embedded PowerPC systems, put global and static items less than or
25162 equal to @var{num} bytes into the small data or BSS sections instead of
25163 the normal data or BSS section. By default, @var{num} is 8. The
25164 @option{-G @var{num}} switch is also passed to the linker.
25165 All modules should be compiled with the same @option{-G @var{num}} value.
25168 @itemx -mno-regnames
25170 @opindex mno-regnames
25171 On System V.4 and embedded PowerPC systems do (do not) emit register
25172 names in the assembly language output using symbolic forms.
25175 @itemx -mno-longcall
25177 @opindex mno-longcall
25178 By default assume that all calls are far away so that a longer and more
25179 expensive calling sequence is required. This is required for calls
25180 farther than 32 megabytes (33,554,432 bytes) from the current location.
25181 A short call is generated if the compiler knows
25182 the call cannot be that far away. This setting can be overridden by
25183 the @code{shortcall} function attribute, or by @code{#pragma
25186 Some linkers are capable of detecting out-of-range calls and generating
25187 glue code on the fly. On these systems, long calls are unnecessary and
25188 generate slower code. As of this writing, the AIX linker can do this,
25189 as can the GNU linker for PowerPC/64. It is planned to add this feature
25190 to the GNU linker for 32-bit PowerPC systems as well.
25192 On PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU linkers,
25193 GCC can generate long calls using an inline PLT call sequence (see
25194 @option{-mpltseq}). PowerPC with @option{-mbss-plt} and PowerPC64
25195 ELFv1 (big-endian) do not support inline PLT calls.
25197 On Darwin/PPC systems, @code{#pragma longcall} generates @code{jbsr
25198 callee, L42}, plus a @dfn{branch island} (glue code). The two target
25199 addresses represent the callee and the branch island. The
25200 Darwin/PPC linker prefers the first address and generates a @code{bl
25201 callee} if the PPC @code{bl} instruction reaches the callee directly;
25202 otherwise, the linker generates @code{bl L42} to call the branch
25203 island. The branch island is appended to the body of the
25204 calling function; it computes the full 32-bit address of the callee
25207 On Mach-O (Darwin) systems, this option directs the compiler emit to
25208 the glue for every direct call, and the Darwin linker decides whether
25209 to use or discard it.
25211 In the future, GCC may ignore all longcall specifications
25212 when the linker is known to generate glue.
25217 @opindex mno-pltseq
25218 Implement (do not implement) -fno-plt and long calls using an inline
25219 PLT call sequence that supports lazy linking and long calls to
25220 functions in dlopen'd shared libraries. Inline PLT calls are only
25221 supported on PowerPC64 ELFv2 and 32-bit PowerPC systems with newer GNU
25222 linkers, and are enabled by default if the support is detected when
25223 configuring GCC, and, in the case of 32-bit PowerPC, if GCC is
25224 configured with @option{--enable-secureplt}. @option{-mpltseq} code
25225 and @option{-mbss-plt} 32-bit PowerPC relocatable objects may not be
25228 @item -mtls-markers
25229 @itemx -mno-tls-markers
25230 @opindex mtls-markers
25231 @opindex mno-tls-markers
25232 Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
25233 specifying the function argument. The relocation allows the linker to
25234 reliably associate function call with argument setup instructions for
25235 TLS optimization, which in turn allows GCC to better schedule the
25241 This option enables use of the reciprocal estimate and
25242 reciprocal square root estimate instructions with additional
25243 Newton-Raphson steps to increase precision instead of doing a divide or
25244 square root and divide for floating-point arguments. You should use
25245 the @option{-ffast-math} option when using @option{-mrecip} (or at
25246 least @option{-funsafe-math-optimizations},
25247 @option{-ffinite-math-only}, @option{-freciprocal-math} and
25248 @option{-fno-trapping-math}). Note that while the throughput of the
25249 sequence is generally higher than the throughput of the non-reciprocal
25250 instruction, the precision of the sequence can be decreased by up to 2
25251 ulp (i.e.@: the inverse of 1.0 equals 0.99999994) for reciprocal square
25254 @item -mrecip=@var{opt}
25255 @opindex mrecip=opt
25256 This option controls which reciprocal estimate instructions
25257 may be used. @var{opt} is a comma-separated list of options, which may
25258 be preceded by a @code{!} to invert the option:
25263 Enable all estimate instructions.
25266 Enable the default instructions, equivalent to @option{-mrecip}.
25269 Disable all estimate instructions, equivalent to @option{-mno-recip}.
25272 Enable the reciprocal approximation instructions for both
25273 single and double precision.
25276 Enable the single-precision reciprocal approximation instructions.
25279 Enable the double-precision reciprocal approximation instructions.
25282 Enable the reciprocal square root approximation instructions for both
25283 single and double precision.
25286 Enable the single-precision reciprocal square root approximation instructions.
25289 Enable the double-precision reciprocal square root approximation instructions.
25293 So, for example, @option{-mrecip=all,!rsqrtd} enables
25294 all of the reciprocal estimate instructions, except for the
25295 @code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
25296 which handle the double-precision reciprocal square root calculations.
25298 @item -mrecip-precision
25299 @itemx -mno-recip-precision
25300 @opindex mrecip-precision
25301 Assume (do not assume) that the reciprocal estimate instructions
25302 provide higher-precision estimates than is mandated by the PowerPC
25303 ABI. Selecting @option{-mcpu=power6}, @option{-mcpu=power7} or
25304 @option{-mcpu=power8} automatically selects @option{-mrecip-precision}.
25305 The double-precision square root estimate instructions are not generated by
25306 default on low-precision machines, since they do not provide an
25307 estimate that converges after three steps.
25309 @item -mveclibabi=@var{type}
25310 @opindex mveclibabi
25311 Specifies the ABI type to use for vectorizing intrinsics using an
25312 external library. The only type supported at present is @samp{mass},
25313 which specifies to use IBM's Mathematical Acceleration Subsystem
25314 (MASS) libraries for vectorizing intrinsics using external libraries.
25315 GCC currently emits calls to @code{acosd2}, @code{acosf4},
25316 @code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
25317 @code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
25318 @code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
25319 @code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
25320 @code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
25321 @code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
25322 @code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
25323 @code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
25324 @code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
25325 @code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
25326 @code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
25327 @code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
25328 @code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
25329 for power7. Both @option{-ftree-vectorize} and
25330 @option{-funsafe-math-optimizations} must also be enabled. The MASS
25331 libraries must be specified at link time.
25336 Generate (do not generate) the @code{friz} instruction when the
25337 @option{-funsafe-math-optimizations} option is used to optimize
25338 rounding of floating-point values to 64-bit integer and back to floating
25339 point. The @code{friz} instruction does not return the same value if
25340 the floating-point number is too large to fit in an integer.
25342 @item -mpointers-to-nested-functions
25343 @itemx -mno-pointers-to-nested-functions
25344 @opindex mpointers-to-nested-functions
25345 Generate (do not generate) code to load up the static chain register
25346 (@code{r11}) when calling through a pointer on AIX and 64-bit Linux
25347 systems where a function pointer points to a 3-word descriptor giving
25348 the function address, TOC value to be loaded in register @code{r2}, and
25349 static chain value to be loaded in register @code{r11}. The
25350 @option{-mpointers-to-nested-functions} is on by default. You cannot
25351 call through pointers to nested functions or pointers
25352 to functions compiled in other languages that use the static chain if
25353 you use @option{-mno-pointers-to-nested-functions}.
25355 @item -msave-toc-indirect
25356 @itemx -mno-save-toc-indirect
25357 @opindex msave-toc-indirect
25358 Generate (do not generate) code to save the TOC value in the reserved
25359 stack location in the function prologue if the function calls through
25360 a pointer on AIX and 64-bit Linux systems. If the TOC value is not
25361 saved in the prologue, it is saved just before the call through the
25362 pointer. The @option{-mno-save-toc-indirect} option is the default.
25364 @item -mcompat-align-parm
25365 @itemx -mno-compat-align-parm
25366 @opindex mcompat-align-parm
25367 Generate (do not generate) code to pass structure parameters with a
25368 maximum alignment of 64 bits, for compatibility with older versions
25371 Older versions of GCC (prior to 4.9.0) incorrectly did not align a
25372 structure parameter on a 128-bit boundary when that structure contained
25373 a member requiring 128-bit alignment. This is corrected in more
25374 recent versions of GCC. This option may be used to generate code
25375 that is compatible with functions compiled with older versions of
25378 The @option{-mno-compat-align-parm} option is the default.
25380 @item -mstack-protector-guard=@var{guard}
25381 @itemx -mstack-protector-guard-reg=@var{reg}
25382 @itemx -mstack-protector-guard-offset=@var{offset}
25383 @itemx -mstack-protector-guard-symbol=@var{symbol}
25384 @opindex mstack-protector-guard
25385 @opindex mstack-protector-guard-reg
25386 @opindex mstack-protector-guard-offset
25387 @opindex mstack-protector-guard-symbol
25388 Generate stack protection code using canary at @var{guard}. Supported
25389 locations are @samp{global} for global canary or @samp{tls} for per-thread
25390 canary in the TLS block (the default with GNU libc version 2.4 or later).
25392 With the latter choice the options
25393 @option{-mstack-protector-guard-reg=@var{reg}} and
25394 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
25395 which register to use as base register for reading the canary, and from what
25396 offset from that base register. The default for those is as specified in the
25397 relevant ABI. @option{-mstack-protector-guard-symbol=@var{symbol}} overrides
25398 the offset with a symbol reference to a canary in the TLS block.
25404 Generate (do not generate) pc-relative addressing when the option
25405 @option{-mcpu=future} is used.
25409 @subsection RX Options
25412 These command-line options are defined for RX targets:
25415 @item -m64bit-doubles
25416 @itemx -m32bit-doubles
25417 @opindex m64bit-doubles
25418 @opindex m32bit-doubles
25419 Make the @code{double} data type be 64 bits (@option{-m64bit-doubles})
25420 or 32 bits (@option{-m32bit-doubles}) in size. The default is
25421 @option{-m32bit-doubles}. @emph{Note} RX floating-point hardware only
25422 works on 32-bit values, which is why the default is
25423 @option{-m32bit-doubles}.
25429 Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
25430 floating-point hardware. The default is enabled for the RX600
25431 series and disabled for the RX200 series.
25433 Floating-point instructions are only generated for 32-bit floating-point
25434 values, however, so the FPU hardware is not used for doubles if the
25435 @option{-m64bit-doubles} option is used.
25437 @emph{Note} If the @option{-fpu} option is enabled then
25438 @option{-funsafe-math-optimizations} is also enabled automatically.
25439 This is because the RX FPU instructions are themselves unsafe.
25441 @item -mcpu=@var{name}
25443 Selects the type of RX CPU to be targeted. Currently three types are
25444 supported, the generic @samp{RX600} and @samp{RX200} series hardware and
25445 the specific @samp{RX610} CPU. The default is @samp{RX600}.
25447 The only difference between @samp{RX600} and @samp{RX610} is that the
25448 @samp{RX610} does not support the @code{MVTIPL} instruction.
25450 The @samp{RX200} series does not have a hardware floating-point unit
25451 and so @option{-nofpu} is enabled by default when this type is
25454 @item -mbig-endian-data
25455 @itemx -mlittle-endian-data
25456 @opindex mbig-endian-data
25457 @opindex mlittle-endian-data
25458 Store data (but not code) in the big-endian format. The default is
25459 @option{-mlittle-endian-data}, i.e.@: to store data in the little-endian
25462 @item -msmall-data-limit=@var{N}
25463 @opindex msmall-data-limit
25464 Specifies the maximum size in bytes of global and static variables
25465 which can be placed into the small data area. Using the small data
25466 area can lead to smaller and faster code, but the size of area is
25467 limited and it is up to the programmer to ensure that the area does
25468 not overflow. Also when the small data area is used one of the RX's
25469 registers (usually @code{r13}) is reserved for use pointing to this
25470 area, so it is no longer available for use by the compiler. This
25471 could result in slower and/or larger code if variables are pushed onto
25472 the stack instead of being held in this register.
25474 Note, common variables (variables that have not been initialized) and
25475 constants are not placed into the small data area as they are assigned
25476 to other sections in the output executable.
25478 The default value is zero, which disables this feature. Note, this
25479 feature is not enabled by default with higher optimization levels
25480 (@option{-O2} etc) because of the potentially detrimental effects of
25481 reserving a register. It is up to the programmer to experiment and
25482 discover whether this feature is of benefit to their program. See the
25483 description of the @option{-mpid} option for a description of how the
25484 actual register to hold the small data area pointer is chosen.
25490 Use the simulator runtime. The default is to use the libgloss
25491 board-specific runtime.
25493 @item -mas100-syntax
25494 @itemx -mno-as100-syntax
25495 @opindex mas100-syntax
25496 @opindex mno-as100-syntax
25497 When generating assembler output use a syntax that is compatible with
25498 Renesas's AS100 assembler. This syntax can also be handled by the GAS
25499 assembler, but it has some restrictions so it is not generated by default.
25501 @item -mmax-constant-size=@var{N}
25502 @opindex mmax-constant-size
25503 Specifies the maximum size, in bytes, of a constant that can be used as
25504 an operand in a RX instruction. Although the RX instruction set does
25505 allow constants of up to 4 bytes in length to be used in instructions,
25506 a longer value equates to a longer instruction. Thus in some
25507 circumstances it can be beneficial to restrict the size of constants
25508 that are used in instructions. Constants that are too big are instead
25509 placed into a constant pool and referenced via register indirection.
25511 The value @var{N} can be between 0 and 4. A value of 0 (the default)
25512 or 4 means that constants of any size are allowed.
25516 Enable linker relaxation. Linker relaxation is a process whereby the
25517 linker attempts to reduce the size of a program by finding shorter
25518 versions of various instructions. Disabled by default.
25520 @item -mint-register=@var{N}
25521 @opindex mint-register
25522 Specify the number of registers to reserve for fast interrupt handler
25523 functions. The value @var{N} can be between 0 and 4. A value of 1
25524 means that register @code{r13} is reserved for the exclusive use
25525 of fast interrupt handlers. A value of 2 reserves @code{r13} and
25526 @code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
25527 @code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
25528 A value of 0, the default, does not reserve any registers.
25530 @item -msave-acc-in-interrupts
25531 @opindex msave-acc-in-interrupts
25532 Specifies that interrupt handler functions should preserve the
25533 accumulator register. This is only necessary if normal code might use
25534 the accumulator register, for example because it performs 64-bit
25535 multiplications. The default is to ignore the accumulator as this
25536 makes the interrupt handlers faster.
25542 Enables the generation of position independent data. When enabled any
25543 access to constant data is done via an offset from a base address
25544 held in a register. This allows the location of constant data to be
25545 determined at run time without requiring the executable to be
25546 relocated, which is a benefit to embedded applications with tight
25547 memory constraints. Data that can be modified is not affected by this
25550 Note, using this feature reserves a register, usually @code{r13}, for
25551 the constant data base address. This can result in slower and/or
25552 larger code, especially in complicated functions.
25554 The actual register chosen to hold the constant data base address
25555 depends upon whether the @option{-msmall-data-limit} and/or the
25556 @option{-mint-register} command-line options are enabled. Starting
25557 with register @code{r13} and proceeding downwards, registers are
25558 allocated first to satisfy the requirements of @option{-mint-register},
25559 then @option{-mpid} and finally @option{-msmall-data-limit}. Thus it
25560 is possible for the small data area register to be @code{r8} if both
25561 @option{-mint-register=4} and @option{-mpid} are specified on the
25564 By default this feature is not enabled. The default can be restored
25565 via the @option{-mno-pid} command-line option.
25567 @item -mno-warn-multiple-fast-interrupts
25568 @itemx -mwarn-multiple-fast-interrupts
25569 @opindex mno-warn-multiple-fast-interrupts
25570 @opindex mwarn-multiple-fast-interrupts
25571 Prevents GCC from issuing a warning message if it finds more than one
25572 fast interrupt handler when it is compiling a file. The default is to
25573 issue a warning for each extra fast interrupt handler found, as the RX
25574 only supports one such interrupt.
25576 @item -mallow-string-insns
25577 @itemx -mno-allow-string-insns
25578 @opindex mallow-string-insns
25579 @opindex mno-allow-string-insns
25580 Enables or disables the use of the string manipulation instructions
25581 @code{SMOVF}, @code{SCMPU}, @code{SMOVB}, @code{SMOVU}, @code{SUNTIL}
25582 @code{SWHILE} and also the @code{RMPA} instruction. These
25583 instructions may prefetch data, which is not safe to do if accessing
25584 an I/O register. (See section 12.2.7 of the RX62N Group User's Manual
25585 for more information).
25587 The default is to allow these instructions, but it is not possible for
25588 GCC to reliably detect all circumstances where a string instruction
25589 might be used to access an I/O register, so their use cannot be
25590 disabled automatically. Instead it is reliant upon the programmer to
25591 use the @option{-mno-allow-string-insns} option if their program
25592 accesses I/O space.
25594 When the instructions are enabled GCC defines the C preprocessor
25595 symbol @code{__RX_ALLOW_STRING_INSNS__}, otherwise it defines the
25596 symbol @code{__RX_DISALLOW_STRING_INSNS__}.
25602 Use only (or not only) @code{JSR} instructions to access functions.
25603 This option can be used when code size exceeds the range of @code{BSR}
25604 instructions. Note that @option{-mno-jsr} does not mean to not use
25605 @code{JSR} but instead means that any type of branch may be used.
25608 @emph{Note:} The generic GCC command-line option @option{-ffixed-@var{reg}}
25609 has special significance to the RX port when used with the
25610 @code{interrupt} function attribute. This attribute indicates a
25611 function intended to process fast interrupts. GCC ensures
25612 that it only uses the registers @code{r10}, @code{r11}, @code{r12}
25613 and/or @code{r13} and only provided that the normal use of the
25614 corresponding registers have been restricted via the
25615 @option{-ffixed-@var{reg}} or @option{-mint-register} command-line
25618 @node S/390 and zSeries Options
25619 @subsection S/390 and zSeries Options
25620 @cindex S/390 and zSeries Options
25622 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
25626 @itemx -msoft-float
25627 @opindex mhard-float
25628 @opindex msoft-float
25629 Use (do not use) the hardware floating-point instructions and registers
25630 for floating-point operations. When @option{-msoft-float} is specified,
25631 functions in @file{libgcc.a} are used to perform floating-point
25632 operations. When @option{-mhard-float} is specified, the compiler
25633 generates IEEE floating-point instructions. This is the default.
25636 @itemx -mno-hard-dfp
25638 @opindex mno-hard-dfp
25639 Use (do not use) the hardware decimal-floating-point instructions for
25640 decimal-floating-point operations. When @option{-mno-hard-dfp} is
25641 specified, functions in @file{libgcc.a} are used to perform
25642 decimal-floating-point operations. When @option{-mhard-dfp} is
25643 specified, the compiler generates decimal-floating-point hardware
25644 instructions. This is the default for @option{-march=z9-ec} or higher.
25646 @item -mlong-double-64
25647 @itemx -mlong-double-128
25648 @opindex mlong-double-64
25649 @opindex mlong-double-128
25650 These switches control the size of @code{long double} type. A size
25651 of 64 bits makes the @code{long double} type equivalent to the @code{double}
25652 type. This is the default.
25655 @itemx -mno-backchain
25656 @opindex mbackchain
25657 @opindex mno-backchain
25658 Store (do not store) the address of the caller's frame as backchain pointer
25659 into the callee's stack frame.
25660 A backchain may be needed to allow debugging using tools that do not understand
25661 DWARF call frame information.
25662 When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
25663 at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
25664 the backchain is placed into the topmost word of the 96/160 byte register
25667 In general, code compiled with @option{-mbackchain} is call-compatible with
25668 code compiled with @option{-mmo-backchain}; however, use of the backchain
25669 for debugging purposes usually requires that the whole binary is built with
25670 @option{-mbackchain}. Note that the combination of @option{-mbackchain},
25671 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25672 to build a linux kernel use @option{-msoft-float}.
25674 The default is to not maintain the backchain.
25676 @item -mpacked-stack
25677 @itemx -mno-packed-stack
25678 @opindex mpacked-stack
25679 @opindex mno-packed-stack
25680 Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
25681 specified, the compiler uses the all fields of the 96/160 byte register save
25682 area only for their default purpose; unused fields still take up stack space.
25683 When @option{-mpacked-stack} is specified, register save slots are densely
25684 packed at the top of the register save area; unused space is reused for other
25685 purposes, allowing for more efficient use of the available stack space.
25686 However, when @option{-mbackchain} is also in effect, the topmost word of
25687 the save area is always used to store the backchain, and the return address
25688 register is always saved two words below the backchain.
25690 As long as the stack frame backchain is not used, code generated with
25691 @option{-mpacked-stack} is call-compatible with code generated with
25692 @option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
25693 S/390 or zSeries generated code that uses the stack frame backchain at run
25694 time, not just for debugging purposes. Such code is not call-compatible
25695 with code compiled with @option{-mpacked-stack}. Also, note that the
25696 combination of @option{-mbackchain},
25697 @option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
25698 to build a linux kernel use @option{-msoft-float}.
25700 The default is to not use the packed stack layout.
25703 @itemx -mno-small-exec
25704 @opindex msmall-exec
25705 @opindex mno-small-exec
25706 Generate (or do not generate) code using the @code{bras} instruction
25707 to do subroutine calls.
25708 This only works reliably if the total executable size does not
25709 exceed 64k. The default is to use the @code{basr} instruction instead,
25710 which does not have this limitation.
25716 When @option{-m31} is specified, generate code compliant to the
25717 GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
25718 code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
25719 particular to generate 64-bit instructions. For the @samp{s390}
25720 targets, the default is @option{-m31}, while the @samp{s390x}
25721 targets default to @option{-m64}.
25727 When @option{-mzarch} is specified, generate code using the
25728 instructions available on z/Architecture.
25729 When @option{-mesa} is specified, generate code using the
25730 instructions available on ESA/390. Note that @option{-mesa} is
25731 not possible with @option{-m64}.
25732 When generating code compliant to the GNU/Linux for S/390 ABI,
25733 the default is @option{-mesa}. When generating code compliant
25734 to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
25740 The @option{-mhtm} option enables a set of builtins making use of
25741 instructions available with the transactional execution facility
25742 introduced with the IBM zEnterprise EC12 machine generation
25743 @ref{S/390 System z Built-in Functions}.
25744 @option{-mhtm} is enabled by default when using @option{-march=zEC12}.
25750 When @option{-mvx} is specified, generate code using the instructions
25751 available with the vector extension facility introduced with the IBM
25752 z13 machine generation.
25753 This option changes the ABI for some vector type values with regard to
25754 alignment and calling conventions. In case vector type values are
25755 being used in an ABI-relevant context a GAS @samp{.gnu_attribute}
25756 command will be added to mark the resulting binary with the ABI used.
25757 @option{-mvx} is enabled by default when using @option{-march=z13}.
25760 @itemx -mno-zvector
25762 @opindex mno-zvector
25763 The @option{-mzvector} option enables vector language extensions and
25764 builtins using instructions available with the vector extension
25765 facility introduced with the IBM z13 machine generation.
25766 This option adds support for @samp{vector} to be used as a keyword to
25767 define vector type variables and arguments. @samp{vector} is only
25768 available when GNU extensions are enabled. It will not be expanded
25769 when requesting strict standard compliance e.g.@: with @option{-std=c99}.
25770 In addition to the GCC low-level builtins @option{-mzvector} enables
25771 a set of builtins added for compatibility with AltiVec-style
25772 implementations like Power and Cell. In order to make use of these
25773 builtins the header file @file{vecintrin.h} needs to be included.
25774 @option{-mzvector} is disabled by default.
25780 Generate (or do not generate) code using the @code{mvcle} instruction
25781 to perform block moves. When @option{-mno-mvcle} is specified,
25782 use a @code{mvc} loop instead. This is the default unless optimizing for
25789 Print (or do not print) additional debug information when compiling.
25790 The default is to not print debug information.
25792 @item -march=@var{cpu-type}
25794 Generate code that runs on @var{cpu-type}, which is the name of a
25795 system representing a certain processor type. Possible values for
25796 @var{cpu-type} are @samp{z900}/@samp{arch5}, @samp{z990}/@samp{arch6},
25797 @samp{z9-109}, @samp{z9-ec}/@samp{arch7}, @samp{z10}/@samp{arch8},
25798 @samp{z196}/@samp{arch9}, @samp{zEC12}, @samp{z13}/@samp{arch11},
25799 @samp{z14}/@samp{arch12}, and @samp{native}.
25801 The default is @option{-march=z900}.
25803 Specifying @samp{native} as cpu type can be used to select the best
25804 architecture option for the host processor.
25805 @option{-march=native} has no effect if GCC does not recognize the
25808 @item -mtune=@var{cpu-type}
25810 Tune to @var{cpu-type} everything applicable about the generated code,
25811 except for the ABI and the set of available instructions.
25812 The list of @var{cpu-type} values is the same as for @option{-march}.
25813 The default is the value used for @option{-march}.
25816 @itemx -mno-tpf-trace
25817 @opindex mtpf-trace
25818 @opindex mno-tpf-trace
25819 Generate code that adds (does not add) in TPF OS specific branches to trace
25820 routines in the operating system. This option is off by default, even
25821 when compiling for the TPF OS@.
25824 @itemx -mno-fused-madd
25825 @opindex mfused-madd
25826 @opindex mno-fused-madd
25827 Generate code that uses (does not use) the floating-point multiply and
25828 accumulate instructions. These instructions are generated by default if
25829 hardware floating point is used.
25831 @item -mwarn-framesize=@var{framesize}
25832 @opindex mwarn-framesize
25833 Emit a warning if the current function exceeds the given frame size. Because
25834 this is a compile-time check it doesn't need to be a real problem when the program
25835 runs. It is intended to identify functions that most probably cause
25836 a stack overflow. It is useful to be used in an environment with limited stack
25837 size e.g.@: the linux kernel.
25839 @item -mwarn-dynamicstack
25840 @opindex mwarn-dynamicstack
25841 Emit a warning if the function calls @code{alloca} or uses dynamically-sized
25842 arrays. This is generally a bad idea with a limited stack size.
25844 @item -mstack-guard=@var{stack-guard}
25845 @itemx -mstack-size=@var{stack-size}
25846 @opindex mstack-guard
25847 @opindex mstack-size
25848 If these options are provided the S/390 back end emits additional instructions in
25849 the function prologue that trigger a trap if the stack size is @var{stack-guard}
25850 bytes above the @var{stack-size} (remember that the stack on S/390 grows downward).
25851 If the @var{stack-guard} option is omitted the smallest power of 2 larger than
25852 the frame size of the compiled function is chosen.
25853 These options are intended to be used to help debugging stack overflow problems.
25854 The additionally emitted code causes only little overhead and hence can also be
25855 used in production-like systems without greater performance degradation. The given
25856 values have to be exact powers of 2 and @var{stack-size} has to be greater than
25857 @var{stack-guard} without exceeding 64k.
25858 In order to be efficient the extra code makes the assumption that the stack starts
25859 at an address aligned to the value given by @var{stack-size}.
25860 The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
25862 @item -mhotpatch=@var{pre-halfwords},@var{post-halfwords}
25864 If the hotpatch option is enabled, a ``hot-patching'' function
25865 prologue is generated for all functions in the compilation unit.
25866 The funtion label is prepended with the given number of two-byte
25867 NOP instructions (@var{pre-halfwords}, maximum 1000000). After
25868 the label, 2 * @var{post-halfwords} bytes are appended, using the
25869 largest NOP like instructions the architecture allows (maximum
25872 If both arguments are zero, hotpatching is disabled.
25874 This option can be overridden for individual functions with the
25875 @code{hotpatch} attribute.
25878 @node Score Options
25879 @subsection Score Options
25880 @cindex Score Options
25882 These options are defined for Score implementations:
25887 Compile code for big-endian mode. This is the default.
25891 Compile code for little-endian mode.
25895 Disable generation of @code{bcnz} instructions.
25899 Enable generation of unaligned load and store instructions.
25903 Enable the use of multiply-accumulate instructions. Disabled by default.
25907 Specify the SCORE5 as the target architecture.
25911 Specify the SCORE5U of the target architecture.
25915 Specify the SCORE7 as the target architecture. This is the default.
25919 Specify the SCORE7D as the target architecture.
25923 @subsection SH Options
25925 These @samp{-m} options are defined for the SH implementations:
25930 Generate code for the SH1.
25934 Generate code for the SH2.
25937 Generate code for the SH2e.
25941 Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
25942 that the floating-point unit is not used.
25944 @item -m2a-single-only
25945 @opindex m2a-single-only
25946 Generate code for the SH2a-FPU, in such a way that no double-precision
25947 floating-point operations are used.
25950 @opindex m2a-single
25951 Generate code for the SH2a-FPU assuming the floating-point unit is in
25952 single-precision mode by default.
25956 Generate code for the SH2a-FPU assuming the floating-point unit is in
25957 double-precision mode by default.
25961 Generate code for the SH3.
25965 Generate code for the SH3e.
25969 Generate code for the SH4 without a floating-point unit.
25971 @item -m4-single-only
25972 @opindex m4-single-only
25973 Generate code for the SH4 with a floating-point unit that only
25974 supports single-precision arithmetic.
25978 Generate code for the SH4 assuming the floating-point unit is in
25979 single-precision mode by default.
25983 Generate code for the SH4.
25987 Generate code for SH4-100.
25989 @item -m4-100-nofpu
25990 @opindex m4-100-nofpu
25991 Generate code for SH4-100 in such a way that the
25992 floating-point unit is not used.
25994 @item -m4-100-single
25995 @opindex m4-100-single
25996 Generate code for SH4-100 assuming the floating-point unit is in
25997 single-precision mode by default.
25999 @item -m4-100-single-only
26000 @opindex m4-100-single-only
26001 Generate code for SH4-100 in such a way that no double-precision
26002 floating-point operations are used.
26006 Generate code for SH4-200.
26008 @item -m4-200-nofpu
26009 @opindex m4-200-nofpu
26010 Generate code for SH4-200 without in such a way that the
26011 floating-point unit is not used.
26013 @item -m4-200-single
26014 @opindex m4-200-single
26015 Generate code for SH4-200 assuming the floating-point unit is in
26016 single-precision mode by default.
26018 @item -m4-200-single-only
26019 @opindex m4-200-single-only
26020 Generate code for SH4-200 in such a way that no double-precision
26021 floating-point operations are used.
26025 Generate code for SH4-300.
26027 @item -m4-300-nofpu
26028 @opindex m4-300-nofpu
26029 Generate code for SH4-300 without in such a way that the
26030 floating-point unit is not used.
26032 @item -m4-300-single
26033 @opindex m4-300-single
26034 Generate code for SH4-300 in such a way that no double-precision
26035 floating-point operations are used.
26037 @item -m4-300-single-only
26038 @opindex m4-300-single-only
26039 Generate code for SH4-300 in such a way that no double-precision
26040 floating-point operations are used.
26044 Generate code for SH4-340 (no MMU, no FPU).
26048 Generate code for SH4-500 (no FPU). Passes @option{-isa=sh4-nofpu} to the
26053 Generate code for the SH4al-dsp, or for a SH4a in such a way that the
26054 floating-point unit is not used.
26056 @item -m4a-single-only
26057 @opindex m4a-single-only
26058 Generate code for the SH4a, in such a way that no double-precision
26059 floating-point operations are used.
26062 @opindex m4a-single
26063 Generate code for the SH4a assuming the floating-point unit is in
26064 single-precision mode by default.
26068 Generate code for the SH4a.
26072 Same as @option{-m4a-nofpu}, except that it implicitly passes
26073 @option{-dsp} to the assembler. GCC doesn't generate any DSP
26074 instructions at the moment.
26078 Compile code for the processor in big-endian mode.
26082 Compile code for the processor in little-endian mode.
26086 Align doubles at 64-bit boundaries. Note that this changes the calling
26087 conventions, and thus some functions from the standard C library do
26088 not work unless you recompile it first with @option{-mdalign}.
26092 Shorten some address references at link time, when possible; uses the
26093 linker option @option{-relax}.
26097 Use 32-bit offsets in @code{switch} tables. The default is to use
26102 Enable the use of bit manipulation instructions on SH2A.
26106 Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
26107 alignment constraints.
26111 Comply with the calling conventions defined by Renesas.
26114 @opindex mno-renesas
26115 Comply with the calling conventions defined for GCC before the Renesas
26116 conventions were available. This option is the default for all
26117 targets of the SH toolchain.
26120 @opindex mnomacsave
26121 Mark the @code{MAC} register as call-clobbered, even if
26122 @option{-mrenesas} is given.
26128 Control the IEEE compliance of floating-point comparisons, which affects the
26129 handling of cases where the result of a comparison is unordered. By default
26130 @option{-mieee} is implicitly enabled. If @option{-ffinite-math-only} is
26131 enabled @option{-mno-ieee} is implicitly set, which results in faster
26132 floating-point greater-equal and less-equal comparisons. The implicit settings
26133 can be overridden by specifying either @option{-mieee} or @option{-mno-ieee}.
26135 @item -minline-ic_invalidate
26136 @opindex minline-ic_invalidate
26137 Inline code to invalidate instruction cache entries after setting up
26138 nested function trampolines.
26139 This option has no effect if @option{-musermode} is in effect and the selected
26140 code generation option (e.g.@: @option{-m4}) does not allow the use of the @code{icbi}
26142 If the selected code generation option does not allow the use of the @code{icbi}
26143 instruction, and @option{-musermode} is not in effect, the inlined code
26144 manipulates the instruction cache address array directly with an associative
26145 write. This not only requires privileged mode at run time, but it also
26146 fails if the cache line had been mapped via the TLB and has become unmapped.
26150 Dump instruction size and location in the assembly code.
26153 @opindex mpadstruct
26154 This option is deprecated. It pads structures to multiple of 4 bytes,
26155 which is incompatible with the SH ABI@.
26157 @item -matomic-model=@var{model}
26158 @opindex matomic-model=@var{model}
26159 Sets the model of atomic operations and additional parameters as a comma
26160 separated list. For details on the atomic built-in functions see
26161 @ref{__atomic Builtins}. The following models and parameters are supported:
26166 Disable compiler generated atomic sequences and emit library calls for atomic
26167 operations. This is the default if the target is not @code{sh*-*-linux*}.
26170 Generate GNU/Linux compatible gUSA software atomic sequences for the atomic
26171 built-in functions. The generated atomic sequences require additional support
26172 from the interrupt/exception handling code of the system and are only suitable
26173 for SH3* and SH4* single-core systems. This option is enabled by default when
26174 the target is @code{sh*-*-linux*} and SH3* or SH4*. When the target is SH4A,
26175 this option also partially utilizes the hardware atomic instructions
26176 @code{movli.l} and @code{movco.l} to create more efficient code, unless
26177 @samp{strict} is specified.
26180 Generate software atomic sequences that use a variable in the thread control
26181 block. This is a variation of the gUSA sequences which can also be used on
26182 SH1* and SH2* targets. The generated atomic sequences require additional
26183 support from the interrupt/exception handling code of the system and are only
26184 suitable for single-core systems. When using this model, the @samp{gbr-offset=}
26185 parameter has to be specified as well.
26188 Generate software atomic sequences that temporarily disable interrupts by
26189 setting @code{SR.IMASK = 1111}. This model works only when the program runs
26190 in privileged mode and is only suitable for single-core systems. Additional
26191 support from the interrupt/exception handling code of the system is not
26192 required. This model is enabled by default when the target is
26193 @code{sh*-*-linux*} and SH1* or SH2*.
26196 Generate hardware atomic sequences using the @code{movli.l} and @code{movco.l}
26197 instructions only. This is only available on SH4A and is suitable for
26198 multi-core systems. Since the hardware instructions support only 32 bit atomic
26199 variables access to 8 or 16 bit variables is emulated with 32 bit accesses.
26200 Code compiled with this option is also compatible with other software
26201 atomic model interrupt/exception handling systems if executed on an SH4A
26202 system. Additional support from the interrupt/exception handling code of the
26203 system is not required for this model.
26206 This parameter specifies the offset in bytes of the variable in the thread
26207 control block structure that should be used by the generated atomic sequences
26208 when the @samp{soft-tcb} model has been selected. For other models this
26209 parameter is ignored. The specified value must be an integer multiple of four
26210 and in the range 0-1020.
26213 This parameter prevents mixed usage of multiple atomic models, even if they
26214 are compatible, and makes the compiler generate atomic sequences of the
26215 specified model only.
26221 Generate the @code{tas.b} opcode for @code{__atomic_test_and_set}.
26222 Notice that depending on the particular hardware and software configuration
26223 this can degrade overall performance due to the operand cache line flushes
26224 that are implied by the @code{tas.b} instruction. On multi-core SH4A
26225 processors the @code{tas.b} instruction must be used with caution since it
26226 can result in data corruption for certain cache configurations.
26229 @opindex mprefergot
26230 When generating position-independent code, emit function calls using
26231 the Global Offset Table instead of the Procedure Linkage Table.
26234 @itemx -mno-usermode
26236 @opindex mno-usermode
26237 Don't allow (allow) the compiler generating privileged mode code. Specifying
26238 @option{-musermode} also implies @option{-mno-inline-ic_invalidate} if the
26239 inlined code would not work in user mode. @option{-musermode} is the default
26240 when the target is @code{sh*-*-linux*}. If the target is SH1* or SH2*
26241 @option{-musermode} has no effect, since there is no user mode.
26243 @item -multcost=@var{number}
26244 @opindex multcost=@var{number}
26245 Set the cost to assume for a multiply insn.
26247 @item -mdiv=@var{strategy}
26248 @opindex mdiv=@var{strategy}
26249 Set the division strategy to be used for integer division operations.
26250 @var{strategy} can be one of:
26255 Calls a library function that uses the single-step division instruction
26256 @code{div1} to perform the operation. Division by zero calculates an
26257 unspecified result and does not trap. This is the default except for SH4,
26258 SH2A and SHcompact.
26261 Calls a library function that performs the operation in double precision
26262 floating point. Division by zero causes a floating-point exception. This is
26263 the default for SHcompact with FPU. Specifying this for targets that do not
26264 have a double precision FPU defaults to @code{call-div1}.
26267 Calls a library function that uses a lookup table for small divisors and
26268 the @code{div1} instruction with case distinction for larger divisors. Division
26269 by zero calculates an unspecified result and does not trap. This is the default
26270 for SH4. Specifying this for targets that do not have dynamic shift
26271 instructions defaults to @code{call-div1}.
26275 When a division strategy has not been specified the default strategy is
26276 selected based on the current target. For SH2A the default strategy is to
26277 use the @code{divs} and @code{divu} instructions instead of library function
26280 @item -maccumulate-outgoing-args
26281 @opindex maccumulate-outgoing-args
26282 Reserve space once for outgoing arguments in the function prologue rather
26283 than around each call. Generally beneficial for performance and size. Also
26284 needed for unwinding to avoid changing the stack frame around conditional code.
26286 @item -mdivsi3_libfunc=@var{name}
26287 @opindex mdivsi3_libfunc=@var{name}
26288 Set the name of the library function used for 32-bit signed division to
26290 This only affects the name used in the @samp{call} division strategies, and
26291 the compiler still expects the same sets of input/output/clobbered registers as
26292 if this option were not present.
26294 @item -mfixed-range=@var{register-range}
26295 @opindex mfixed-range
26296 Generate code treating the given register range as fixed registers.
26297 A fixed register is one that the register allocator cannot use. This is
26298 useful when compiling kernel code. A register range is specified as
26299 two registers separated by a dash. Multiple register ranges can be
26300 specified separated by a comma.
26302 @item -mbranch-cost=@var{num}
26303 @opindex mbranch-cost=@var{num}
26304 Assume @var{num} to be the cost for a branch instruction. Higher numbers
26305 make the compiler try to generate more branch-free code if possible.
26306 If not specified the value is selected depending on the processor type that
26307 is being compiled for.
26310 @itemx -mno-zdcbranch
26311 @opindex mzdcbranch
26312 @opindex mno-zdcbranch
26313 Assume (do not assume) that zero displacement conditional branch instructions
26314 @code{bt} and @code{bf} are fast. If @option{-mzdcbranch} is specified, the
26315 compiler prefers zero displacement branch code sequences. This is
26316 enabled by default when generating code for SH4 and SH4A. It can be explicitly
26317 disabled by specifying @option{-mno-zdcbranch}.
26319 @item -mcbranch-force-delay-slot
26320 @opindex mcbranch-force-delay-slot
26321 Force the usage of delay slots for conditional branches, which stuffs the delay
26322 slot with a @code{nop} if a suitable instruction cannot be found. By default
26323 this option is disabled. It can be enabled to work around hardware bugs as
26324 found in the original SH7055.
26327 @itemx -mno-fused-madd
26328 @opindex mfused-madd
26329 @opindex mno-fused-madd
26330 Generate code that uses (does not use) the floating-point multiply and
26331 accumulate instructions. These instructions are generated by default
26332 if hardware floating point is used. The machine-dependent
26333 @option{-mfused-madd} option is now mapped to the machine-independent
26334 @option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
26335 mapped to @option{-ffp-contract=off}.
26341 Allow or disallow the compiler to emit the @code{fsca} instruction for sine
26342 and cosine approximations. The option @option{-mfsca} must be used in
26343 combination with @option{-funsafe-math-optimizations}. It is enabled by default
26344 when generating code for SH4A. Using @option{-mno-fsca} disables sine and cosine
26345 approximations even if @option{-funsafe-math-optimizations} is in effect.
26351 Allow or disallow the compiler to emit the @code{fsrra} instruction for
26352 reciprocal square root approximations. The option @option{-mfsrra} must be used
26353 in combination with @option{-funsafe-math-optimizations} and
26354 @option{-ffinite-math-only}. It is enabled by default when generating code for
26355 SH4A. Using @option{-mno-fsrra} disables reciprocal square root approximations
26356 even if @option{-funsafe-math-optimizations} and @option{-ffinite-math-only} are
26359 @item -mpretend-cmove
26360 @opindex mpretend-cmove
26361 Prefer zero-displacement conditional branches for conditional move instruction
26362 patterns. This can result in faster code on the SH4 processor.
26366 Generate code using the FDPIC ABI.
26370 @node Solaris 2 Options
26371 @subsection Solaris 2 Options
26372 @cindex Solaris 2 options
26374 These @samp{-m} options are supported on Solaris 2:
26377 @item -mclear-hwcap
26378 @opindex mclear-hwcap
26379 @option{-mclear-hwcap} tells the compiler to remove the hardware
26380 capabilities generated by the Solaris assembler. This is only necessary
26381 when object files use ISA extensions not supported by the current
26382 machine, but check at runtime whether or not to use them.
26384 @item -mimpure-text
26385 @opindex mimpure-text
26386 @option{-mimpure-text}, used in addition to @option{-shared}, tells
26387 the compiler to not pass @option{-z text} to the linker when linking a
26388 shared object. Using this option, you can link position-dependent
26389 code into a shared object.
26391 @option{-mimpure-text} suppresses the ``relocations remain against
26392 allocatable but non-writable sections'' linker error message.
26393 However, the necessary relocations trigger copy-on-write, and the
26394 shared object is not actually shared across processes. Instead of
26395 using @option{-mimpure-text}, you should compile all source code with
26396 @option{-fpic} or @option{-fPIC}.
26400 These switches are supported in addition to the above on Solaris 2:
26405 This is a synonym for @option{-pthread}.
26408 @node SPARC Options
26409 @subsection SPARC Options
26410 @cindex SPARC options
26412 These @samp{-m} options are supported on the SPARC:
26415 @item -mno-app-regs
26417 @opindex mno-app-regs
26419 Specify @option{-mapp-regs} to generate output using the global registers
26420 2 through 4, which the SPARC SVR4 ABI reserves for applications. Like the
26421 global register 1, each global register 2 through 4 is then treated as an
26422 allocable register that is clobbered by function calls. This is the default.
26424 To be fully SVR4 ABI-compliant at the cost of some performance loss,
26425 specify @option{-mno-app-regs}. You should compile libraries and system
26426 software with this option.
26432 With @option{-mflat}, the compiler does not generate save/restore instructions
26433 and uses a ``flat'' or single register window model. This model is compatible
26434 with the regular register window model. The local registers and the input
26435 registers (0--5) are still treated as ``call-saved'' registers and are
26436 saved on the stack as needed.
26438 With @option{-mno-flat} (the default), the compiler generates save/restore
26439 instructions (except for leaf functions). This is the normal operating mode.
26442 @itemx -mhard-float
26444 @opindex mhard-float
26445 Generate output containing floating-point instructions. This is the
26449 @itemx -msoft-float
26451 @opindex msoft-float
26452 Generate output containing library calls for floating point.
26453 @strong{Warning:} the requisite libraries are not available for all SPARC
26454 targets. Normally the facilities of the machine's usual C compiler are
26455 used, but this cannot be done directly in cross-compilation. You must make
26456 your own arrangements to provide suitable library functions for
26457 cross-compilation. The embedded targets @samp{sparc-*-aout} and
26458 @samp{sparclite-*-*} do provide software floating-point support.
26460 @option{-msoft-float} changes the calling convention in the output file;
26461 therefore, it is only useful if you compile @emph{all} of a program with
26462 this option. In particular, you need to compile @file{libgcc.a}, the
26463 library that comes with GCC, with @option{-msoft-float} in order for
26466 @item -mhard-quad-float
26467 @opindex mhard-quad-float
26468 Generate output containing quad-word (long double) floating-point
26471 @item -msoft-quad-float
26472 @opindex msoft-quad-float
26473 Generate output containing library calls for quad-word (long double)
26474 floating-point instructions. The functions called are those specified
26475 in the SPARC ABI@. This is the default.
26477 As of this writing, there are no SPARC implementations that have hardware
26478 support for the quad-word floating-point instructions. They all invoke
26479 a trap handler for one of these instructions, and then the trap handler
26480 emulates the effect of the instruction. Because of the trap handler overhead,
26481 this is much slower than calling the ABI library routines. Thus the
26482 @option{-msoft-quad-float} option is the default.
26484 @item -mno-unaligned-doubles
26485 @itemx -munaligned-doubles
26486 @opindex mno-unaligned-doubles
26487 @opindex munaligned-doubles
26488 Assume that doubles have 8-byte alignment. This is the default.
26490 With @option{-munaligned-doubles}, GCC assumes that doubles have 8-byte
26491 alignment only if they are contained in another type, or if they have an
26492 absolute address. Otherwise, it assumes they have 4-byte alignment.
26493 Specifying this option avoids some rare compatibility problems with code
26494 generated by other compilers. It is not the default because it results
26495 in a performance loss, especially for floating-point code.
26498 @itemx -mno-user-mode
26499 @opindex muser-mode
26500 @opindex mno-user-mode
26501 Do not generate code that can only run in supervisor mode. This is relevant
26502 only for the @code{casa} instruction emitted for the LEON3 processor. This
26505 @item -mfaster-structs
26506 @itemx -mno-faster-structs
26507 @opindex mfaster-structs
26508 @opindex mno-faster-structs
26509 With @option{-mfaster-structs}, the compiler assumes that structures
26510 should have 8-byte alignment. This enables the use of pairs of
26511 @code{ldd} and @code{std} instructions for copies in structure
26512 assignment, in place of twice as many @code{ld} and @code{st} pairs.
26513 However, the use of this changed alignment directly violates the SPARC
26514 ABI@. Thus, it's intended only for use on targets where the developer
26515 acknowledges that their resulting code is not directly in line with
26516 the rules of the ABI@.
26518 @item -mstd-struct-return
26519 @itemx -mno-std-struct-return
26520 @opindex mstd-struct-return
26521 @opindex mno-std-struct-return
26522 With @option{-mstd-struct-return}, the compiler generates checking code
26523 in functions returning structures or unions to detect size mismatches
26524 between the two sides of function calls, as per the 32-bit ABI@.
26526 The default is @option{-mno-std-struct-return}. This option has no effect
26533 Enable Local Register Allocation. This is the default for SPARC since GCC 7
26534 so @option{-mno-lra} needs to be passed to get old Reload.
26536 @item -mcpu=@var{cpu_type}
26538 Set the instruction set, register set, and instruction scheduling parameters
26539 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
26540 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{hypersparc},
26541 @samp{leon}, @samp{leon3}, @samp{leon3v7}, @samp{sparclite}, @samp{f930},
26542 @samp{f934}, @samp{sparclite86x}, @samp{sparclet}, @samp{tsc701}, @samp{v9},
26543 @samp{ultrasparc}, @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2},
26544 @samp{niagara3}, @samp{niagara4}, @samp{niagara7} and @samp{m8}.
26546 Native Solaris and GNU/Linux toolchains also support the value @samp{native},
26547 which selects the best architecture option for the host processor.
26548 @option{-mcpu=native} has no effect if GCC does not recognize
26551 Default instruction scheduling parameters are used for values that select
26552 an architecture and not an implementation. These are @samp{v7}, @samp{v8},
26553 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
26555 Here is a list of each supported architecture and their supported
26563 supersparc, hypersparc, leon, leon3
26566 f930, f934, sparclite86x
26572 ultrasparc, ultrasparc3, niagara, niagara2, niagara3, niagara4,
26576 By default (unless configured otherwise), GCC generates code for the V7
26577 variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
26578 additionally optimizes it for the Cypress CY7C602 chip, as used in the
26579 SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
26580 SPARCStation 1, 2, IPX etc.
26582 With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
26583 architecture. The only difference from V7 code is that the compiler emits
26584 the integer multiply and integer divide instructions which exist in SPARC-V8
26585 but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
26586 optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
26589 With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
26590 the SPARC architecture. This adds the integer multiply, integer divide step
26591 and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
26592 With @option{-mcpu=f930}, the compiler additionally optimizes it for the
26593 Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
26594 @option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
26595 MB86934 chip, which is the more recent SPARClite with FPU@.
26597 With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
26598 the SPARC architecture. This adds the integer multiply, multiply/accumulate,
26599 integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
26600 but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
26601 optimizes it for the TEMIC SPARClet chip.
26603 With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
26604 architecture. This adds 64-bit integer and floating-point move instructions,
26605 3 additional floating-point condition code registers and conditional move
26606 instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
26607 optimizes it for the Sun UltraSPARC I/II/IIi chips. With
26608 @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
26609 Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
26610 @option{-mcpu=niagara}, the compiler additionally optimizes it for
26611 Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
26612 additionally optimizes it for Sun UltraSPARC T2 chips. With
26613 @option{-mcpu=niagara3}, the compiler additionally optimizes it for Sun
26614 UltraSPARC T3 chips. With @option{-mcpu=niagara4}, the compiler
26615 additionally optimizes it for Sun UltraSPARC T4 chips. With
26616 @option{-mcpu=niagara7}, the compiler additionally optimizes it for
26617 Oracle SPARC M7 chips. With @option{-mcpu=m8}, the compiler
26618 additionally optimizes it for Oracle M8 chips.
26620 @item -mtune=@var{cpu_type}
26622 Set the instruction scheduling parameters for machine type
26623 @var{cpu_type}, but do not set the instruction set or register set that the
26624 option @option{-mcpu=@var{cpu_type}} does.
26626 The same values for @option{-mcpu=@var{cpu_type}} can be used for
26627 @option{-mtune=@var{cpu_type}}, but the only useful values are those
26628 that select a particular CPU implementation. Those are
26629 @samp{cypress}, @samp{supersparc}, @samp{hypersparc}, @samp{leon},
26630 @samp{leon3}, @samp{leon3v7}, @samp{f930}, @samp{f934},
26631 @samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
26632 @samp{ultrasparc3}, @samp{niagara}, @samp{niagara2}, @samp{niagara3},
26633 @samp{niagara4}, @samp{niagara7} and @samp{m8}. With native Solaris
26634 and GNU/Linux toolchains, @samp{native} can also be used.
26639 @opindex mno-v8plus
26640 With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
26641 difference from the V8 ABI is that the global and out registers are
26642 considered 64 bits wide. This is enabled by default on Solaris in 32-bit
26643 mode for all SPARC-V9 processors.
26649 With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
26650 Visual Instruction Set extensions. The default is @option{-mno-vis}.
26656 With @option{-mvis2}, GCC generates code that takes advantage of
26657 version 2.0 of the UltraSPARC Visual Instruction Set extensions. The
26658 default is @option{-mvis2} when targeting a cpu that supports such
26659 instructions, such as UltraSPARC-III and later. Setting @option{-mvis2}
26660 also sets @option{-mvis}.
26666 With @option{-mvis3}, GCC generates code that takes advantage of
26667 version 3.0 of the UltraSPARC Visual Instruction Set extensions. The
26668 default is @option{-mvis3} when targeting a cpu that supports such
26669 instructions, such as niagara-3 and later. Setting @option{-mvis3}
26670 also sets @option{-mvis2} and @option{-mvis}.
26676 With @option{-mvis4}, GCC generates code that takes advantage of
26677 version 4.0 of the UltraSPARC Visual Instruction Set extensions. The
26678 default is @option{-mvis4} when targeting a cpu that supports such
26679 instructions, such as niagara-7 and later. Setting @option{-mvis4}
26680 also sets @option{-mvis3}, @option{-mvis2} and @option{-mvis}.
26686 With @option{-mvis4b}, GCC generates code that takes advantage of
26687 version 4.0 of the UltraSPARC Visual Instruction Set extensions, plus
26688 the additional VIS instructions introduced in the Oracle SPARC
26689 Architecture 2017. The default is @option{-mvis4b} when targeting a
26690 cpu that supports such instructions, such as m8 and later. Setting
26691 @option{-mvis4b} also sets @option{-mvis4}, @option{-mvis3},
26692 @option{-mvis2} and @option{-mvis}.
26697 @opindex mno-cbcond
26698 With @option{-mcbcond}, GCC generates code that takes advantage of the UltraSPARC
26699 Compare-and-Branch-on-Condition instructions. The default is @option{-mcbcond}
26700 when targeting a CPU that supports such instructions, such as Niagara-4 and
26707 With @option{-mfmaf}, GCC generates code that takes advantage of the UltraSPARC
26708 Fused Multiply-Add Floating-point instructions. The default is @option{-mfmaf}
26709 when targeting a CPU that supports such instructions, such as Niagara-3 and
26715 @opindex mno-fsmuld
26716 With @option{-mfsmuld}, GCC generates code that takes advantage of the
26717 Floating-point Multiply Single to Double (FsMULd) instruction. The default is
26718 @option{-mfsmuld} when targeting a CPU supporting the architecture versions V8
26719 or V9 with FPU except @option{-mcpu=leon}.
26725 With @option{-mpopc}, GCC generates code that takes advantage of the UltraSPARC
26726 Population Count instruction. The default is @option{-mpopc}
26727 when targeting a CPU that supports such an instruction, such as Niagara-2 and
26734 With @option{-msubxc}, GCC generates code that takes advantage of the UltraSPARC
26735 Subtract-Extended-with-Carry instruction. The default is @option{-msubxc}
26736 when targeting a CPU that supports such an instruction, such as Niagara-7 and
26740 @opindex mfix-at697f
26741 Enable the documented workaround for the single erratum of the Atmel AT697F
26742 processor (which corresponds to erratum #13 of the AT697E processor).
26745 @opindex mfix-ut699
26746 Enable the documented workarounds for the floating-point errata and the data
26747 cache nullify errata of the UT699 processor.
26750 @opindex mfix-ut700
26751 Enable the documented workaround for the back-to-back store errata of
26752 the UT699E/UT700 processor.
26754 @item -mfix-gr712rc
26755 @opindex mfix-gr712rc
26756 Enable the documented workaround for the back-to-back store errata of
26757 the GR712RC processor.
26760 These @samp{-m} options are supported in addition to the above
26761 on SPARC-V9 processors in 64-bit environments:
26768 Generate code for a 32-bit or 64-bit environment.
26769 The 32-bit environment sets int, long and pointer to 32 bits.
26770 The 64-bit environment sets int to 32 bits and long and pointer
26773 @item -mcmodel=@var{which}
26775 Set the code model to one of
26779 The Medium/Low code model: 64-bit addresses, programs
26780 must be linked in the low 32 bits of memory. Programs can be statically
26781 or dynamically linked.
26784 The Medium/Middle code model: 64-bit addresses, programs
26785 must be linked in the low 44 bits of memory, the text and data segments must
26786 be less than 2GB in size and the data segment must be located within 2GB of
26790 The Medium/Anywhere code model: 64-bit addresses, programs
26791 may be linked anywhere in memory, the text and data segments must be less
26792 than 2GB in size and the data segment must be located within 2GB of the
26796 The Medium/Anywhere code model for embedded systems:
26797 64-bit addresses, the text and data segments must be less than 2GB in
26798 size, both starting anywhere in memory (determined at link time). The
26799 global register %g4 points to the base of the data segment. Programs
26800 are statically linked and PIC is not supported.
26803 @item -mmemory-model=@var{mem-model}
26804 @opindex mmemory-model
26805 Set the memory model in force on the processor to one of
26809 The default memory model for the processor and operating system.
26812 Relaxed Memory Order
26815 Partial Store Order
26821 Sequential Consistency
26824 These memory models are formally defined in Appendix D of the SPARC-V9
26825 architecture manual, as set in the processor's @code{PSTATE.MM} field.
26828 @itemx -mno-stack-bias
26829 @opindex mstack-bias
26830 @opindex mno-stack-bias
26831 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
26832 frame pointer if present, are offset by @minus{}2047 which must be added back
26833 when making stack frame references. This is the default in 64-bit mode.
26834 Otherwise, assume no such offset is present.
26837 @node System V Options
26838 @subsection Options for System V
26840 These additional options are available on System V Release 4 for
26841 compatibility with other compilers on those systems:
26846 Create a shared object.
26847 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
26851 Identify the versions of each tool used by the compiler, in a
26852 @code{.ident} assembler directive in the output.
26856 Refrain from adding @code{.ident} directives to the output file (this is
26859 @item -YP,@var{dirs}
26861 Search the directories @var{dirs}, and no others, for libraries
26862 specified with @option{-l}.
26864 @item -Ym,@var{dir}
26866 Look in the directory @var{dir} to find the M4 preprocessor.
26867 The assembler uses this option.
26868 @c This is supposed to go with a -Yd for predefined M4 macro files, but
26869 @c the generic assembler that comes with Solaris takes just -Ym.
26872 @node TILE-Gx Options
26873 @subsection TILE-Gx Options
26874 @cindex TILE-Gx options
26876 These @samp{-m} options are supported on the TILE-Gx:
26879 @item -mcmodel=small
26880 @opindex mcmodel=small
26881 Generate code for the small model. The distance for direct calls is
26882 limited to 500M in either direction. PC-relative addresses are 32
26883 bits. Absolute addresses support the full address range.
26885 @item -mcmodel=large
26886 @opindex mcmodel=large
26887 Generate code for the large model. There is no limitation on call
26888 distance, pc-relative addresses, or absolute addresses.
26890 @item -mcpu=@var{name}
26892 Selects the type of CPU to be targeted. Currently the only supported
26893 type is @samp{tilegx}.
26899 Generate code for a 32-bit or 64-bit environment. The 32-bit
26900 environment sets int, long, and pointer to 32 bits. The 64-bit
26901 environment sets int to 32 bits and long and pointer to 64 bits.
26904 @itemx -mlittle-endian
26905 @opindex mbig-endian
26906 @opindex mlittle-endian
26907 Generate code in big/little endian mode, respectively.
26910 @node TILEPro Options
26911 @subsection TILEPro Options
26912 @cindex TILEPro options
26914 These @samp{-m} options are supported on the TILEPro:
26917 @item -mcpu=@var{name}
26919 Selects the type of CPU to be targeted. Currently the only supported
26920 type is @samp{tilepro}.
26924 Generate code for a 32-bit environment, which sets int, long, and
26925 pointer to 32 bits. This is the only supported behavior so the flag
26926 is essentially ignored.
26930 @subsection V850 Options
26931 @cindex V850 Options
26933 These @samp{-m} options are defined for V850 implementations:
26937 @itemx -mno-long-calls
26938 @opindex mlong-calls
26939 @opindex mno-long-calls
26940 Treat all calls as being far away (near). If calls are assumed to be
26941 far away, the compiler always loads the function's address into a
26942 register, and calls indirect through the pointer.
26948 Do not optimize (do optimize) basic blocks that use the same index
26949 pointer 4 or more times to copy pointer into the @code{ep} register, and
26950 use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
26951 option is on by default if you optimize.
26953 @item -mno-prolog-function
26954 @itemx -mprolog-function
26955 @opindex mno-prolog-function
26956 @opindex mprolog-function
26957 Do not use (do use) external functions to save and restore registers
26958 at the prologue and epilogue of a function. The external functions
26959 are slower, but use less code space if more than one function saves
26960 the same number of registers. The @option{-mprolog-function} option
26961 is on by default if you optimize.
26965 Try to make the code as small as possible. At present, this just turns
26966 on the @option{-mep} and @option{-mprolog-function} options.
26968 @item -mtda=@var{n}
26970 Put static or global variables whose size is @var{n} bytes or less into
26971 the tiny data area that register @code{ep} points to. The tiny data
26972 area can hold up to 256 bytes in total (128 bytes for byte references).
26974 @item -msda=@var{n}
26976 Put static or global variables whose size is @var{n} bytes or less into
26977 the small data area that register @code{gp} points to. The small data
26978 area can hold up to 64 kilobytes.
26980 @item -mzda=@var{n}
26982 Put static or global variables whose size is @var{n} bytes or less into
26983 the first 32 kilobytes of memory.
26987 Specify that the target processor is the V850.
26991 Specify that the target processor is the V850E3V5. The preprocessor
26992 constant @code{__v850e3v5__} is defined if this option is used.
26996 Specify that the target processor is the V850E3V5. This is an alias for
26997 the @option{-mv850e3v5} option.
27001 Specify that the target processor is the V850E2V3. The preprocessor
27002 constant @code{__v850e2v3__} is defined if this option is used.
27006 Specify that the target processor is the V850E2. The preprocessor
27007 constant @code{__v850e2__} is defined if this option is used.
27011 Specify that the target processor is the V850E1. The preprocessor
27012 constants @code{__v850e1__} and @code{__v850e__} are defined if
27013 this option is used.
27017 Specify that the target processor is the V850ES. This is an alias for
27018 the @option{-mv850e1} option.
27022 Specify that the target processor is the V850E@. The preprocessor
27023 constant @code{__v850e__} is defined if this option is used.
27025 If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
27026 nor @option{-mv850e2} nor @option{-mv850e2v3} nor @option{-mv850e3v5}
27027 are defined then a default target processor is chosen and the
27028 relevant @samp{__v850*__} preprocessor constant is defined.
27030 The preprocessor constants @code{__v850} and @code{__v851__} are always
27031 defined, regardless of which processor variant is the target.
27033 @item -mdisable-callt
27034 @itemx -mno-disable-callt
27035 @opindex mdisable-callt
27036 @opindex mno-disable-callt
27037 This option suppresses generation of the @code{CALLT} instruction for the
27038 v850e, v850e1, v850e2, v850e2v3 and v850e3v5 flavors of the v850
27041 This option is enabled by default when the RH850 ABI is
27042 in use (see @option{-mrh850-abi}), and disabled by default when the
27043 GCC ABI is in use. If @code{CALLT} instructions are being generated
27044 then the C preprocessor symbol @code{__V850_CALLT__} is defined.
27050 Pass on (or do not pass on) the @option{-mrelax} command-line option
27054 @itemx -mno-long-jumps
27055 @opindex mlong-jumps
27056 @opindex mno-long-jumps
27057 Disable (or re-enable) the generation of PC-relative jump instructions.
27060 @itemx -mhard-float
27061 @opindex msoft-float
27062 @opindex mhard-float
27063 Disable (or re-enable) the generation of hardware floating point
27064 instructions. This option is only significant when the target
27065 architecture is @samp{V850E2V3} or higher. If hardware floating point
27066 instructions are being generated then the C preprocessor symbol
27067 @code{__FPU_OK__} is defined, otherwise the symbol
27068 @code{__NO_FPU__} is defined.
27072 Enables the use of the e3v5 LOOP instruction. The use of this
27073 instruction is not enabled by default when the e3v5 architecture is
27074 selected because its use is still experimental.
27078 @opindex mrh850-abi
27080 Enables support for the RH850 version of the V850 ABI. This is the
27081 default. With this version of the ABI the following rules apply:
27085 Integer sized structures and unions are returned via a memory pointer
27086 rather than a register.
27089 Large structures and unions (more than 8 bytes in size) are passed by
27093 Functions are aligned to 16-bit boundaries.
27096 The @option{-m8byte-align} command-line option is supported.
27099 The @option{-mdisable-callt} command-line option is enabled by
27100 default. The @option{-mno-disable-callt} command-line option is not
27104 When this version of the ABI is enabled the C preprocessor symbol
27105 @code{__V850_RH850_ABI__} is defined.
27109 Enables support for the old GCC version of the V850 ABI. With this
27110 version of the ABI the following rules apply:
27114 Integer sized structures and unions are returned in register @code{r10}.
27117 Large structures and unions (more than 8 bytes in size) are passed by
27121 Functions are aligned to 32-bit boundaries, unless optimizing for
27125 The @option{-m8byte-align} command-line option is not supported.
27128 The @option{-mdisable-callt} command-line option is supported but not
27129 enabled by default.
27132 When this version of the ABI is enabled the C preprocessor symbol
27133 @code{__V850_GCC_ABI__} is defined.
27135 @item -m8byte-align
27136 @itemx -mno-8byte-align
27137 @opindex m8byte-align
27138 @opindex mno-8byte-align
27139 Enables support for @code{double} and @code{long long} types to be
27140 aligned on 8-byte boundaries. The default is to restrict the
27141 alignment of all objects to at most 4-bytes. When
27142 @option{-m8byte-align} is in effect the C preprocessor symbol
27143 @code{__V850_8BYTE_ALIGN__} is defined.
27146 @opindex mbig-switch
27147 Generate code suitable for big switch tables. Use this option only if
27148 the assembler/linker complain about out of range branches within a switch
27153 This option causes r2 and r5 to be used in the code generated by
27154 the compiler. This setting is the default.
27156 @item -mno-app-regs
27157 @opindex mno-app-regs
27158 This option causes r2 and r5 to be treated as fixed registers.
27163 @subsection VAX Options
27164 @cindex VAX options
27166 These @samp{-m} options are defined for the VAX:
27171 Do not output certain jump instructions (@code{aobleq} and so on)
27172 that the Unix assembler for the VAX cannot handle across long
27177 Do output those jump instructions, on the assumption that the
27178 GNU assembler is being used.
27182 Output code for G-format floating-point numbers instead of D-format.
27185 @node Visium Options
27186 @subsection Visium Options
27187 @cindex Visium options
27193 A program which performs file I/O and is destined to run on an MCM target
27194 should be linked with this option. It causes the libraries libc.a and
27195 libdebug.a to be linked. The program should be run on the target under
27196 the control of the GDB remote debugging stub.
27200 A program which performs file I/O and is destined to run on the simulator
27201 should be linked with option. This causes libraries libc.a and libsim.a to
27205 @itemx -mhard-float
27207 @opindex mhard-float
27208 Generate code containing floating-point instructions. This is the
27212 @itemx -msoft-float
27214 @opindex msoft-float
27215 Generate code containing library calls for floating-point.
27217 @option{-msoft-float} changes the calling convention in the output file;
27218 therefore, it is only useful if you compile @emph{all} of a program with
27219 this option. In particular, you need to compile @file{libgcc.a}, the
27220 library that comes with GCC, with @option{-msoft-float} in order for
27223 @item -mcpu=@var{cpu_type}
27225 Set the instruction set, register set, and instruction scheduling parameters
27226 for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
27227 @samp{mcm}, @samp{gr5} and @samp{gr6}.
27229 @samp{mcm} is a synonym of @samp{gr5} present for backward compatibility.
27231 By default (unless configured otherwise), GCC generates code for the GR5
27232 variant of the Visium architecture.
27234 With @option{-mcpu=gr6}, GCC generates code for the GR6 variant of the Visium
27235 architecture. The only difference from GR5 code is that the compiler will
27236 generate block move instructions.
27238 @item -mtune=@var{cpu_type}
27240 Set the instruction scheduling parameters for machine type @var{cpu_type},
27241 but do not set the instruction set or register set that the option
27242 @option{-mcpu=@var{cpu_type}} would.
27246 Generate code for the supervisor mode, where there are no restrictions on
27247 the access to general registers. This is the default.
27250 @opindex muser-mode
27251 Generate code for the user mode, where the access to some general registers
27252 is forbidden: on the GR5, registers r24 to r31 cannot be accessed in this
27253 mode; on the GR6, only registers r29 to r31 are affected.
27257 @subsection VMS Options
27259 These @samp{-m} options are defined for the VMS implementations:
27262 @item -mvms-return-codes
27263 @opindex mvms-return-codes
27264 Return VMS condition codes from @code{main}. The default is to return POSIX-style
27265 condition (e.g.@: error) codes.
27267 @item -mdebug-main=@var{prefix}
27268 @opindex mdebug-main=@var{prefix}
27269 Flag the first routine whose name starts with @var{prefix} as the main
27270 routine for the debugger.
27274 Default to 64-bit memory allocation routines.
27276 @item -mpointer-size=@var{size}
27277 @opindex mpointer-size=@var{size}
27278 Set the default size of pointers. Possible options for @var{size} are
27279 @samp{32} or @samp{short} for 32 bit pointers, @samp{64} or @samp{long}
27280 for 64 bit pointers, and @samp{no} for supporting only 32 bit pointers.
27281 The later option disables @code{pragma pointer_size}.
27284 @node VxWorks Options
27285 @subsection VxWorks Options
27286 @cindex VxWorks Options
27288 The options in this section are defined for all VxWorks targets.
27289 Options specific to the target hardware are listed with the other
27290 options for that target.
27295 GCC can generate code for both VxWorks kernels and real time processes
27296 (RTPs). This option switches from the former to the latter. It also
27297 defines the preprocessor macro @code{__RTP__}.
27300 @opindex non-static
27301 Link an RTP executable against shared libraries rather than static
27302 libraries. The options @option{-static} and @option{-shared} can
27303 also be used for RTPs (@pxref{Link Options}); @option{-static}
27310 These options are passed down to the linker. They are defined for
27311 compatibility with Diab.
27314 @opindex Xbind-lazy
27315 Enable lazy binding of function calls. This option is equivalent to
27316 @option{-Wl,-z,now} and is defined for compatibility with Diab.
27320 Disable lazy binding of function calls. This option is the default and
27321 is defined for compatibility with Diab.
27325 @subsection x86 Options
27326 @cindex x86 Options
27328 These @samp{-m} options are defined for the x86 family of computers.
27332 @item -march=@var{cpu-type}
27334 Generate instructions for the machine type @var{cpu-type}. In contrast to
27335 @option{-mtune=@var{cpu-type}}, which merely tunes the generated code
27336 for the specified @var{cpu-type}, @option{-march=@var{cpu-type}} allows GCC
27337 to generate code that may not run at all on processors other than the one
27338 indicated. Specifying @option{-march=@var{cpu-type}} implies
27339 @option{-mtune=@var{cpu-type}}.
27341 The choices for @var{cpu-type} are:
27345 This selects the CPU to generate code for at compilation time by determining
27346 the processor type of the compiling machine. Using @option{-march=native}
27347 enables all instruction subsets supported by the local machine (hence
27348 the result might not run on different machines). Using @option{-mtune=native}
27349 produces code optimized for the local machine under the constraints
27350 of the selected instruction set.
27353 A generic CPU with 64-bit extensions.
27356 Original Intel i386 CPU@.
27359 Intel i486 CPU@. (No scheduling is implemented for this chip.)
27363 Intel Pentium CPU with no MMX support.
27366 Intel Lakemont MCU, based on Intel Pentium CPU.
27369 Intel Pentium MMX CPU, based on Pentium core with MMX instruction set support.
27372 Intel Pentium Pro CPU@.
27375 When used with @option{-march}, the Pentium Pro
27376 instruction set is used, so the code runs on all i686 family chips.
27377 When used with @option{-mtune}, it has the same meaning as @samp{generic}.
27380 Intel Pentium II CPU, based on Pentium Pro core with MMX instruction set
27385 Intel Pentium III CPU, based on Pentium Pro core with MMX and SSE instruction
27389 Intel Pentium M; low-power version of Intel Pentium III CPU
27390 with MMX, SSE and SSE2 instruction set support. Used by Centrino notebooks.
27394 Intel Pentium 4 CPU with MMX, SSE and SSE2 instruction set support.
27397 Improved version of Intel Pentium 4 CPU with MMX, SSE, SSE2 and SSE3 instruction
27401 Improved version of Intel Pentium 4 CPU with 64-bit extensions, MMX, SSE,
27402 SSE2 and SSE3 instruction set support.
27405 Intel Core 2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
27406 instruction set support.
27409 Intel Nehalem CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27410 SSE4.1, SSE4.2 and POPCNT instruction set support.
27413 Intel Westmere CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27414 SSE4.1, SSE4.2, POPCNT, AES and PCLMUL instruction set support.
27417 Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27418 SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.
27421 Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3,
27422 SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C
27423 instruction set support.
27426 Intel Haswell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27427 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27428 BMI, BMI2 and F16C instruction set support.
27431 Intel Broadwell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27432 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27433 BMI, BMI2, F16C, RDSEED, ADCX and PREFETCHW instruction set support.
27436 Intel Skylake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27437 SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27438 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC and
27439 XSAVES instruction set support.
27442 Intel Bonnell CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3 and SSSE3
27443 instruction set support.
27446 Intel Silvermont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27447 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL and RDRND instruction set support.
27450 Intel Goldmont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27451 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT and FSGSBASE
27452 instruction set support.
27454 @item goldmont-plus
27455 Intel Goldmont Plus CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27456 SSSE3, SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE,
27457 PTWRITE, RDPID, SGX and UMIP instruction set support.
27460 Intel Tremont CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27461 SSE4.1, SSE4.2, POPCNT, AES, PCLMUL, RDRND, XSAVE, XSAVEOPT, FSGSBASE, PTWRITE,
27462 RDPID, SGX, UMIP, GFNI-SSE, CLWB and ENCLV instruction set support.
27465 Intel Knight's Landing CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27466 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27467 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER and
27468 AVX512CD instruction set support.
27471 Intel Knights Mill CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27472 SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27473 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, AVX512F, AVX512PF, AVX512ER, AVX512CD,
27474 AVX5124VNNIW, AVX5124FMAPS and AVX512VPOPCNTDQ instruction set support.
27476 @item skylake-avx512
27477 Intel Skylake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3,
27478 SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA,
27479 BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27480 CLWB, AVX512VL, AVX512BW, AVX512DQ and AVX512CD instruction set support.
27483 Intel Cannonlake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27484 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27485 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27486 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27487 AVX512IFMA, SHA and UMIP instruction set support.
27489 @item icelake-client
27490 Intel Icelake Client CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27491 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27492 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27493 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27494 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27495 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES instruction set support.
27497 @item icelake-server
27498 Intel Icelake Server CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2,
27499 SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE,
27500 RDRND, FMA, BMI, BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC,
27501 XSAVES, AVX512F, AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI,
27502 AVX512IFMA, SHA, CLWB, UMIP, RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ,
27503 AVX512BITALG, AVX512VNNI, VPCLMULQDQ, VAES, PCONFIG and WBNOINVD instruction
27507 Intel Cascadelake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27508 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27509 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27510 AVX512VL, AVX512BW, AVX512DQ, AVX512CD and AVX512VNNI instruction set support.
27513 Intel cooperlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27514 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27515 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F, CLWB,
27516 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VNNI and AVX512BF16 instruction
27520 Intel Tigerlake CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, SSSE3,
27521 SSE4.1, SSE4.2, POPCNT, PKU, AVX, AVX2, AES, PCLMUL, FSGSBASE, RDRND, FMA, BMI,
27522 BMI2, F16C, RDSEED, ADCX, PREFETCHW, CLFLUSHOPT, XSAVEC, XSAVES, AVX512F,
27523 AVX512VL, AVX512BW, AVX512DQ, AVX512CD, AVX512VBMI, AVX512IFMA, SHA, CLWB, UMIP,
27524 RDPID, GFNI, AVX512VBMI2, AVX512VPOPCNTDQ, AVX512BITALG, AVX512VNNI, VPCLMULQDQ,
27525 VAES, PCONFIG, WBNOINVD, MOVDIRI, MOVDIR64B and AVX512VP2INTERSECT instruction
27529 AMD K6 CPU with MMX instruction set support.
27533 Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
27536 @itemx athlon-tbird
27537 AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
27543 Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
27544 instruction set support.
27550 Processors based on the AMD K8 core with x86-64 instruction set support,
27551 including the AMD Opteron, Athlon 64, and Athlon 64 FX processors.
27552 (This supersets MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit
27553 instruction set extensions.)
27556 @itemx opteron-sse3
27557 @itemx athlon64-sse3
27558 Improved versions of AMD K8 cores with SSE3 instruction set support.
27562 CPUs based on AMD Family 10h cores with x86-64 instruction set support. (This
27563 supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
27564 instruction set extensions.)
27567 CPUs based on AMD Family 15h cores with x86-64 instruction set support. (This
27568 supersets FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A,
27569 SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set extensions.)
27571 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27572 supersets BMI, TBM, F16C, FMA, FMA4, AVX, XOP, LWP, AES, PCLMUL, CX16, MMX,
27573 SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and 64-bit instruction set
27576 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27577 supersets BMI, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, XOP, LWP, AES,
27578 PCLMUL, CX16, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1, SSE4.2, ABM and
27579 64-bit instruction set extensions.
27581 AMD Family 15h core based CPUs with x86-64 instruction set support. (This
27582 supersets BMI, BMI2, TBM, F16C, FMA, FMA4, FSGSBASE, AVX, AVX2, XOP, LWP,
27583 AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3, SSE4.1,
27584 SSE4.2, ABM and 64-bit instruction set extensions.
27587 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27588 supersets BMI, BMI2, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED, MWAITX,
27589 SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A, SSSE3,
27590 SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27591 instruction set extensions.
27593 AMD Family 17h core based CPUs with x86-64 instruction set support. (This
27594 supersets BMI, BMI2, ,CLWB, F16C, FMA, FSGSBASE, AVX, AVX2, ADCX, RDSEED,
27595 MWAITX, SHA, CLZERO, AES, PCLMUL, CX16, MOVBE, MMX, SSE, SSE2, SSE3, SSE4A,
27596 SSSE3, SSE4.1, SSE4.2, ABM, XSAVEC, XSAVES, CLFLUSHOPT, POPCNT, and 64-bit
27597 instruction set extensions.)
27601 CPUs based on AMD Family 14h cores with x86-64 instruction set support. (This
27602 supersets MMX, SSE, SSE2, SSE3, SSSE3, SSE4A, CX16, ABM and 64-bit
27603 instruction set extensions.)
27606 CPUs based on AMD Family 16h cores with x86-64 instruction set support. This
27607 includes MOVBE, F16C, BMI, AVX, PCLMUL, AES, SSE4.2, SSE4.1, CX16, ABM,
27608 SSE4A, SSSE3, SSE3, SSE2, SSE, MMX and 64-bit instruction set extensions.
27611 IDT WinChip C6 CPU, dealt in same way as i486 with additional MMX instruction
27615 IDT WinChip 2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
27616 instruction set support.
27619 VIA C3 CPU with MMX and 3DNow!@: instruction set support.
27620 (No scheduling is implemented for this chip.)
27623 VIA C3-2 (Nehemiah/C5XL) CPU with MMX and SSE instruction set support.
27624 (No scheduling is implemented for this chip.)
27627 VIA C7 (Esther) CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27628 (No scheduling is implemented for this chip.)
27631 VIA Eden Samuel 2 CPU with MMX and 3DNow!@: instruction set support.
27632 (No scheduling is implemented for this chip.)
27635 VIA Eden Nehemiah CPU with MMX and SSE instruction set support.
27636 (No scheduling is implemented for this chip.)
27639 VIA Eden Esther CPU with MMX, SSE, SSE2 and SSE3 instruction set support.
27640 (No scheduling is implemented for this chip.)
27643 VIA Eden X2 CPU with x86-64, MMX, SSE, SSE2 and SSE3 instruction set support.
27644 (No scheduling is implemented for this chip.)
27647 VIA Eden X4 CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2,
27648 AVX and AVX2 instruction set support.
27649 (No scheduling is implemented for this chip.)
27652 Generic VIA Nano CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27653 instruction set support.
27654 (No scheduling is implemented for this chip.)
27657 VIA Nano 1xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27658 instruction set support.
27659 (No scheduling is implemented for this chip.)
27662 VIA Nano 2xxx CPU with x86-64, MMX, SSE, SSE2, SSE3 and SSSE3
27663 instruction set support.
27664 (No scheduling is implemented for this chip.)
27667 VIA Nano 3xxx CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27668 instruction set support.
27669 (No scheduling is implemented for this chip.)
27672 VIA Nano Dual Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27673 instruction set support.
27674 (No scheduling is implemented for this chip.)
27677 VIA Nano Quad Core CPU with x86-64, MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1
27678 instruction set support.
27679 (No scheduling is implemented for this chip.)
27682 AMD Geode embedded processor with MMX and 3DNow!@: instruction set support.
27685 @item -mtune=@var{cpu-type}
27687 Tune to @var{cpu-type} everything applicable about the generated code, except
27688 for the ABI and the set of available instructions.
27689 While picking a specific @var{cpu-type} schedules things appropriately
27690 for that particular chip, the compiler does not generate any code that
27691 cannot run on the default machine type unless you use a
27692 @option{-march=@var{cpu-type}} option.
27693 For example, if GCC is configured for i686-pc-linux-gnu
27694 then @option{-mtune=pentium4} generates code that is tuned for Pentium 4
27695 but still runs on i686 machines.
27697 The choices for @var{cpu-type} are the same as for @option{-march}.
27698 In addition, @option{-mtune} supports 2 extra choices for @var{cpu-type}:
27702 Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
27703 If you know the CPU on which your code will run, then you should use
27704 the corresponding @option{-mtune} or @option{-march} option instead of
27705 @option{-mtune=generic}. But, if you do not know exactly what CPU users
27706 of your application will have, then you should use this option.
27708 As new processors are deployed in the marketplace, the behavior of this
27709 option will change. Therefore, if you upgrade to a newer version of
27710 GCC, code generation controlled by this option will change to reflect
27712 that are most common at the time that version of GCC is released.
27714 There is no @option{-march=generic} option because @option{-march}
27715 indicates the instruction set the compiler can use, and there is no
27716 generic instruction set applicable to all processors. In contrast,
27717 @option{-mtune} indicates the processor (or, in this case, collection of
27718 processors) for which the code is optimized.
27721 Produce code optimized for the most current Intel processors, which are
27722 Haswell and Silvermont for this version of GCC. If you know the CPU
27723 on which your code will run, then you should use the corresponding
27724 @option{-mtune} or @option{-march} option instead of @option{-mtune=intel}.
27725 But, if you want your application performs better on both Haswell and
27726 Silvermont, then you should use this option.
27728 As new Intel processors are deployed in the marketplace, the behavior of
27729 this option will change. Therefore, if you upgrade to a newer version of
27730 GCC, code generation controlled by this option will change to reflect
27731 the most current Intel processors at the time that version of GCC is
27734 There is no @option{-march=intel} option because @option{-march} indicates
27735 the instruction set the compiler can use, and there is no common
27736 instruction set applicable to all processors. In contrast,
27737 @option{-mtune} indicates the processor (or, in this case, collection of
27738 processors) for which the code is optimized.
27741 @item -mcpu=@var{cpu-type}
27743 A deprecated synonym for @option{-mtune}.
27745 @item -mfpmath=@var{unit}
27747 Generate floating-point arithmetic for selected unit @var{unit}. The choices
27748 for @var{unit} are:
27752 Use the standard 387 floating-point coprocessor present on the majority of chips and
27753 emulated otherwise. Code compiled with this option runs almost everywhere.
27754 The temporary results are computed in 80-bit precision instead of the precision
27755 specified by the type, resulting in slightly different results compared to most
27756 of other chips. See @option{-ffloat-store} for more detailed description.
27758 This is the default choice for non-Darwin x86-32 targets.
27761 Use scalar floating-point instructions present in the SSE instruction set.
27762 This instruction set is supported by Pentium III and newer chips,
27763 and in the AMD line
27764 by Athlon-4, Athlon XP and Athlon MP chips. The earlier version of the SSE
27765 instruction set supports only single-precision arithmetic, thus the double and
27766 extended-precision arithmetic are still done using 387. A later version, present
27767 only in Pentium 4 and AMD x86-64 chips, supports double-precision
27770 For the x86-32 compiler, you must use @option{-march=@var{cpu-type}}, @option{-msse}
27771 or @option{-msse2} switches to enable SSE extensions and make this option
27772 effective. For the x86-64 compiler, these extensions are enabled by default.
27774 The resulting code should be considerably faster in the majority of cases and avoid
27775 the numerical instability problems of 387 code, but may break some existing
27776 code that expects temporaries to be 80 bits.
27778 This is the default choice for the x86-64 compiler, Darwin x86-32 targets,
27779 and the default choice for x86-32 targets with the SSE2 instruction set
27780 when @option{-ffast-math} is enabled.
27785 Attempt to utilize both instruction sets at once. This effectively doubles the
27786 amount of available registers, and on chips with separate execution units for
27787 387 and SSE the execution resources too. Use this option with care, as it is
27788 still experimental, because the GCC register allocator does not model separate
27789 functional units well, resulting in unstable performance.
27792 @item -masm=@var{dialect}
27793 @opindex masm=@var{dialect}
27794 Output assembly instructions using selected @var{dialect}. Also affects
27795 which dialect is used for basic @code{asm} (@pxref{Basic Asm}) and
27796 extended @code{asm} (@pxref{Extended Asm}). Supported choices (in dialect
27797 order) are @samp{att} or @samp{intel}. The default is @samp{att}. Darwin does
27798 not support @samp{intel}.
27801 @itemx -mno-ieee-fp
27803 @opindex mno-ieee-fp
27804 Control whether or not the compiler uses IEEE floating-point
27805 comparisons. These correctly handle the case where the result of a
27806 comparison is unordered.
27809 @itemx -mhard-float
27811 @opindex mhard-float
27812 Generate output containing 80387 instructions for floating point.
27815 @itemx -msoft-float
27817 @opindex msoft-float
27818 Generate output containing library calls for floating point.
27820 @strong{Warning:} the requisite libraries are not part of GCC@.
27821 Normally the facilities of the machine's usual C compiler are used, but
27822 this cannot be done directly in cross-compilation. You must make your
27823 own arrangements to provide suitable library functions for
27826 On machines where a function returns floating-point results in the 80387
27827 register stack, some floating-point opcodes may be emitted even if
27828 @option{-msoft-float} is used.
27830 @item -mno-fp-ret-in-387
27831 @opindex mno-fp-ret-in-387
27832 @opindex mfp-ret-in-387
27833 Do not use the FPU registers for return values of functions.
27835 The usual calling convention has functions return values of types
27836 @code{float} and @code{double} in an FPU register, even if there
27837 is no FPU@. The idea is that the operating system should emulate
27840 The option @option{-mno-fp-ret-in-387} causes such values to be returned
27841 in ordinary CPU registers instead.
27843 @item -mno-fancy-math-387
27844 @opindex mno-fancy-math-387
27845 @opindex mfancy-math-387
27846 Some 387 emulators do not support the @code{sin}, @code{cos} and
27847 @code{sqrt} instructions for the 387. Specify this option to avoid
27848 generating those instructions.
27849 This option is overridden when @option{-march}
27850 indicates that the target CPU always has an FPU and so the
27851 instruction does not need emulation. These
27852 instructions are not generated unless you also use the
27853 @option{-funsafe-math-optimizations} switch.
27855 @item -malign-double
27856 @itemx -mno-align-double
27857 @opindex malign-double
27858 @opindex mno-align-double
27859 Control whether GCC aligns @code{double}, @code{long double}, and
27860 @code{long long} variables on a two-word boundary or a one-word
27861 boundary. Aligning @code{double} variables on a two-word boundary
27862 produces code that runs somewhat faster on a Pentium at the
27863 expense of more memory.
27865 On x86-64, @option{-malign-double} is enabled by default.
27867 @strong{Warning:} if you use the @option{-malign-double} switch,
27868 structures containing the above types are aligned differently than
27869 the published application binary interface specifications for the x86-32
27870 and are not binary compatible with structures in code compiled
27871 without that switch.
27873 @item -m96bit-long-double
27874 @itemx -m128bit-long-double
27875 @opindex m96bit-long-double
27876 @opindex m128bit-long-double
27877 These switches control the size of @code{long double} type. The x86-32
27878 application binary interface specifies the size to be 96 bits,
27879 so @option{-m96bit-long-double} is the default in 32-bit mode.
27881 Modern architectures (Pentium and newer) prefer @code{long double}
27882 to be aligned to an 8- or 16-byte boundary. In arrays or structures
27883 conforming to the ABI, this is not possible. So specifying
27884 @option{-m128bit-long-double} aligns @code{long double}
27885 to a 16-byte boundary by padding the @code{long double} with an additional
27888 In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
27889 its ABI specifies that @code{long double} is aligned on 16-byte boundary.
27891 Notice that neither of these options enable any extra precision over the x87
27892 standard of 80 bits for a @code{long double}.
27894 @strong{Warning:} if you override the default value for your target ABI, this
27895 changes the size of
27896 structures and arrays containing @code{long double} variables,
27897 as well as modifying the function calling convention for functions taking
27898 @code{long double}. Hence they are not binary-compatible
27899 with code compiled without that switch.
27901 @item -mlong-double-64
27902 @itemx -mlong-double-80
27903 @itemx -mlong-double-128
27904 @opindex mlong-double-64
27905 @opindex mlong-double-80
27906 @opindex mlong-double-128
27907 These switches control the size of @code{long double} type. A size
27908 of 64 bits makes the @code{long double} type equivalent to the @code{double}
27909 type. This is the default for 32-bit Bionic C library. A size
27910 of 128 bits makes the @code{long double} type equivalent to the
27911 @code{__float128} type. This is the default for 64-bit Bionic C library.
27913 @strong{Warning:} if you override the default value for your target ABI, this
27914 changes the size of
27915 structures and arrays containing @code{long double} variables,
27916 as well as modifying the function calling convention for functions taking
27917 @code{long double}. Hence they are not binary-compatible
27918 with code compiled without that switch.
27920 @item -malign-data=@var{type}
27921 @opindex malign-data
27922 Control how GCC aligns variables. Supported values for @var{type} are
27923 @samp{compat} uses increased alignment value compatible uses GCC 4.8
27924 and earlier, @samp{abi} uses alignment value as specified by the
27925 psABI, and @samp{cacheline} uses increased alignment value to match
27926 the cache line size. @samp{compat} is the default.
27928 @item -mlarge-data-threshold=@var{threshold}
27929 @opindex mlarge-data-threshold
27930 When @option{-mcmodel=medium} is specified, data objects larger than
27931 @var{threshold} are placed in the large data section. This value must be the
27932 same across all objects linked into the binary, and defaults to 65535.
27936 Use a different function-calling convention, in which functions that
27937 take a fixed number of arguments return with the @code{ret @var{num}}
27938 instruction, which pops their arguments while returning. This saves one
27939 instruction in the caller since there is no need to pop the arguments
27942 You can specify that an individual function is called with this calling
27943 sequence with the function attribute @code{stdcall}. You can also
27944 override the @option{-mrtd} option by using the function attribute
27945 @code{cdecl}. @xref{Function Attributes}.
27947 @strong{Warning:} this calling convention is incompatible with the one
27948 normally used on Unix, so you cannot use it if you need to call
27949 libraries compiled with the Unix compiler.
27951 Also, you must provide function prototypes for all functions that
27952 take variable numbers of arguments (including @code{printf});
27953 otherwise incorrect code is generated for calls to those
27956 In addition, seriously incorrect code results if you call a
27957 function with too many arguments. (Normally, extra arguments are
27958 harmlessly ignored.)
27960 @item -mregparm=@var{num}
27962 Control how many registers are used to pass integer arguments. By
27963 default, no registers are used to pass arguments, and at most 3
27964 registers can be used. You can control this behavior for a specific
27965 function by using the function attribute @code{regparm}.
27966 @xref{Function Attributes}.
27968 @strong{Warning:} if you use this switch, and
27969 @var{num} is nonzero, then you must build all modules with the same
27970 value, including any libraries. This includes the system libraries and
27974 @opindex msseregparm
27975 Use SSE register passing conventions for float and double arguments
27976 and return values. You can control this behavior for a specific
27977 function by using the function attribute @code{sseregparm}.
27978 @xref{Function Attributes}.
27980 @strong{Warning:} if you use this switch then you must build all
27981 modules with the same value, including any libraries. This includes
27982 the system libraries and startup modules.
27984 @item -mvect8-ret-in-mem
27985 @opindex mvect8-ret-in-mem
27986 Return 8-byte vectors in memory instead of MMX registers. This is the
27987 default on VxWorks to match the ABI of the Sun Studio compilers until
27988 version 12. @emph{Only} use this option if you need to remain
27989 compatible with existing code produced by those previous compiler
27990 versions or older versions of GCC@.
27999 Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
28000 is specified, the significands of results of floating-point operations are
28001 rounded to 24 bits (single precision); @option{-mpc64} rounds the
28002 significands of results of floating-point operations to 53 bits (double
28003 precision) and @option{-mpc80} rounds the significands of results of
28004 floating-point operations to 64 bits (extended double precision), which is
28005 the default. When this option is used, floating-point operations in higher
28006 precisions are not available to the programmer without setting the FPU
28007 control word explicitly.
28009 Setting the rounding of floating-point operations to less than the default
28010 80 bits can speed some programs by 2% or more. Note that some mathematical
28011 libraries assume that extended-precision (80-bit) floating-point operations
28012 are enabled by default; routines in such libraries could suffer significant
28013 loss of accuracy, typically through so-called ``catastrophic cancellation'',
28014 when this option is used to set the precision to less than extended precision.
28016 @item -mstackrealign
28017 @opindex mstackrealign
28018 Realign the stack at entry. On the x86, the @option{-mstackrealign}
28019 option generates an alternate prologue and epilogue that realigns the
28020 run-time stack if necessary. This supports mixing legacy codes that keep
28021 4-byte stack alignment with modern codes that keep 16-byte stack alignment for
28022 SSE compatibility. See also the attribute @code{force_align_arg_pointer},
28023 applicable to individual functions.
28025 @item -mpreferred-stack-boundary=@var{num}
28026 @opindex mpreferred-stack-boundary
28027 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
28028 byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
28029 the default is 4 (16 bytes or 128 bits).
28031 @strong{Warning:} When generating code for the x86-64 architecture with
28032 SSE extensions disabled, @option{-mpreferred-stack-boundary=3} can be
28033 used to keep the stack boundary aligned to 8 byte boundary. Since
28034 x86-64 ABI require 16 byte stack alignment, this is ABI incompatible and
28035 intended to be used in controlled environment where stack space is
28036 important limitation. This option leads to wrong code when functions
28037 compiled with 16 byte stack alignment (such as functions from a standard
28038 library) are called with misaligned stack. In this case, SSE
28039 instructions may lead to misaligned memory access traps. In addition,
28040 variable arguments are handled incorrectly for 16 byte aligned
28041 objects (including x87 long double and __int128), leading to wrong
28042 results. You must build all modules with
28043 @option{-mpreferred-stack-boundary=3}, including any libraries. This
28044 includes the system libraries and startup modules.
28046 @item -mincoming-stack-boundary=@var{num}
28047 @opindex mincoming-stack-boundary
28048 Assume the incoming stack is aligned to a 2 raised to @var{num} byte
28049 boundary. If @option{-mincoming-stack-boundary} is not specified,
28050 the one specified by @option{-mpreferred-stack-boundary} is used.
28052 On Pentium and Pentium Pro, @code{double} and @code{long double} values
28053 should be aligned to an 8-byte boundary (see @option{-malign-double}) or
28054 suffer significant run time performance penalties. On Pentium III, the
28055 Streaming SIMD Extension (SSE) data type @code{__m128} may not work
28056 properly if it is not 16-byte aligned.
28058 To ensure proper alignment of this values on the stack, the stack boundary
28059 must be as aligned as that required by any value stored on the stack.
28060 Further, every function must be generated such that it keeps the stack
28061 aligned. Thus calling a function compiled with a higher preferred
28062 stack boundary from a function compiled with a lower preferred stack
28063 boundary most likely misaligns the stack. It is recommended that
28064 libraries that use callbacks always use the default setting.
28066 This extra alignment does consume extra stack space, and generally
28067 increases code size. Code that is sensitive to stack space usage, such
28068 as embedded systems and operating system kernels, may want to reduce the
28069 preferred alignment to @option{-mpreferred-stack-boundary=2}.
28126 @itemx -mavx512ifma
28127 @opindex mavx512ifma
28129 @itemx -mavx512vbmi
28130 @opindex mavx512vbmi
28141 @itemx -mclflushopt
28142 @opindex mclflushopt
28177 @itemx -mprefetchwt1
28178 @opindex mprefetchwt1
28249 @itemx -mavx512vbmi2
28250 @opindex mavx512vbmi2
28252 @itemx -mavx512bf16
28253 @opindex mavx512bf16
28264 @itemx -mvpclmulqdq
28265 @opindex mvpclmulqdq
28267 @itemx -mavx512bitalg
28268 @opindex mavx512bitalg
28274 @opindex mmovdir64b
28279 @itemx -mavx512vpopcntdq
28280 @opindex mavx512vpopcntdq
28282 @itemx -mavx512vp2intersect
28283 @opindex mavx512vp2intersect
28285 @itemx -mavx5124fmaps
28286 @opindex mavx5124fmaps
28288 @itemx -mavx512vnni
28289 @opindex mavx512vnni
28291 @itemx -mavx5124vnniw
28292 @opindex mavx5124vnniw
28296 These switches enable the use of instructions in the MMX, SSE,
28297 SSE2, SSE3, SSSE3, SSE4, SSE4A, SSE4.1, SSE4.2, AVX, AVX2, AVX512F, AVX512PF,
28298 AVX512ER, AVX512CD, AVX512VL, AVX512BW, AVX512DQ, AVX512IFMA, AVX512VBMI, SHA,
28299 AES, PCLMUL, CLFLUSHOPT, CLWB, FSGSBASE, PTWRITE, RDRND, F16C, FMA, PCONFIG,
28300 WBNOINVD, FMA4, PREFETCHW, RDPID, PREFETCHWT1, RDSEED, SGX, XOP, LWP,
28301 3DNow!@:, enhanced 3DNow!@:, POPCNT, ABM, ADX, BMI, BMI2, LZCNT, FXSR, XSAVE,
28302 XSAVEOPT, XSAVEC, XSAVES, RTM, HLE, TBM, MWAITX, CLZERO, PKU, AVX512VBMI2,
28303 GFNI, VAES, WAITPKG, VPCLMULQDQ, AVX512BITALG, MOVDIRI, MOVDIR64B, AVX512BF16,
28304 ENQCMD, AVX512VPOPCNTDQ, AVX5124FMAPS, AVX512VNNI, AVX5124VNNIW, or CLDEMOTE
28305 extended instruction sets. Each has a corresponding @option{-mno-} option to
28306 disable use of these instructions.
28308 These extensions are also available as built-in functions: see
28309 @ref{x86 Built-in Functions}, for details of the functions enabled and
28310 disabled by these switches.
28312 To generate SSE/SSE2 instructions automatically from floating-point
28313 code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
28315 GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
28316 generates new AVX instructions or AVX equivalence for all SSEx instructions
28319 These options enable GCC to use these extended instructions in
28320 generated code, even without @option{-mfpmath=sse}. Applications that
28321 perform run-time CPU detection must compile separate files for each
28322 supported architecture, using the appropriate flags. In particular,
28323 the file containing the CPU detection code should be compiled without
28326 @item -mdump-tune-features
28327 @opindex mdump-tune-features
28328 This option instructs GCC to dump the names of the x86 performance
28329 tuning features and default settings. The names can be used in
28330 @option{-mtune-ctrl=@var{feature-list}}.
28332 @item -mtune-ctrl=@var{feature-list}
28333 @opindex mtune-ctrl=@var{feature-list}
28334 This option is used to do fine grain control of x86 code generation features.
28335 @var{feature-list} is a comma separated list of @var{feature} names. See also
28336 @option{-mdump-tune-features}. When specified, the @var{feature} is turned
28337 on if it is not preceded with @samp{^}, otherwise, it is turned off.
28338 @option{-mtune-ctrl=@var{feature-list}} is intended to be used by GCC
28339 developers. Using it may lead to code paths not covered by testing and can
28340 potentially result in compiler ICEs or runtime errors.
28343 @opindex mno-default
28344 This option instructs GCC to turn off all tunable features. See also
28345 @option{-mtune-ctrl=@var{feature-list}} and @option{-mdump-tune-features}.
28349 This option instructs GCC to emit a @code{cld} instruction in the prologue
28350 of functions that use string instructions. String instructions depend on
28351 the DF flag to select between autoincrement or autodecrement mode. While the
28352 ABI specifies the DF flag to be cleared on function entry, some operating
28353 systems violate this specification by not clearing the DF flag in their
28354 exception dispatchers. The exception handler can be invoked with the DF flag
28355 set, which leads to wrong direction mode when string instructions are used.
28356 This option can be enabled by default on 32-bit x86 targets by configuring
28357 GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
28358 instructions can be suppressed with the @option{-mno-cld} compiler option
28362 @opindex mvzeroupper
28363 This option instructs GCC to emit a @code{vzeroupper} instruction
28364 before a transfer of control flow out of the function to minimize
28365 the AVX to SSE transition penalty as well as remove unnecessary @code{zeroupper}
28368 @item -mprefer-avx128
28369 @opindex mprefer-avx128
28370 This option instructs GCC to use 128-bit AVX instructions instead of
28371 256-bit AVX instructions in the auto-vectorizer.
28373 @item -mprefer-vector-width=@var{opt}
28374 @opindex mprefer-vector-width
28375 This option instructs GCC to use @var{opt}-bit vector width in instructions
28376 instead of default on the selected platform.
28380 No extra limitations applied to GCC other than defined by the selected platform.
28383 Prefer 128-bit vector width for instructions.
28386 Prefer 256-bit vector width for instructions.
28389 Prefer 512-bit vector width for instructions.
28394 This option enables GCC to generate @code{CMPXCHG16B} instructions in 64-bit
28395 code to implement compare-and-exchange operations on 16-byte aligned 128-bit
28396 objects. This is useful for atomic updates of data structures exceeding one
28397 machine word in size. The compiler uses this instruction to implement
28398 @ref{__sync Builtins}. However, for @ref{__atomic Builtins} operating on
28399 128-bit integers, a library call is always used.
28403 This option enables generation of @code{SAHF} instructions in 64-bit code.
28404 Early Intel Pentium 4 CPUs with Intel 64 support,
28405 prior to the introduction of Pentium 4 G1 step in December 2005,
28406 lacked the @code{LAHF} and @code{SAHF} instructions
28407 which are supported by AMD64.
28408 These are load and store instructions, respectively, for certain status flags.
28409 In 64-bit mode, the @code{SAHF} instruction is used to optimize @code{fmod},
28410 @code{drem}, and @code{remainder} built-in functions;
28411 see @ref{Other Builtins} for details.
28415 This option enables use of the @code{movbe} instruction to implement
28416 @code{__builtin_bswap32} and @code{__builtin_bswap64}.
28420 The @option{-mshstk} option enables shadow stack built-in functions
28421 from x86 Control-flow Enforcement Technology (CET).
28425 This option enables built-in functions @code{__builtin_ia32_crc32qi},
28426 @code{__builtin_ia32_crc32hi}, @code{__builtin_ia32_crc32si} and
28427 @code{__builtin_ia32_crc32di} to generate the @code{crc32} machine instruction.
28431 This option enables use of @code{RCPSS} and @code{RSQRTSS} instructions
28432 (and their vectorized variants @code{RCPPS} and @code{RSQRTPS})
28433 with an additional Newton-Raphson step
28434 to increase precision instead of @code{DIVSS} and @code{SQRTSS}
28435 (and their vectorized
28436 variants) for single-precision floating-point arguments. These instructions
28437 are generated only when @option{-funsafe-math-optimizations} is enabled
28438 together with @option{-ffinite-math-only} and @option{-fno-trapping-math}.
28439 Note that while the throughput of the sequence is higher than the throughput
28440 of the non-reciprocal instruction, the precision of the sequence can be
28441 decreased by up to 2 ulp (i.e.@: the inverse of 1.0 equals 0.99999994).
28443 Note that GCC implements @code{1.0f/sqrtf(@var{x})} in terms of @code{RSQRTSS}
28444 (or @code{RSQRTPS}) already with @option{-ffast-math} (or the above option
28445 combination), and doesn't need @option{-mrecip}.
28447 Also note that GCC emits the above sequence with additional Newton-Raphson step
28448 for vectorized single-float division and vectorized @code{sqrtf(@var{x})}
28449 already with @option{-ffast-math} (or the above option combination), and
28450 doesn't need @option{-mrecip}.
28452 @item -mrecip=@var{opt}
28453 @opindex mrecip=opt
28454 This option controls which reciprocal estimate instructions
28455 may be used. @var{opt} is a comma-separated list of options, which may
28456 be preceded by a @samp{!} to invert the option:
28460 Enable all estimate instructions.
28463 Enable the default instructions, equivalent to @option{-mrecip}.
28466 Disable all estimate instructions, equivalent to @option{-mno-recip}.
28469 Enable the approximation for scalar division.
28472 Enable the approximation for vectorized division.
28475 Enable the approximation for scalar square root.
28478 Enable the approximation for vectorized square root.
28481 So, for example, @option{-mrecip=all,!sqrt} enables
28482 all of the reciprocal approximations, except for square root.
28484 @item -mveclibabi=@var{type}
28485 @opindex mveclibabi
28486 Specifies the ABI type to use for vectorizing intrinsics using an
28487 external library. Supported values for @var{type} are @samp{svml}
28488 for the Intel short
28489 vector math library and @samp{acml} for the AMD math core library.
28490 To use this option, both @option{-ftree-vectorize} and
28491 @option{-funsafe-math-optimizations} have to be enabled, and an SVML or ACML
28492 ABI-compatible library must be specified at link time.
28494 GCC currently emits calls to @code{vmldExp2},
28495 @code{vmldLn2}, @code{vmldLog102}, @code{vmldPow2},
28496 @code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
28497 @code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
28498 @code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
28499 @code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4},
28500 @code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
28501 @code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
28502 @code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
28503 @code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
28504 function type when @option{-mveclibabi=svml} is used, and @code{__vrd2_sin},
28505 @code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
28506 @code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
28507 @code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
28508 @code{__vrs4_log10f} and @code{__vrs4_powf} for the corresponding function type
28509 when @option{-mveclibabi=acml} is used.
28511 @item -mabi=@var{name}
28513 Generate code for the specified calling convention. Permissible values
28514 are @samp{sysv} for the ABI used on GNU/Linux and other systems, and
28515 @samp{ms} for the Microsoft ABI. The default is to use the Microsoft
28516 ABI when targeting Microsoft Windows and the SysV ABI on all other systems.
28517 You can control this behavior for specific functions by
28518 using the function attributes @code{ms_abi} and @code{sysv_abi}.
28519 @xref{Function Attributes}.
28521 @item -mforce-indirect-call
28522 @opindex mforce-indirect-call
28523 Force all calls to functions to be indirect. This is useful
28524 when using Intel Processor Trace where it generates more precise timing
28525 information for function calls.
28527 @item -mmanual-endbr
28528 @opindex mmanual-endbr
28529 Insert ENDBR instruction at function entry only via the @code{cf_check}
28530 function attribute. This is useful when used with the option
28531 @option{-fcf-protection=branch} to control ENDBR insertion at the
28534 @item -mcall-ms2sysv-xlogues
28535 @opindex mcall-ms2sysv-xlogues
28536 @opindex mno-call-ms2sysv-xlogues
28537 Due to differences in 64-bit ABIs, any Microsoft ABI function that calls a
28538 System V ABI function must consider RSI, RDI and XMM6-15 as clobbered. By
28539 default, the code for saving and restoring these registers is emitted inline,
28540 resulting in fairly lengthy prologues and epilogues. Using
28541 @option{-mcall-ms2sysv-xlogues} emits prologues and epilogues that
28542 use stubs in the static portion of libgcc to perform these saves and restores,
28543 thus reducing function size at the cost of a few extra instructions.
28545 @item -mtls-dialect=@var{type}
28546 @opindex mtls-dialect
28547 Generate code to access thread-local storage using the @samp{gnu} or
28548 @samp{gnu2} conventions. @samp{gnu} is the conservative default;
28549 @samp{gnu2} is more efficient, but it may add compile- and run-time
28550 requirements that cannot be satisfied on all systems.
28553 @itemx -mno-push-args
28554 @opindex mpush-args
28555 @opindex mno-push-args
28556 Use PUSH operations to store outgoing parameters. This method is shorter
28557 and usually equally fast as method using SUB/MOV operations and is enabled
28558 by default. In some cases disabling it may improve performance because of
28559 improved scheduling and reduced dependencies.
28561 @item -maccumulate-outgoing-args
28562 @opindex maccumulate-outgoing-args
28563 If enabled, the maximum amount of space required for outgoing arguments is
28564 computed in the function prologue. This is faster on most modern CPUs
28565 because of reduced dependencies, improved scheduling and reduced stack usage
28566 when the preferred stack boundary is not equal to 2. The drawback is a notable
28567 increase in code size. This switch implies @option{-mno-push-args}.
28571 Support thread-safe exception handling on MinGW. Programs that rely
28572 on thread-safe exception handling must compile and link all code with the
28573 @option{-mthreads} option. When compiling, @option{-mthreads} defines
28574 @option{-D_MT}; when linking, it links in a special thread helper library
28575 @option{-lmingwthrd} which cleans up per-thread exception-handling data.
28577 @item -mms-bitfields
28578 @itemx -mno-ms-bitfields
28579 @opindex mms-bitfields
28580 @opindex mno-ms-bitfields
28582 Enable/disable bit-field layout compatible with the native Microsoft
28585 If @code{packed} is used on a structure, or if bit-fields are used,
28586 it may be that the Microsoft ABI lays out the structure differently
28587 than the way GCC normally does. Particularly when moving packed
28588 data between functions compiled with GCC and the native Microsoft compiler
28589 (either via function call or as data in a file), it may be necessary to access
28592 This option is enabled by default for Microsoft Windows
28593 targets. This behavior can also be controlled locally by use of variable
28594 or type attributes. For more information, see @ref{x86 Variable Attributes}
28595 and @ref{x86 Type Attributes}.
28597 The Microsoft structure layout algorithm is fairly simple with the exception
28598 of the bit-field packing.
28599 The padding and alignment of members of structures and whether a bit-field
28600 can straddle a storage-unit boundary are determine by these rules:
28603 @item Structure members are stored sequentially in the order in which they are
28604 declared: the first member has the lowest memory address and the last member
28607 @item Every data object has an alignment requirement. The alignment requirement
28608 for all data except structures, unions, and arrays is either the size of the
28609 object or the current packing size (specified with either the
28610 @code{aligned} attribute or the @code{pack} pragma),
28611 whichever is less. For structures, unions, and arrays,
28612 the alignment requirement is the largest alignment requirement of its members.
28613 Every object is allocated an offset so that:
28616 offset % alignment_requirement == 0
28619 @item Adjacent bit-fields are packed into the same 1-, 2-, or 4-byte allocation
28620 unit if the integral types are the same size and if the next bit-field fits
28621 into the current allocation unit without crossing the boundary imposed by the
28622 common alignment requirements of the bit-fields.
28625 MSVC interprets zero-length bit-fields in the following ways:
28628 @item If a zero-length bit-field is inserted between two bit-fields that
28629 are normally coalesced, the bit-fields are not coalesced.
28636 unsigned long bf_1 : 12;
28638 unsigned long bf_2 : 12;
28643 The size of @code{t1} is 8 bytes with the zero-length bit-field. If the
28644 zero-length bit-field were removed, @code{t1}'s size would be 4 bytes.
28646 @item If a zero-length bit-field is inserted after a bit-field, @code{foo}, and the
28647 alignment of the zero-length bit-field is greater than the member that follows it,
28648 @code{bar}, @code{bar} is aligned as the type of the zero-length bit-field.
28669 For @code{t2}, @code{bar} is placed at offset 2, rather than offset 1.
28670 Accordingly, the size of @code{t2} is 4. For @code{t3}, the zero-length
28671 bit-field does not affect the alignment of @code{bar} or, as a result, the size
28674 Taking this into account, it is important to note the following:
28677 @item If a zero-length bit-field follows a normal bit-field, the type of the
28678 zero-length bit-field may affect the alignment of the structure as whole. For
28679 example, @code{t2} has a size of 4 bytes, since the zero-length bit-field follows a
28680 normal bit-field, and is of type short.
28682 @item Even if a zero-length bit-field is not followed by a normal bit-field, it may
28683 still affect the alignment of the structure:
28694 Here, @code{t4} takes up 4 bytes.
28697 @item Zero-length bit-fields following non-bit-field members are ignored:
28709 Here, @code{t5} takes up 2 bytes.
28713 @item -mno-align-stringops
28714 @opindex mno-align-stringops
28715 @opindex malign-stringops
28716 Do not align the destination of inlined string operations. This switch reduces
28717 code size and improves performance in case the destination is already aligned,
28718 but GCC doesn't know about it.
28720 @item -minline-all-stringops
28721 @opindex minline-all-stringops
28722 By default GCC inlines string operations only when the destination is
28723 known to be aligned to least a 4-byte boundary.
28724 This enables more inlining and increases code
28725 size, but may improve performance of code that depends on fast
28726 @code{memcpy} and @code{memset} for short lengths.
28727 The option enables inline expansion of @code{strlen} for all
28728 pointer alignments.
28730 @item -minline-stringops-dynamically
28731 @opindex minline-stringops-dynamically
28732 For string operations of unknown size, use run-time checks with
28733 inline code for small blocks and a library call for large blocks.
28735 @item -mstringop-strategy=@var{alg}
28736 @opindex mstringop-strategy=@var{alg}
28737 Override the internal decision heuristic for the particular algorithm to use
28738 for inlining string operations. The allowed values for @var{alg} are:
28744 Expand using i386 @code{rep} prefix of the specified size.
28748 @itemx unrolled_loop
28749 Expand into an inline loop.
28752 Always use a library call.
28755 @item -mmemcpy-strategy=@var{strategy}
28756 @opindex mmemcpy-strategy=@var{strategy}
28757 Override the internal decision heuristic to decide if @code{__builtin_memcpy}
28758 should be inlined and what inline algorithm to use when the expected size
28759 of the copy operation is known. @var{strategy}
28760 is a comma-separated list of @var{alg}:@var{max_size}:@var{dest_align} triplets.
28761 @var{alg} is specified in @option{-mstringop-strategy}, @var{max_size} specifies
28762 the max byte size with which inline algorithm @var{alg} is allowed. For the last
28763 triplet, the @var{max_size} must be @code{-1}. The @var{max_size} of the triplets
28764 in the list must be specified in increasing order. The minimal byte size for
28765 @var{alg} is @code{0} for the first triplet and @code{@var{max_size} + 1} of the
28768 @item -mmemset-strategy=@var{strategy}
28769 @opindex mmemset-strategy=@var{strategy}
28770 The option is similar to @option{-mmemcpy-strategy=} except that it is to control
28771 @code{__builtin_memset} expansion.
28773 @item -momit-leaf-frame-pointer
28774 @opindex momit-leaf-frame-pointer
28775 Don't keep the frame pointer in a register for leaf functions. This
28776 avoids the instructions to save, set up, and restore frame pointers and
28777 makes an extra register available in leaf functions. The option
28778 @option{-fomit-leaf-frame-pointer} removes the frame pointer for leaf functions,
28779 which might make debugging harder.
28781 @item -mtls-direct-seg-refs
28782 @itemx -mno-tls-direct-seg-refs
28783 @opindex mtls-direct-seg-refs
28784 Controls whether TLS variables may be accessed with offsets from the
28785 TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
28786 or whether the thread base pointer must be added. Whether or not this
28787 is valid depends on the operating system, and whether it maps the
28788 segment to cover the entire TLS area.
28790 For systems that use the GNU C Library, the default is on.
28793 @itemx -mno-sse2avx
28795 Specify that the assembler should encode SSE instructions with VEX
28796 prefix. The option @option{-mavx} turns this on by default.
28801 If profiling is active (@option{-pg}), put the profiling
28802 counter call before the prologue.
28803 Note: On x86 architectures the attribute @code{ms_hook_prologue}
28804 isn't possible at the moment for @option{-mfentry} and @option{-pg}.
28806 @item -mrecord-mcount
28807 @itemx -mno-record-mcount
28808 @opindex mrecord-mcount
28809 If profiling is active (@option{-pg}), generate a __mcount_loc section
28810 that contains pointers to each profiling call. This is useful for
28811 automatically patching and out calls.
28814 @itemx -mno-nop-mcount
28815 @opindex mnop-mcount
28816 If profiling is active (@option{-pg}), generate the calls to
28817 the profiling functions as NOPs. This is useful when they
28818 should be patched in later dynamically. This is likely only
28819 useful together with @option{-mrecord-mcount}.
28821 @item -minstrument-return=@var{type}
28822 @opindex minstrument-return
28823 Instrument function exit in -pg -mfentry instrumented functions with
28824 call to specified function. This only instruments true returns ending
28825 with ret, but not sibling calls ending with jump. Valid types
28826 are @var{none} to not instrument, @var{call} to generate a call to __return__,
28827 or @var{nop5} to generate a 5 byte nop.
28829 @item -mrecord-return
28830 @itemx -mno-record-return
28831 @opindex mrecord-return
28832 Generate a __return_loc section pointing to all return instrumentation code.
28834 @item -mfentry-name=@var{name}
28835 @opindex mfentry-name
28836 Set name of __fentry__ symbol called at function entry for -pg -mfentry functions.
28838 @item -mfentry-section=@var{name}
28839 @opindex mfentry-section
28840 Set name of section to record -mrecord-mcount calls (default __mcount_loc).
28842 @item -mskip-rax-setup
28843 @itemx -mno-skip-rax-setup
28844 @opindex mskip-rax-setup
28845 When generating code for the x86-64 architecture with SSE extensions
28846 disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX
28847 register when there are no variable arguments passed in vector registers.
28849 @strong{Warning:} Since RAX register is used to avoid unnecessarily
28850 saving vector registers on stack when passing variable arguments, the
28851 impacts of this option are callees may waste some stack space,
28852 misbehave or jump to a random location. GCC 4.4 or newer don't have
28853 those issues, regardless the RAX register value.
28856 @itemx -mno-8bit-idiv
28857 @opindex m8bit-idiv
28858 On some processors, like Intel Atom, 8-bit unsigned integer divide is
28859 much faster than 32-bit/64-bit integer divide. This option generates a
28860 run-time check. If both dividend and divisor are within range of 0
28861 to 255, 8-bit unsigned integer divide is used instead of
28862 32-bit/64-bit integer divide.
28864 @item -mavx256-split-unaligned-load
28865 @itemx -mavx256-split-unaligned-store
28866 @opindex mavx256-split-unaligned-load
28867 @opindex mavx256-split-unaligned-store
28868 Split 32-byte AVX unaligned load and store.
28870 @item -mstack-protector-guard=@var{guard}
28871 @itemx -mstack-protector-guard-reg=@var{reg}
28872 @itemx -mstack-protector-guard-offset=@var{offset}
28873 @opindex mstack-protector-guard
28874 @opindex mstack-protector-guard-reg
28875 @opindex mstack-protector-guard-offset
28876 Generate stack protection code using canary at @var{guard}. Supported
28877 locations are @samp{global} for global canary or @samp{tls} for per-thread
28878 canary in the TLS block (the default). This option has effect only when
28879 @option{-fstack-protector} or @option{-fstack-protector-all} is specified.
28881 With the latter choice the options
28882 @option{-mstack-protector-guard-reg=@var{reg}} and
28883 @option{-mstack-protector-guard-offset=@var{offset}} furthermore specify
28884 which segment register (@code{%fs} or @code{%gs}) to use as base register
28885 for reading the canary, and from what offset from that base register.
28886 The default for those is as specified in the relevant ABI.
28888 @item -mgeneral-regs-only
28889 @opindex mgeneral-regs-only
28890 Generate code that uses only the general-purpose registers. This
28891 prevents the compiler from using floating-point, vector, mask and bound
28894 @item -mindirect-branch=@var{choice}
28895 @opindex mindirect-branch
28896 Convert indirect call and jump with @var{choice}. The default is
28897 @samp{keep}, which keeps indirect call and jump unmodified.
28898 @samp{thunk} converts indirect call and jump to call and return thunk.
28899 @samp{thunk-inline} converts indirect call and jump to inlined call
28900 and return thunk. @samp{thunk-extern} converts indirect call and jump
28901 to external call and return thunk provided in a separate object file.
28902 You can control this behavior for a specific function by using the
28903 function attribute @code{indirect_branch}. @xref{Function Attributes}.
28905 Note that @option{-mcmodel=large} is incompatible with
28906 @option{-mindirect-branch=thunk} and
28907 @option{-mindirect-branch=thunk-extern} since the thunk function may
28908 not be reachable in the large code model.
28910 Note that @option{-mindirect-branch=thunk-extern} is incompatible with
28911 @option{-fcf-protection=branch} since the external thunk cannot be modified
28912 to disable control-flow check.
28914 @item -mfunction-return=@var{choice}
28915 @opindex mfunction-return
28916 Convert function return with @var{choice}. The default is @samp{keep},
28917 which keeps function return unmodified. @samp{thunk} converts function
28918 return to call and return thunk. @samp{thunk-inline} converts function
28919 return to inlined call and return thunk. @samp{thunk-extern} converts
28920 function return to external call and return thunk provided in a separate
28921 object file. You can control this behavior for a specific function by
28922 using the function attribute @code{function_return}.
28923 @xref{Function Attributes}.
28925 Note that @option{-mcmodel=large} is incompatible with
28926 @option{-mfunction-return=thunk} and
28927 @option{-mfunction-return=thunk-extern} since the thunk function may
28928 not be reachable in the large code model.
28931 @item -mindirect-branch-register
28932 @opindex mindirect-branch-register
28933 Force indirect call and jump via register.
28937 These @samp{-m} switches are supported in addition to the above
28938 on x86-64 processors in 64-bit environments.
28951 Generate code for a 16-bit, 32-bit or 64-bit environment.
28952 The @option{-m32} option sets @code{int}, @code{long}, and pointer types
28954 generates code that runs on any i386 system.
28956 The @option{-m64} option sets @code{int} to 32 bits and @code{long} and pointer
28957 types to 64 bits, and generates code for the x86-64 architecture.
28958 For Darwin only the @option{-m64} option also turns off the @option{-fno-pic}
28959 and @option{-mdynamic-no-pic} options.
28961 The @option{-mx32} option sets @code{int}, @code{long}, and pointer types
28963 generates code for the x86-64 architecture.
28965 The @option{-m16} option is the same as @option{-m32}, except for that
28966 it outputs the @code{.code16gcc} assembly directive at the beginning of
28967 the assembly output so that the binary can run in 16-bit mode.
28969 The @option{-miamcu} option generates code which conforms to Intel MCU
28970 psABI. It requires the @option{-m32} option to be turned on.
28972 @item -mno-red-zone
28973 @opindex mno-red-zone
28975 Do not use a so-called ``red zone'' for x86-64 code. The red zone is mandated
28976 by the x86-64 ABI; it is a 128-byte area beyond the location of the
28977 stack pointer that is not modified by signal or interrupt handlers
28978 and therefore can be used for temporary data without adjusting the stack
28979 pointer. The flag @option{-mno-red-zone} disables this red zone.
28981 @item -mcmodel=small
28982 @opindex mcmodel=small
28983 Generate code for the small code model: the program and its symbols must
28984 be linked in the lower 2 GB of the address space. Pointers are 64 bits.
28985 Programs can be statically or dynamically linked. This is the default
28988 @item -mcmodel=kernel
28989 @opindex mcmodel=kernel
28990 Generate code for the kernel code model. The kernel runs in the
28991 negative 2 GB of the address space.
28992 This model has to be used for Linux kernel code.
28994 @item -mcmodel=medium
28995 @opindex mcmodel=medium
28996 Generate code for the medium model: the program is linked in the lower 2
28997 GB of the address space. Small symbols are also placed there. Symbols
28998 with sizes larger than @option{-mlarge-data-threshold} are put into
28999 large data or BSS sections and can be located above 2GB. Programs can
29000 be statically or dynamically linked.
29002 @item -mcmodel=large
29003 @opindex mcmodel=large
29004 Generate code for the large model. This model makes no assumptions
29005 about addresses and sizes of sections.
29007 @item -maddress-mode=long
29008 @opindex maddress-mode=long
29009 Generate code for long address mode. This is only supported for 64-bit
29010 and x32 environments. It is the default address mode for 64-bit
29013 @item -maddress-mode=short
29014 @opindex maddress-mode=short
29015 Generate code for short address mode. This is only supported for 32-bit
29016 and x32 environments. It is the default address mode for 32-bit and
29020 @node x86 Windows Options
29021 @subsection x86 Windows Options
29022 @cindex x86 Windows Options
29023 @cindex Windows Options for x86
29025 These additional options are available for Microsoft Windows targets:
29031 specifies that a console application is to be generated, by
29032 instructing the linker to set the PE header subsystem type
29033 required for console applications.
29034 This option is available for Cygwin and MinGW targets and is
29035 enabled by default on those targets.
29039 This option is available for Cygwin and MinGW targets. It
29040 specifies that a DLL---a dynamic link library---is to be
29041 generated, enabling the selection of the required runtime
29042 startup object and entry point.
29044 @item -mnop-fun-dllimport
29045 @opindex mnop-fun-dllimport
29046 This option is available for Cygwin and MinGW targets. It
29047 specifies that the @code{dllimport} attribute should be ignored.
29051 This option is available for MinGW targets. It specifies
29052 that MinGW-specific thread support is to be used.
29056 This option is available for MinGW-w64 targets. It causes
29057 the @code{UNICODE} preprocessor macro to be predefined, and
29058 chooses Unicode-capable runtime startup code.
29062 This option is available for Cygwin and MinGW targets. It
29063 specifies that the typical Microsoft Windows predefined macros are to
29064 be set in the pre-processor, but does not influence the choice
29065 of runtime library/startup code.
29069 This option is available for Cygwin and MinGW targets. It
29070 specifies that a GUI application is to be generated by
29071 instructing the linker to set the PE header subsystem type
29074 @item -fno-set-stack-executable
29075 @opindex fno-set-stack-executable
29076 @opindex fset-stack-executable
29077 This option is available for MinGW targets. It specifies that
29078 the executable flag for the stack used by nested functions isn't
29079 set. This is necessary for binaries running in kernel mode of
29080 Microsoft Windows, as there the User32 API, which is used to set executable
29081 privileges, isn't available.
29083 @item -fwritable-relocated-rdata
29084 @opindex fno-writable-relocated-rdata
29085 @opindex fwritable-relocated-rdata
29086 This option is available for MinGW and Cygwin targets. It specifies
29087 that relocated-data in read-only section is put into the @code{.data}
29088 section. This is a necessary for older runtimes not supporting
29089 modification of @code{.rdata} sections for pseudo-relocation.
29091 @item -mpe-aligned-commons
29092 @opindex mpe-aligned-commons
29093 This option is available for Cygwin and MinGW targets. It
29094 specifies that the GNU extension to the PE file format that
29095 permits the correct alignment of COMMON variables should be
29096 used when generating code. It is enabled by default if
29097 GCC detects that the target assembler found during configuration
29098 supports the feature.
29101 See also under @ref{x86 Options} for standard options.
29103 @node Xstormy16 Options
29104 @subsection Xstormy16 Options
29105 @cindex Xstormy16 Options
29107 These options are defined for Xstormy16:
29112 Choose startup files and linker script suitable for the simulator.
29115 @node Xtensa Options
29116 @subsection Xtensa Options
29117 @cindex Xtensa Options
29119 These options are supported for Xtensa targets:
29123 @itemx -mno-const16
29125 @opindex mno-const16
29126 Enable or disable use of @code{CONST16} instructions for loading
29127 constant values. The @code{CONST16} instruction is currently not a
29128 standard option from Tensilica. When enabled, @code{CONST16}
29129 instructions are always used in place of the standard @code{L32R}
29130 instructions. The use of @code{CONST16} is enabled by default only if
29131 the @code{L32R} instruction is not available.
29134 @itemx -mno-fused-madd
29135 @opindex mfused-madd
29136 @opindex mno-fused-madd
29137 Enable or disable use of fused multiply/add and multiply/subtract
29138 instructions in the floating-point option. This has no effect if the
29139 floating-point option is not also enabled. Disabling fused multiply/add
29140 and multiply/subtract instructions forces the compiler to use separate
29141 instructions for the multiply and add/subtract operations. This may be
29142 desirable in some cases where strict IEEE 754-compliant results are
29143 required: the fused multiply add/subtract instructions do not round the
29144 intermediate result, thereby producing results with @emph{more} bits of
29145 precision than specified by the IEEE standard. Disabling fused multiply
29146 add/subtract instructions also ensures that the program output is not
29147 sensitive to the compiler's ability to combine multiply and add/subtract
29150 @item -mserialize-volatile
29151 @itemx -mno-serialize-volatile
29152 @opindex mserialize-volatile
29153 @opindex mno-serialize-volatile
29154 When this option is enabled, GCC inserts @code{MEMW} instructions before
29155 @code{volatile} memory references to guarantee sequential consistency.
29156 The default is @option{-mserialize-volatile}. Use
29157 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
29159 @item -mforce-no-pic
29160 @opindex mforce-no-pic
29161 For targets, like GNU/Linux, where all user-mode Xtensa code must be
29162 position-independent code (PIC), this option disables PIC for compiling
29165 @item -mtext-section-literals
29166 @itemx -mno-text-section-literals
29167 @opindex mtext-section-literals
29168 @opindex mno-text-section-literals
29169 These options control the treatment of literal pools. The default is
29170 @option{-mno-text-section-literals}, which places literals in a separate
29171 section in the output file. This allows the literal pool to be placed
29172 in a data RAM/ROM, and it also allows the linker to combine literal
29173 pools from separate object files to remove redundant literals and
29174 improve code size. With @option{-mtext-section-literals}, the literals
29175 are interspersed in the text section in order to keep them as close as
29176 possible to their references. This may be necessary for large assembly
29177 files. Literals for each function are placed right before that function.
29179 @item -mauto-litpools
29180 @itemx -mno-auto-litpools
29181 @opindex mauto-litpools
29182 @opindex mno-auto-litpools
29183 These options control the treatment of literal pools. The default is
29184 @option{-mno-auto-litpools}, which places literals in a separate
29185 section in the output file unless @option{-mtext-section-literals} is
29186 used. With @option{-mauto-litpools} the literals are interspersed in
29187 the text section by the assembler. Compiler does not produce explicit
29188 @code{.literal} directives and loads literals into registers with
29189 @code{MOVI} instructions instead of @code{L32R} to let the assembler
29190 do relaxation and place literals as necessary. This option allows
29191 assembler to create several literal pools per function and assemble
29192 very big functions, which may not be possible with
29193 @option{-mtext-section-literals}.
29195 @item -mtarget-align
29196 @itemx -mno-target-align
29197 @opindex mtarget-align
29198 @opindex mno-target-align
29199 When this option is enabled, GCC instructs the assembler to
29200 automatically align instructions to reduce branch penalties at the
29201 expense of some code density. The assembler attempts to widen density
29202 instructions to align branch targets and the instructions following call
29203 instructions. If there are not enough preceding safe density
29204 instructions to align a target, no widening is performed. The
29205 default is @option{-mtarget-align}. These options do not affect the
29206 treatment of auto-aligned instructions like @code{LOOP}, which the
29207 assembler always aligns, either by widening density instructions or
29208 by inserting NOP instructions.
29211 @itemx -mno-longcalls
29212 @opindex mlongcalls
29213 @opindex mno-longcalls
29214 When this option is enabled, GCC instructs the assembler to translate
29215 direct calls to indirect calls unless it can determine that the target
29216 of a direct call is in the range allowed by the call instruction. This
29217 translation typically occurs for calls to functions in other source
29218 files. Specifically, the assembler translates a direct @code{CALL}
29219 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
29220 The default is @option{-mno-longcalls}. This option should be used in
29221 programs where the call target can potentially be out of range. This
29222 option is implemented in the assembler, not the compiler, so the
29223 assembly code generated by GCC still shows direct call
29224 instructions---look at the disassembled object code to see the actual
29225 instructions. Note that the assembler uses an indirect call for
29226 every cross-file call, not just those that really are out of range.
29229 @node zSeries Options
29230 @subsection zSeries Options
29231 @cindex zSeries options
29233 These are listed under @xref{S/390 and zSeries Options}.
29239 @section Specifying Subprocesses and the Switches to Pass to Them
29242 @command{gcc} is a driver program. It performs its job by invoking a
29243 sequence of other programs to do the work of compiling, assembling and
29244 linking. GCC interprets its command-line parameters and uses these to
29245 deduce which programs it should invoke, and which command-line options
29246 it ought to place on their command lines. This behavior is controlled
29247 by @dfn{spec strings}. In most cases there is one spec string for each
29248 program that GCC can invoke, but a few programs have multiple spec
29249 strings to control their behavior. The spec strings built into GCC can
29250 be overridden by using the @option{-specs=} command-line switch to specify
29253 @dfn{Spec files} are plain-text files that are used to construct spec
29254 strings. They consist of a sequence of directives separated by blank
29255 lines. The type of directive is determined by the first non-whitespace
29256 character on the line, which can be one of the following:
29259 @item %@var{command}
29260 Issues a @var{command} to the spec file processor. The commands that can
29264 @item %include <@var{file}>
29265 @cindex @code{%include}
29266 Search for @var{file} and insert its text at the current point in the
29269 @item %include_noerr <@var{file}>
29270 @cindex @code{%include_noerr}
29271 Just like @samp{%include}, but do not generate an error message if the include
29272 file cannot be found.
29274 @item %rename @var{old_name} @var{new_name}
29275 @cindex @code{%rename}
29276 Rename the spec string @var{old_name} to @var{new_name}.
29280 @item *[@var{spec_name}]:
29281 This tells the compiler to create, override or delete the named spec
29282 string. All lines after this directive up to the next directive or
29283 blank line are considered to be the text for the spec string. If this
29284 results in an empty string then the spec is deleted. (Or, if the
29285 spec did not exist, then nothing happens.) Otherwise, if the spec
29286 does not currently exist a new spec is created. If the spec does
29287 exist then its contents are overridden by the text of this
29288 directive, unless the first character of that text is the @samp{+}
29289 character, in which case the text is appended to the spec.
29291 @item [@var{suffix}]:
29292 Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
29293 and up to the next directive or blank line are considered to make up the
29294 spec string for the indicated suffix. When the compiler encounters an
29295 input file with the named suffix, it processes the spec string in
29296 order to work out how to compile that file. For example:
29300 z-compile -input %i
29303 This says that any input file whose name ends in @samp{.ZZ} should be
29304 passed to the program @samp{z-compile}, which should be invoked with the
29305 command-line switch @option{-input} and with the result of performing the
29306 @samp{%i} substitution. (See below.)
29308 As an alternative to providing a spec string, the text following a
29309 suffix directive can be one of the following:
29312 @item @@@var{language}
29313 This says that the suffix is an alias for a known @var{language}. This is
29314 similar to using the @option{-x} command-line switch to GCC to specify a
29315 language explicitly. For example:
29322 Says that .ZZ files are, in fact, C++ source files.
29325 This causes an error messages saying:
29328 @var{name} compiler not installed on this system.
29332 GCC already has an extensive list of suffixes built into it.
29333 This directive adds an entry to the end of the list of suffixes, but
29334 since the list is searched from the end backwards, it is effectively
29335 possible to override earlier entries using this technique.
29339 GCC has the following spec strings built into it. Spec files can
29340 override these strings or create their own. Note that individual
29341 targets can also add their own spec strings to this list.
29344 asm Options to pass to the assembler
29345 asm_final Options to pass to the assembler post-processor
29346 cpp Options to pass to the C preprocessor
29347 cc1 Options to pass to the C compiler
29348 cc1plus Options to pass to the C++ compiler
29349 endfile Object files to include at the end of the link
29350 link Options to pass to the linker
29351 lib Libraries to include on the command line to the linker
29352 libgcc Decides which GCC support library to pass to the linker
29353 linker Sets the name of the linker
29354 predefines Defines to be passed to the C preprocessor
29355 signed_char Defines to pass to CPP to say whether @code{char} is signed
29357 startfile Object files to include at the start of the link
29360 Here is a small example of a spec file:
29363 %rename lib old_lib
29366 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
29369 This example renames the spec called @samp{lib} to @samp{old_lib} and
29370 then overrides the previous definition of @samp{lib} with a new one.
29371 The new definition adds in some extra command-line options before
29372 including the text of the old definition.
29374 @dfn{Spec strings} are a list of command-line options to be passed to their
29375 corresponding program. In addition, the spec strings can contain
29376 @samp{%}-prefixed sequences to substitute variable text or to
29377 conditionally insert text into the command line. Using these constructs
29378 it is possible to generate quite complex command lines.
29380 Here is a table of all defined @samp{%}-sequences for spec
29381 strings. Note that spaces are not generated automatically around the
29382 results of expanding these sequences. Therefore you can concatenate them
29383 together or combine them with constant text in a single argument.
29387 Substitute one @samp{%} into the program name or argument.
29390 Substitute the name of the input file being processed.
29393 Substitute the basename of the input file being processed.
29394 This is the substring up to (and not including) the last period
29395 and not including the directory.
29398 This is the same as @samp{%b}, but include the file suffix (text after
29402 Marks the argument containing or following the @samp{%d} as a
29403 temporary file name, so that that file is deleted if GCC exits
29404 successfully. Unlike @samp{%g}, this contributes no text to the
29407 @item %g@var{suffix}
29408 Substitute a file name that has suffix @var{suffix} and is chosen
29409 once per compilation, and mark the argument in the same way as
29410 @samp{%d}. To reduce exposure to denial-of-service attacks, the file
29411 name is now chosen in a way that is hard to predict even when previously
29412 chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
29413 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
29414 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
29415 treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
29416 was simply substituted with a file name chosen once per compilation,
29417 without regard to any appended suffix (which was therefore treated
29418 just like ordinary text), making such attacks more likely to succeed.
29420 @item %u@var{suffix}
29421 Like @samp{%g}, but generates a new temporary file name
29422 each time it appears instead of once per compilation.
29424 @item %U@var{suffix}
29425 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
29426 new one if there is no such last file name. In the absence of any
29427 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
29428 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
29429 involves the generation of two distinct file names, one
29430 for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
29431 simply substituted with a file name chosen for the previous @samp{%u},
29432 without regard to any appended suffix.
29434 @item %j@var{suffix}
29435 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
29436 writable, and if @option{-save-temps} is not used;
29437 otherwise, substitute the name
29438 of a temporary file, just like @samp{%u}. This temporary file is not
29439 meant for communication between processes, but rather as a junk
29440 disposal mechanism.
29442 @item %|@var{suffix}
29443 @itemx %m@var{suffix}
29444 Like @samp{%g}, except if @option{-pipe} is in effect. In that case
29445 @samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
29446 all. These are the two most common ways to instruct a program that it
29447 should read from standard input or write to standard output. If you
29448 need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
29449 construct: see for example @file{gcc/fortran/lang-specs.h}.
29451 @item %.@var{SUFFIX}
29452 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
29453 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
29454 terminated by the next space or %.
29457 Marks the argument containing or following the @samp{%w} as the
29458 designated output file of this compilation. This puts the argument
29459 into the sequence of arguments that @samp{%o} substitutes.
29462 Substitutes the names of all the output files, with spaces
29463 automatically placed around them. You should write spaces
29464 around the @samp{%o} as well or the results are undefined.
29465 @samp{%o} is for use in the specs for running the linker.
29466 Input files whose names have no recognized suffix are not compiled
29467 at all, but they are included among the output files, so they are
29471 Substitutes the suffix for object files. Note that this is
29472 handled specially when it immediately follows @samp{%g, %u, or %U},
29473 because of the need for those to form complete file names. The
29474 handling is such that @samp{%O} is treated exactly as if it had already
29475 been substituted, except that @samp{%g, %u, and %U} do not currently
29476 support additional @var{suffix} characters following @samp{%O} as they do
29477 following, for example, @samp{.o}.
29480 Substitutes the standard macro predefinitions for the
29481 current target machine. Use this when running @command{cpp}.
29484 Like @samp{%p}, but puts @samp{__} before and after the name of each
29485 predefined macro, except for macros that start with @samp{__} or with
29486 @samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
29490 Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
29491 @option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
29492 @option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
29493 and @option{-imultilib} as necessary.
29496 Current argument is the name of a library or startup file of some sort.
29497 Search for that file in a standard list of directories and substitute
29498 the full name found. The current working directory is included in the
29499 list of directories scanned.
29502 Current argument is the name of a linker script. Search for that file
29503 in the current list of directories to scan for libraries. If the file
29504 is located insert a @option{--script} option into the command line
29505 followed by the full path name found. If the file is not found then
29506 generate an error message. Note: the current working directory is not
29510 Print @var{str} as an error message. @var{str} is terminated by a newline.
29511 Use this when inconsistent options are detected.
29513 @item %(@var{name})
29514 Substitute the contents of spec string @var{name} at this point.
29516 @item %x@{@var{option}@}
29517 Accumulate an option for @samp{%X}.
29520 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
29524 Output the accumulated assembler options specified by @option{-Wa}.
29527 Output the accumulated preprocessor options specified by @option{-Wp}.
29530 Process the @code{asm} spec. This is used to compute the
29531 switches to be passed to the assembler.
29534 Process the @code{asm_final} spec. This is a spec string for
29535 passing switches to an assembler post-processor, if such a program is
29539 Process the @code{link} spec. This is the spec for computing the
29540 command line passed to the linker. Typically it makes use of the
29541 @samp{%L %G %S %D and %E} sequences.
29544 Dump out a @option{-L} option for each directory that GCC believes might
29545 contain startup files. If the target supports multilibs then the
29546 current multilib directory is prepended to each of these paths.
29549 Process the @code{lib} spec. This is a spec string for deciding which
29550 libraries are included on the command line to the linker.
29553 Process the @code{libgcc} spec. This is a spec string for deciding
29554 which GCC support library is included on the command line to the linker.
29557 Process the @code{startfile} spec. This is a spec for deciding which
29558 object files are the first ones passed to the linker. Typically
29559 this might be a file named @file{crt0.o}.
29562 Process the @code{endfile} spec. This is a spec string that specifies
29563 the last object files that are passed to the linker.
29566 Process the @code{cpp} spec. This is used to construct the arguments
29567 to be passed to the C preprocessor.
29570 Process the @code{cc1} spec. This is used to construct the options to be
29571 passed to the actual C compiler (@command{cc1}).
29574 Process the @code{cc1plus} spec. This is used to construct the options to be
29575 passed to the actual C++ compiler (@command{cc1plus}).
29578 Substitute the variable part of a matched option. See below.
29579 Note that each comma in the substituted string is replaced by
29583 Remove all occurrences of @code{-S} from the command line. Note---this
29584 command is position dependent. @samp{%} commands in the spec string
29585 before this one see @code{-S}, @samp{%} commands in the spec string
29586 after this one do not.
29588 @item %:@var{function}(@var{args})
29589 Call the named function @var{function}, passing it @var{args}.
29590 @var{args} is first processed as a nested spec string, then split
29591 into an argument vector in the usual fashion. The function returns
29592 a string which is processed as if it had appeared literally as part
29593 of the current spec.
29595 The following built-in spec functions are provided:
29598 @item @code{getenv}
29599 The @code{getenv} spec function takes two arguments: an environment
29600 variable name and a string. If the environment variable is not
29601 defined, a fatal error is issued. Otherwise, the return value is the
29602 value of the environment variable concatenated with the string. For
29603 example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
29606 %:getenv(TOPDIR /include)
29609 expands to @file{/path/to/top/include}.
29611 @item @code{if-exists}
29612 The @code{if-exists} spec function takes one argument, an absolute
29613 pathname to a file. If the file exists, @code{if-exists} returns the
29614 pathname. Here is a small example of its usage:
29618 crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
29621 @item @code{if-exists-else}
29622 The @code{if-exists-else} spec function is similar to the @code{if-exists}
29623 spec function, except that it takes two arguments. The first argument is
29624 an absolute pathname to a file. If the file exists, @code{if-exists-else}
29625 returns the pathname. If it does not exist, it returns the second argument.
29626 This way, @code{if-exists-else} can be used to select one file or another,
29627 based on the existence of the first. Here is a small example of its usage:
29631 crt0%O%s %:if-exists(crti%O%s) \
29632 %:if-exists-else(crtbeginT%O%s crtbegin%O%s)
29635 @item @code{replace-outfile}
29636 The @code{replace-outfile} spec function takes two arguments. It looks for the
29637 first argument in the outfiles array and replaces it with the second argument. Here
29638 is a small example of its usage:
29641 %@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
29644 @item @code{remove-outfile}
29645 The @code{remove-outfile} spec function takes one argument. It looks for the
29646 first argument in the outfiles array and removes it. Here is a small example
29650 %:remove-outfile(-lm)
29653 @item @code{pass-through-libs}
29654 The @code{pass-through-libs} spec function takes any number of arguments. It
29655 finds any @option{-l} options and any non-options ending in @file{.a} (which it
29656 assumes are the names of linker input library archive files) and returns a
29657 result containing all the found arguments each prepended by
29658 @option{-plugin-opt=-pass-through=} and joined by spaces. This list is
29659 intended to be passed to the LTO linker plugin.
29662 %:pass-through-libs(%G %L %G)
29665 @item @code{print-asm-header}
29666 The @code{print-asm-header} function takes no arguments and simply
29667 prints a banner like:
29673 Use "-Wa,OPTION" to pass "OPTION" to the assembler.
29676 It is used to separate compiler options from assembler options
29677 in the @option{--target-help} output.
29681 Substitutes the @code{-S} switch, if that switch is given to GCC@.
29682 If that switch is not specified, this substitutes nothing. Note that
29683 the leading dash is omitted when specifying this option, and it is
29684 automatically inserted if the substitution is performed. Thus the spec
29685 string @samp{%@{foo@}} matches the command-line option @option{-foo}
29686 and outputs the command-line option @option{-foo}.
29689 Like %@{@code{S}@} but mark last argument supplied within as a file to be
29690 deleted on failure.
29693 Substitutes all the switches specified to GCC whose names start
29694 with @code{-S}, but which also take an argument. This is used for
29695 switches like @option{-o}, @option{-D}, @option{-I}, etc.
29696 GCC considers @option{-o foo} as being
29697 one switch whose name starts with @samp{o}. %@{o*@} substitutes this
29698 text, including the space. Thus two arguments are generated.
29701 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
29702 (the order of @code{S} and @code{T} in the spec is not significant).
29703 There can be any number of ampersand-separated variables; for each the
29704 wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
29707 Substitutes @code{X}, if the @option{-S} switch is given to GCC@.
29710 Substitutes @code{X}, if the @option{-S} switch is @emph{not} given to GCC@.
29713 Substitutes @code{X} if one or more switches whose names start with
29714 @code{-S} are specified to GCC@. Normally @code{X} is substituted only
29715 once, no matter how many such switches appeared. However, if @code{%*}
29716 appears somewhere in @code{X}, then @code{X} is substituted once
29717 for each matching switch, with the @code{%*} replaced by the part of
29718 that switch matching the @code{*}.
29720 If @code{%*} appears as the last part of a spec sequence then a space
29721 is added after the end of the last substitution. If there is more
29722 text in the sequence, however, then a space is not generated. This
29723 allows the @code{%*} substitution to be used as part of a larger
29724 string. For example, a spec string like this:
29727 %@{mcu=*:--script=%*/memory.ld@}
29731 when matching an option like @option{-mcu=newchip} produces:
29734 --script=newchip/memory.ld
29738 Substitutes @code{X}, if processing a file with suffix @code{S}.
29741 Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
29744 Substitutes @code{X}, if processing a file for language @code{S}.
29747 Substitutes @code{X}, if not processing a file for language @code{S}.
29750 Substitutes @code{X} if either @code{-S} or @code{-P} is given to
29751 GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
29752 @code{*} sequences as well, although they have a stronger binding than
29753 the @samp{|}. If @code{%*} appears in @code{X}, all of the
29754 alternatives must be starred, and only the first matching alternative
29757 For example, a spec string like this:
29760 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
29764 outputs the following command-line options from the following input
29765 command-line options:
29770 -d fred.c -foo -baz -boggle
29771 -d jim.d -bar -baz -boggle
29774 @item %@{S:X; T:Y; :D@}
29776 If @code{S} is given to GCC, substitutes @code{X}; else if @code{T} is
29777 given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
29778 be as many clauses as you need. This may be combined with @code{.},
29779 @code{,}, @code{!}, @code{|}, and @code{*} as needed.
29784 The switch matching text @code{S} in a @samp{%@{S@}}, @samp{%@{S:X@}}
29785 or similar construct can use a backslash to ignore the special meaning
29786 of the character following it, thus allowing literal matching of a
29787 character that is otherwise specially treated. For example,
29788 @samp{%@{std=iso9899\:1999:X@}} substitutes @code{X} if the
29789 @option{-std=iso9899:1999} option is given.
29791 The conditional text @code{X} in a @samp{%@{S:X@}} or similar
29792 construct may contain other nested @samp{%} constructs or spaces, or
29793 even newlines. They are processed as usual, as described above.
29794 Trailing white space in @code{X} is ignored. White space may also
29795 appear anywhere on the left side of the colon in these constructs,
29796 except between @code{.} or @code{*} and the corresponding word.
29798 The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
29799 handled specifically in these constructs. If another value of
29800 @option{-O} or the negated form of a @option{-f}, @option{-m}, or
29801 @option{-W} switch is found later in the command line, the earlier
29802 switch value is ignored, except with @{@code{S}*@} where @code{S} is
29803 just one letter, which passes all matching options.
29805 The character @samp{|} at the beginning of the predicate text is used to
29806 indicate that a command should be piped to the following command, but
29807 only if @option{-pipe} is specified.
29809 It is built into GCC which switches take arguments and which do not.
29810 (You might think it would be useful to generalize this to allow each
29811 compiler's spec to say which switches take arguments. But this cannot
29812 be done in a consistent fashion. GCC cannot even decide which input
29813 files have been specified without knowing which switches take arguments,
29814 and it must know which input files to compile in order to tell which
29817 GCC also knows implicitly that arguments starting in @option{-l} are to be
29818 treated as compiler output files, and passed to the linker in their
29819 proper position among the other output files.
29821 @node Environment Variables
29822 @section Environment Variables Affecting GCC
29823 @cindex environment variables
29825 @c man begin ENVIRONMENT
29826 This section describes several environment variables that affect how GCC
29827 operates. Some of them work by specifying directories or prefixes to use
29828 when searching for various kinds of files. Some are used to specify other
29829 aspects of the compilation environment.
29831 Note that you can also specify places to search using options such as
29832 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
29833 take precedence over places specified using environment variables, which
29834 in turn take precedence over those specified by the configuration of GCC@.
29835 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
29836 GNU Compiler Collection (GCC) Internals}.
29841 @c @itemx LC_COLLATE
29843 @c @itemx LC_MONETARY
29844 @c @itemx LC_NUMERIC
29849 @c @findex LC_COLLATE
29850 @findex LC_MESSAGES
29851 @c @findex LC_MONETARY
29852 @c @findex LC_NUMERIC
29856 These environment variables control the way that GCC uses
29857 localization information which allows GCC to work with different
29858 national conventions. GCC inspects the locale categories
29859 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
29860 so. These locale categories can be set to any value supported by your
29861 installation. A typical value is @samp{en_GB.UTF-8} for English in the United
29862 Kingdom encoded in UTF-8.
29864 The @env{LC_CTYPE} environment variable specifies character
29865 classification. GCC uses it to determine the character boundaries in
29866 a string; this is needed for some multibyte encodings that contain quote
29867 and escape characters that are otherwise interpreted as a string
29870 The @env{LC_MESSAGES} environment variable specifies the language to
29871 use in diagnostic messages.
29873 If the @env{LC_ALL} environment variable is set, it overrides the value
29874 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
29875 and @env{LC_MESSAGES} default to the value of the @env{LANG}
29876 environment variable. If none of these variables are set, GCC
29877 defaults to traditional C English behavior.
29881 If @env{TMPDIR} is set, it specifies the directory to use for temporary
29882 files. GCC uses temporary files to hold the output of one stage of
29883 compilation which is to be used as input to the next stage: for example,
29884 the output of the preprocessor, which is the input to the compiler
29887 @item GCC_COMPARE_DEBUG
29888 @findex GCC_COMPARE_DEBUG
29889 Setting @env{GCC_COMPARE_DEBUG} is nearly equivalent to passing
29890 @option{-fcompare-debug} to the compiler driver. See the documentation
29891 of this option for more details.
29893 @item GCC_EXEC_PREFIX
29894 @findex GCC_EXEC_PREFIX
29895 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
29896 names of the subprograms executed by the compiler. No slash is added
29897 when this prefix is combined with the name of a subprogram, but you can
29898 specify a prefix that ends with a slash if you wish.
29900 If @env{GCC_EXEC_PREFIX} is not set, GCC attempts to figure out
29901 an appropriate prefix to use based on the pathname it is invoked with.
29903 If GCC cannot find the subprogram using the specified prefix, it
29904 tries looking in the usual places for the subprogram.
29906 The default value of @env{GCC_EXEC_PREFIX} is
29907 @file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
29908 the installed compiler. In many cases @var{prefix} is the value
29909 of @code{prefix} when you ran the @file{configure} script.
29911 Other prefixes specified with @option{-B} take precedence over this prefix.
29913 This prefix is also used for finding files such as @file{crt0.o} that are
29916 In addition, the prefix is used in an unusual way in finding the
29917 directories to search for header files. For each of the standard
29918 directories whose name normally begins with @samp{/usr/local/lib/gcc}
29919 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
29920 replacing that beginning with the specified prefix to produce an
29921 alternate directory name. Thus, with @option{-Bfoo/}, GCC searches
29922 @file{foo/bar} just before it searches the standard directory
29923 @file{/usr/local/lib/bar}.
29924 If a standard directory begins with the configured
29925 @var{prefix} then the value of @var{prefix} is replaced by
29926 @env{GCC_EXEC_PREFIX} when looking for header files.
29928 @item COMPILER_PATH
29929 @findex COMPILER_PATH
29930 The value of @env{COMPILER_PATH} is a colon-separated list of
29931 directories, much like @env{PATH}. GCC tries the directories thus
29932 specified when searching for subprograms, if it cannot find the
29933 subprograms using @env{GCC_EXEC_PREFIX}.
29936 @findex LIBRARY_PATH
29937 The value of @env{LIBRARY_PATH} is a colon-separated list of
29938 directories, much like @env{PATH}. When configured as a native compiler,
29939 GCC tries the directories thus specified when searching for special
29940 linker files, if it cannot find them using @env{GCC_EXEC_PREFIX}. Linking
29941 using GCC also uses these directories when searching for ordinary
29942 libraries for the @option{-l} option (but directories specified with
29943 @option{-L} come first).
29947 @cindex locale definition
29948 This variable is used to pass locale information to the compiler. One way in
29949 which this information is used is to determine the character set to be used
29950 when character literals, string literals and comments are parsed in C and C++.
29951 When the compiler is configured to allow multibyte characters,
29952 the following values for @env{LANG} are recognized:
29956 Recognize JIS characters.
29958 Recognize SJIS characters.
29960 Recognize EUCJP characters.
29963 If @env{LANG} is not defined, or if it has some other value, then the
29964 compiler uses @code{mblen} and @code{mbtowc} as defined by the default locale to
29965 recognize and translate multibyte characters.
29969 Some additional environment variables affect the behavior of the
29972 @include cppenv.texi
29976 @node Precompiled Headers
29977 @section Using Precompiled Headers
29978 @cindex precompiled headers
29979 @cindex speed of compilation
29981 Often large projects have many header files that are included in every
29982 source file. The time the compiler takes to process these header files
29983 over and over again can account for nearly all of the time required to
29984 build the project. To make builds faster, GCC allows you to
29985 @dfn{precompile} a header file.
29987 To create a precompiled header file, simply compile it as you would any
29988 other file, if necessary using the @option{-x} option to make the driver
29989 treat it as a C or C++ header file. You may want to use a
29990 tool like @command{make} to keep the precompiled header up-to-date when
29991 the headers it contains change.
29993 A precompiled header file is searched for when @code{#include} is
29994 seen in the compilation. As it searches for the included file
29995 (@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
29996 compiler looks for a precompiled header in each directory just before it
29997 looks for the include file in that directory. The name searched for is
29998 the name specified in the @code{#include} with @samp{.gch} appended. If
29999 the precompiled header file cannot be used, it is ignored.
30001 For instance, if you have @code{#include "all.h"}, and you have
30002 @file{all.h.gch} in the same directory as @file{all.h}, then the
30003 precompiled header file is used if possible, and the original
30004 header is used otherwise.
30006 Alternatively, you might decide to put the precompiled header file in a
30007 directory and use @option{-I} to ensure that directory is searched
30008 before (or instead of) the directory containing the original header.
30009 Then, if you want to check that the precompiled header file is always
30010 used, you can put a file of the same name as the original header in this
30011 directory containing an @code{#error} command.
30013 This also works with @option{-include}. So yet another way to use
30014 precompiled headers, good for projects not designed with precompiled
30015 header files in mind, is to simply take most of the header files used by
30016 a project, include them from another header file, precompile that header
30017 file, and @option{-include} the precompiled header. If the header files
30018 have guards against multiple inclusion, they are skipped because
30019 they've already been included (in the precompiled header).
30021 If you need to precompile the same header file for different
30022 languages, targets, or compiler options, you can instead make a
30023 @emph{directory} named like @file{all.h.gch}, and put each precompiled
30024 header in the directory, perhaps using @option{-o}. It doesn't matter
30025 what you call the files in the directory; every precompiled header in
30026 the directory is considered. The first precompiled header
30027 encountered in the directory that is valid for this compilation is
30028 used; they're searched in no particular order.
30030 There are many other possibilities, limited only by your imagination,
30031 good sense, and the constraints of your build system.
30033 A precompiled header file can be used only when these conditions apply:
30037 Only one precompiled header can be used in a particular compilation.
30040 A precompiled header cannot be used once the first C token is seen. You
30041 can have preprocessor directives before a precompiled header; you cannot
30042 include a precompiled header from inside another header.
30045 The precompiled header file must be produced for the same language as
30046 the current compilation. You cannot use a C precompiled header for a C++
30050 The precompiled header file must have been produced by the same compiler
30051 binary as the current compilation is using.
30054 Any macros defined before the precompiled header is included must
30055 either be defined in the same way as when the precompiled header was
30056 generated, or must not affect the precompiled header, which usually
30057 means that they don't appear in the precompiled header at all.
30059 The @option{-D} option is one way to define a macro before a
30060 precompiled header is included; using a @code{#define} can also do it.
30061 There are also some options that define macros implicitly, like
30062 @option{-O} and @option{-Wdeprecated}; the same rule applies to macros
30065 @item If debugging information is output when using the precompiled
30066 header, using @option{-g} or similar, the same kind of debugging information
30067 must have been output when building the precompiled header. However,
30068 a precompiled header built using @option{-g} can be used in a compilation
30069 when no debugging information is being output.
30071 @item The same @option{-m} options must generally be used when building
30072 and using the precompiled header. @xref{Submodel Options},
30073 for any cases where this rule is relaxed.
30075 @item Each of the following options must be the same when building and using
30076 the precompiled header:
30078 @gccoptlist{-fexceptions}
30081 Some other command-line options starting with @option{-f},
30082 @option{-p}, or @option{-O} must be defined in the same way as when
30083 the precompiled header was generated. At present, it's not clear
30084 which options are safe to change and which are not; the safest choice
30085 is to use exactly the same options when generating and using the
30086 precompiled header. The following are known to be safe:
30088 @gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
30089 -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
30090 -fsched-verbose=@var{number} -fschedule-insns -fvisibility= @gol
30095 For all of these except the last, the compiler automatically
30096 ignores the precompiled header if the conditions aren't met. If you
30097 find an option combination that doesn't work and doesn't cause the
30098 precompiled header to be ignored, please consider filing a bug report,
30101 If you do use differing options when generating and using the
30102 precompiled header, the actual behavior is a mixture of the
30103 behavior for the options. For instance, if you use @option{-g} to
30104 generate the precompiled header but not when using it, you may or may
30105 not get debugging information for routines in the precompiled header.